From a7748694f807d0bf908860a302bbef8f90ac40eb Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Mon, 4 Oct 2004 13:31:09 +0000 Subject: [PATCH] Added statistics hook for arch dependand opt [r4031] --- ir/ir/irarch.c | 7 +++++-- ir/stat/firmstat.c | 19 +++++++++++++++++++ ir/stat/firmstat.h | 7 +++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ir/ir/irarch.c b/ir/ir/irarch.c index 3e60f090b..818f72503 100644 --- a/ir/ir/irarch.c +++ b/ir/ir/irarch.c @@ -24,13 +24,13 @@ #include "firmstat.h" #include "ircons.h" #include "irarch.h" - +#include "firmstat.h" #undef DEB #define MAX_BITSTR 64 -/** The params got from the factopry in arch_dep_init(...). */ +/** The params got from the factory in arch_dep_init(...). */ static const arch_dep_params_t *params = NULL; /** The bit mask, which optimizations to apply. */ @@ -294,6 +294,9 @@ ir_node *arch_dep_replace_mul_with_shifts(ir_node *irn) } + if (res != irn) + stat_arch_dep_replace_mul_with_shifts(irn); + return res; } diff --git a/ir/stat/firmstat.c b/ir/stat/firmstat.c index 9368b583c..9ed5080dd 100644 --- a/ir/stat/firmstat.c +++ b/ir/stat/firmstat.c @@ -39,6 +39,7 @@ static const char *opt_names[] = { "ID optimization", "Constant evaluation", "Strength reduction", + "Architecture dependant optimization", "Lowered", }; @@ -1123,6 +1124,22 @@ void stat_dead_node_elim_stop(ir_graph *irg) --status->in_dead_node_elim; } +/* + * A multiply was replaced by a series of Shifts/Adds/Subs + */ +void stat_arch_dep_replace_mul_with_shifts(ir_node *mul) +{ + if (! status->enable) + return; + + STAT_ENTER; + { + graph_entry_t *graph = graph_get_entry(current_ir_graph, status->irg_hash); + removed_due_opt(mul, graph->opt_hash[STAT_OPT_ARCH_DEP]); + } + STAT_LEAVE; +} + /* Finish the statistics */ void stat_finish(const char *name) { @@ -1228,4 +1245,6 @@ void stat_dead_node_elim_start(ir_graph *irg) {} void stat_dead_node_elim_stop(ir_graph *irg) {} +void stat_arch_dep_replace_mul_with_shifts(ir_node *mul) {} + #endif diff --git a/ir/stat/firmstat.h b/ir/stat/firmstat.h index cb38f81a5..0cadf7e7c 100644 --- a/ir/stat/firmstat.h +++ b/ir/stat/firmstat.h @@ -50,6 +50,7 @@ typedef enum { STAT_OPT_ID, /**< ID optimization */ STAT_OPT_CONST_EVAL, /**< constant evaluation */ STAT_OPT_STRENGTH_RED, /**< strenght reduction */ + STAT_OPT_ARCH_DEP, /**< architecture dependant optimization */ STAT_LOWERED, /**< lowered */ STAT_OPT_MAX @@ -145,6 +146,11 @@ void stat_dead_node_elim_start(ir_graph *irg); */ void stat_dead_node_elim_stop(ir_graph *irg); +/** + * A multiply was replaced by a series of Shifts/Adds/Subs + */ +void stat_arch_dep_replace_mul_with_shifts(ir_node *mul); + /** * helper: get an ir_op from an opcode * @@ -174,6 +180,7 @@ ir_op *stat_get_op_from_opcode(opcode code); #define stat_strength_red(irg, strong, cmp) #define stat_dead_node_elim_start(irg) #define stat_dead_node_elim_stop(irg) +#define stat_arch_dep_replace_mul_with_shifts(irn) #endif -- 2.20.1