[LLVMdev] Win64 calling convention

Jay Cornwall jay at jcornwall.me.uk
Wed Jan 12 04:15:35 PST 2011


 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.

 Should I file a bug for this?

-- 
 Jay Cornwall
 http://www.jcornwall.me.uk/



More information about the llvm-dev mailing list