The compiler uses the scratch registers to pass values to the called routine for all parameters of simple data type. If there are not enough scratch registers to hold all parameter data to be passed to the called routine, the excess data are passed on the stack.
Simple data types which require more than a single word of storage are passed in register pairs or register quads. The register requirement for the basic data types are:
Allocation of the scratch registers for function calls proceeds in a left-to-right fashion, starting with register R15 and progressing in reverse order to R12. The compiler tries to fit each parameter into the scratch registers and, if it can, allocates those registers to the incoming parameter. If the parameter requires more scratch registers than are free, it is noted and is passed on the stack. All parameters which are passed on the stack are pushed in reverse order.