Movatterモバイル変換


[0]ホーム

URL:


Next:, Previous:, Up:Stack Layout and Calling Conventions   [Contents][Index]


17.9.9 How Large Values Are Returned

When a function value’s mode isBLKmode (and in some othercases), the value is not returned according toTARGET_FUNCTION_VALUE (seeHow Scalar Function Values Are Returned). Instead, thecaller passes the address of a block of memory in which the valueshould be stored. This address is called thestructure valueaddress.

This section describes how to control returning structure values inmemory.

Target Hook:boolTARGET_RETURN_IN_MEMORY(const_treetype, const_treefntype)

This target hook should return a nonzero value to say to return thefunction value in memory, just as large structures are always returned.Heretype will be the data type of the value, andfntypewill be the type of the function doing the returning, orNULL forlibcalls.

Note that values of modeBLKmode must be explicitly handledby this function. Also, the option-fpcc-struct-returntakes effect regardless of this macro. On most systems, it ispossible to leave the hook undefined; this causes a defaultdefinition to be used, whose value is the constant 1 forBLKmodevalues, and 0 otherwise.

Do not use this hook to indicate that structures and unions should alwaysbe returned in memory. You should instead useDEFAULT_PCC_STRUCT_RETURNto indicate this.

Macro:DEFAULT_PCC_STRUCT_RETURN

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

If not defined, this defaults to the value 1.

Target Hook:rtxTARGET_STRUCT_VALUE_RTX(treefndecl, intincoming)

This target hook should return the location of the structure valueaddress (normally amem orreg), or 0 if the address ispassed as an “invisible” first argument. Note thatfndecl maybeNULL, for libcalls. You do not need to define this targethook if the address is always passed as an “invisible” firstargument.

On some architectures the place where the structure value addressis found by the called function is not the same place that thecaller put it. This can be due to register windows, or it couldbe because the function prologue moves it to a different place.incoming is1 or2 when the location is needed inthe context of the called function, and0 in the context ofthe caller.

Ifincoming is nonzero and the address is to be found on thestack, return amem which refers to the frame pointer. Ifincoming is2, the result is being used to fetch thestructure value address at the beginning of a function. If you needto emit adjusting code, you should do it at this point.

Macro:PCC_STATIC_STRUCT_RETURN

Define this macro if the usual system convention on the target machinefor returning structures and unions is for the called function to returnthe address of a static variable containing the value.

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

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

Target Hook:fixed_size_modeTARGET_GET_RAW_RESULT_MODE(intregno)

This target hook returns the mode to be used when accessing raw returnregisters in__builtin_return. Define this macro if the valueinreg_raw_mode is not correct. UseVOIDmode if a registershould be ignored for__builtin_return purposes.

Target Hook:fixed_size_modeTARGET_GET_RAW_ARG_MODE(intregno)

This target hook returns the mode to be used when accessing raw argumentregisters in__builtin_apply_args. Define this macro if the valueinreg_raw_mode is not correct. UseVOIDmode if a registershould be ignored for__builtin_apply_args purposes.

Target Hook:boolTARGET_EMPTY_RECORD_P(const_treetype)

This target hook returns true if the type is an empty record. The defaultis to returnfalse.

Target Hook:voidTARGET_WARN_PARAMETER_PASSING_ABI(cumulative_args_tca, treetype)

This target hook warns about the change in empty class parameter passingABI.


Next:Caller-Saves Register Allocation, Previous:How Scalar Function Values Are Returned, Up:Stack Layout and Calling Conventions   [Contents][Index]


[8]ページ先頭

©2009-2026 Movatter.jp