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: [RFC]: Argument setup for sibcalls


> I haven't looked at Alan's bug report, but using FUNCTION_INCOMING_ARG is
> definitely the right thing for sibcalls.

This was a private communication.  He was working on some AIX ABI
issues.

> The whole idea behind argument setup for a sibcall is you overwrite the
> incoming arguments for the current function with the arguments for the
> sibcall because you're simply going to jump to the sibcall target.  You
> don't have outgoing arguments because you don't have an outgoing argument
> area.

Yes, I agree that you don't have an outgoing argument area.  You do
have the incoming argument area of the function plus possibly a set
of argument registers to use for a sibcall.  FUNCTION_INCOMING_ARG
and FUNCTION_ARG deal with argument registers, so I don't see what
this has to do with argument space on the stack.  

Simply overwriting the incoming arguments doesn't provide the correct
behavior.  This can fail in the PA case when sibcall is to a function
with a variable number of arguments (e.g., printf) and you try to pass
a float value.  Using FUNCTION_INCOMING_ARG, bypasses the special
situations where we pass an argument in both floating and general
registers.

In the PR case, we a function with a single double argument tries to
call fprintf as a sibcall.  The fprintf sibcall has two integer and
one float (double) arguments.  This is ok in terms of the incoming
argument space of the caller (we always have 16 bytes of incoming
argument space).  So, it's technically possible to do a sibcall to
fprintf if we can get the arguments in the right place.  However, we
are using more and different arg registers, so a simple mapping to
the incoming arguments of the original function isn't possible.

The definitions of CUMULATIVE_ARGS, INIT_CUMULATIVE_ARGS and
INIT_CUMULATIVE_INCOMING_ARGS could be hacked to allow determination
of an incoming argument.  However, before trying to fix the code
in function_arg, I wanted to check whether FUNCTION_INCOMING_ARG
is being used correctly in this situation.  It still seems to me
that the current usage assumes a model of register windows that's
not applicable to the PA.

Dave
-- 
J. David Anglin                                  dave dot anglin at nrc-cnrc dot gc dot ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)


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