From e5dfea5d277d85af4a9edc2ea60c9080bab61555 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20W=C3=BCrdig?= Date: Mon, 10 Apr 2006 09:23:35 +0000 Subject: [PATCH] fixed indents [r7610] --- ir/stat/stat_dmp.c | 675 +++++++++++++++++++++++---------------------- 1 file changed, 340 insertions(+), 335 deletions(-) diff --git a/ir/stat/stat_dmp.c b/ir/stat/stat_dmp.c index c5d804a62..d0608c886 100644 --- a/ir/stat/stat_dmp.c +++ b/ir/stat/stat_dmp.c @@ -90,12 +90,12 @@ static const struct { }; static const char *if_conv_names[IF_RESULT_LAST] = { - "if conv done ", - "if conv side effect ", - "if conv Phi node found ", - "if conv to deep DAG's ", - "if conv bad control flow ", - "if conv denied by arch ", + "if conv done ", + "if conv side effect ", + "if conv Phi node found ", + "if conv to deep DAG's ", + "if conv bad control flow ", + "if conv denied by arch ", }; /** @@ -103,29 +103,29 @@ static const char *if_conv_names[IF_RESULT_LAST] = { */ static void simple_dump_opcode_hash(dumper_t *dmp, pset *set) { - node_entry_t *entry; - counter_t f_alive; - counter_t f_new_node; - counter_t f_Id; - - cnt_clr(&f_alive); - cnt_clr(&f_new_node); - cnt_clr(&f_Id); - - fprintf(dmp->f, "%-16s %-8s %-8s %-8s\n", "Opcode", "alive", "created", "->Id"); - for (entry = pset_first(set); entry; entry = pset_next(set)) { - fprintf(dmp->f, "%-16s %8u %8u %8u\n", - get_id_str(entry->op->name), entry->cnt_alive.cnt[0], entry->new_node.cnt[0], entry->into_Id.cnt[0]); - - cnt_add(&f_alive, &entry->cnt_alive); - cnt_add(&f_new_node, &entry->new_node); - cnt_add(&f_Id, &entry->into_Id); - } - fprintf(dmp->f, "-------------------------------------------\n"); - fprintf(dmp->f, "%-16s %8u %8u %8u\n", "Sum", - f_alive.cnt[0], - f_new_node.cnt[0], - f_Id.cnt[0]); + node_entry_t *entry; + counter_t f_alive; + counter_t f_new_node; + counter_t f_Id; + + cnt_clr(&f_alive); + cnt_clr(&f_new_node); + cnt_clr(&f_Id); + + fprintf(dmp->f, "%-16s %-8s %-8s %-8s\n", "Opcode", "alive", "created", "->Id"); + for (entry = pset_first(set); entry; entry = pset_next(set)) { + fprintf(dmp->f, "%-16s %8u %8u %8u\n", + get_id_str(entry->op->name), entry->cnt_alive.cnt[0], entry->new_node.cnt[0], entry->into_Id.cnt[0]); + + cnt_add(&f_alive, &entry->cnt_alive); + cnt_add(&f_new_node, &entry->new_node); + cnt_add(&f_Id, &entry->into_Id); + } + fprintf(dmp->f, "-------------------------------------------\n"); + fprintf(dmp->f, "%-16s %8u %8u %8u\n", "Sum", + f_alive.cnt[0], + f_new_node.cnt[0], + f_Id.cnt[0]); } /** @@ -133,94 +133,98 @@ static void simple_dump_opcode_hash(dumper_t *dmp, pset *set) */ static void simple_dump_opt_hash(dumper_t *dmp, pset *set, int index) { - opt_entry_t *entry = pset_first(set); - - assert(index < ARR_SIZE(opt_names) && "index out of range"); - assert(opt_names[index].kind == index && "opt_names broken"); - if (entry) { - fprintf(dmp->f, "\n%s:\n", opt_names[index].name); - fprintf(dmp->f, "%-16s %-8s\n", "Opcode", "deref"); - - for (; entry; entry = pset_next(set)) { - fprintf(dmp->f, "%-16s %8u\n", - get_id_str(entry->op->name), entry->count.cnt[0]); - } - } + opt_entry_t *entry = pset_first(set); + + assert(index < ARR_SIZE(opt_names) && "index out of range"); + assert(opt_names[index].kind == index && "opt_names broken"); + if (entry) { + fprintf(dmp->f, "\n%s:\n", opt_names[index].name); + fprintf(dmp->f, "%-16s %-8s\n", "Opcode", "deref"); + + for (; entry; entry = pset_next(set)) { + fprintf(dmp->f, "%-16s %8u\n", + get_id_str(entry->op->name), entry->count.cnt[0]); + } + } } /** * 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 reg pressure information available */ - if (! b_entry) - return; - - /* print table head (register classes) */ - fprintf(dmp->f, "\nREG PRESSURE:\n"); - fprintf(dmp->f, "%12s", "Block Nr"); - for (rp_entry = pset_first(b_entry->reg_pressure); - rp_entry; - rp_entry = pset_next(b_entry->reg_pressure)) - { - fprintf(dmp->f, "%15s", get_id_str(rp_entry->id_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); + be_block_entry_t *b_entry = pset_first(entry->be_block_hash); + reg_pressure_entry_t *rp_entry; + + /* return if no reg pressure information available */ + if (! b_entry) + return; + + fprintf(dmp->f, "\nREG PRESSURE:\n"); + fprintf(dmp->f, "%12s", "Block Nr"); + + /* print table head (register class names) */ for (rp_entry = pset_first(b_entry->reg_pressure); rp_entry; - rp_entry = pset_next(b_entry->reg_pressure)) + rp_entry = pset_next(b_entry->reg_pressure)) { - fprintf(dmp->f, "%15d", rp_entry->pressure); + fprintf(dmp->f, "%15s", get_id_str(rp_entry->id_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); + + for (rp_entry = pset_first(b_entry->reg_pressure); + rp_entry; + rp_entry = pset_next(b_entry->reg_pressure)) + { + fprintf(dmp->f, "%15d", rp_entry->pressure); + } + fprintf(dmp->f, "\n"); } - fprintf(dmp->f, "\n"); - } } /** prints a distribution entry */ void dump_block_sched_ready_distrib(const distrib_entry_t *entry, void *env) { - FILE *dmp_f = env; - fprintf(dmp_f, "%12d", entry->cnt.cnt[0]); + FILE *dmp_f = env; + fprintf(dmp_f, "%12d", entry->cnt.cnt[0]); } /** * 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) { - be_block_entry_t *b_entry = pset_first(entry->be_block_hash); - counter_t cnt_0; - int i; - - /* return if no reg pressure information available */ - if (! b_entry) - return; - - cnt_clr(&cnt_0); - - 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", "mean value"); - for (/* b_entry is already initialized */ ; - b_entry; - b_entry = pset_next(entry->be_block_hash)) - { - /* this ensures that all keys from 1 to 5 are in the table*/ - for (i = 1; i < 6; i++) - stat_add_int_distrib_tbl(b_entry->sched_ready, i, &cnt_0); - - fprintf(dmp->f, "BLK %6ld", b_entry->block_nr); - stat_iterate_distrib_tbl(b_entry->sched_ready, dump_block_sched_ready_distrib, dmp->f); - fprintf(dmp->f, "%12.2lf", stat_calc_mean_distrib_tbl(b_entry->sched_ready)); - fprintf(dmp->f, "\n"); - } + be_block_entry_t *b_entry = pset_first(entry->be_block_hash); + counter_t cnt_0; + int i; + + /* return if no reg pressure information available */ + if (! b_entry) + return; + + cnt_clr(&cnt_0); + + 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"); + + for (/* b_entry is already initialized */ ; + b_entry; + b_entry = pset_next(entry->be_block_hash)) + { + /* this ensures that all keys from 1 to 5 are in the table*/ + for (i = 1; i < 6; i++) + stat_add_int_distrib_tbl(b_entry->sched_ready, i, &cnt_0); + + fprintf(dmp->f, "BLK %6ld", b_entry->block_nr); + stat_iterate_distrib_tbl(b_entry->sched_ready, dump_block_sched_ready_distrib, dmp->f); + fprintf(dmp->f, "%12.2lf", stat_calc_avg_distrib_tbl(b_entry->sched_ready)); + fprintf(dmp->f, "\n"); + } } /** @@ -228,14 +232,13 @@ static void simple_dump_be_block_sched_ready(dumper_t *dmp, graph_entry_t *entry */ 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->cnt[0]); - } + 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->cnt[0]); + } } /** @@ -243,13 +246,13 @@ static void simple_dump_real_func_calls(dumper_t *dmp, counter_t *cnt) */ static void simple_dump_tail_recursion(dumper_t *dmp, unsigned num_tail_recursion) { - if (! dmp->f) - return; + 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 (num_tail_recursion > 0) { + fprintf(dmp->f, "\nTail recursion optimized:\n"); + fprintf(dmp->f, "%-16s %8u\n", "Call", num_tail_recursion); + } } /** @@ -257,10 +260,10 @@ static void simple_dump_tail_recursion(dumper_t *dmp, unsigned num_tail_recursio */ static void simple_dump_edges(dumper_t *dmp, counter_t *cnt) { - if (! dmp->f) - return; + if (! dmp->f) + return; - fprintf(dmp->f, "%-16s %8d\n", "Edges", cnt->cnt[0]); + fprintf(dmp->f, "%-16s %8d\n", "Edges", cnt->cnt[0]); } /** @@ -268,114 +271,116 @@ static void simple_dump_edges(dumper_t *dmp, counter_t *cnt) */ static void simple_dump_graph(dumper_t *dmp, graph_entry_t *entry) { - int i, dump_opts = 1; - block_entry_t *b_entry; - extbb_entry_t *eb_entry; - - if (! dmp->f) - return; - - if (entry->irg) { - ir_graph *const_irg = get_const_code_irg(); - - if (entry->irg == const_irg) { - fprintf(dmp->f, "\nConst code Irg %p", (void *)entry->irg); - } - else { - if (entry->ent) - fprintf(dmp->f, "\nEntity %s, Irg %p", get_entity_ld_name(entry->ent), (void *)entry->irg); - else - fprintf(dmp->f, "\nIrg %p", (void *)entry->irg); - } - - fprintf(dmp->f, " %swalked %u over blocks %u:\n" - " was inlined : %u\n" - " got inlined : %u\n" - " strength red : %u\n" - " leaf function : %s\n" - " calls only leaf functions : %s\n" - " recursive : %s\n" - " chain call : %s\n" - " calls : %u\n" - " indirect calls : %u\n", - entry->is_deleted ? "DELETED " : "", - entry->cnt_walked.cnt[0], entry->cnt_walked_blocks.cnt[0], - entry->cnt_was_inlined.cnt[0], - entry->cnt_got_inlined.cnt[0], - entry->cnt_strength_red.cnt[0], - entry->is_leaf ? "YES" : "NO", - entry->is_leaf_call == LCS_NON_LEAF_CALL ? "NO" : (entry->is_leaf_call == LCS_LEAF_CALL ? "Yes" : "Maybe"), - entry->is_recursive ? "YES" : "NO", - entry->is_chain_call ? "YES" : "NO", - entry->cnt_all_calls.cnt[0], - entry->cnt_indirect_calls.cnt[0] - ); - - for (i = 0; i < sizeof(entry->cnt_if_conv)/sizeof(entry->cnt_if_conv[0]); ++i) { - fprintf(dmp->f, " %s : %u\n", if_conv_names[i], entry->cnt_if_conv[i].cnt[0]); - } - - } - else { - fprintf(dmp->f, "\nGlobals counts:\n"); - fprintf(dmp->f, "--------------\n"); - dump_opts = 0; - } - - simple_dump_opcode_hash(dmp, entry->opcode_hash); - simple_dump_edges(dmp, &entry->cnt_edges); - - /* effects of optimizations */ - if (dump_opts) { - int i; - - simple_dump_real_func_calls(dmp, &entry->cnt_real_func_call); - simple_dump_tail_recursion(dmp, entry->num_tail_recursion); - - for (i = 0; i < sizeof(entry->opt_hash)/sizeof(entry->opt_hash[0]); ++i) { - simple_dump_opt_hash(dmp, entry->opt_hash[i], i); - } - - /* dump block info */ - fprintf(dmp->f, "\n%12s %12s %12s %12s %12s %12s %12s\n", "Block Nr", "Nodes", "intern E", "incoming E", "outgoing E", "Phi", "quot"); - for (b_entry = pset_first(entry->block_hash); - b_entry; - b_entry = pset_next(entry->block_hash)) { - fprintf(dmp->f, "BLK %6ld %12u %12u %12u %12u %12u %4.8f\n", - b_entry->block_nr, - b_entry->cnt_nodes.cnt[0], - b_entry->cnt_edges.cnt[0], - b_entry->cnt_in_edges.cnt[0], - b_entry->cnt_out_edges.cnt[0], - b_entry->cnt_phi_data.cnt[0], - (double)b_entry->cnt_edges.cnt[0] / (double)b_entry->cnt_nodes.cnt[0] - ); - } - - /* dump block reg pressure */ - simple_dump_be_block_reg_pressure(dmp, entry); - - /* dump block ready nodes distribution */ - simple_dump_be_block_sched_ready(dmp, entry); - - if (dmp->status->stat_options & FIRMSTAT_COUNT_EXTBB) { - /* dump extended block info */ - fprintf(dmp->f, "\n%12s %12s %12s %12s %12s %12s %12s\n", "Extbb Nr", "Nodes", "intern E", "incoming E", "outgoing E", "Phi", "quot"); - for (eb_entry = pset_first(entry->extbb_hash); - eb_entry; - eb_entry = pset_next(entry->extbb_hash)) { - fprintf(dmp->f, "ExtBB %6ld %12u %12u %12u %12u %12u %4.8f\n", - eb_entry->block_nr, - eb_entry->cnt_nodes.cnt[0], - eb_entry->cnt_edges.cnt[0], - eb_entry->cnt_in_edges.cnt[0], - eb_entry->cnt_out_edges.cnt[0], - eb_entry->cnt_phi_data.cnt[0], - (double)eb_entry->cnt_edges.cnt[0] / (double)eb_entry->cnt_nodes.cnt[0] - ); - } - } - } + int i, dump_opts = 1; + block_entry_t *b_entry; + extbb_entry_t *eb_entry; + + if (! dmp->f) + return; + + if (entry->irg) { + ir_graph *const_irg = get_const_code_irg(); + + if (entry->irg == const_irg) { + fprintf(dmp->f, "\nConst code Irg %p", (void *)entry->irg); + } + else { + if (entry->ent) + fprintf(dmp->f, "\nEntity %s, Irg %p", get_entity_ld_name(entry->ent), (void *)entry->irg); + else + fprintf(dmp->f, "\nIrg %p", (void *)entry->irg); + } + + fprintf(dmp->f, " %swalked %u over blocks %u:\n" + " was inlined : %u\n" + " got inlined : %u\n" + " strength red : %u\n" + " leaf function : %s\n" + " calls only leaf functions : %s\n" + " recursive : %s\n" + " chain call : %s\n" + " calls : %u\n" + " indirect calls : %u\n", + entry->is_deleted ? "DELETED " : "", + entry->cnt_walked.cnt[0], entry->cnt_walked_blocks.cnt[0], + entry->cnt_was_inlined.cnt[0], + entry->cnt_got_inlined.cnt[0], + entry->cnt_strength_red.cnt[0], + entry->is_leaf ? "YES" : "NO", + entry->is_leaf_call == LCS_NON_LEAF_CALL ? "NO" : (entry->is_leaf_call == LCS_LEAF_CALL ? "Yes" : "Maybe"), + entry->is_recursive ? "YES" : "NO", + entry->is_chain_call ? "YES" : "NO", + entry->cnt_all_calls.cnt[0], + entry->cnt_indirect_calls.cnt[0] + ); + + for (i = 0; i < sizeof(entry->cnt_if_conv)/sizeof(entry->cnt_if_conv[0]); ++i) { + fprintf(dmp->f, " %s : %u\n", if_conv_names[i], entry->cnt_if_conv[i].cnt[0]); + } + + } + else { + fprintf(dmp->f, "\nGlobals counts:\n"); + fprintf(dmp->f, "--------------\n"); + dump_opts = 0; + } + + simple_dump_opcode_hash(dmp, entry->opcode_hash); + simple_dump_edges(dmp, &entry->cnt_edges); + + /* effects of optimizations */ + if (dump_opts) { + int i; + + simple_dump_real_func_calls(dmp, &entry->cnt_real_func_call); + simple_dump_tail_recursion(dmp, entry->num_tail_recursion); + + for (i = 0; i < sizeof(entry->opt_hash)/sizeof(entry->opt_hash[0]); ++i) { + simple_dump_opt_hash(dmp, entry->opt_hash[i], i); + } + + /* dump block info */ + fprintf(dmp->f, "\n%12s %12s %12s %12s %12s %12s %12s\n", "Block Nr", "Nodes", "intern E", "incoming E", "outgoing E", "Phi", "quot"); + for (b_entry = pset_first(entry->block_hash); + b_entry; + b_entry = pset_next(entry->block_hash)) + { + fprintf(dmp->f, "BLK %6ld %12u %12u %12u %12u %12u %4.8f\n", + b_entry->block_nr, + b_entry->cnt_nodes.cnt[0], + b_entry->cnt_edges.cnt[0], + b_entry->cnt_in_edges.cnt[0], + b_entry->cnt_out_edges.cnt[0], + b_entry->cnt_phi_data.cnt[0], + (double)b_entry->cnt_edges.cnt[0] / (double)b_entry->cnt_nodes.cnt[0] + ); + } + + /* dump block reg pressure */ + simple_dump_be_block_reg_pressure(dmp, entry); + + /* dump block ready nodes distribution */ + simple_dump_be_block_sched_ready(dmp, entry); + + if (dmp->status->stat_options & FIRMSTAT_COUNT_EXTBB) { + /* dump extended block info */ + fprintf(dmp->f, "\n%12s %12s %12s %12s %12s %12s %12s\n", "Extbb Nr", "Nodes", "intern E", "incoming E", "outgoing E", "Phi", "quot"); + for (eb_entry = pset_first(entry->extbb_hash); + eb_entry; + eb_entry = pset_next(entry->extbb_hash)) + { + fprintf(dmp->f, "ExtBB %6ld %12u %12u %12u %12u %12u %4.8f\n", + eb_entry->block_nr, + eb_entry->cnt_nodes.cnt[0], + eb_entry->cnt_edges.cnt[0], + eb_entry->cnt_in_edges.cnt[0], + eb_entry->cnt_out_edges.cnt[0], + eb_entry->cnt_phi_data.cnt[0], + (double)eb_entry->cnt_edges.cnt[0] / (double)eb_entry->cnt_nodes.cnt[0] + ); + } + } + } } /** @@ -383,39 +388,39 @@ static void simple_dump_graph(dumper_t *dmp, graph_entry_t *entry) */ static void simple_dump_const_tbl(dumper_t *dmp, const constant_info_t *tbl) { - int i; - counter_t sum; + int i; + counter_t sum; - if (! dmp->f) - return; + if (! dmp->f) + return; - cnt_clr(&sum); + cnt_clr(&sum); - fprintf(dmp->f, "\nConstant Information:\n"); - fprintf(dmp->f, "---------------------\n"); + fprintf(dmp->f, "\nConstant Information:\n"); + fprintf(dmp->f, "---------------------\n"); - fprintf(dmp->f, "\nBit usage for integer constants\n"); - fprintf(dmp->f, "-------------------------------\n"); + fprintf(dmp->f, "\nBit usage for integer constants\n"); + fprintf(dmp->f, "-------------------------------\n"); - for (i = 0; i < ARR_SIZE(tbl->int_bits_count); ++i) { - fprintf(dmp->f, "%5d %12u\n", i + 1, tbl->int_bits_count[i].cnt[0]); - cnt_add(&sum, &tbl->int_bits_count[i]); - } - fprintf(dmp->f, "-------------------------------\n"); + for (i = 0; i < ARR_SIZE(tbl->int_bits_count); ++i) { + fprintf(dmp->f, "%5d %12u\n", i + 1, tbl->int_bits_count[i].cnt[0]); + cnt_add(&sum, &tbl->int_bits_count[i]); + } + fprintf(dmp->f, "-------------------------------\n"); - fprintf(dmp->f, "\nFloating point constants classification\n"); - fprintf(dmp->f, "--------------------------------------\n"); - for (i = 0; i < ARR_SIZE(tbl->floats); ++i) { - fprintf(dmp->f, "%-10s %12u\n", stat_fc_name(i), tbl->floats[i].cnt[0]); - cnt_add(&sum, &tbl->floats[i]); - } - fprintf(dmp->f, "--------------------------------------\n"); + fprintf(dmp->f, "\nFloating point constants classification\n"); + fprintf(dmp->f, "--------------------------------------\n"); + for (i = 0; i < ARR_SIZE(tbl->floats); ++i) { + fprintf(dmp->f, "%-10s %12u\n", stat_fc_name(i), tbl->floats[i].cnt[0]); + cnt_add(&sum, &tbl->floats[i]); + } + fprintf(dmp->f, "--------------------------------------\n"); - fprintf(dmp->f, "other %12u\n", tbl->others.cnt[0]); - cnt_add(&sum, &tbl->others); - fprintf(dmp->f, "-------------------------------\n"); + fprintf(dmp->f, "other %12u\n", tbl->others.cnt[0]); + cnt_add(&sum, &tbl->others); + fprintf(dmp->f, "-------------------------------\n"); - fprintf(dmp->f, "sum %12u\n", sum.cnt[0]); + fprintf(dmp->f, "sum %12u\n", sum.cnt[0]); } /** @@ -423,13 +428,13 @@ static void simple_dump_const_tbl(dumper_t *dmp, const constant_info_t *tbl) */ static void simple_init(dumper_t *dmp, const char *name) { - char fname[2048]; + char fname[2048]; - snprintf(fname, sizeof(fname), "%s.txt", name); - dmp->f = fopen(fname, "w"); - if (! dmp->f) { - perror(fname); - } + snprintf(fname, sizeof(fname), "%s.txt", name); + dmp->f = fopen(fname, "w"); + if (! dmp->f) { + perror(fname); + } } /** @@ -437,22 +442,22 @@ static void simple_init(dumper_t *dmp, const char *name) */ static void simple_finish(dumper_t *dmp) { - if (dmp->f) - fclose(dmp->f); - dmp->f = NULL; + if (dmp->f) + fclose(dmp->f); + dmp->f = NULL; } /** * the simple human readable dumper */ const dumper_t simple_dumper = { - simple_dump_graph, - simple_dump_const_tbl, - simple_init, - simple_finish, - NULL, - NULL, - NULL, + simple_dump_graph, + simple_dump_const_tbl, + simple_init, + simple_finish, + NULL, + NULL, + NULL, }; /* ---------------------------------------------------------------------- */ @@ -467,30 +472,30 @@ const dumper_t simple_dumper = { */ static void csv_count_nodes(dumper_t *dmp, graph_entry_t *graph, counter_t cnt[]) { - node_entry_t *entry; - int i; - - for (i = 0; i < 4; ++i) - cnt_clr(&cnt[i]); - - for (entry = pset_first(graph->opcode_hash); entry; entry = pset_next(graph->opcode_hash)) { - if (entry->op == op_Phi) { - /* normal Phi */ - cnt_add(&cnt[1], &entry->cnt_alive); - } - else if (entry->op == dmp->status->op_PhiM) { - /* memory Phi */ - cnt_add(&cnt[2], &entry->cnt_alive); - } - else if (entry->op == op_Proj) { - /* Proj */ - cnt_add(&cnt[3], &entry->cnt_alive); - } - else { - /* all other nodes */ - cnt_add(&cnt[0], &entry->cnt_alive); - } - } + node_entry_t *entry; + int i; + + for (i = 0; i < 4; ++i) + cnt_clr(&cnt[i]); + + for (entry = pset_first(graph->opcode_hash); entry; entry = pset_next(graph->opcode_hash)) { + if (entry->op == op_Phi) { + /* normal Phi */ + cnt_add(&cnt[1], &entry->cnt_alive); + } + else if (entry->op == dmp->status->op_PhiM) { + /* memory Phi */ + cnt_add(&cnt[2], &entry->cnt_alive); + } + else if (entry->op == op_Proj) { + /* Proj */ + cnt_add(&cnt[3], &entry->cnt_alive); + } + else { + /* all other nodes */ + cnt_add(&cnt[0], &entry->cnt_alive); + } + } } /** @@ -498,37 +503,37 @@ static void csv_count_nodes(dumper_t *dmp, graph_entry_t *graph, counter_t cnt[] */ static void csv_dump_graph(dumper_t *dmp, graph_entry_t *entry) { - const char *name; - counter_t cnt[4]; - - if (! dmp->f) - return; - - if (entry->irg && !entry->is_deleted) { - ir_graph *const_irg = get_const_code_irg(); - - if (entry->irg == const_irg) { - name = ""; - return; - } - else { - if (entry->ent) - name = get_entity_name(entry->ent); - else - name = ""; - } - - csv_count_nodes(dmp, entry, cnt); - - fprintf(dmp->f, "%-40s, %p, %d, %d, %d, %d\n", - name, - (void *)entry->irg, - cnt[0].cnt[0], - cnt[1].cnt[0], - cnt[2].cnt[0], - cnt[3].cnt[0] - ); - } + const char *name; + counter_t cnt[4]; + + if (! dmp->f) + return; + + if (entry->irg && !entry->is_deleted) { + ir_graph *const_irg = get_const_code_irg(); + + if (entry->irg == const_irg) { + name = ""; + return; + } + else { + if (entry->ent) + name = get_entity_name(entry->ent); + else + name = ""; + } + + csv_count_nodes(dmp, entry, cnt); + + fprintf(dmp->f, "%-40s, %p, %d, %d, %d, %d\n", + name, + (void *)entry->irg, + cnt[0].cnt[0], + cnt[1].cnt[0], + cnt[2].cnt[0], + cnt[3].cnt[0] + ); + } } /** @@ -536,7 +541,7 @@ static void csv_dump_graph(dumper_t *dmp, graph_entry_t *entry) */ static void csv_dump_const_tbl(dumper_t *dmp, const constant_info_t *tbl) { - /* FIXME: NYI */ + /* FIXME: NYI */ } /** @@ -544,13 +549,13 @@ static void csv_dump_const_tbl(dumper_t *dmp, const constant_info_t *tbl) */ static void csv_init(dumper_t *dmp, const char *name) { - char fname[2048]; + char fname[2048]; - snprintf(fname, sizeof(fname), "%s.csv", name); - dmp->f = fopen(fname, "a"); - if (! dmp->f) { - perror(fname); - } + snprintf(fname, sizeof(fname), "%s.csv", name); + dmp->f = fopen(fname, "a"); + if (! dmp->f) { + perror(fname); + } } /** @@ -558,20 +563,20 @@ static void csv_init(dumper_t *dmp, const char *name) */ static void csv_finish(dumper_t *dmp) { - if (dmp->f) - fclose(dmp->f); - dmp->f = NULL; + if (dmp->f) + fclose(dmp->f); + dmp->f = NULL; } /** * the simple human readable dumper */ const dumper_t csv_dumper = { - csv_dump_graph, - csv_dump_const_tbl, - csv_init, - csv_finish, - NULL, - NULL, - NULL, + csv_dump_graph, + csv_dump_const_tbl, + csv_init, + csv_finish, + NULL, + NULL, + NULL, }; -- 2.20.1