<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 29, 2017 at 4:38 AM, Nemanja Ivanovic via Phabricator <span dir="ltr"><<a href="mailto:reviews@reviews.llvm.org" target="_blank" class="cremed">reviews@reviews.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">nemanjai added a comment.<br>
<span class=""><br>
> You talk about a call instruction? Is X2 saved and restored in the called function? Then it's just a CSR and should not be mentioned in the clobber list so no problem with my proposal above.<br>
<br>
</span>But it is the caller that saves and restores it, not the callee. The sequence is essentially this (all in the caller of course):<br>
<br>
- Save X2 to it's stack slot<br>
- Update X2 prior to the call<br>
- Call the function through a pointer<br>
- Restore X2 immediately after the call<br>
<br></blockquote><div><br></div><div>All of that is hidden in the linker and the call_nop instruction. As far as llvm is concerned, it may as well be a callee saved register. The callee is just the trampoline, whose last instruction replaces the NOP.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<a href="https://reviews.llvm.org/D33562" rel="noreferrer" target="_blank" class="cremed">https://reviews.llvm.org/<wbr>D33562</a><br>
<br>
<br>
<br>
</blockquote></div><br></div></div>