calling conventions for MIPS 2000/3000

pjh@cs.unh.edu (Philip J. Hatcher)
Wed, 21 Aug 91 16:48:50 EDT

          From comp.compilers

Related articles
calling conventions for MIPS 2000/3000 pjh@cs.unh.edu (1991-08-21)
Re: calling conventions for MIPS 2000/3000 chenw@crhc.uiuc.edu (1991-08-23)
| List of all articles for this month |
Newsgroups: comp.sys.mips,comp.compilers
From: pjh@cs.unh.edu (Philip J. Hatcher)
Keywords: architecture, design, question
Organization: Compilers Central
Date: Wed, 21 Aug 91 16:48:50 EDT

Can someone provide me a cogent description of the C calling
conventions for the MIPS 2000/3000? I'm executing on DECstations and
DECsystems running Ultrix 4.x and using cc.


I have read Kane (particularly the section "Linkage Conventions" in
Appendix D), but don't think that all the details are spelled out.


In particular I am confused about the size of the "procedure call
argument area". I realize that I must allocate space here even though
arguments are being passed in registers. What I'm baffled about is
exactly how much space must be allocated here.


For example, for this simple C function,


void main()
{
                 float x;


                 x = 1.0;
                 printf("%e\n",x);
}


"cc -O" generates a frame of length 24 bytes. This apparently
includes 4 unused bytes at the "top" of the frame, 4 bytes for saving
r31, and 16 bytes for the arguments area. Why 16 bytes here? It looks
like only 12 bytes are needed, 4 for the char * first parameter and 8
for x converted to a double. But if only 12 bytes are allocated then
printf prints garbage.


Phil Hatcher
Dept. of Computer Science
Univ. of New Hampshire
Kingsbury Hall
Durham, NH 03824
603-862-2678
pjh@cs.unh.edu
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.