This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Internal Representation
- From: Ian Lance Taylor <iant at google dot com>
- To: Nicolas COLLIN <nicolas dot collin at fr dot thalesgroup dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 09 Jul 2009 11:06:25 -0700
- Subject: Re: Internal Representation
- References: <4A559517.6000105@fr.thalesgroup.com>
Nicolas COLLIN <nicolas.collin@fr.thalesgroup.com> writes:
>> From internal representation. I got the body with DECL_SAVED_TREE
>> and I
> succeed to get the name of functions and methods called from
> CALL_EXPR, using TREE_OPERAND, EXPR_STMT_EXPR, etc... But I can't get
> the object on which is called the method (for example in att.getX(); i
> would like to get the name :"att"). I tried in many ways but never got
> it.
There need not be any such name (f().getX()), or for a given call there
may be more than one such name (f ? a.getX() : b.getX() with the method
call factored out by the optimizers). Assuming you are working in SSA
form, and assuming you have an SSA_VAR, the best you can do is look back
to the defining statement to see if you can find a VAR_DECL there.
Ian