<div dir="ltr">Folks,<div><br></div><div style>I'm working on bug 16387:</div><div style>"clang doesn't produce ARM EABI-compliant modulo runtime function"<br></div><div style><a href="http://llvm.org/bugs/show_bug.cgi?id=16387">http://llvm.org/bugs/show_bug.cgi?id=16387</a></div>
<div style><br></div><div style>And I need some pointers.</div><div style><br></div><div style>I've changed ARMISelLowering::ARMTargetLowering::ARMTargetLowering() to associate __aeabi_idivmod variants to RTLIB::{U,S}DIVREM_* library calls, but now I need to teach the expansion that on AEABI case, the remainder is not on the stack, but on registers.</div>
<div style><br></div><div style>However, SelectionDAGLegalize::ExpandDivRemLibCall() assumes the remainder is *always* on the stack, as is the case for GNU:</div><div style><br></div><div style><div>  // Remainder is loaded back from the stack frame.</div>
<div>  SDValue Rem = DAG.getLoad(RetVT, dl, CallInfo.second, FIPtr,</div><div>                            MachinePointerInfo(), false, false, false, 0);</div><div><br></div><div style>Since I don't want to add a target-specific condition there, and I found no hierarchy for DAGLegalize, I'm wondering what's the best approach.</div>
<div style><br></div><div style>Two options could be:</div><div style> * Creating a feature (HasDivRemRegister or whatever) and hard-code AEABI together with the hard-coded GNU</div><div style> * Have some call-back mechanism, possibly upon a flag (HasSpecialDivRemLowering), and update the remainder result</div>
<div style><br></div><div style>Both are ugly... :(</div><div style><br></div><div style>Is there anything like that elsewhere, that would hopefully be implemented inside ARM's tree, that I could follow? </div><div style>
<br></div><div style>cheers,</div><div style>--renato</div></div></div>