Re: compiling for mips environment

Zalman Stern <zalman@netcom15.netcom.com>
29 Jun 1999 02:59:27 -0400

          From comp.compilers

Related articles
compiling for mips environment simon@gatecrashers.com (simon) (1999-06-27)
Re: compiling for mips environment zalman@netcom15.netcom.com (Zalman Stern) (1999-06-29)
Re: compiling for mips environment jejones@microware.com (James Jones) (1999-06-29)
Re: compiling for mips environment chrisd@reservoir.com (Chris Dodd) (1999-06-29)
Re: compiling for mips environment postiffm@umich.edu (Matt Postiff) (1999-07-01)
Re: compiling for mips environment meissner@cygnus.com (Michael Meissner) (1999-07-11)
| List of all articles for this month |

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

simon <simon@gatecrashers.com> 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.)


-Z-


Post a followup to this message

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