SH-4 Return Values

The following list shows the standard registers that a called function uses to return values:

  • R0 for single-word integer and integer-equivalent values.
  • FR0 for single-precision floating-point return values.
  • R0 for structures or unions that are four bytes or less.
  • Structures that are more than four bytes in size return a pointer to the updated structure in R0. The calling function provides a pointer to the return structure copying location as a hidden first argument. Functions return 64-bit integer values, Int64, by the same method used to return structures more than 4 bytes in size.
  • DR0 for double-precision floating-point values.

If a function written in C or C++ returns large structures or 64-bit integers, the return value must be copied to a location provided by the calling function. The calling function adds a pointer to this location to the front of the argument list, called the hidden first argument. It points to a location allocated in the stack frame of the calling function that holds the result of the function call.

See Also

SH-4 Calling Sequence Specification | SH-4 Registers | SH-4 Stack Frame Layout | SH-4 Parameter Passing | SH-4 Prolog and Epilog | SH-4 pdata Format | SH-4 Assembler Macros

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.