+ fprintf(dmp->f, "\n%s:\n", opt_names[index].name);
+ fprintf(dmp->f, "%-16s %-8s\n", "Opcode", "deref");
+
+ foreach_pset(set, entry) {
+ fprintf(dmp->f, "%-16s %8u\n",
+ get_id_str(entry->op->name), cnt_to_uint(&entry->count));
+ } /* foreach_pset */
+ } /* if */
+} /* simple_dump_opt_hash */
+
+/**
+ * dumps the register pressure for each block and for each register class
+ */
+static void simple_dump_be_block_reg_pressure(dumper_t *dmp, graph_entry_t *entry)
+{
+ be_block_entry_t *b_entry = pset_first(entry->be_block_hash);
+ reg_pressure_entry_t *rp_entry;
+
+ /* return if no be statistic information available */
+ if (! b_entry)
+ return;
+
+ fprintf(dmp->f, "\nREG PRESSURE:\n");
+ fprintf(dmp->f, "%12s", "Block Nr");
+
+ /* print table head (register class names) */
+ foreach_pset(b_entry->reg_pressure, rp_entry)
+ fprintf(dmp->f, "%15s", rp_entry->class_name);
+ fprintf(dmp->f, "\n");
+
+ /* print the reg pressure for all blocks and register classes */
+ for (/* b_entry is already initialized */ ;
+ b_entry;
+ b_entry = pset_next(entry->be_block_hash)) {
+ fprintf(dmp->f, "BLK %6ld", b_entry->block_nr);
+
+ foreach_pset(b_entry->reg_pressure, rp_entry)
+ fprintf(dmp->f, "%15d", rp_entry->pressure);
+ fprintf(dmp->f, "\n");
+ } /* for */
+} /* simple_dump_be_block_reg_pressure */
+
+/** prints a distribution entry */
+static void simple_dump_distrib_entry(const distrib_entry_t *entry, void *env) {
+ FILE *dmp_f = env;
+ fprintf(dmp_f, "%12d", cnt_to_uint(&entry->cnt));
+} /* simple_dump_distrib_entry */
+
+/**
+ * dumps the distribution of the amount of ready nodes for each block
+ */
+static void simple_dump_be_block_sched_ready(dumper_t *dmp, graph_entry_t *entry)
+{
+ if (pset_count(entry->be_block_hash) > 0) {
+ be_block_entry_t *b_entry;
+ int i;
+
+ fprintf(dmp->f, "\nSCHEDULING: NUMBER OF READY NODES\n");
+ fprintf(dmp->f, "%12s %12s %12s %12s %12s %12s %12s\n",
+ "Block Nr", "1 node", "2 nodes", "3 nodes", "4 nodes", "5 or more", "AVERAGE");
+
+ foreach_pset(entry->be_block_hash, b_entry) {
+ /* this ensures that all keys from 1 to 5 are in the table */
+ for (i = 1; i < 6; ++i)
+ stat_insert_int_distrib_tbl(b_entry->sched_ready, i);
+
+ fprintf(dmp->f, "BLK %6ld", b_entry->block_nr);
+ stat_iterate_distrib_tbl(b_entry->sched_ready, simple_dump_distrib_entry, dmp->f);
+ fprintf(dmp->f, "%12.2lf", stat_calc_avg_distrib_tbl(b_entry->sched_ready));
+ fprintf(dmp->f, "\n");
+ } /* foreach_pset */
+ } /* if */
+} /* simple_dump_be_block_sched_ready */
+
+/**
+ * Adds the counter for given entry to another distribution table.
+ */
+static void add_distrib_entry(const distrib_entry_t *entry, void *env) {
+ distrib_tbl_t *sum_tbl = env;
+
+ stat_add_int_distrib_tbl(sum_tbl, (int)(entry->object), &entry->cnt);
+} /* add_distrib_entry */
+
+/**
+ * dumps permutation statistics for one and block and one class
+ */
+static void simple_dump_be_block_permstat_class(dumper_t *dmp, perm_class_entry_t *entry)
+{
+ perm_stat_entry_t *ps_ent;
+ distrib_tbl_t *sum_chains = stat_new_int_distrib_tbl();
+ distrib_tbl_t *sum_cycles = stat_new_int_distrib_tbl();
+ char buf[16];
+ int i;
+
+ fprintf(dmp->f, "%12s %12s %12s %12s %12s %12s\n",
+ "size",
+ "real size",
+ "# chains",
+ "# cycles",
+ "# copies",
+ "# exchanges"
+ );
+
+ foreach_pset(entry->perm_stat, ps_ent) {
+ fprintf(dmp->f, "%12d %12d %12d %12d %12d %12d\n",
+ ps_ent->size,
+ ps_ent->real_size,
+ stat_get_count_distrib_tbl(ps_ent->chains),
+ stat_get_count_distrib_tbl(ps_ent->cycles),
+ ps_ent->n_copies,
+ ps_ent->n_exchg
+ );
+
+ /* sum up distribution table for chains */
+ stat_iterate_distrib_tbl(ps_ent->chains, add_distrib_entry, sum_chains);
+
+ /* sum up distribution table for cycles */
+ stat_iterate_distrib_tbl(ps_ent->cycles, add_distrib_entry, sum_cycles);
+ } /* foreach_pset */
+
+ /* print chain distribution for all perms of this class in this block */
+ fprintf(dmp->f, "chain distribution:\n");
+
+ /* add all missing entries to chain distribution table */
+ for (i = 1; i <= entry->n_regs; i++) {
+ snprintf(buf, sizeof(buf), "length %d", i);
+ fprintf(dmp->f, "%12s", buf);
+ stat_insert_int_distrib_tbl(sum_chains, i);
+ } /* for */
+ fprintf(dmp->f, "\n");
+ stat_iterate_distrib_tbl(sum_chains, simple_dump_distrib_entry, dmp->f);
+ fprintf(dmp->f, "\n");
+
+ /* print cycle distribution for all perms of this class in this block */
+ fprintf(dmp->f, "cycle distribution:\n");
+
+ /* add all missing entries to cycle distribution table */
+ for (i = 1; i <= entry->n_regs; i++) {
+ snprintf(buf, sizeof(buf), "length %d", i);
+ fprintf(dmp->f, "%12s", buf);
+ stat_insert_int_distrib_tbl(sum_cycles, i);
+ } /* for */
+ fprintf(dmp->f, "\n");
+ stat_iterate_distrib_tbl(sum_cycles, simple_dump_distrib_entry, dmp->f);
+ fprintf(dmp->f, "\n");
+
+ /* delete temporary sum distribution tables */
+ stat_delete_distrib_tbl(sum_chains);
+ stat_delete_distrib_tbl(sum_cycles);
+
+} /* simple_dump_be_block_permstat_class */
+
+/**
+ * dumps statistics about perms
+ */
+static void simple_dump_be_block_permstat(dumper_t *dmp, graph_entry_t *entry)
+{
+ if (pset_count(entry->be_block_hash) > 0) {
+ be_block_entry_t *b_entry;
+
+ fprintf(dmp->f, "\nPERMUTATION STATISTICS BEGIN:\n");
+ foreach_pset(entry->be_block_hash, b_entry) {
+ perm_class_entry_t *pc_ent;
+
+ fprintf(dmp->f, "BLOCK %ld:\n", b_entry->block_nr);
+
+ if (b_entry->perm_class_stat) {
+ foreach_pset(b_entry->perm_class_stat, pc_ent) {
+ fprintf(dmp->f, "register class %s:\n", pc_ent->class_name);
+ simple_dump_be_block_permstat_class(dmp, pc_ent);
+ } /* foreach_pset */
+ } /* if */
+ } /* foreach_pset */
+
+ fprintf(dmp->f, "PERMUTATION STATISTICS END\n");
+ } /* if */
+} /* simple_dump_be_block_permstat */
+
+/**
+ * dumps the number of real_function_call optimization
+ */
+static void simple_dump_real_func_calls(dumper_t *dmp, counter_t *cnt)
+{
+ if (! dmp->f)
+ return;
+
+ if (! cnt_eq(cnt, 0)) {
+ fprintf(dmp->f, "\nReal Function Calls optimized:\n");
+ fprintf(dmp->f, "%-16s %8u\n", "Call", cnt_to_uint(cnt));
+ } /* if */
+} /* simple_dump_real_func_calls */
+
+/**
+ * dumps the number of tail_recursion optimization
+ */
+static void simple_dump_tail_recursion(dumper_t *dmp, unsigned num_tail_recursion)
+{
+ if (! dmp->f)
+ return;
+
+ if (num_tail_recursion > 0) {
+ fprintf(dmp->f, "\nTail recursion optimized:\n");
+ fprintf(dmp->f, "%-16s %8u\n", "Call", num_tail_recursion);
+ } /* if */
+} /* simple_dump_tail_recursion */