7.3. Register Usage
The ABI adds additional usage conventions to the Nios II register file defined in the
Programming Model chapter of the Nios II Processor Reference Handbook.
Table 83.
Nios II ABI Register Usage
Register
Name
Used by
Compiler
Callee
Saved
(41)
Normal Usage
r0
zero
v
0x00000000
r1
at
Assembler temporary
r2
v
Return value (least-significant 32 bits)
r3
v
Return value (most-significant 32 bits)
r4
v
Register arguments (first 32 bits)
r5
v
Register arguments (second 32 bits)
r6
v
Register arguments (third 32 bits)
r7
v
Register arguments (fourth 32 bits)
r8
v
Caller-saved general-purpose registers
r9
v
r10
v
r11
v
r12
v
r13
v
r14
v
r15
v
r16
v
v
Callee-saved general-purpose registers
r17
v
v
r18
v
v
r19
v
v
r20
v
v
r21
v
v
r22
v
(42)
r23
v
(43)
continued...
(41)
A function can use one of these registers if it saves it first. The function must restore the
register’s original value before exiting.
(42)
In the GNU Linux operating system,
r22
points to the global offset table (GOT). Otherwise, it
is available as a callee-saved general-purpose register.
7. Application Binary Interface
NII-PRG | 2018.04.18
Nios II Processor Reference Guide
147