Node: Aggregate Return, Next: , Previous: Scalar Return, Up: Stack and Calling



How Large Values Are Returned

When a function value's mode is BLKmode (and in some other cases), the value is not returned according to FUNCTION_VALUE (see Scalar Return). Instead, the caller passes the address of a block of memory in which the value should be stored. This address is called the structure value address.

This section describes how to control returning structure values in memory.

RETURN_IN_MEMORY (type)
A C expression which can inhibit the returning of certain function values in registers, based on the type of value. A nonzero value says to return the function value in memory, just as large structures are always returned. Here type will be a C expression of type tree, representing the data type of the value.

Note that values of mode BLKmode must be explicitly handled by this macro. Also, the option -fpcc-struct-return takes effect regardless of this macro. On most systems, it is possible to leave the macro undefined; this causes a default definition to be used, whose value is the constant 1 for BLKmode values, and 0 otherwise.

Do not use this macro to indicate that structures and unions should always be returned in memory. You should instead use DEFAULT_PCC_STRUCT_RETURN to indicate this.

DEFAULT_PCC_STRUCT_RETURN
Define this macro to be 1 if all structure and union return values must be in memory. Since this results in slower code, this should be defined only if needed for compatibility with other compilers or with an ABI. If you define this macro to be 0, then the conventions used for structure and union return values are decided by the RETURN_IN_MEMORY macro.

If not defined, this defaults to the value 1.

STRUCT_VALUE_REGNUM
If the structure value address is passed in a register, then STRUCT_VALUE_REGNUM should be the number of that register.
STRUCT_VALUE
If the structure value address is not passed in a register, define STRUCT_VALUE as an expression returning an RTX for the place where the address is passed. If it returns 0, the address is passed as an "invisible" first argument.
STRUCT_VALUE_INCOMING_REGNUM
On some architectures the place where the structure value address is found by the called function is not the same place that the caller put it. This can be due to register windows, or it could be because the function prologue moves it to a different place.

If the incoming location of the structure value address is in a register, define this macro as the register number.

STRUCT_VALUE_INCOMING
If the incoming location is not a register, then you should define STRUCT_VALUE_INCOMING as an expression for an RTX for where the called function should find the value. If it should find the value on the stack, define this to create a mem which refers to the frame pointer. A definition of 0 means that the address is passed as an "invisible" first argument.
PCC_STATIC_STRUCT_RETURN
Define this macro if the usual system convention on the target machine for returning structures and unions is for the called function to return the address of a static variable containing the value.

Do not define this if the usual system convention is for the caller to pass an address to the subroutine.

This macro has effect in -fpcc-struct-return mode, but it does nothing when you use -freg-struct-return mode.