<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi,<div><br></div><div>I am working on a patch for CodeGenPrepare, which introduces a use of TargetLoweringBase::InstructionOpcodeToISD (see [1] for the details).</div><div>This is usual for CodeGenPrepare to use the TargetLowering class when it is available, however, using this particular function creates linking problems.</div><div><br></div><div>** Context **</div><div><br></div><div>The TargetLowering class is part of libLLVMCodeGen, which means that in theory every consumer of libLLVMScalarOpts would have to link against libLLVMCodeGen.</div><div><br></div><div><div>In practice, so far it was not required because all the functions of TargetLowering called in CodeGenPrepare are either:</div><div>- virtual function (resolved dynamically).</div><div>- inlined in the header (code available statically).</div></div><div><br></div><div>However, if you use a method that does not follow this pattern (like TargetLoweringBase::InstructionOpcodeToISD), the problem will show up.</div><div><br></div><div><br></div><div>** Advices Needed **</div><div><br></div><div>What would be the right way of fixing that?</div><div><br></div><div>There are short term solutions:</div><div>- We can inline the functions we need in the header (Hack).</div><div>- We can mark the functions we need as virtual (Hack). </div><div>- We can move the functions elsewhere (where?).</div><div><br></div><div>What would be a longer term solution: i.e., how can we prevent this problem to happen again?</div><div>The only thing I can think of is moving CodeGenPrepare elsewhere.</div><div><br></div><div><br></div><div>Thanks for your help,</div><div><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">-Quentin</div>
</div>
[1] <a href="http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140217/205266.html">http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140217/205266.html</a></div></body></html>