[LLVMdev] [llvm-commits] ABI: how to let the backend know that an aggregate should be allocated on stack
bob.wilson at apple.com
Fri Oct 26 07:16:38 PDT 2012
On Oct 24, 2012, at 12:40 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
> On 24 October 2012 01:00, Manman Ren <mren at apple.com> wrote:
>> Byval does not work for me, it will try to split the struct to fit into
>> available core registers and the rest on stack.
> 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 current definition of the byval attribute in LangRef says nothing about requiring passing the argument on the stack. It just says it "should really be passed by value". When discussing the alignment, it does refer to a stack slot, but it isn't at all clear that it is required to be on the stack.
>From looking at the PowerPC backend, I got the impression that it does not interpret the byval attribute to mean that an argument must go on the stack. It could be entirely in registers or split between registers and stack. For Intel, on the other hand, there seem to be many cases where byval is intentionally used as a substitute for the "on stack" attribute that Manman was looking for.
It would be good to clarify the intention of this in the docs.
More information about the llvm-dev