MIPS Epilog (Windows CE 5.0)
While each procedure has only one prolog, a procedure may contain any number of epilogs if the procedure uses multiple exit points. Each epilog is required to have certain specific parts. All parts are contiguous with no intervening instructions.
The following example shows how to restore the registers saved by the called function for a MIPS ISA. For MIPS IV, replace the lw instruction with ld. Note that MIPS16 epilogs employ slightly different guidelines to restore the registers saved by the called function.
Issue a restore for each register saved in the prologue where N is four and incremented by four for each subsequent lower number register saved.
lw $31, framesize+frameoffset($29) ; restore return address lw reg, framesize+frameoffset-N($29) ; restore integer register ldc1 reg, framesize+frameoffset-N($29) ; restore float register
Return from the procedure.
j $31
End the routine.
.end routine_name
The minimum proper epilog for a leaf routine includes the return jump and the .end. Additionally, for a nonleaf routine, loading register $31 is required.
jr scratch
See Also
Send Feedback on this topic to the authors