MIPS calling conventions

Meissner, Michael michael.meissner@amd.com
Wed Aug 10 23:21:00 GMT 2005

Looking at the source, there are at least 5 different ABIs in mips.c.  I
believe Sony has designed another ABI for use in the PSP system, but
those sources are not integrated at the FSF.  I don't recall which ABIs
P&H describes in their book.  Note, GCC can use a frame pointer if it
has allocates variable size auto variables, or if the user directs it
with -fno-omit-frame-pointer. 

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Nelson H. F. Beebe
Sent: Wednesday, August 10, 2005 4:02 PM
To: Mad Props; gcc-help@gcc.gnu.org
Cc: beebe@math.utah.edu
Subject: Re: MIPS calling conventions

"Mad Props" <madprops@gmx.net> asks on Wed, 10 Aug 2005 15:55:12 +0200
(MEST) about the calling conventions used by gcc on the MIPS

An excellent resource that I strongly recommend that you get is this
recent book:

@String{pub-MORGAN-KAUFMANN     = "Morgan Kaufmann Publishers"}
@String{pub-MORGAN-KAUFMANN:adr = "2929 Campus Drive, Suite 260, San
                                  Mateo, CA 94403, USA"}

  author =       "David A. Patterson and John L. Hennessy",
  title =        "Computer Organization: The Hardware\slash Software
  publisher =    pub-MORGAN-KAUFMANN,
  address =      pub-MORGAN-KAUFMANN:adr,
  edition =      "Third",
  pages =        "xvii + 621",
  year =         "2004",
  ISBN =         "1-55860-604-1",
  ISBN-13 =      "978-1-55860-604-3",
  LCCN =         "QA76.9.C643 H46 2004",
  bibdate =      "Mon Nov 15 16:01:50 2004",
  price =        "US\$64.95",
  acknowledgement = ack-nhfb,

There are two conventions used by compilers on the MIPS architecture for
argument passing: one keeps a constant frame pointer within each
procedure, addressing local variables at constant offset from the frame
pointer (native SGI IRIX compilers do this), and the other dispenses
with the frame pointer, and uses only the stack pointer, which changes
during execution of the procedure, and thus variable offsets change as
well (gcc does this).

This is described on pp. 86ff of the above book, and in Appendix A,
which is not printed, but is on the book's CD-ROM inside the back cover.
The CD also contains the SPIM simulator for the MIPS architecture, but a
newer version is now available here:


With the book and the simulator, you should then have the tools you need
for your work with gcc on MIPS.

Other resources include these books:

@String{pub-PH                  = "Pren{\-}tice-Hall"}
@String{pub-PH:adr              = "Upper Saddle River, NJ 07458, USA"}

  author =       "Gerry Kane and Joe Heinrich",
  title =        "{MIPS RISC} Architecture",
  publisher =    pub-PH,
  address =      pub-PH:adr,
  year =         "1992",
  ISBN =         "0-13-590472-2",
  ISBN-13 =      "978-0-13-590472-5",
  LCCN =         "QA76.8.M52 K37 1992",
  bibdate =      "Wed Dec 15 10:35:45 1993",

  author =       "Dominic Sweetman",
  title =        "See {MIPS} run",
  publisher =    pub-MORGAN-KAUFMANN,
  address =      pub-MORGAN-KAUFMANN:adr,
  pages =        "xviii + 488",
  year =         "1999",
  ISBN =         "1-55860-410-3",
  ISBN-13 =      "978-1-55860-410-0",
  LCCN =         "QA76.9.A73 S88 1999",
  bibdate =      "Thu Jun 20 10:21:55 2002",
  price =        "US\$52.95, UK\pounds 35.95",
  acknowledgement = ack-nhfb,
  keywords =     "MIPS (Computer architecture); RISC microprocessors;
                 Embedded computer systems --- Programming",
  libnote =      "Not yet in my library.",

and these manuals:


- Nelson H. F. Beebe                    Tel: +1 801 581 5254
- University of Utah                    FAX: +1 801 581 4148
- Department of Mathematics, 110 LCB    Internet e-mail:
beebe@math.utah.edu  -
- 155 S 1400 E RM 233                       beebe@acm.org
beebe@computer.org -
- Salt Lake City, UT 84112-0090, USA    URL:
http://www.math.utah.edu/~beebe  -

More information about the Gcc-help mailing list