MIPS16 Epilog Example
The following example shows how to construct an epilog for a MIPS16 ISA. MIPS16 epilogs employ slightly different guidelines to restore the registers saved by the called function.
The following example shows how to restore the registers saved by the called function for a MIPS16 ISA.
If reg is a MIPS16 register, restore it with:
lw reg, framesize+frameoffset-N($29)
Otherwise, use:
lw scratch, framesize+frameoffset-N($29)
move reg, scratch
Here, scratch is any MIPS16 register other than the return value registers (v0 and v1), or a register saved by the called function that the epilog restores. N is four and incremented by four for each subsequent lower number register saved.
Leaf routines may return to their calling functions
jr ra $31
Non-leaf routines must restore the return address to a scratch register and use it to return
lw scratch, framesize+frameoffset($29) jr scratch
See Also
MIPS Epilog | MIPSII Epilog Example
Last updated on Thursday, April 08, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.