X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeutil.c;h=bcf3c286d2816fdbe0aa3be321b5e94dd11d2a7d;hb=a7f5d1be44da38c242b89f3547dd4b48d511ab26;hp=18effda0f3ed7aafd89e5e03c74344df88fa7420;hpb=a2f828247f44de1a46f0baeecd0fbf81751e4777;p=libfirm diff --git a/ir/be/beutil.c b/ir/be/beutil.c index 18effda0f..bcf3c286d 100644 --- a/ir/be/beutil.c +++ b/ir/be/beutil.c @@ -1,3 +1,8 @@ +/** + * Contains some useful function for the backend. + * @author Sebastian Hack + * @cvsid $Id$ + */ #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -182,6 +187,7 @@ void be_dump(ir_graph *irg, const char *suffix, void (*dumper)(ir_graph *, const } snprintf(buf, sizeof(buf), "-%02d%s", nr++, suffix); + buf[sizeof(buf) - 1] = '\0'; dumper(irg, buf); } @@ -206,6 +212,17 @@ void be_collect_phis(ir_graph *irg) irg_walk_graph(irg, collect_phis, NULL, NULL); } +static void count_num_reachable_nodes(ir_node *irn, void *env) { + int *num = env; + (*num)++; +} + +unsigned get_num_reachable_nodes(ir_graph *irg) { + int num = 0; + irg_walk_graph(irg, count_num_reachable_nodes, NULL, &num); + return num; +} + /* FIXME: not used. can be deleted? */ ir_node *dom_up_search(pset *accept, ir_node *start_point_exclusive) { ir_node *irn, *idom;