gccint: Scalar Return

1 
1 18.9.8 How Scalar Function Values Are Returned
1 ----------------------------------------------
1 
1 This section discusses the macros that control returning scalars as
1 values--values that can fit in registers.
1 
1  -- Target Hook: rtx TARGET_FUNCTION_VALUE (const_tree RET_TYPE,
1           const_tree FN_DECL_OR_TYPE, bool OUTGOING)
1 
1      Define this to return an RTX representing the place where a
1      function returns or receives a value of data type RET_TYPE, a tree
1      node representing a data type.  FN_DECL_OR_TYPE is a tree node
1      representing 'FUNCTION_DECL' or 'FUNCTION_TYPE' of a function being
1      called.  If OUTGOING is false, the hook should compute the register
1      in which the caller will see the return value.  Otherwise, the hook
1      should return an RTX representing the place where a function
1      returns a value.
1 
1      On many machines, only 'TYPE_MODE (RET_TYPE)' is relevant.
1      (Actually, on most machines, scalar values are returned in the same
1      place regardless of mode.)  The value of the expression is usually
1      a 'reg' RTX for the hard register where the return value is stored.
1      The value can also be a 'parallel' RTX, if the return value is in
1      multiple places.  See 'TARGET_FUNCTION_ARG' for an explanation of
1      the 'parallel' form.  Note that the callee will populate every
1      location specified in the 'parallel', but if the first element of
1      the 'parallel' contains the whole return value, callers will use
1      that element as the canonical location and ignore the others.  The
1      m68k port uses this type of 'parallel' to return pointers in both
1      '%a0' (the canonical location) and '%d0'.
1 
1      If 'TARGET_PROMOTE_FUNCTION_RETURN' returns true, you must apply
1      the same promotion rules specified in 'PROMOTE_MODE' if VALTYPE is
1      a scalar type.
1 
1      If the precise function being called is known, FUNC is a tree node
1      ('FUNCTION_DECL') for it; otherwise, FUNC is a null pointer.  This
1      makes it possible to use a different value-returning convention for
1      specific functions when all their calls are known.
1 
1      Some target machines have "register windows" so that the register
1      in which a function returns its value is not the same as the one in
1      which the caller sees the value.  For such machines, you should
1      return different RTX depending on OUTGOING.
1 
1      'TARGET_FUNCTION_VALUE' is not used for return values with
1      aggregate data types, because these are returned in another way.
1      See 'TARGET_STRUCT_VALUE_RTX' and related macros, below.
1 
1  -- Macro: FUNCTION_VALUE (VALTYPE, FUNC)
1      This macro has been deprecated.  Use 'TARGET_FUNCTION_VALUE' for a
1      new target instead.
1 
1  -- Macro: LIBCALL_VALUE (MODE)
1      A C expression to create an RTX representing the place where a
1      library function returns a value of mode MODE.
1 
1      Note that "library function" in this context means a compiler
1      support routine, used to perform arithmetic, whose name is known
1      specially by the compiler and was not mentioned in the C code being
1      compiled.
1 
1  -- Target Hook: rtx TARGET_LIBCALL_VALUE (machine_mode MODE, const_rtx
1           FUN)
1      Define this hook if the back-end needs to know the name of the
1      libcall function in order to determine where the result should be
1      returned.
1 
1      The mode of the result is given by MODE and the name of the called
1      library function is given by FUN.  The hook should return an RTX
1      representing the place where the library function result will be
1      returned.
1 
1      If this hook is not defined, then LIBCALL_VALUE will be used.
1 
1  -- Macro: FUNCTION_VALUE_REGNO_P (REGNO)
1      A C expression that is nonzero if REGNO is the number of a hard
1      register in which the values of called function may come back.
1 
1      A register whose use for returning values is limited to serving as
1      the second of a pair (for a value of type 'double', say) need not
1      be recognized by this macro.  So for most machines, this definition
1      suffices:
1 
1           #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
1 
1      If the machine has register windows, so that the caller and the
1      called function use different registers for the return value, this
1      macro should recognize only the caller's register numbers.
1 
1      This macro has been deprecated.  Use
1      'TARGET_FUNCTION_VALUE_REGNO_P' for a new target instead.
1 
1  -- Target Hook: bool TARGET_FUNCTION_VALUE_REGNO_P (const unsigned int
1           REGNO)
1      A target hook that return 'true' if REGNO is the number of a hard
1      register in which the values of called function may come back.
1 
1      A register whose use for returning values is limited to serving as
1      the second of a pair (for a value of type 'double', say) need not
1      be recognized by this target hook.
1 
1      If the machine has register windows, so that the caller and the
1      called function use different registers for the return value, this
1      target hook should recognize only the caller's register numbers.
1 
1      If this hook is not defined, then FUNCTION_VALUE_REGNO_P will be
1      used.
1 
1  -- Macro: APPLY_RESULT_SIZE
1      Define this macro if 'untyped_call' and 'untyped_return' need more
1      space than is implied by 'FUNCTION_VALUE_REGNO_P' for saving and
1      restoring an arbitrary return value.
1 
1  -- Target Hook: bool TARGET_OMIT_STRUCT_RETURN_REG
1      Normally, when a function returns a structure by memory, the
1      address is passed as an invisible pointer argument, but the
1      compiler also arranges to return the address from the function like
1      it would a normal pointer return value.  Define this to true if
1      that behavior is undesirable on your target.
1 
1  -- Target Hook: bool TARGET_RETURN_IN_MSB (const_tree TYPE)
1      This hook should return true if values of type TYPE are returned at
1      the most significant end of a register (in other words, if they are
1      padded at the least significant end).  You can assume that TYPE is
1      returned in a register; the caller is required to check this.
1 
1      Note that the register provided by 'TARGET_FUNCTION_VALUE' must be
1      able to hold the complete return value.  For example, if a 1-, 2-
1      or 3-byte structure is returned at the most significant end of a
1      4-byte register, 'TARGET_FUNCTION_VALUE' should provide an 'SImode'
1      rtx.
1