In the section on parameter passing, we saw how to pass parameters
from a caller to a callee and how to access those parameters during
the execution of the callee.
To make the call/return protocol complete, we also need to show
how to allocte variables local to a particular subprogram. These
variables are allocated on the stack. Fortunately, we already have
all the architectural support we need for local variables.
We will use the following stack frame layout:
Allocation of local variables must now be integrated into the
call/return protocol as follows:
compute argument n in R1
compute argument 1 in R1
addsp -m (to allocate m vars)
compute return value in R0
addsp m (to deallocate vars)
addsp n (to pop arguments)