Boleslaw Ciesielski wrote:
(I wrote)
>>As far as passing arguments in registers, there is at least one
>>convention (possibly SPARC, but I am not sure now) where some are
>>passed in registers, but stack space is still reserved for them. The
>>called routine can then store them into the stack. As some number of
>>words are kept in the registers, in some cases a double variable will
>>be half in a register and half on the stack. Storing to the stack is
>>a convenient way to get the two back together again.
> This is the case for 32-bit PowerPC.
It seems the one I was remembering is SPARC. The LCC book, "A
Retargetable C compiler: Design and Implementation," describes code
generators for MIPS R3000, SPARC, and x86.
For SPARC, the first 24 bytes of arguments go in registers, even if a
double is split in half. Stack space is allocated for them, and also
16 words to store other registers if the register stack overflows.
Floating point values are passed in i registers, so have to be stored
anyway before they can be loaded into floating point registers. It
would have seemed more convenient to pass floating point values in
floating point registers, but that may not be compatible with C,
especially in the case of varargs.
-- glen


|