Important: The information in this document is obsolete and should not be used for new development.
Function Return
In the PowerPC runtime environment, floating-point function values are returned in register FPR1 (or FPR1 and FPR2 for long double values). Other values are returned in GPR3 as follows:
- Functions returning simple values smaller than 4 bytes (such as type
SInt8
,Boolean
, orSInt16
) place the return value in the least significant byte or bytes of GPR3. The most significant bytes in GPR3 are undefined.- Functions returning 4-byte values (such as pointers, including array pointers, or types
SInt32
andUInt32
) return them normally in GPR3.- If a function returns a composite value (for example, a
struct
orunion
data type) or a value larger than 4 bytes, a pointer must be passed as an implicit left-most parameter before passing all the user-visible arguments (that is, the address is passed in GPR3, and the actual parameters begin with GPR4). The address of the pointer must be a memory location large enough to hold the function return value. Since GPR3 is treated as a parameter in this case, its value is not guaranteed on return.