This section discusses the macros that control returning scalars as values--values that can fit in registers.
TRADITIONAL_RETURN_FLOAT
float
to convert the value to double
.
FUNCTION_VALUE (valtype, func)
TYPE_MODE
(valtype)
to get the machine mode used to represent that type.
On many machines, only the mode is relevant. (Actually, on most
machines, scalar values are returned in the same place regardless of
mode).
The value of the expression is usually a reg
RTX for the hard
register where the return value is stored. The value can also be a
parallel
RTX, if the return value is in multiple places. See
FUNCTION_ARG
for an explanation of the parallel
form.
If PROMOTE_FUNCTION_RETURN
is defined, you must apply the same
promotion rules specified in PROMOTE_MODE
if valtype is a
scalar type.
If the precise function being called is known, func is a tree
node (FUNCTION_DECL
) for it; otherwise, func is a null
pointer. This makes it possible to use a different value-returning
convention for specific functions when all their calls are
known.
FUNCTION_VALUE
is not used for return vales with aggregate data
types, because these are returned in another way. See
STRUCT_VALUE_REGNUM
and related macros, below.
FUNCTION_OUTGOING_VALUE (valtype, func)
FUNCTION_VALUE
computes the register in which
the caller will see the value. FUNCTION_OUTGOING_VALUE
should be
defined in a similar fashion to tell the function where to put the
value.
If FUNCTION_OUTGOING_VALUE
is not defined,
FUNCTION_VALUE
serves both purposes.
FUNCTION_OUTGOING_VALUE
is not used for return vales with
aggregate data types, because these are returned in another way. See
STRUCT_VALUE_REGNUM
and related macros, below.
LIBCALL_VALUE (mode)
FUNCTION_DECL
) for it; otherwise, func is a null
pointer. This makes it possible to use a different value-returning
convention for specific functions when all their calls are
known.
Note that "library function" in this context means a compiler
support routine, used to perform arithmetic, whose name is known
specially by the compiler and was not mentioned in the C code being
compiled.
The definition of LIBRARY_VALUE
need not be concerned aggregate
data types, because none of the library functions returns such types.
FUNCTION_VALUE_REGNO_P (regno)
double
, say) need not be
recognized by this macro. So for most machines, this definition
suffices:
#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)If the machine has register windows, so that the caller and the called function use different registers for the return value, this macro should recognize only the caller's register numbers.
APPLY_RESULT_SIZE
FUNCTION_VALUE_REGNO_P
for
saving and restoring an arbitrary return value.
Go to the first, previous, next, last section, table of contents.