On Mon, Jan 11, 2010 at 8:39 PM, Paulo J. Matos <pocma...@gmail.com> wrote: > On Mon, 2010-01-11 at 17:51 +0100, Richard Guenther wrote: >> On Mon, Jan 11, 2010 at 4:46 PM, Paulo J. Matos <pocma...@gmail.com> wrote: >> > Hi all, >> > >> > I am using gcc 4.3.4 to loop through the gimple tree to find >> > CALL_EXPR. This is what I have (even though I tried several variants, >> > none of which worked): >> > tree body_stmt = DECL_SAVED_TREE (current_function_decl); >> > while (body_stmt) // >> > { >> > if (TREE_CODE (body_stmt) == CALL_EXPR) >> > { >> > printf("CALL_EXPR found in %s\n", >> > IDENTIFIER_POINTER(DECL_NAME(current_function_decl))); >> > } >> > >> > body_stmt = TREE_CHAIN (body_stmt); >> > } >> > >> > I have read in the internals doc about EXPR_STMT and EXPR_STMT_EXPR >> > but using them to access the expression through the statement and then >> > checking if the expressions is a CALL expression doesn't work either. >> > In fact, EXPR_STMT doesn't even seem to be defined. >> > >> > Any tips? >> >> statements are chained in STATEMENT_LIST nodes, you need to >> iterate through them using iterators - see tree-iterator.h. >> > > Thanks for the tip. I used the code found in > http://gcc.gnu.org/onlinedocs/gccint/Function-Bodies.html#Function-Bodies > > Why doesn't that apply?
Because it talks about trees as used by the C / C++ frontends and it is way out of date anyway. Richard. > Cheers, > > Paulo Matos > >> Richard. >> >> > -- >> > Paulo Jorge Matos - pocmatos at gmail.com >> > http://www.pmatos.net >> > > > >