Re: compiling for mips environment

Zalman Stern <>
29 Jun 1999 02:59:27 -0400

          From comp.compilers

Related articles
compiling for mips environment (simon) (1999-06-27)
Re: compiling for mips environment (Zalman Stern) (1999-06-29)
Re: compiling for mips environment (James Jones) (1999-06-29)
Re: compiling for mips environment (Chris Dodd) (1999-06-29)
Re: compiling for mips environment (Matt Postiff) (1999-07-01)
Re: compiling for mips environment (Michael Meissner) (1999-07-11)
| List of all articles for this month |

From: Zalman Stern <>
Newsgroups: comp.compilers
Date: 29 Jun 1999 02:59:27 -0400
Organization: Netcom
References: 99-06-086
Keywords: architecture

simon <> wrote:
: It seems stack usage convention for mips in C environment dictate
: caller reserve space in stack for routine to save arguments a0..a3 if
: it needs to.

This is to support calling C routines that use stdarg (or vararg
historically) to access a variable size argument list. It is much
easier for the compiler point of view to have all the arguments at
contiguous addresses. So the stdarg callee can just save a0-a3 to the
four locations the caller left on the stack and then use the common
"bunch of macros" implementation for va_start and va_next.

Note that for non-stdarg routines, a0-a3 may never be saved to those
locations so the only cost is 16 bytes in the stack frame. There isn't
any execution overhead really.

The number of argument passing registers varies from calling
convention to calling convention. Most RISCs allow more than
4. (E.g. PowerPC uses 7 or 8, SPARC uses 8.)


Post a followup to this message

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