MIPS Assembly/Register File
From Wikibooks, the open-content textbooks collection
This page will talk about the structural details of the MIPS register file.
Contents |
[edit] Zero Register
The zero register ($zero or $0) always contains a value of 0. It is built into the hardware and therefore cannot be modified.
[edit] $at Register
The $at (Assembler Temporary) register is used for temporary values within pseudo commands. It is not preserved across function calls.
[edit] $v Registers
The $v Registers are used for returning values from functions. They are not preserved across function calls.
[edit] Argument Registers
The $a registers are used for passing arguments to functions. They are not preserved across function calls.
[edit] Temporaries
The temporary registers are used by the assembler or assembly language programmer to store intermediate values. They are not preserved across function calls.
[edit] Saved Temporaries
Saved Temporary registers are used to store longer lasting values. They are preserved across function calls.
[edit] $k Registers
The k registers are reserved for use by the OS kernel.
[edit] Pointer Registers
- Global Pointer ($gp)
- Stack Pointer ($sp) - Used to store the value of the stack pointer.
- Frame Pointer ($fp) - Used to store the value of the frame pointer.
- Return Address ($ra) - Stores the return address (the location in the program that a function needs to return to).
All Pointer Registers are preserved accross function calls.