[llvm-dev] Semantics of preserve_all calling convention

Keno Fischer via llvm-dev llvm-dev at lists.llvm.org
Mon Jun 13 05:49:42 PDT 2016


The ir reference for preserve_all states:

This calling convention also behaves identical to the Ccalling convention
> on how arguments and return values are passed


I tried the following:

uint64_t return_zero() __attribute__((preserve_all))
{
    return 0;
}

and got

0000000000000020 <return_zero>:
  20: 50                   push   %rax
  21: 31 c0                xor    %eax,%eax
  23: 58                   pop    %rax
  24: c3                   retq

as you can see, the rax register is restored to its value upon entry to the
function and does not contain the return value. What are the semantics
here? Should this work? Should we add a verifier error for functions with
this calling convention that return values?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160613/9d19ade0/attachment.html>


More information about the llvm-dev mailing list