<br><br><div class="gmail_quote">On Thu Nov 13 2014 at 5:36:40 PM Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Nov 13, 2014 at 5:24 PM, reed kotler <span dir="ltr"><<a href="mailto:rkotler@mips.com" target="_blank">rkotler@mips.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>On 11/13/2014 05:20 PM, Reid Kleckner
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Looks like you're including that .inc file twice,
which is going to duplicate the code. IMO it'd be better to call
over from FastISel into a wrapper in ISelLowering if you want to
use these.</div>
<div class="gmail_extra"><br>
</div>
</blockquote>
I think it's a mistake for tablegen to be generating static
functions here.<br>
<br>
Why should I have to make a wrapper?<br>
<br>
I've raised this issue before but did not get any response.<br></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Wow. Looks like all the other backends duplicate this code:</div><div><br></div><div><div>$ git grep '#include.*GenCallingConv.inc' ../lib/Target/</div><div>../lib/Target/AArch64/AArch64FastISel.cpp:#include "AArch64GenCallingConv.inc"</div><div>../lib/Target/AArch64/AArch64ISelLowering.cpp:#include "AArch64GenCallingConv.inc"</div><div>../lib/Target/ARM/ARMFastISel.cpp:#include "ARMGenCallingConv.inc"</div><div>../lib/Target/ARM/ARMISelLowering.cpp:#include "ARMGenCallingConv.inc"</div><div>../lib/Target/MSP430/MSP430ISelLowering.cpp:#include "MSP430GenCallingConv.inc"</div><div>../lib/Target/Mips/MipsFastISel.cpp:#include "MipsGenCallingConv.inc"</div><div>../lib/Target/Mips/MipsISelLowering.cpp:#include "MipsGenCallingConv.inc"</div><div>../lib/Target/PowerPC/PPCFastISel.cpp:#include "PPCGenCallingConv.inc"</div><div>../lib/Target/PowerPC/PPCISelLowering.cpp:#include "PPCGenCallingConv.inc"</div><div>../lib/Target/R600/AMDGPUISelLowering.cpp:#include "AMDGPUGenCallingConv.inc"</div><div>../lib/Target/Sparc/SparcISelLowering.cpp:#include "SparcGenCallingConv.inc"</div><div>../lib/Target/SystemZ/SystemZISelLowering.cpp:#include "SystemZGenCallingConv.inc"</div><div>../lib/Target/X86/X86FastISel.cpp:#include "X86GenCallingConv.inc"</div><div>../lib/Target/X86/X86ISelLowering.cpp:#include "X86GenCallingConv.inc"</div><div>../lib/Target/XCore/XCoreISelLowering.cpp:#include "XCoreGenCallingConv.inc"</div></div><div><br></div><div>This seems less than ideal. Eric, should we really be doing that? </div></div></div></div></blockquote><div><br></div><div>Ideally no. I mean, we could generate separate CC.inc files for fast-isel? A wrapper seems reasonable as well, but seems like a shame we can't generate the right stuff out of it. </div><div><br></div><div>Perhaps the best solution is taking the calling convention bits from being a bunch of static functions in a namespace and encapsulating them into a class in a header that can be extended by the target. I.e. giving it a wrapper by default?</div><div><br></div><div>That's probably what I'd do.</div><div><br></div><div>-eric </div></div>