[llvm-commits] ABI: how to let the backend know that an aggregate should be allocated on stack

Duncan Sands baldrick at free.fr
Thu Oct 25 00:14:03 PDT 2012


Hi Tim,

On 24/10/12 22:03, Tim Northover wrote:
>> That is a strange byval implementation. Maybe the llvm ARM backend
>> should be changed to always pass byval on the stack? Clang can create
>> regular (integer, fp) arguments for the registers.
>
> The problem is that the ABI says the argument *should* be split
> between registers and stack. The relevant callbacks in clang only get
> to suggest one type (+ a padding dummy going before if they want);
> they can't (currently) say "put the first 4 bytes here and the rest
> there".
>
> Given that constraint "byval" is probably the sanest option since it's
> special anyway.
>
> That could be changed of course, but I'm not convinced Clang would be
> improved for it.

I think it is best if "byval" acts in the same simple way everywhere: it
passes the argument on the stack.  Front-ends can split types themselves
into the bits that have to go into registers, and the bits that need to
go on the stack.  That's how it's done for x86-64 for example.  There is
no need (and in my opinion it would be extremely unwise) to have backends
do it.

Ciao, Duncan.



More information about the llvm-commits mailing list