On Wed, Jul 27, 2016 at 12:19:59PM +0100, Daniel Thompson wrote: [...]
> It is interesting to note that you force large_func() to stack its arguments > (by providing 8 dummy int arguments first) then the implicit > pass-by-reference behavior is still preserved even for a stacked argument; > large_func() ends up as: > > ~~~ > large_func: > ldr x0, [sp] > ldr x0, [x0] > ret > ~~~ > > Only thing is... I *still* haven't found anything in the AArch64 PCS which > describes this behavior. > > I'm coming to believe that this is a mistake and this information (and the > threshold at which implicit pass-by-reference kicks in) should be documented > in section 7. Is that answered by this? B.3. If the argument type is a Composite Type that is larger than 16 bytes, then the argument is copied to memory allocated by the caller and the argument is replaced by a pointer to the copy. Experimenting with gcc's behaviour seems to back this up. Cheers ---Dave