From f58b7b5e2031f5f76ab21cd398c04185b46fd727 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Wed, 23 Mar 2005 15:17:50 +0000 Subject: [PATCH] added Florians Sel(Sel(..)) counter [r5470] --- ir/stat/firmstat.c | 30 ++++++++++++++++++++++++++++++ ir/stat/firmstat.h | 1 + ir/stat/firmstat_t.h | 2 ++ 3 files changed, 33 insertions(+) diff --git a/ir/stat/firmstat.c b/ir/stat/firmstat.c index 0411455a6..3231f945f 100644 --- a/ir/stat/firmstat.c +++ b/ir/stat/firmstat.c @@ -62,6 +62,12 @@ static ir_op _op_DivModC; /** The memory Proj node. */ static ir_op _op_ProjM; +/** A Sel of a Sel */ +static ir_op _op_SelSel; + +/** A Sel of a Sel of a Sel */ +static ir_op _op_SelSelSel; + /* ---------------------------------------------------------------------------------- */ /** Marks the begin of a statistic (hook) function. */ @@ -369,6 +375,15 @@ static ir_op *stat_get_irn_op(ir_node *node) /* special case, a division/modulo by a const, count on extra counter */ op = status->op_DivModC ? status->op_DivModC : op; } + else if (op == op_Sel && get_irn_op(get_Sel_ptr(node)) == op_Sel) { + /* special case, a Sel of a Sel, count on extra counter */ + op = status->op_SelSel ? status->op_SelSel : op; + + if (get_irn_op(get_Sel_ptr(get_Sel_ptr(node))) == op_Sel) { + /* special case, a Sel of a Sel of a Sel, count on extra counter */ + op = status->op_SelSelSel ? status->op_SelSelSel : op; + } + } return op; } @@ -1552,6 +1567,21 @@ void init_stat(unsigned enable_options) status->op_DivModC = NULL; } + if (enable_options & FIRMSTAT_COUNT_SELS) { + _op_SelSel.code = get_next_ir_opcode(); + _op_SelSel.name = new_id_from_chars(X("Sel(Sel)")); + + _op_SelSelSel.code = get_next_ir_opcode(); + _op_SelSelSel.name = new_id_from_chars(X("Sel(Sel(Sel))")); + + status->op_SelSel = &_op_SelSel; + status->op_SelSelSel = &_op_SelSelSel; + } + else { + status->op_SelSel = NULL; + status->op_SelSelSel = NULL; + } + /* register the dumper */ stat_register_dumper(&simple_dumper); diff --git a/ir/stat/firmstat.h b/ir/stat/firmstat.h index 793ec0621..a30ef26ee 100644 --- a/ir/stat/firmstat.h +++ b/ir/stat/firmstat.h @@ -27,6 +27,7 @@ enum firmstat_options_t { FIRMSTAT_COUNT_STRONG_OP = 0x00000004, /**< if set, count Mul/Div/Mod/DivMod by constant */ FIRMSTAT_COUNT_DAG = 0x00000008, /**< if set, count DAG statistics */ FIRMSTAT_COUNT_DELETED = 0x00000010, /**< if set, count deleted graphs */ + FIRMSTAT_COUNT_SELS = 0x00000020, /**< if set, count Sel(Sel(..)) differently */ FIRMSTAT_CSV_OUTPUT = 0x10000000 /**< CSV output of some mini-statistic */ }; diff --git a/ir/stat/firmstat_t.h b/ir/stat/firmstat_t.h index 5f67de80a..2c515e384 100644 --- a/ir/stat/firmstat_t.h +++ b/ir/stat/firmstat_t.h @@ -166,6 +166,8 @@ typedef struct _statistic_info_t { ir_op *op_DivC; /**< pseudo op for division by const */ ir_op *op_ModC; /**< pseudo op for modulo by const */ ir_op *op_DivModC; /**< pseudo op for DivMod by const */ + ir_op *op_SelSel; /**< pseudo op for Sel(Sel) */ + ir_op *op_SelSelSel; /**< pseudo op for Sel(Sel(Sel)) */ dumper_t *dumper; /**< list of dumper */ int reassoc_run; /**< if set, reassociation is running */ int stat_options; /**< statistic options */ -- 2.20.1