- phase_key.phase = phase;
- phase_entry = pset_find_ptr(irg_entry->phases, &phase_key);
-
- if (! phase_entry) {
- phase_entry = obstack_alloc(&irg_entry->obst, sizeof(*phase_entry));
- phase_entry = pset_insert(irg_entry->phases, phase_entry, HASH_PTR(phase));
- }
- memset(phase_entry, 0, sizeof(*phase_entry));
-
- phase_entry->phase = phase;
- phase_entry->arch_env = irg_entry->arch_env;
-
- irg_walk_blkwise_graph(irg_entry->irg, NULL, do_nodes_stat, phase_entry);
-}
-
-/**
- * Dumps statistics about nodes (called from dump_snapshot)
- */
-static void be_dump_node_stat(dumper_t *dmp, graph_entry_t *entry) {
- be_stat_irg_t *stat_irg = find_stat_irg_entry(entry->irg);
- be_stat_phase_t *phase;
-
- if (! stat_irg || ! stat_irg->phases)
- return;
-
- fprintf(dmp->f, "===> BE NODE STATISTIC BEGIN <===\n");
-
- foreach_pset(stat_irg->phases, phase) {
- fprintf(dmp->f, "--> Phase: %s\n", phase->phase);
- fprintf(dmp->f, "# nodes: %ld\n", phase->num_nodes);
- fprintf(dmp->f, "# data nodes: %ld\n", phase->num_data);
- fprintf(dmp->f, "# Proj: %ld\n", phase->num_proj);
- fprintf(dmp->f, "# Phi: %ld\n", phase->num_phi);
- fprintf(dmp->f, "# Load: %ld\n", phase->num_load);
- fprintf(dmp->f, "# Store: %ld\n", phase->num_store);
- fprintf(dmp->f, "# Spill: %ld\n", phase->num_spill);
- fprintf(dmp->f, "# Reload: %ld\n", phase->num_reload);
- }
-
- fprintf(dmp->f, "===> BE NODE STATISTIC END <===\n");
-}
-
-/**
- * Returns a be statistic object for the given irg.
- */
-void be_stat_init_irg(const arch_env_t *arch_env, ir_graph *irg) {
- static int reg_func = 1;
-
- if (stat_is_active()) {
- be_stat_irg_t *stat_irg;
-
- if (! be_stat_data)
- be_stat_data = new_set(cmp_stat_data, 8);
-
- stat_irg = get_stat_irg_entry(irg);
- stat_irg->irg = irg;
- stat_irg->phases = new_pset(cmp_stat_phase, 8);
- stat_irg->arch_env = arch_env;
- obstack_init(&stat_irg->obst);
-
- if (reg_func) {
- /* first init: register dumper */
- stat_register_dumper_func(be_dump_node_stat);
- reg_func = 0;
- }
- }
-}
-#endif /* FIRM_STATISTICS */