106
Chapter 3
CPU System Functions
Preliminary User’s Manual U17566EE1V2UM00
3.2.1
General purpose registers (r0 to r31)
Each of the 32 general purpose registers can be used as a data variable or
address variable.
However, the registers r0, r1, r3 to r5, r30, and r31 may implicitly be used by
the assembler/compiler (see table
Table 3-2
). For details refer to the
documentation of your assembler/compiler.
Caution
Before using registers r1, r3 to r5, r30, and r31, their contents must be saved
so that they are not lost. The contents must be restored to the registers after
the registers have been used.
Table 3-2
General purpose registers
Register name
Usage
Operation
r0
Zero register
Always holds 0. It is used for
operations using 0 and offset 0
addressing.
a
a)
Registers r0 and r30 are used by dedicated instructions.
r1
Assembler-reserved register
Used for 32-bit direct addressing.
b
b)
Registers r1, r3, r4, r5, and r31 may be used by the assembler/compiler.
r2
User address/data variable register
r3
Stack pointer
Used to generate stack frame when
function is called.
b
r4
Global pointer
Used to access global variable in
data area.
b
r5
Text pointer
Used to indicate the start of the text
area (where program code is
located).
b
r6 to r29
User address/data variable registers
r30
Element pointer
Base pointer when memory is
accessed by means of instructions
SLD (short format load) and SST
(short format store).
a
r31
Link pointer
Used when calling a function.
b
electronic components distributor