<div dir="ltr"><div><div>Thanks! It was the ARM back end which alerted me to the 
possibility of doing this. It's great to have confirmation that 
generating conversion code within the call lowering is considered 
reasonable.<br><br></div>It appears that CallingConv.td is used to 
declare what the lowering code will do and the function lowering is the 
place to actually do it. The CCCustom API certainly makes more sense 
with the example.<br><br></div>Cheers<br><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 10, 2017 at 7:38 PM, Friedman, Eli <span dir="ltr"><<a target="_blank" href="mailto:efriedma@codeaurora.org">efriedma@codeaurora.org</a>></span> wrote:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span class="gmail-">On 8/10/2017 1:49 AM, Jon Chesterfield via llvm-dev wrote:<br>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
The CallingConv.td file can specify CCCustom and ISelLowering has LowerFormalArguments. The existing uses of CCCustom pick a register to pass an unmodified argument in and LowerFormalArguments is mostly concerned with marking registers as live, though I think provides enough information that I can munge the DAG there.<br>
<br>
I would like to pass a scalar type (marked as a register class) in a vector register. I essentially want to wrap the argument in a SCALAR_TO_VECTOR ISD node before calling a function and unwrap it using EXTRACT_VECTOR_ELT or similar within the function.<br>
<br>
Where should I introduce these additional nodes, or should it be possible to achieve this via CCCustom?<br>
</blockquote>
<br></span>
See RetCC_ARM_APCS_Custom_f64/ARMT<wbr>argetLowering::LowerCallResult for an straightforward example of how CCCustom works in practice.  You can generate whatever conversion code you need in your call lowering code.<span class="gmail-HOEnZb"><font color="#888888"><br>
<br>
-Eli<br>
<br>
-- <br>
Employee of Qualcomm Innovation Center, Inc.<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project<br>
<br>
</font></span></blockquote></div><br></div></div>