A dedicated register contains a stack pointer
which indicates where to unwind the runtime stack to.
If we were simply to do the opposite of what was done for register saves in function prologs, the code resulting from procedural abstraction at each return block for a function might have the following structure, with three instructions to manage the control transfers and stack pointer
SP is the stack pointer
register that points to the top of the stack.
The new devices contain a number of important architectural features including 16 register banks for fast context switching, instruction pre-fetch, a 16-bit stack pointer
over the entire memory space, 20 addressing modes, 16-bit program counter and five power saving modes (STOP, SLOW, IDLE1, IDLE2 and SLEEP).
An efficient but architecture-specific implementation of this test would be a comparison of the address of the table with the current stack pointer
Other enhancements include double precision multiplication support, shadow registers for fast context switching, a dedicated software stack pointer
, automatic boot procedure, single cycle min/max instruction and single cycle division seed generation.
Other features of the new MCUs include, 8 register banks for fast context switching, 32-bit stack pointer
over the entire memory space, 20 addressing modes and five power saving modes.