- stat_ev_emit("average_register_pressure", average_pressure);
- stat_ev_emit("maximum_register_pressure", env.max_pressure);
-}
-
-/**
- * Notify statistic module about amount of ready nodes.
- */
-void be_do_stat_sched_ready(ir_node *block, const ir_nodeset_t *ready_set) {
- if (stat_is_active()) {
- stat_be_block_sched_ready(get_irn_irg(block), block, MIN(ir_nodeset_size(ready_set), 5));
- }
-}
-
-/**
- * Pass information about a perm to the statistic module.
- */
-void be_do_stat_perm(const char *class_name, int n_regs, ir_node *perm, ir_node *block, int n, int real_size) {
- if (stat_is_active()) {
- stat_be_block_stat_perm(class_name, n_regs, perm, block, n, real_size);
- }
-}
-
-/**
- * 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) {
- if (stat_is_active()) {
- stat_be_block_stat_permcycle(class_name, perm, block, is_chain, n_elems, n_ops);
- }
-}
-
-/**
- * Updates nodes statistics.
- */
-static void do_nodes_stat(ir_node *irn, void *env) {
- be_stat_phase_t *phase = env;
- ir_mode *mode;
- ir_opcode opc;
- arch_irn_class_t irn_class;
-
- if (is_Block(irn))
- return;
-
- mode = get_irn_mode(irn);
- opc = get_irn_opcode(irn);
-
- phase->num_nodes++;
-
- /* check for nodes we want to ignore */
- if (be_is_Keep(irn) ||
- be_is_CopyKeep(irn) ||
- opc == iro_Start ||
- opc == iro_End)
- return;
-
- if (is_Proj(irn) && (mode != mode_X)) {
- phase->num_proj++;
- return;
- }
- else if (is_Phi(irn)) {
- phase->num_phi++;
- return;
- }
- else if (mode_is_datab(mode) || ((mode == mode_T) && ! is_be_node(irn)) || (is_Proj(irn) && (mode == mode_X)))
- phase->num_data++;
-
- if (opc == iro_Load)
- phase->num_load++;
- else if (opc == iro_Store)
- phase->num_store++;
-
- irn_class = arch_irn_classify(phase->arch_env, irn);
- if (irn_class & arch_irn_class_spill)
- phase->num_spill++;
- else if (irn_class & arch_irn_class_reload)
- phase->num_reload++;
- else if (irn_class & arch_irn_class_stackparam)
- phase->num_load++;
- else if (irn_class & arch_irn_class_load)
- phase->num_load++;
- else if (irn_class & arch_irn_class_store)
- phase->num_store++;
-}
-
-/**
- * Collects node statistics.
- *
- * @param irg the to do statistics for
- * @param phase the phase to collect the statistic for
- */
-void be_do_stat_nodes(ir_graph *irg, const char *phase) {
- be_stat_irg_t *irg_entry;
- be_stat_phase_t *phase_entry, phase_key;
-
- irg_entry = find_stat_irg_entry(irg);
-
- if (! irg_entry)
- return;
-
- 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");