MIPS varargs (Was Re: Reality check)

Tom Gargulak gargulak at mozart.convex.com
Fri Nov 2 09:18:17 AEST 1990


In article <MEISSNER.90Oct22135944 at osf.osf.org>, meissner at osf.org
(Michael Meissner) writes:
> With the MIPS standard calling sequence (also used in DECstations, and
> Silicon Graphics systems), there is one case that is impossible with
> varargs, but can be handled with stdarg.  If the first argument is
> floating point, the MIPS calling sequence passes the number in a
> floating point register, otherwise it passes the first argument in
> integer registers.  If the second argument was floating point and the
> first one was as well, it too is passed in a floating point register,
> otherwise it is passed in an integer register.  The varargs stuff only
> works for arguments passed in integer registers.  Because varargs
> functions don't tell the compiler anything in terms of a prototype,
> the compiler doesn't have a clue that it should really pass the
> floating point arguments in an integer register.

So what does an MIPS ANSI-C compiler do in the case when the first two
args are doubles?  Does it store the floating point registers on the
stack?  I have not used an ANSI-C MIPS compiler.

BTW: I know this is getting off the subject, but... I was amazed to find
out that the MIPS compiler has different codegen when it sees "va_alist"
in the parameter list in order to implement varargs. 

For example, the following two functions will have different codegen.
	test(Xa_alist) {}
	test(va_alist) {}
No include files required.


-Tom 



More information about the Comp.std.c mailing list