[llvm-dev] Capturing x86 %rax in prologue to use in body

John Reagan via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 16 11:11:13 PDT 2018


Thanks.  We did exactly that (add a new intrinsic call & put a piece of
VMS-specific metadata on the routine to tell it to capture the %ah into
a virtual register) and it all works as expected.


On 3/14/18 3:58 PM, Tim Northover wrote:
> Hi John,
>
> On 14 March 2018 at 18:28, John Reagan via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
>> However, we're struggling somewhat on the code in the prologue to
>> capture the %ah value to then be obtained by our "arg_count" compiler
>> builtin.  We found where the 1st parameter is put into a virtual
>> register in the event that it has to be passed back in %rax for
>> functions returning large structures. We certainly could do the same
>> with %ah, but what IR would we generate to fetch that value in the body
>> of a routine?
> It would almost certainly be an @llvm.whatever intrinsic call at the
> IR level with custom SDAG lowering that uses getCopyFromReg to copy
> the value back out of the stashed VReg you found before.
>
>> We haven't created our own private OpenVMS calling convention but just
>> riding along on the standard convention.  Another thought would be to
>> create a new CC but that seems overkill just for this.
> That sounds pretty sensible. Unless you need to support multiple
> calling conventions simultaneously the default "C" makes sense at the
> IR level. You may or may not want a special OpenVMS CallingConv in the
> .td files.
>
> Cheers.
>
> Tim.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180316/c50e4419/attachment.sig>


More information about the llvm-dev mailing list