The caller must restore any T
registers it saved.
main()
In
this example, main()
did not save any T
registers.
There is nothing to do when it regains
control from the
subroutine other than to use the value returned in $v0
.
Look down to the section where main
regains control.
Fill in the blanks that follow so that the
value returned by the subroutine
(contained in $v0
) is copied
to the variable a
on the stack.
The next few statements
load $a0
with the value
of a
from the stack,
and then print that value by using
a SPIM service.
Again, this could have been done
without involving the stack,
but this example shows the type of
code that a non-optimizing compiler
might produce.
Fill in the blanks.