X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fana%2Fcallgraph.c;h=dac267e3afc5ac5e8d4d8b30745d31054f90d42e;hb=afbbc0b1ccd684c4c24bfd43d0f994123245f39f;hp=b03a0f0000b996b11b66343f5cd2d66ff75d3ea5;hpb=86e761ab84e9d929821dd977f6395cb21b89cde1;p=libfirm diff --git a/ir/ana/callgraph.c b/ir/ana/callgraph.c index b03a0f000..dac267e3a 100644 --- a/ir/ana/callgraph.c +++ b/ir/ana/callgraph.c @@ -386,32 +386,23 @@ static void do_walk(ir_graph *irg, callgraph_walk_func *pre, callgraph_walk_func post(irg, env); } -void callgraph_walk(ir_entity **roots, unsigned n_roots, - callgraph_walk_func *pre, callgraph_walk_func *post, void *env) { - //int i, n_irgs = get_irp_n_irgs(); - unsigned r; +void callgraph_walk(callgraph_walk_func *pre, callgraph_walk_func *post, void *env) { + int i, n_irgs = get_irp_n_irgs(); ++master_cg_visited; - for (r = 0; r < n_roots; ++r) { - ir_graph *irg = get_entity_irg(roots[r]); - if (irg == NULL) - continue; - - do_walk(irg, pre, post, env); - } - -#if 0 - for (i = 0; i < n_irgs; i++) { + /* roots are methods which have no callers in the current program */ + for (i = 0; i < n_irgs; ++i) { ir_graph *irg = get_irp_irg(i); - if (!cg_irg_visited(irg) && get_irg_n_callers(irg) == 0) + + if (get_irg_n_callers(irg) == 0) do_walk(irg, pre, post, env); } + + /* in case of unreachable call loops we haven't visited some irgs yet */ for (i = 0; i < n_irgs; i++) { ir_graph *irg = get_irp_irg(i); - if (!cg_irg_visited(irg)) - do_walk(irg, pre, post, env); + do_walk(irg, pre, post, env); } -#endif } /* ----------------------------------------------------------------------------------- */