[cfe-commits] [PATCH][CodeGen] Add padding to expanded struct function arguments if the ABI requires it.

John McCall rjmccall at apple.com
Sun Nov 14 00:16:21 PST 2010


On Nov 14, 2010, at 12:01 AM, Frits van Bommel wrote:

> On Sun, Nov 14, 2010 at 7:49 AM, John McCall <rjmccall at apple.com> wrote:
>> (In contrast, the standard Unix x86-64 CC will pass, e.g., struct { double d; void *p; } in an FP register and an integer register unless you're passing it as a vararg).
> 
> Actually, I'm pretty sure it does that for vararg too. From what I
> understand the calling convention of vararg functions and regular
> functions *must* be the same for the C calling convention because a
> function declared in C as e.g. "int foo()" (or more commonly, not
> declared at all) is treated as vararg but may later match a definition
> with a different prototype, including "int foo(Struct) { ... }".

You're right, the x86-64 ABI actually still expands this struct even when passing via varargs.

There are situations where the convention for calling a function is different depending on whether it was declared with a prototype or not, but apparently they don't extend to this case.

John.



More information about the cfe-commits mailing list