[llvm-bugs] [Bug 43208] Struct return does not match Windows X64 stack convention.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 3 10:32:47 PDT 2019


Eli Friedman <efriedma at quicinc.com> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
                 CC|                            |efriedma at quicinc.com
         Resolution|---                         |WONTFIX

--- Comment #2 from Eli Friedman <efriedma at quicinc.com> ---
Yes, this is handled in clang.

In general, LLVM IR does not contain enough information about C structs to
compute the C calling convention correctly; we can't even distinguish whether
an LLVM IR struct type was originally a C struct.  Therefore, LLVM IR's
handling of struct type in the calling convention is intentionally simplified:
LLVM IR structs are always passed and returned in registers, as long as enough
registers are available.

The only supported way to lower a C calling convention call involving a
class/struct/union/complex type is to use clang's IR generation API, or
implement equivalent code yourself.  There's been some discussion in the past
of providing an API for non-clang frontends that's more convenient, but nothing
has been implemented.  You should be able to find some discussion in the
mailing list archive. (If you have trouble finding it, ask, and I'll try to dig
it up.)

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190903/ab0ea640/attachment.html>

More information about the llvm-bugs mailing list