<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>I actually managed to solve my own problem. If anyone has a
similar issue in the future, this is what I did:<br>
</p>
<p>I marked the return address register as being callee saved in
both calling conventions. In determineCalleeSaves I then check
whether there is a function call that uses the new calling
convention. If so, I mark the return address reg as being required
to be spilled. This way I basically get a caller-save behavior and
can use the already existing infrastructure in
TargetFrameLowering.<br>
</p>
<p>Cheers,</p>
<p>Dominik<br>
</p>
<div class="moz-cite-prefix">On 19.07.21 14:50, Dominik Montada via
llvm-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:8c078197-58e4-50d5-8f2b-49cc8f234403@hightec-rt.com">Hi,
<br>
<br>
I'm working on a new calling convention for a downstream target.
Our target normally saves and restores the return address
automatically with the call and return instruction, so there is no
need to to handle it in any way. The new calling convention
however must save the return address in the caller manually. I
thought that the register allocator would spill and restore the
register holding the return address around a call, but I guess
since we marked the register as reserved, it is not doing that.
<br>
<br>
I'm wondering now how I should correctly handle this. As a
workaround I inserted COPY instructions to and from virtual
registers around the call, but although that works, it looks more
like a hack instead of a solution.
<br>
Could someone tell me how handling the save and restore of a
return address register should look like?
<br>
<br>
Btw, I tried looking at ARM, but it looks like that LR is marked
as callee-saved and therefore handled during prologue/epilogue
creation (IIUC). That is not an option for us though.
<br>
<br>
Cheers,
<br>
<br>
Dominik
<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
</body>
</html>