removed defines which are in irtools.h now
[libfirm] / ir / be / beutil.c
index 18effda..bcf3c28 100644 (file)
@@ -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;