SPRAB89A September 2011 – March 2014
Structures (including classes) and unions larger than 64 bits are passed and returned by reference.
To pass a structure or union by reference, the caller places its address in the appropriate location: either in a register or on the stack, according to its position in the argument list. To preserve pass-by-value semantics (required for C and C++), the callee may not modify the pointed-to object; it must make its own copy.
If the called function returns a structure or union larger than 64 bits, the caller must pass an additional argument in A3 containing a destination address for the returned value, or NULL if the returned value is not used.
The callee returns the object by copying it to the address in A3, if non-zero. The caller is responsible for allocating memory if required. Typically, this involves reserving space on the stack, but in some cases the address of an already-existing object can be passed and no allocation is required. For example, if f returns a structure, the assignment s = f() can be compiled by passing &s in A3.