var_args for rs6000 backend

Yao Qi qi qiyaobit@hotmail.com
Wed Sep 7 11:11:00 GMT 2005


>From: Ian Lance Taylor <ian@airs.com>
>To: "Yao qi" <qiyaobit@hotmail.com>
>CC: gcc@gcc.gnu.org
>Subject: Re: var_args for rs6000 backend
>Date: 06 Sep 2005 11:05:38 -0700
>
>"Yao qi" <qiyaobit@hotmail.com> writes:
>
>
>These are partially documented in gcc/doc/tm.texi.  Unfortunately the
>documentation is not particularly good.
>
>These functions are all oriented around C stdarg.h functions.  In
>brief, setup_incoming_varargs is called for a function which takes a
>variable number of arguments, and does any required preparation
>statements.  build_builtin_va_list builds the va_list data type.
>va_start is called to implement the va_start macro.  gimplify_va_arg
>is called to implement the va_arg macro.
>
Thanks for your detailed explanation, from which I got a general image  of
these routines.  I think the setup_incoming_varargs is the starting point of 
these
routines and I start my work from this function.
I divided setup_incoming_varargs() to *three* parts logically on the 
condation
that default ABI is ABI_V4,  If I make some mistakes here, feel free to tell 
me.

1 Deal with all the named arguments.
2 Calculate the number of GPR needed and generate RTX for copying GPR to 
MEM.
3 Generate RTX for copying FPR to MEM.

I met some problems when I go on further, so I want to display the symptoms 
here
before I continue my question.

New data types were added into GCC as well as new modes.   Argument passing 
and
return value works well, but when I pass  arguments of these new types of 
variable length,
and return a certain arguments in parameters list, the value is incorrect on 
PowerPC, but
works well on x86.  So I think it has something to do with PowerPC backend.

Now, the most difficult thing for me is error location.  I do not which part 
of PowerPC backend caused this problem.  I dumped the test case in RTL form 
with option -dr and in assembly form, but both of them are not informative 
enough to expose the error.

This "bug" may be relative to argument passing, stack alloction, new modes 
and register allocation, but I do not know how to get enought information 
about these fields.  Could anybody give me some suggestions about 
information collection for them?

I am lack of experience in gcc development, any comments about it are highly 
appreicate.
> > I do not know what is the precondation if I want to do it?  May I need
> > to  know the architecture of PowerPC and ABI for it?
>
>You do indeed need to know the PowerPC ABIs to understand what these
>routines are doing and why.
Got it , thanks for your advice here.
>
>Ian


Best Regards
----------------
Yao Qi
Bejing Institute of Technology

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



More information about the Gcc mailing list