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

Chris Lattner clattner at apple.com
Sun Oct 28 12:48:49 PDT 2012


On Oct 26, 2012, at 7:27 AM, Duncan Sands <baldrick at free.fr> 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 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.
> 
> it needs to be addressable.  The "byval" parameter is a pointer, and that
> pointer can be passed to any old routine as an ordinary pointer, and they
> may read or write the memory it points to.  So while you could pass in

Right, this is my gripe with "byval".  It makes a lot of sense for large things that need to be passed on the stack, but very little sense for small things that need to be passed that way.  Clang on i386 suffers a number of code quality issues because it can't express this "I don't need it to be addressable, but I do need it passed on the stack" concept.  An "onstack" attribute seems the perfect analog to "inreg" to fix this.  That is, if anyone still cares about i386 :-)

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121028/ac324588/attachment.html>


More information about the llvm-commits mailing list