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

Owen Anderson resistor at mac.com
Fri Feb 7 14:54:39 PST 2014


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.

—Owen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140207/85e11559/attachment.html>


More information about the llvm-commits mailing list