TargetLowering expects the target to implement two types of virtual methods: LowerOperation and the rest of the Lower* methods. The LowerOperation method is used by the legalizer, and the rest of the Lower* methods are used at dag formation time. This is confusing and makes future work harder. Instead of this, it would be nice for SelectionDAGISel to create a target-independent node for each of the Lower* methods, and have LowerOperation do the actual implementation. For example, the LowerCallTo method could return an new ISD::CALLTO node which has all of the operands and the return value passed into the call: this would get expanded at legalize time. Another important case is incoming arguments. This could be represented with an ISD::INCOMINGARGS node which has a token chain input (entry node) and one result for each incoming argument to a function. This is interesting for two reasons: 1. It gets rid of lowering during dag construction, making it easier to understand things for new people. 2. This allows the legalizer to hack on things before having the target lower the node. For example, if a target doesn't know how to pass a <16 x double> vector to a function but does know how to pass <4 x vector>'s, the legalizer would simplify it down before handing it off to the LowerOperation code. 3. This makes a future planned change more powerful: I want to be able to run the dag combiner on intermediate stages of legalization (e.g. after custom lower is done, but before other legalization has been run). This will allow us to catch things like the double->longlong->double conversion sequence in PPC. -Chris
s/two/three :)
LowerVA* is dead. Need to replace LowerCallTo, LowerArguments, and LowerReturnTo next.
LowerReturnTo is dead. Just args and calls left.
ISD::FORMAL_ARGUMENTS is implemented and working. We just have calls left. -Chris
Oh, we also have TLI::LowerFrameReturnAddress. It should be easy, but I don't plan to do it in the immediate future. -Chris
ISD::CALL now exists, we just need TLI::LowerFrameReturnAddress converted over. -Chris
This one is close, but not done yet. The rest looks easy though.
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070129/043469.html