Re: Compiling an ellipsis

Zalman Stern <>
23 Nov 1999 00:40:49 -0500

          From comp.compilers

Related articles
Compiling an ellipsis (Guillaume Comeau) (1999-11-21)
Re: Compiling an ellipsis (Alan Donovan) (1999-11-23)
Re: Compiling an ellipsis (Zalman Stern) (1999-11-23)
Re: Compiling an ellipsis (James Jones) (1999-11-23)
| List of all articles for this month |

From: Zalman Stern <>
Newsgroups: comp.compilers
Date: 23 Nov 1999 00:40:49 -0500
Organization: MindSpring Enterprises
References: 99-11-129
Keywords: C, code

Guillaume Comeau <> wrote:
: Hence the question: are parameters in ellipsis forcefully on the
: operand stack, or can they be in internal registers as space allows?
: (in which I have some assembly work to do for each processor port).

Usually, the calling convention reserves space in the stack frame for
the parameters that are passed in registers. (Imprecisely, as many
bytes as the registers take up and contiguous with the paramters after
those passed in registers.) The compiler arranges that the first thing
a varags function does is to store all of the registers used for
parameter passing into the reserved slots in the stack frame. (I've
heard this called "homing" the parameters.") Then the variable
argument accessor routines can be implemented using macros that do
casts and pointer manipulation since all the arguments are now in a
contiguous block. (Except for padding of course, but most calling
conventions require that the padding can be deduced from only the size
of a type.)

The above ends up placing some requirements on the calling convention.
Mainly that all properties of the calling convention have to depend on
the size of items, not their precise type. Though games get played
even there to support floating-point argument passing in
registers. Ultimately, the compiler could take a different approach
for caling varargs and non-varags routines if there are prototypes in
scope. Most don't because lots of legacy code would break.


Post a followup to this message

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