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
orlong double
values. - Registers F0 - F7 will be used to
transmit
float
,double
orlong double
values.
Data Type | Number and Type of Registers Required |
---|---|
char | 1 W register |
short | 1 W register |
int | 1 W register |
any C qualified pointer | 1 W register |
long | 1 W register |
float | 1 F register |
double (Note 1) | 1 F register |
long long int | 2 W register, aligned to an even numbered register |
long double | 2 F registers, aligned to an even numbered register |
_Fract | 1 W register |
_long _Fract | 2 W registers, aligned to even numbered register |
struct | 1 register per 4 bytes in structure |
Note 1: double
is equivalent to long double if
-fno-short-double is used. |