Related articles |
---|
x86-64 and calling conventions cr88192@hotmail.com (cr88192) (2008-05-12) |
Re: x86-64 and calling conventions cr88192@hotmail.com (cr88192) (2008-05-12) |
Re: x86-64 and calling conventions james.harris.1@googlemail.com (James Harris) (2008-05-12) |
Re: x86-64 and calling conventions vidar.hokstad@gmail.com (Vidar Hokstad) (2008-05-12) |
Re: x86-64 and calling conventions daveparker@flamingthunder.com (Dave Parker) (2008-05-12) |
Re: x86-64 and calling conventions cr88192@hotmail.com (cr88192) (2008-05-13) |
Re: x86-64 and calling conventions cr88192@hotmail.com (cr88192) (2008-05-13) |
Re: x86-64 and calling conventions gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-05-13) |
Re: x86-64 and calling conventions james.harris.1@googlemail.com (James Harris) (2008-05-14) |
Re: x86-64 and calling conventions vidar.hokstad@gmail.com (Vidar Hokstad) (2008-05-14) |
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) |
[3 later articles] |
From: | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
Newsgroups: | comp.compilers |
Date: | Tue, 13 May 2008 01:28:57 -0800 |
Organization: | Compilers Central |
References: | 08-05-031 08-05-043 |
Keywords: | architecture, design |
Posted-Date: | 14 May 2008 11:55:53 EDT |
Dave Parker wrote:
(snip)
> The calling convention is left-to-right (since I was making my own
> calling convention, I figured I might as well fix the old right-to-
> left holdover and use the stack the way the stack should be used ---
> left-to-right). Left-to-right means the arguments are evaluated in
> the order that users expect them to be. If the function is vararg,
> then I push the argument count on the stack last.
That doesn't sound very convenient. I have known for a while now that
ANSI C requires varargs routines to be declared as such so that a
different calling convention could be used.
So far, I haven't known any that actually did that, though.
If you always push the length, one could use it to find the address of
the first argument, and then subsequent arguments.
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.
-- glen
Return to the
comp.compilers page.
Search the
comp.compilers archives again.