These conventions must be followed by anyone wishing to write subroutines that will be used with other code (including code produced by compilers)—however, there is nothing inherent within the MIPS architecture that requires or enforces the use of these conventions.
|
|
Register Number |
Mnemonic Name |
Conventional Use |
$0 |
$zero |
Hardwired constant 0 |
$1 |
$at |
Reserved for assembler |
$2- $3 |
$v0-$v1 |
Return results from functions. |
$4- $7 |
$a0-$a3 |
Used for arguments 1-4 of subroutine.
Any additional arguments are placed on the stack. |
$8-$15 |
$t0-$t7 |
“Temporary,” not saved across a call |
$16-$23 |
$s0-$s7 |
“Saved,” saved across a call, but must be saved (usually on stack) before being used, restored before return |
$24-$25 |
$t8-$t9 |
More temporary |
$26-$27 |
$k0-$k1 |
“Kernel”—reserved for OS use |
$28 |
$gp |
Pointer to global data area |
$29 |
$sp |
Stack pointer—contains address of top of stack |
$30 |
$fp |
Frame pointer—contains address of local variable space |
$31 |
$ra |
Return address of subroutine |
|