14.7 Function Call Conventions

When calling a function:

  • Registers W0-W7 are caller saved. The calling function must preserve these values before the function call, if their value is required subsequently from the function call. The stack is a good place to preserve these values.
  • Registers W8-W14 are callee saved. The function being called must save any of these registers it will modify.
  • Registers W0-W4 are used for function return values.
  • Registers W0-W7 are used for argument transmission.
  • The following conventions hold:
    • Registers F0 - F7 are caller saved. The calling function must preserve these values before the function call if their value is required upon returning from the function. The stack is a good place to preserve these values.
    • Registers F8 - F31 are callee saved. The function being called must save any of these registers it will modify.
    • Registers F0 - F1 will be used to return float , double or long double values.
    • Registers F0 - F7 will be used to transmit float , double or long double values.
Table 14-1. Registers Required
Data TypeNumber and Type of Registers Required
char1 W register
short1 W register
int1 W register
any C qualified pointer1 W register
long1 W register
float1 F register
double (Note 1)1 F register
long long int2 W register, aligned to an even numbered register
long double2 F registers, aligned to an even numbered register
_Fract1 W register
_long _Fract2 W registers, aligned to even numbered register
struct1 register per 4 bytes in structure
Note 1: double is equivalent to long double if -fno-short-double is used.