llvm ir vs dag

It seems to me that a lot of the transformations done on DAG could more easily and cleanly be done in the IR.

It could require some ability to extend IR for targets but this could be useful anyway.
With inline assembly, one can already place assembly in the IR.

Some things that could be done in IR:

1) call and return lowering and related functions
2) atomic
3) soft float
4) ... many others

This could eliminate a lot of messy coding takes place in target lowering and DAG to DAG.

The average person doing porting should not, IMO, be exposed to many of the details of chains, glue and other complexities and idiosyncrasies of the Selection DAG.

The main idea is to eliminate or shrink considerably XXXTargetLowering and XXXISelDagToDag.

There could also be some Machine IR added to the current IR that is not target specific.

My 2c.


Hi Reed,

There was some discussion at the DevMeeting last year about this. The consensus was that:

- It would be great if SelectionDAG could go away and the translations be done via progressive replacement in the IR of LLVM instructions with machine instructions and LLVM registers to machine registers.

- If someone did this work, there are lots of people willing to review and comment on it.

- No one has all three of the time, expertise, and inclination to actually do it.

Or, to put it more succinctly: patches welcome.