From f80015e6ee059955c4068043ee13f5fe2a373255 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Thu, 30 Sep 2004 11:33:55 +0000 Subject: [PATCH] added statistics for strenght reduction [r4016] --- ir/stat/firmstat.c | 48 ++++++++++++++++++++++++++++++++++++++------ ir/stat/firmstat.h | 6 ++++++ ir/stat/firmstat_t.h | 1 + 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/ir/stat/firmstat.c b/ir/stat/firmstat.c index a4c9391c3..18d51d024 100644 --- a/ir/stat/firmstat.c +++ b/ir/stat/firmstat.c @@ -172,8 +172,9 @@ static void graph_clear_entry(graph_entry_t *elem) { cnt_clr(&elem->cnt_walked); cnt_clr(&elem->cnt_walked_blocks); - cnt_clr(&elem->cnt_got_inlined); cnt_clr(&elem->cnt_was_inlined); + cnt_clr(&elem->cnt_got_inlined); + cnt_clr(&elem->cnt_strength_red); cnt_clr(&elem->cnt_edges); } @@ -527,11 +528,12 @@ static void simple_dump_graph(dumper_t *dmp, graph_entry_t *entry) fprintf(dmp->f, "\nIrg %p", (void *)entry->irg); } - fprintf(dmp->f, " %swalked %d over blocks %d was inlined %d got inlined %d:\n", + fprintf(dmp->f, " %swalked %d over blocks %d was inlined %d got inlined %d strength red %d:\n", entry->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_got_inlined.cnt[0], + entry->cnt_strength_red.cnt[0] ); } else { @@ -646,7 +648,7 @@ static void csv_dump_graph(dumper_t *dmp, graph_entry_t *entry) counter_t cnt[4]; - if (entry->irg) { + if (entry->irg && !entry->deleted) { ir_graph *const_irg = get_const_code_irg(); if (entry->irg == const_irg) { @@ -872,7 +874,7 @@ void stat_free_graph(ir_graph *irg) count_nodes_in_graph(global, graph); /* count the DAG's */ - count_dags_in_graph(global, graph); +// count_dags_in_graph(global, graph); /* calculate the pattern */ stat_calc_pattern_history(irg); @@ -1002,6 +1004,36 @@ void stat_inline(ir_node *call, ir_graph *called_irg) STAT_LEAVE; } +/* + * A graph with tail-recursions was optimized. + */ +void stat_tail_rec(ir_graph *irg) +{ + if (! status->enable) + return; + + STAT_ENTER; + { + } + STAT_LEAVE; +} + +/* + * Strength reduction was performed on an iteration variable. + */ +void stat_strength_red(ir_graph *irg, ir_node *strong, ir_node *cmp) +{ + if (! status->enable) + return; + + STAT_ENTER; + { + graph_entry_t *graph = graph_get_entry(irg, status->irg_hash); + cnt_inc(&graph->cnt_strength_red); + } + STAT_LEAVE; +} + /* * Start the dead node elimination. */ @@ -1050,7 +1082,7 @@ void stat_finish(const char *name) count_nodes_in_graph(global, entry); /* count the DAG's */ - count_dags_in_graph(global, entry); +// count_dags_in_graph(global, entry); /* calculate the pattern */ stat_calc_pattern_history(entry->irg); @@ -1121,6 +1153,10 @@ void stat_lower(ir_node *node) {} void stat_inline(ir_node *call, ir_graph *irg) {} +void stat_tail_rec(ir_graph *irg) {} + +void stat_strength_red(ir_graph *irg, ir_node *strong, ir_node *cmp) {} + void stat_dead_node_elim_start(ir_graph *irg) {} void stat_dead_node_elim_stop(ir_graph *irg) {} diff --git a/ir/stat/firmstat.h b/ir/stat/firmstat.h index a8ce64b4d..d3faee1b9 100644 --- a/ir/stat/firmstat.h +++ b/ir/stat/firmstat.h @@ -127,6 +127,11 @@ void stat_inline(ir_node *call, ir_graph *irg); */ void stat_tail_rec(ir_graph *irg); +/** + * Strength reduction was performed on an iteration variable. + */ +void stat_strength_red(ir_graph *irg, ir_node *strong, ir_node *cmp); + /** * Start the dead node elimination. */ @@ -163,6 +168,7 @@ ir_op *stat_get_op_from_opcode(opcode code); #define stat_lower(node) #define stat_inline(call, irg) #define stat_tail_rec(irg) +#define stat_strength_red(irg, strong, cmp) #define stat_dead_node_elim_start(irg) #define stat_dead_node_elim_stop(irg) diff --git a/ir/stat/firmstat_t.h b/ir/stat/firmstat_t.h index 662d35f16..31afefd93 100644 --- a/ir/stat/firmstat_t.h +++ b/ir/stat/firmstat_t.h @@ -58,6 +58,7 @@ typedef struct _graph_entry_t { counter_t cnt_walked_blocks; /**< walker walked over the graph blocks */ counter_t cnt_was_inlined; /**< number of times other graph were inlined */ counter_t cnt_got_inlined; /**< number of times this graph was inlined */ + counter_t cnt_strength_red; /**< number of times strength reduction was successful on this graph */ counter_t cnt_edges; /**< number of DF edges in this graph */ HASH_MAP(opt_entry_t) *opt_hash[STAT_OPT_MAX]; /**< hash maps containing opcode counter for optimizations */ ir_graph *irg; /**< the graph of this object */ -- 2.20.1