LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 680 - Simplify the TargetLowering interface
Summary: Simplify the TargetLowering interface
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Common Code Generator Code (show other bugs)
Version: trunk
Hardware: All All
: P enhancement
Assignee: Nate Begeman
URL:
Keywords: code-cleanup
Depends on:
Blocks:
 
Reported: 2005-12-22 20:15 PST by Chris Lattner
Modified: 2010-02-22 12:43 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Lattner 2005-12-22 20:15:32 PST
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
Comment 1 Chris Lattner 2005-12-22 20:16:01 PST
s/two/three :)
Comment 2 Nate Begeman 2006-01-25 13:21:56 PST
LowerVA* is dead.

Need to replace LowerCallTo, LowerArguments, and LowerReturnTo next.
Comment 3 Nate Begeman 2006-01-27 15:16:40 PST
LowerReturnTo is dead.  Just args and calls left.
Comment 4 Chris Lattner 2006-05-16 15:40:00 PDT
ISD::FORMAL_ARGUMENTS is implemented and working.  We just have calls left.

-Chris
Comment 5 Chris Lattner 2006-05-16 15:56:44 PDT
Oh, we also have TLI::LowerFrameReturnAddress.  It should be easy, but I don't plan to do it in the 
immediate future.

-Chris
Comment 6 Chris Lattner 2006-05-16 19:47:53 PDT
ISD::CALL now exists, we just need TLI::LowerFrameReturnAddress converted over.

-Chris
Comment 7 Chris Lattner 2006-08-24 17:20:32 PDT
This one is close, but not done yet.  The rest looks easy though.