$t0
- $t9
— The subroutine is free to change these registers.
$s0
- $s7
— The subroutine must not change these registers.
$a0
- $a3
— These registers contain arguments for the subroutine.
The subroutine can change them.
$v0
- $v1
— These registers contain values returned from the subroutine.
$t0
-$t9
or $8
-$15
and $24
-$25
) without any restrictions.
$s0
-$s7
or $16
-$23
), you must save their contents before you use them (callee-saved registers), and restore the values before returning.
$sp
).
Since saving and restoring a register is an expensive operation, it is a goal of the assembly programmer to design a register allocation scheme that minimizes the number of save/restore operations.
A guy walks into a bar owned by Eminem… He says, “Give me 2 shots…” The bartender cuts him off saying, “You only get one shot.” |