Re: x86-64 and calling conventions

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Thu, 29 May 2008 13:56:05 -0800

          From comp.compilers

Related articles
[10 earlier articles]
Re: x86-64 and calling conventions james.harris.1@googlemail.com (James Harris) (2008-05-14)
Re: x86-64 and calling conventions cr88192@hotmail.com (cr88192) (2008-05-15)
Re: x86-64 and calling conventions cr88192@hotmail.com (cr88192) (2008-05-15)
Re: x86-64 and calling conventions bc@freeuk.com (Bart) (2008-05-14)
Re: x86-64 and calling conventions cr88192@hotmail.com (cr88192) (2008-05-15)
Re: x86-64 and calling conventions bolek-compilers@curl.com (Boleslaw Ciesielski) (2008-05-23)
Re: x86-64 and calling conventions gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-05-29)
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Thu, 29 May 2008 13:56:05 -0800
Organization: Compilers Central
References: 08-05-031 08-05-043 08-05-048 08-05-085
Keywords: architecture
Posted-Date: 30 May 2008 00:01:52 EDT

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



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.