This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Re: help:how to get the Nth argument stmt from CALL_EXPR stmttree
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: alert7 <bugs at whitecell dot org>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 06 Jul 2005 11:40:12 -0400
- Subject: Re: Re: help:how to get the Nth argument stmt from CALL_EXPR stmttree
- References: <20050706233514.CBD982BAB7@mail.ddmdd.com>
On Wed, 2005-07-06 at 23:30 +0800, alert7 wrote:
> Daniel Berlin,æåï
>
> I'am gcc beginner,thank your answer .
>
> Is it the return Value of GetCallArgOperand function that u given stmt tree?
No.
>
> I pass return value--ops to function FOR_EACH_SSA_TREE_OPERAND
> FOR_EACH_SSA_TREE_OPERAND (use, ops, iter, SSA_OP_ALL_USES) {
>
> }
>
That won't work, because ops is not a statement tree.
> but ,at runtime ,FOR_EACH_SSA_TREE_OPERAND report internal compiler error: in stmt_ann, at tree-flow-inline.h:55 .
>
> what happen? Maybe there is another problem.how to fix it?
>
>
> Maybe My really problem is How to get stmt tree from a common tree value.
i'm not sure i understand.
do you want to get, given
a_5 = 69
foo(a_5)
the a_5 = 69 part?
Or a pointer a_5 inside the call to foo(..)
>
> ======= 2005-07-05 18:40:00 æåæääåéï=======
>
> >On Tue, 2005-07-05 at 23:18 +0800, alert7 wrote:
> >> hi,all
> >>
> >>
> >> I don't know how to get the Nth argument stmt from CALL_EXPR stmt tree?
> >
> >
> >assuming TREE_CODE (call) == CALL_EXPR:
> >
> >GetCallArgOperand(tree call, int i)
> >{
> > int j = 0;
> > tree arg;
> > for (arg = TREE_OPERAND (call, 1); arg; arg = TREE_CHAIN (arg), j++)
> > {
> > if (i == j)
> > return TREE_VALUE (arg);
> >
> > }
> >}
> >
> >>
> >> the GetCallArgOperands implement this function that i code ,but it isn't working :(
> >
> >You are looking at the arguments the declaration takes, instead of the
> >arguments passed to the function.
> >Arguments passed to the function are stored in TREE_OPERAND (call, 1),
> >as tree.def says.
> >
> >>
> >> thanks any advice or piece of example code .
> >>
> >> //////////////////////////////////////////////////////
> >>
> >> tree GetCallArgOperands(tree stmt ,int i){
> >> tree func, param, args;
> >> int j = 1;
> >>
> >>
> >> func = get_callee_fndecl (stmt);
> >>
> >> for (param = DECL_ARGUMENTS (func), args = TREE_OPERAND (stmt, 1);
> >> param && args;
> >> param = TREE_CHAIN (param), args = TREE_CHAIN (args))
> >> {
> >> tree arg = TREE_VALUE (args);
> >> if (param != arg)
> >> {
> >> // FIXME:
> >> }
> >> if (j==i)
> >> {
> >> fprintf(stderr,"args ----------\n");
> >> debug_tree(arg);
> >>
> >> return default_def (arg); //FIXME: to stmt tree ?
> >> }
> >>
> >> j++;
> >> }
> >> return NULL_TREE;
> >> }
> >> /////////////////////////////////////////////////
> >>
> >>
> >>
> >>
> >>
> >> ããããããããbugs
> >> ããããããããbugs@whitecell.org
> >> ãããããããããã2005-07-05
> >>
> >>
>
> = = = = = = = = = = = = = = = = = = = =
>
>
> ããããããããè
> çï
>
>
> ããããããããalert7
> ããããããããbugs@whitecell.org
> ãããããããããã2005-07-06
>
>
>