[llvm-commits] [llvm-gcc-4.2] r86892 - /llvm-gcc-4.2/trunk/gcc/llvm-abi.h

Rafael Espindola espindola at google.com
Thu Dec 10 17:08:50 PST 2009


> I think it's a bad idea to try to do this in target-independent code.
>  Whether the information goes in the high part or the low part of the
> register is target-dependent (there's some correlation with endianness), and
> just which structs need special treatment is also target-dependent.  I think
> there's even a target where
>  struct { char[3] a;}
> and
>  struct { short a; char b; }
> are passed differently.
>
> I think most existing targets use byval, so I'd use that; there's lots of
> prior art to copy.


I think I failed to pass by point: How would you expand

--------------------------
struct foo {
char c[5];
};

void f(int a, int b, int c, struct foo d) {
...
}
-----------------------

Byval was created to force something to the stack
(http://llvm.org/bugs/show_bug.cgi?id=1521). In this case the first 4
bytes have to go in a register. The last byte goes to the stack. I can
use byval, but only for the last byte. I still need to know when the
registers are over so that I can split the structure at that point.

Cheers,
-- 
Rafael Ávila de Espíndola




More information about the llvm-commits mailing list