17.10.9 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
TARGET_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
This section describes how to control returning structure values in memory.
This target hook should return a nonzero value to say to return the function value in memory, just as large structures are always returned. Here type will be the data type of the value, and fntype will be the type of the function doing the returning, or
Note that values of mode
BLKmodemust be explicitly handled by this function. Also, the option -fpcc-struct-return takes effect regardless of this macro. On most systems, it is possible to leave the hook undefined; this causes a default definition to be used, whose value is the constant 1 for
BLKmodevalues, and 0 otherwise.
Do not use this hook to indicate that structures and unions should always be returned in memory. You should instead use
DEFAULT_PCC_STRUCT_RETURNto indicate this.
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
If not defined, this defaults to the value 1.
This target hook should return the location of the structure value address (normally a
reg), or 0 if the address is passed as an “invisible” first argument. Note that fndecl may be
NULL, for libcalls. You do not need to define this target hook if the address is always passed as an “invisible” first argument.
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. incoming is
2when the location is needed in the context of the called function, and
0in the context of the caller.
If incoming is nonzero and the address is to be found on the stack, return a
memwhich refers to the frame pointer. If incoming is
2, the result is being used to fetch the structure value address at the beginning of a function. If you need to emit adjusting code, you should do it at this point.
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.