rfg@MCC.COM (Ron Guilmette) (05/19/89)
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. This gives rise to two questions. First, is the tm-sparc.h file just obeying existing conventions? Second, regardless of whether or not the tm-sparc.h file reflects the existing (Sun mandated) conventions, doesn't this seem wasteful? It seems that this would be especially wasteful whenever you had some function calls like: calculate_something (x1+y1, x2+y2); where the values of the parameters had to be calculated into the floating-point registers just before the call anyway. It there some secret reason that I don't know about which makes it inadvisable to pass floating-point parameters in floating-point registers? // Ron Guilmette - MCC - Experimental Systems Kit Project // 3500 West Balcones Center Drive, Austin, TX 78759 - (512)338-3740 // ARPA: rfg@mcc.com // UUCP: {rutgers,uunet,gatech,ames,pyramid}!cs.utexas.edu!pp!rfg
bothner@decwrl.dec.com (Per Bothner) (05/20/89)
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 <vararg.h> (or <stdarg.h>) 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
tiemann@YAHI.STANFORD.EDU (Michael Tiemann) (05/20/89)
I don't know the Sparc calling convention, but I suspect it is similar to the Misp R2000: [ ... description of how MIPS does not pass arguments ... ] Such a trick would not work if some parameters were passed in floating point registers. Indeed, such a trick would not work, but this is not how MIPS varags work. In fact, MIPS does have a complicated scheme so that floating point parameters *can* be passed in floating point registers. Michael
meissner@tiktok.dg.com (Michael Meissner) (05/23/89)
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. | | This gives rise to two questions. | | First, is the tm-sparc.h file just obeying existing | conventions? | | Second, regardless of whether or not the tm-sparc.h file | reflects the existing (Sun mandated) conventions, doesn't | this seem wasteful? It seems that this would be especially | wasteful whenever you had some function calls like: | | calculate_something (x1+y1, x2+y2); | | where the values of the parameters had to be calculated into | the floating-point registers just before the call anyway. | | It there some secret reason that I don't know about which | makes it inadvisable to pass floating-point parameters in | floating-point registers? I would suspect that 1) tm-sparc.h is following Sun's convention, and 2) it would make varargs harder, because you couldn't traverse a single linear list. I had to deal with this for the 88k, because some arguments are passed in registers, and some are passed in the shadow stack locations, but it required adding builtins and new syntax to get it work correctly. -- Michael Meissner, Data General. Uucp: ...!mcnc!rti!xyzzy!meissner If compiles were much Internet: meissner@dg-rtp.DG.COM faster, when would we Old Internet: meissner%dg-rtp.DG.COM@relay.cs.net have time for netnews?