[PATCH] SelectionDAG: Share ISD::MUL lowering code between the SelectionDAGLegalize and DAGTypeLegalizer

Tom Stellard tom at stellard.net
Mon Mar 31 07:25:30 PDT 2014


On Fri, Feb 07, 2014 at 02:54:39PM -0800, Owen Anderson wrote:
> 
> On Feb 7, 2014, at 2:20 PM, Hal Finkel <hfinkel at anl.gov> wrote:
> 
> > ----- Original Message -----
> >> From: "Tom Stellard" <tom at stellard.net>
> >> To: llvm-commits at cs.uiuc.edu
> >> Sent: Friday, February 7, 2014 4:12:13 PM
> >> Subject: [PATCH] SelectionDAG: Share ISD::MUL lowering code between the	SelectionDAGLegalize and  DAGTypeLegalizer
> >> 
> >> Hi,
> >> 
> >> The attached patches allow the SelectionDAGLegalizer to reuse ISD:MUL
> >> lowering code from the DAGTypeLegalizer.
> >> 
> >> The first patch moves the DAGTypeLegalizer ISD:MUL lowering code into
> >> a public
> >> SelectionDAG function called expandMUL() and the second patch
> >> modifies
> >> the SelectionDAGLegalizer to use this code.
> >> 
> >> I think there may be other opportunities to share code between these
> >> two classes,
> >> so I'm wondering if the approach I've taken would work for other
> >> operations too.
> >> I'm interested in hearing what other people think.
> > 
> > I've not yet looked at the patch, but I'll add: There is also expansion logic hidden away in the legalization code that could be used by *ISelLowering in the various targets, and I think that moving things into utility functions in SelectionDAG will help with reuse there as well (GatherAllAliases comes to mind, for example). So, generally speaking, I think this kind of refactoring is a good idea.
> 
> I agree with Hal, and the general sentiment that it would be great to share more of these expansions between type and operation legalization.  That said, I’d like to find a cleaner way to factor them out than just moving them all into methods on SelectionDAG.
> 

I wasn't sure where else to put these functions, so I moved them into
the TargetLowering class.  What do you think?

-Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-SelectionDAG-Factor-ISD-MUL-lowering-code-out-of-DAG.patch
Type: text/x-diff
Size: 10266 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140331/6afb28df/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-SelectionDAG-Use-helper-function-to-improve-legaliza.patch
Type: text/x-diff
Size: 5861 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140331/6afb28df/attachment-0001.patch>


More information about the llvm-commits mailing list