typo fixed
[libfirm] / ir / be / becopystat.c
index 52a5c5c..d788c01 100644 (file)
@@ -50,7 +50,8 @@ void copystat_reset(void) {
 /**
  * Collect general data
  */
-static void stat_walker(ir_node *node, void *env) {
+static void irg_stat_walker(ir_node *node, void *env) {
+       arch_env_t *arch_env = env;
        curr_vals[I_ALL_NODES]++; /* count all nodes */
 
        if (is_Block(node)) /* count all blocks */
@@ -59,10 +60,16 @@ static void stat_walker(ir_node *node, void *env) {
        if (is_Phi(node)) /* collect phis */
                pset_insert_ptr(all_phi_nodes, node);
 
-       if (is_Copy(node))
+       if (is_Copy(arch_env, node))
                pset_insert_ptr(all_copy_nodes, node);
 }
 
+void copystat_collect_irg(ir_graph *irg, arch_env_t *arch_env) {
+       irg_walk_graph(irg, irg_stat_walker, NULL, arch_env);
+       curr_vals[I_BLOCKS] -= 2; /* substract 2 for start and end block */
+       all_phi_classes = phi_class_compute_by_phis(all_phi_nodes);
+}
+
 /**
  * Collect phi node data
  */
@@ -166,12 +173,6 @@ static void stat_phi_class(be_chordal_env_t *chordal_env, pset *pc) {
        xfree(members);
 }
 
-void copystat_collect_irg(ir_graph *irg) {
-       irg_walk_graph(irg, stat_walker, NULL, NULL);
-       curr_vals[I_BLOCKS] -= 2; /* substract 2 for start and end block */
-       all_phi_classes = phi_class_compute_by_phis(all_phi_nodes);
-}
-
 #define is_curr_reg_class(irn) (arch_get_irn_reg_class(chordal_env->arch_env, irn, arch_pos_make_out(0)) == chordal_env->cls)
 
 void copystat_collect_cls(be_chordal_env_t *chordal_env) {
@@ -197,9 +198,10 @@ void copystat_collect_cls(be_chordal_env_t *chordal_env) {
 void copystat_dump(ir_graph *irg) {
        int i;
        char buf[1024];
+       FILE *out;
 
        snprintf(buf, sizeof(buf), "%s__%s", get_irp_prog_name(), get_entity_name(get_irg_entity(irg)));
-       FILE *out = ffopen(buf, "stat", "wt");
+       out = ffopen(buf, "stat", "wt");
 
        fprintf(out, "%s\n", get_irp_prog_name());
        for (i = 0; i < ASIZE; i++) {
@@ -217,9 +219,10 @@ void copystat_dump(ir_graph *irg) {
 void copystat_dump_pretty(ir_graph *irg) {
        int i;
        char buf[1024];
+       FILE *out;
 
        snprintf(buf, sizeof(buf), "%s__%s", get_irp_prog_name(), get_entity_name(get_irg_entity(irg)));
-       FILE *out = ffopen(buf, "pstat", "wt");
+       out = ffopen(buf, "pstat", "wt");
 
        fprintf(out, "Nodes     %4d\n", curr_vals[I_ALL_NODES]);
        fprintf(out, "Blocks    %4d\n", curr_vals[I_BLOCKS]);