<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Feb 7, 2014, at 2:20 PM, Hal Finkel <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">----- Original Message -----<br><blockquote type="cite">From: "Tom Stellard" <<a href="mailto:tom@stellard.net">tom@stellard.net</a>><br>To: <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>Sent: Friday, February 7, 2014 4:12:13 PM<br>Subject: [PATCH] SelectionDAG: Share ISD::MUL lowering code between the<span class="Apple-tab-span" style="white-space: pre;">      </span>SelectionDAGLegalize and  DAGTypeLegalizer<br><br>Hi,<br><br>The attached patches allow the SelectionDAGLegalizer to reuse ISD:MUL<br>lowering code from the DAGTypeLegalizer.<br><br>The first patch moves the DAGTypeLegalizer ISD:MUL lowering code into<br>a public<br>SelectionDAG function called expandMUL() and the second patch<br>modifies<br>the SelectionDAGLegalizer to use this code.<br><br>I think there may be other opportunities to share code between these<br>two classes,<br>so I'm wondering if the approach I've taken would work for other<br>operations too.<br>I'm interested in hearing what other people think.<br></blockquote><br>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.<br></div></blockquote></div><br><div>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.</div><div><br></div><div>—Owen</div></body></html>