This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM: testsuite gcc.c-torture/execute/20020307-2.c failure


>>>>> Richard Earnshaw writes:

Richard> Where is 99 put?  Answer: it depends on the value of i.  If i < 3, then 99 
Richard> is placed in a register, otherwise it is on the stack.  For the register 
Richard> case even that can vary.

Richard> That makes compiling the call to foo very difficult, if not impossible.

Richard> It's even worse for passing d itself, part of it (sometimes all of it) is 
Richard> in registers, and the remainder of it (if there is any) is on the stack.  
Richard> How much stack space do we have to allocate...

	Passing the arguments in registers is difficult if one constructs
the arguments one at a time.  On AIX, at least, the registers are an image
of the beginning of the argument list on the stack.  When passing
arguments in registers, GCC can handle fixed-size arguments to varadic
functions and a fixed number of variable-sized arguments.  Also, passing
the variable-sized argument by reference requires that the argument be
constructed on the stack.

	I believe that GCC could handle variable-sized arguments to
varadic functions if it constructed the entire argument list on the stack
and then copied the memory image of the beginning of the argument list
into the argument registers.  GCC would perform a block load of all
argument registers, regardless the actual number of arguments  This is a
finite, well-defined operation and does not require that GCC construct the
actual register argument list piece by piece.

	I do not know if the ARM ABI calling convention allows for this
technique, and GCC currently does not support it, but it allows GCC to
generate the register arguments without knowing their size, thereby
supporting the GCC extension and conforming to the target calling
convention for passing structures.

David


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]