Go to the first, previous, next, last section, table of contents.

Calling conventions

The first four words of arguments are passed in registers `R4' through `R7'. All remaining arguments are pushed onto the stack, last to first, so that the lowest numbered argument not passed in a register is at the lowest address in the stack. The registers are always filled, so a double word argument starting in `R7' would have the most significant word in `R7' and the least significant word on the stack.

When a function is compiled with the default options, it must return with registers `R8' through `R15' unchanged. Registers `R0' through `R7', `T', `MACH' and `MACL' are volatile.

The `-mhitachi SH' switch makes the `MACH' and `MACL' registers caller-saved, which is compatible with the Hitachi SH tool chain at the expense of performance.

The `-mnosave' switch makes registers `R0' through `R11' volatile, which can often improve performance.

Note that functions compiled with different calling conventions cannot be run together without some care.


Go to the first, previous, next, last section, table of contents.