$t registers do not need to be preserved across procedure calls; however, if they contain live values, they should be saved before making a call. That is, procedure A should save any $t registers containing live values before calling procedure B, because procedure B is free to overwrite any $t register. (Note: a register contains a "live value" if it could be read before being written).
jal instruction within a leaf
procedure.
You are not required to allocate or use an activation record
for leaf procedures, unless you need space for local variables or
to save $s registers.
Therefore, you do not need to save the return address (on
the stack) for a leaf procedure.
| | largest addresses
|----------------|
| |
|----------------|
| |
|----------------|
| |
|================|
| A's local | --| <-- A's frame pointer
| variables | |
|----------------| |
| any $t regs | |
| used by A, that| |
| must be preser-| |
| ved across the | |
| call to B | |
|----------------| |---- procedure A's activation record
| copy of $ra | |
| A's return addr| |
|----------------| |
| any $s regs | |
| used by A | |
|----------------| |
| 5 words, | |
| parameters | |
| from A to B | --|
|================|
| B's local | --|<-- A's $sp, B's frame pointer
| variables | |
|----------------| |
| any $t regs | |
| used by B, that| |
| must be preser-| |
| across a call | |
| to C | |
|----------------| |---- procedure B's activation record
| copy of $ra | |
| B's return addr| |
|----------------| |
| any $s regs | |
| used by B | |
|----------------| |
| 4 words, | |
| space for $a0- | |
| $a3 if needed | |
| (parameters | |
| from B to C) | --|
|================|
| | <-- B's $sp
|----------------|
| | smallest address
Notes: