On November 18, 2017 5:38:35 PM GMT+01:00, Katsunori Kumatani <katsunori.kumat...@gmail.com> wrote: >Hello, I'm doing some testing with a gcc plugin (also helped me >understand a lot of how GCC works) but I've hit a roadblock. > >I want to find all of a function body's CALL_EXPR nodes (i.e. what >calls it has) early during GENERIC, so I assume the >PLUGIN_PRE_GENERICIZE hook is what I should use right? > >Anyway, my problem is I don't know how to find all the CALL_EXPR nodes >from the DECL_SAVED_TREE of the function's decl. So what's the >simplest way to do that? The routines in tree-iterator.h don't help >much, they only iterate through a statement list. Do I have to go >through every expr manually? Is there no API available? (walk_tree >doesn't seem to handle it, or maybe I don't know how to use it)
Walk_tree should do it. Richard. > >This is obviously trivial to do in GIMPLE form (iterating through all >statements and finding GIMPLE_CALL) but I need it as early as >possible, so that would be in the tree representation (GENERIC?). I >hope I'm just missing something obvious. > >Thanks.