[LLVMdev] Win64 Calling Convention problem

Stephan Reiter stephan.reiter at gmail.com
Fri Dec 4 06:55:43 PST 2009


Thanks, Anton!

I didn't know about exceptions like _Complex that you mentioned. The
only way to support them is to place the burden of correct parameter
passing on the front-end, I understand that now.

So, today I created a new transformation pass that makes sure that
LLVM IR, which works alright with the default Win32 calling
conventions, also plays nice with Win64 code within the limited scope
of my language (that requires packing of aggregates of sizes 8, 16,
32, and 64-bits into an integer argument, and passing of larger
aggregates by reference).

Best regards,
Stephan

2009/12/3 Anton Korobeynikov <anton at korobeynikov.info>:
> Hello
>
>> I don't know. I feel reluctant to generate different IRs for Win32 and
>> for Win64.
> Unfortunately, you should. Think about differences and between
> _Complex type and struct {double, double}.
> From LLVM's point of view these are same types, however many ABIs have
> special rules for passing / returning _Complex,
> this is possible to handle in frontend only.
>
>> Since the C calling convention is the default for LLVM functions, I
>> thought that it would map to *the* Win64 calling convention (since
>> cdecl, fastcall and stdcall are all the same) when a 64-bit build was
>> used. This is quite confusing ...
> Yes, default calling convention is C. But you're not using an
> ABI-compliant C compiler to generate the IR.
>
> --
> With best regards, Anton Korobeynikov
> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>



More information about the llvm-dev mailing list