Nios® II Processor Reference Guide

ID 683836
Date 10/22/2020
Public
Document Table of Contents

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 80.  Nios II ABI Register Usage
Register Name Used by Compiler Callee Saved36 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 37
r23   v 38
r24 et     Exception temporary
r25 bt     Break temporary
r26 gp v   Global pointer
r27 sp v   Stack pointer
r28 fp v 39 Frame pointer
r29 ea     Exception return address
r30 ba    
  • Normal register set: Break return address
  • Shadow register sets: SSTATUS register
r31 ra v   Return address

The endianness of values greater than 8 bits is little endian. The upper 8 bits of a value are stored at the higher byte address.

36 A function can use one of these registers if it saves it first. The function must restore the register’s original value before exiting.
37 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.
38 In the GNU Linux operating system, r23 is used as the thread pointer. Otherwise, it is available as a callee-saved general-purpose register.
39 If the frame pointer is not used, the register is available as a callee-saved temporary register. Refer to “Frame Pointer Elimination” .

Did you find the information on this page useful?

Characters remaining:

Feedback Message