Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!shelby!apple!sun-barr!decwrl!bothner From: bothner@decwrl.dec.com (Per Bothner) Newsgroups: gnu.gcc Subject: Re: question on parm passing in regs Message-ID: <1433@bacchus.dec.com> Date: 19 May 89 17:56:04 GMT References: <8905182218.AA12401@riunite.aca.mcc.com> Distribution: gnu Organization: DEC Western Software Lab Lines: 34 In article <8905182218.AA12401@riunite.aca.mcc.com> rfg@MCC.COM (Ron Guilmette) writes: > >I have just noticed that the tm-sparc.h file allows for >function parameters to be passed via registers, but it >does *not* allow parameters (no matter what their type) >to be passed via the floating point registers. > >It there some secret reason that I don't know about which >makes it inadvisable to pass floating-point parameters in >floating-point registers? The problem that I can see has to do with functions that have non-fixed parameters list, such as printf. If you put different parameters in different places depending on their type, it becomes much more difficult to get (or ) working. These usually depend on a single pointer to a parameter area. That pointer is adjusted for each argument depending on its \size/ alone. I don't know the Sparc calling convention, but I suspect it is similar to the Misp R2000: The first N parameter words are passed in registers, and the remainder on the stack. When the compiler sees a parameter named "va_alist", it emits code to copy the registers onto the stack. (Gross, I know.) This makes the arguments contiguous on the stack, and one can use an ordinary pointer for the va_list. Such a trick would not work if some parameters were passed in floating point registers. -- --Per Bothner Western Software Lab, Digital Equipment, 100 Hamilton Ave, Palo Alto CA 94301 bothner@wsl.dec.com ...!decwrl!bothner