A%20Simple%20Example - PowerPoint PPT Presentation

About This Presentation
Title:

A%20Simple%20Example

Description:

A Simple Example ... following convention in using registers ... ra: one return address register to return to the point of origin. week04-3.ppt. 4. Registers ... – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 10
Provided by: Zhen67
Learn more at: http://www.cs.fsu.edu
Category:

less

Transcript and Presenter's Notes

Title: A%20Simple%20Example


1
(No Transcript)
2
A Simple Example
Note that there are steps involved in the calling
function as well as in the one being called
3
MIPS Calling Conventions
  • MIPS assembly follows the following convention in
    using registers
  • a0 - a3 four argument registers in which to
    pass parameters
  • v0 - v1 two value registers in which to return
    values
  • ra one return address register to return to the
    point of origin

4
Registers
  • Remember that the same registers are used by both
    the caller and callee
  • What do we need to do in order to guarantee the
    correctness of the program?
  • For the following code for example, what do we
    need to do?

5
Register Spilling
  • The callee has to save all the registers it uses
    and restore the values before it returns
  • By storing them on the stack
  • At the beginning
  • Then restoring them
  • At the end

6
Simple Example
7
The Stack Pointer
8
MIPS Calling Conventions - more
  • MIPS software divides 18 of the registers into
    two groups
  • t0 - t9 10 temporary registers that are not
    preserved by the callee on a procedure call
  • These are caller-saved registers since the caller
    must save the ones it is using
  • s0 - s7 8 saved registers that must be
    preserved on a procedure call
  • These are callee-saved registers since the callee
    must save the ones it uses

9
Revised Version
Write a Comment
User Comments (0)
About PowerShow.com