-/**
- * Pass information about a cycle or chain in a perm to the statistic module.
- */
-void be_do_stat_permcycle(const char *class_name, ir_node *perm, ir_node *block, int is_chain, int n_elems, int n_ops) {
- stat_be_block_stat_permcycle(class_name, perm, block, is_chain, n_elems, n_ops);
+
+
+static void node_stat_walker(ir_node *irn, void *data)
+{
+ be_node_stats_t *const stats = data;
+
+ /* if the node is a normal phi */
+ if(is_Phi(irn)) {
+ if (get_irn_mode(irn) == mode_M) {
+ (*stats)[BE_STAT_MEM_PHIS]++;
+ } else {
+ (*stats)[BE_STAT_PHIS]++;
+ }
+ } else {
+ arch_irn_class_t classify = arch_irn_classify(irn);
+
+ if(classify & arch_irn_class_spill)
+ (*stats)[BE_STAT_SPILLS]++;
+ if(classify & arch_irn_class_reload)
+ (*stats)[BE_STAT_RELOADS]++;
+ if(classify & arch_irn_class_remat)
+ (*stats)[BE_STAT_REMATS]++;
+ if(classify & arch_irn_class_copy)
+ (*stats)[BE_STAT_COPIES]++;
+ if(classify & arch_irn_class_perm)
+ (*stats)[BE_STAT_PERMS]++;
+ }
+}
+
+void be_collect_node_stats(be_node_stats_t *new_stats, be_irg_t *birg)
+{
+ memset(new_stats, 0, sizeof(*new_stats));
+ irg_walk_graph(birg->irg, NULL, node_stat_walker, new_stats);