Everything
9.1.1 General-purpose registers guaranteed before and after function calls

Some general-purpose registers are guaranteed to be the same before and after a function call, and others are not. The rules for guaranteeing general-purpose registers are as follows.

(1)

Registers guaranteed to be same before and after function call (Callee-Save registers)

These general-purpose registers must be saved and restored by the called function. It is thus guaranteed to the caller that the register contents will be the same before and after the function call.

r20, r21, r22, r23, r24, r25, r26, r27, r28, r29, r30Note, r31

Note

r30 (EP) may be locked throughout the entire program. If it is locked, then the contents of the general-purpose registers are never changed anywhere in the program, and consequently it is not necessary for the callee to save and restore the registers.

(2)

Registers not guaranteed to be same before and after function call (Caller-Save registers)

General-purpose registers other than the Callee-Save registers above could be overwritten by the called function. It is thus not guaranteed to the caller that the register contents will be the same before and after the function call.

Remark 1.

The user must take responsibility for overwriting register r1, because it may be used by the assembler.

Remark 2.

r2 may be reserved by the OS. The rules described here do not apply to reserved registers, because the compiler does not use them as general-purpose registers. The user is responsible for overwriting them.

Remark 3.

r3 is a stack pointer. The rules described here do not apply to it, because it is not used as a general-purpose register. The user is responsible for overwriting it.

Remark 4.

It is possible to specify usage of r2, r4, and r30 using options.