[cfe-dev] [LLVMdev] Win64 calling convention

NAKAMURA Takumi geek4civic at gmail.com
Wed Jan 12 04:43:01 PST 2011


Good evening, Jay.


2011/1/12 Jay Cornwall <jay at jcornwall.me.uk>:
>  Hi,
>
>  I've encountered a problem invoking LLVM-generated x86_64 code on
>  Windows from MSVC-compiled code. There seems to be disagreement between
>  the two compilers over the calling convention for passing a 12 or 16
>  byte structure by value. e.g.
>
>  struct aggregate { int a; int b; int c; int d; };
>  int test(aggregate byVal) { ... }
>
>  LLVM chooses to pass byVal with a and b packed into rcx and c and d
>  packed into rdx. MSVC (8 here) instead passes a reference to the
>  structure in rcx. My reading of the System V ABI spec is unclear,
>  although Microsoft already deviate in their choice of fastcall registers
>  so perhaps it is irrelevant.

I guess it might be a clang's issue.
ToT clang does not know Win64 calling conversion and it seems you saw
"amd64-like" cc.

>  Should I file a bug for this?

You may file one though I have patches for it.
I will post patches for clang soon.


...Takumi




More information about the cfe-dev mailing list