/** * dumps a opcode hash into human readable form */ static void simple_dump_opcode_hash(dumper_t *dmp, pset *set) { counter_t f_alive; counter_t f_new_node; counter_t f_Id; counter_t f_normlized; cnt_clr(&f_alive); cnt_clr(&f_new_node); cnt_clr(&f_Id); cnt_clr(&f_normlized); fprintf(dmp->f, "%-16s %-8s %-8s %-8s %-8s\n", "Opcode", "alive", "created", "->Id", "normalized"); foreach_pset(set, node_entry_t, entry) { fprintf(dmp->f, "%-16s %8u %8u %8u %8u\n", get_id_str(entry->op->name), cnt_to_uint(&entry->cnt_alive), cnt_to_uint(&entry->new_node), cnt_to_uint(&entry->into_Id), cnt_to_uint(&entry->normalized) ); cnt_add(&f_alive, &entry->cnt_alive); cnt_add(&f_new_node, &entry->new_node); cnt_add(&f_Id, &entry->into_Id); cnt_add(&f_normlized, &entry->normalized); }
/** * Starts a new pattern. */ static void vcg_dump_new_pattern(pattern_dumper_t *self, counter_t *cnt) { vcg_private_t *priv = (vcg_private_t*)self->data; static unsigned nr = 0; if (priv->pattern_id > priv->max_pattern) return; fprintf(priv->f, " graph: { title: \"g%u\" label: \"pattern %u\" status:clustered color:yellow\n", priv->pattern_id, priv->pattern_id ); /* add a pseudo node for the count of this pattern */ fprintf(priv->f, " node: {title: \"c%u\" label: \"cnt: %u\" color:red }\n", ++nr, cnt_to_uint(cnt) ); }
fprintf(dmp->f, "%-16s %8u %8u %8u %8u\n", get_id_str(entry->op->name), cnt_to_uint(&entry->cnt_alive), cnt_to_uint(&entry->new_node), cnt_to_uint(&entry->into_Id), cnt_to_uint(&entry->normalized) ); cnt_add(&f_alive, &entry->cnt_alive); cnt_add(&f_new_node, &entry->new_node); cnt_add(&f_Id, &entry->into_Id); cnt_add(&f_normlized, &entry->normalized); } fprintf(dmp->f, "-------------------------------------------\n"); fprintf(dmp->f, "%-16s %8u %8u %8u %8u\n", "Sum", cnt_to_uint(&f_alive), cnt_to_uint(&f_new_node), cnt_to_uint(&f_Id), cnt_to_uint(&f_normlized) ); } /** * Return the name of an optimization. */ static const char *get_opt_name(int index) { assert(index < (int) ARRAY_SIZE(opt_names) && "index out of range"); assert((int) opt_names[index].kind == index && "opt_names broken"); return opt_names[index].name; }
/** * Starts a new pattern. */ static void stdout_dump_new_pattern(pattern_dumper_t *self, counter_t *cnt) { FILE *f = (FILE*)self->data; fprintf(f, "%8u ", cnt_to_uint(cnt)); }