var_args for rs6000 backend

Yao qi qiyaobit@hotmail.com
Wed Sep 14 11:46:00 GMT 2005


Sorry for delayed reply.
>
>As I said, I haven't looked at the code in awhile (before GIMPLE), but
>the TREE code is the symbol table that allows you to look up the types
>of arguments and the function return type.
Yes, I think you ar right.  I found some other functionalities in
rs6000_gimplify_va_arg() of TREE, but I am not sure of it , could you have
a look at it and verify my thoughts to it.  Some code listed here for
your reference.

   5784       t = fold_convert (TREE_TYPE (reg), size_int (8 - n_reg + 1));
   5785       t = build2 (GE_EXPR, boolean_type_node, u, t);
   5786       u = build1 (GOTO_EXPR, void_type_node, lab_false);
   5787       t = build3 (COND_EXPR, void_type_node, t, u, NULL_TREE);
   5788       gimplify_and_add (t, pre_p);

I can not find any document to explain these routines and  just infer the
meaning literally.  When this slice of code executed, the structure of tree
is like this,
                    COND_EXPR
                     /            \
                    /              \
           GOTO_EXPR     GE_EXPR
Am I missing some thing?  Anyone could approve or deny this.  On the
presumption I am on right track, I do not know why compute
(8 - n_reg + 1) in compile-time and convert to TREE_TYPE (reg)?

>The RTX code are the
>instructions you produce for va_arg, etc.  For example, I believe the
>eabi/System V had a structure that had a few elements, one of which was
>the argument number, then there pointers to the save areas for gpr and
>fpr registers and the stack frame.  The va_arg code would have to
>produce code that tested the argument number, and if it was the first 8
>arguments it would use the pointer to the gpr/fpr save areas and if not
>it would use the stack pointer, and finally bump up the argument number.
Yes, I have got something in my mind about you have pointed out, but
there is another concept confused me, align.  For example,
   5820   t = ovf;
   5821   if (align != 1)
   5822     {
   5823       t = build2 (PLUS_EXPR, TREE_TYPE (t), t, size_int (align - 
1));
   5824       t = build2 (BIT_AND_EXPR, TREE_TYPE (t), t,
   5825                   build_int_cst (NULL_TREE, -align));
   5826     }
I do not know why align is relative to PLUS and BIT_AND, just for
alignment adjustment?
>
>I may be somewhat wrong on the details.  That is the trouble on working
>on quite a few different ports -- after awhile all of the details blend
>together.
>

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

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



More information about the Gcc mailing list