<div dir="ltr">Hi All,<div><br></div><div>I am currently attempting to insert a label immediately after a call to a certain function that returns a value.</div><div>For example:</div><div><br></div><div><div>    callq   function<br>mylabel:<br></div><div>    movl    %eax, %r14d</div></div><div><br></div><div>My first attempt was similar to the following file</div><div><br><a href="http://www.llvm.org/doxygen/SelectionDAGBuilder_8cpp_source.html">http://www.llvm.org/doxygen/SelectionDAGBuilder_8cpp_source.html</a>, <br><br>function: lowerInvokable.<br><br>Where I use a similar mechanism to Exception handling.  </div><div>However, this seems to work when the return value is stored into a stack. Otherwise, I would get the following code<br><br><div>    callq   function<br></div><div>    movl    %eax, %r14d</div></div><div><div>mylabel:<br></div><div></div><div><br></div>Which is not what I desired. <br></div><div><br></div><div>My next attempt was to modify the function that lowers the function call inst. <br>I inserted a eh_label node in between the callseq_end node and CopyFromReg node<br>However, I am getting an error message of the following just before the Greedy Register Allocator pass. </div><div><br></div><div><b>Bad machine code: Using an undefined physical register<br>instruction: %75:gr32 = COPY</b><br><b>operand 1:   killed %eax<br></b></div><div><br></div><div>I was wondering if this is because the information passed from callseq_end to eh_label to CopyFromReg did not propagate properly. </div><div>If so, I was wondering whether I need a custom SDNode for this or if I should add the label once the code representation becomes machine IR.<br></div><div><br>Previously I try to add the label once the code representation becomes machine IR.</div><div>However, I seem to have an issue in getting the Function object from the machine inst that represents the function call.<br>The reason why I need the Function object is so that I can query whether the function that is being called has a certain attribute or not.<br><br></div><div>Thank you.<br></div><div><div>Best regards,</div><div>Chrisma</div></div></div>