Everything
9.1.5 Examples of Parameter Allocation

Examples of parameter allocation are shown in the following. Note that addresses increase from the right side to the left side in all figures (upper address is on the left side).

Examples 1.

Parameters matching the type to be passed to registers are allocated, in the order in which they are declared, to registers R1 to R4.
If there is a parameter that will not be allocated to registers midway, parameters after that will be allocated to registers. The parameter will be placed on the stack at an address corrected to match the boundary alignment number of that parameter.

 

Examples 2.

Parameters of a structure or union whose size is 16 bytes or less and is also a multiple of 4 are allocated to registers. Parameters of all other structures and unions are allocated to the stack.

 

Examples 3.

When declared in a prototype declaration as a function with a variable-number of parameters, the parameters without corresponding types and the immediately preceding parameter are allocated to the stack in the order in which they are declared.

 

Examples 4.

When the type returned by a function is more than 16 bytes, or for a structure or union that is not the size of a multiple of 4, the return value address is set to R15.

 

Examples 5.

When setting the return value to memory, normally a stack is allocated, as shown in example 4. In the case of setting the return value to a variable, however, no stack is allocated and it is directly set to the memory area for that variable. In this case, the address for the variable is set to R15.