Share via


MIPS Epilog (Windows CE 5.0)

Send Feedback

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.

  1. 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
    
  2. Return from the procedure.

    j $31
    
  3. 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

MIPS Prolog and Epilog

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.