Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!texsun!convex!mozart.convex.com!gargulak From: gargulak@mozart.convex.com (Tom Gargulak) Newsgroups: comp.std.c Subject: MIPS varargs (Was Re: Reality check) Message-ID: <108077@convex.convex.com> Date: 1 Nov 90 22:18:17 GMT References: <1061@dg.dg.com> <1171@dms.UUCP> <14199@smoke.BRL.MIL> Sender: usenet@convex.com Reply-To: gargulak@mozart.convex.com (Tom Gargulak) Organization: Convex Computer Corporation, Richardson, Texas Lines: 30 In article , meissner@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