stack instructions
stack contract
- stack is LIFO (last in first out)
- popping gives you back the last value pushed
what’s it for?
- holding return addresses for recursive calls
- saving values of registers
- sometimes, passing arguments
we’ll asssume we have enough registers to put all args in registers
more realistically, only the first few are put in registers, and the
rest go on the stack
instructions
- pop R1
pop the top value off the stack and put it in register R1
- push R1
push the contents of register R1 onto the top of the stack