* Internal Representation
@ 2009-07-09 6:58 Nicolas COLLIN
2009-07-09 18:06 ` Ian Lance Taylor
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas COLLIN @ 2009-07-09 6:58 UTC (permalink / raw)
To: gcc
Hello,
my purpose is to write informations about a function by reading its body
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.
Can you help me ?
Thank you.
Nicolas COLLIN
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Internal Representation
2009-07-09 6:58 Internal Representation Nicolas COLLIN
@ 2009-07-09 18:06 ` Ian Lance Taylor
0 siblings, 0 replies; 5+ messages in thread
From: Ian Lance Taylor @ 2009-07-09 18:06 UTC (permalink / raw)
To: Nicolas COLLIN; +Cc: gcc
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Internal Representation
2009-07-07 11:26 Nicolas COLLIN
@ 2009-07-07 13:28 ` Ian Lance Taylor
2009-07-07 13:28 ` Daniel Berlin
1 sibling, 0 replies; 5+ messages in thread
From: Ian Lance Taylor @ 2009-07-07 13:28 UTC (permalink / raw)
To: Nicolas COLLIN; +Cc: gcc
Nicolas COLLIN <nicolas.collin@fr.thalesgroup.com> writes:
> I looked at the part of the documentation about function bodies and I
> wonder something : is there a way to get the function calls from it ?
> Because I'd like to make a call graph which represent function and the
> functions it calls.
gcc builds a call graph. See cgraph.h.
Ian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Internal Representation
2009-07-07 11:26 Nicolas COLLIN
2009-07-07 13:28 ` Ian Lance Taylor
@ 2009-07-07 13:28 ` Daniel Berlin
1 sibling, 0 replies; 5+ messages in thread
From: Daniel Berlin @ 2009-07-07 13:28 UTC (permalink / raw)
To: Nicolas COLLIN; +Cc: gcc
You must be looking at old documentation or something.
Call's are represented by GIMPLE_CALL_STMT (or CALL_EXPR in older GCC'en).
There has been a callgraph for quite a long time (see cgraph*.c and cgraph*.h)
On Tue, Jul 7, 2009 at 7:26 AM, Nicolas
COLLIN<nicolas.collin@fr.thalesgroup.com> wrote:
> Hello,
> I looked at the part of the documentation about function bodies and I wonder
> something : is there a way to get the function calls from it ? Because I'd
> like to make a call graph which represent function and the functions it
> calls.
> Thank you.
>
> Nicolas COLLIN
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Internal Representation
@ 2009-07-07 11:26 Nicolas COLLIN
2009-07-07 13:28 ` Ian Lance Taylor
2009-07-07 13:28 ` Daniel Berlin
0 siblings, 2 replies; 5+ messages in thread
From: Nicolas COLLIN @ 2009-07-07 11:26 UTC (permalink / raw)
To: gcc
Hello,
I looked at the part of the documentation about function bodies and I
wonder something : is there a way to get the function calls from it ?
Because I'd like to make a call graph which represent function and the
functions it calls.
Thank you.
Nicolas COLLIN
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-07-09 18:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-09 6:58 Internal Representation Nicolas COLLIN
2009-07-09 18:06 ` Ian Lance Taylor
-- strict thread matches above, loose matches on Subject: below --
2009-07-07 11:26 Nicolas COLLIN
2009-07-07 13:28 ` Ian Lance Taylor
2009-07-07 13:28 ` Daniel Berlin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).