Register Guide

RISC-V t6 / x31 Register: Temporary

Temporary register 6 (x31). In the standard RISC-V psABI calling convention, t6 is a temporary register and is not preserved across calls.

ABI name: t6; physical register: x31.
Save rule: Not preserved across calls.
Read it through its psABI role first, then inspect how each instruction reads or writes it.
Physical Name x31ABI Name t6Save Rule Not preserved across calls
Role
Temporary
Convention
Not preserved across calls
Remember This First
t6 is a standard-psABI temporary register and is not preserved across calls.
psABI Reference

Temporary register

The psABI marks t0-t6 as temporary registers. They are not callee-saved; callers must save any value that needs to survive a call.

Preserved across calls: No
RISC-V psABI integer register convention
Quick Understanding & Search Notes

psABI Table 1 names x31 t6, a temporary register not preserved across calls.

x28-x31 / t3-t6 are temporary registers and are not preserved across calls.

When It Fits Best

  • - Recognize t6 as a temporary register not preserved across calls in the standard psABI.
  • - On procedure exit, contents not specified as return values or callee-saved are unspecified.
  • - The temporary-register classification does not prescribe a particular call sequence or save location.

When Not To Use It This Way

  • - Do not assume a pre-call t6 value remains available after a call.
  • - Do not describe the psABI temporary classification as special hardware behavior.

What Happens Around A Call

1

t6 is a standard-psABI temporary register and is not preserved across calls.

2

Contents not specified as return values or callee-saved are unspecified on procedure exit.

3

This rule applies to the standard calling convention.

Standard psABI Rule For t6

Examples explain the rule, not a complete program
# t6: temporary register, not preserved across calls
# Scope: standard psABI calling convention

FAQ

Is t6 / x31 preserved across calls?

No. t0-t6 are temporary registers and are not preserved across calls.