From 0088e938ea995a92ef1e61c87bd836e188da6bd5 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sun, 4 Nov 2012 17:22:53 +0100 Subject: [PATCH] Correct name: OP(OP(x)) = x is involution, not idempotence. --- include/libfirm/firmstat.h | 2 +- ir/ir/iropt.c | 10 ++++------ ir/stat/stat_dmp.c | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/libfirm/firmstat.h b/include/libfirm/firmstat.h index 65ad21131..c52edb10c 100644 --- a/include/libfirm/firmstat.h +++ b/include/libfirm/firmstat.h @@ -95,7 +95,7 @@ enum firmstat_optimizations_t { FS_OPT_MUX_TO_MIN, /**< Mux(a < b, a, b) = Min(a,b) */ FS_OPT_MUX_TO_MAX, /**< Mux(a > b, a, b) = Max(a,b) */ FS_OPT_MUX_TO_BITOP, /**< Mux((a & 2^x) ==/!= 0, 2^x, 0) = (a & 2^x) (xor 2^x) */ - FS_OPT_IDEM_UNARY, /**< Idempotent unary operation */ + FS_OPT_INVOLUTION, /**< OP(OP(x)) = x */ FS_OPT_MINUS_NOT, /**< -(~x) = x + 1 */ FS_OPT_NOT_MINUS_1, /**< ~(x - 1) = -x */ FS_OPT_NOT_PLUS_1, /**< ~x + 1 = -x */ diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index c43ae4d4a..02c3a4bee 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -947,15 +947,13 @@ static ir_node *equivalent_node_Sub(ir_node *n) * We handle it anyway here but the better way would be a * flag. This would be needed for Pascal for instance. */ -static ir_node *equivalent_node_idempotent_unop(ir_node *n) +static ir_node *equivalent_node_involution(ir_node *n) { ir_node *oldn = n; ir_node *pred = get_unop_op(n); - - /* optimize symmetric unop */ if (get_irn_op(pred) == get_irn_op(n)) { n = get_unop_op(pred); - DBG_OPT_ALGSIM2(oldn, pred, n, FS_OPT_IDEM_UNARY); + DBG_OPT_ALGSIM2(oldn, pred, n, FS_OPT_INVOLUTION); } return n; } @@ -6358,10 +6356,10 @@ void ir_register_opt_node_ops(void) register_equivalent_node_func(op_Conv, equivalent_node_Conv); register_equivalent_node_func(op_Eor, equivalent_node_Eor); register_equivalent_node_func(op_Id, equivalent_node_Id); - register_equivalent_node_func(op_Minus, equivalent_node_idempotent_unop); + register_equivalent_node_func(op_Minus, equivalent_node_involution); register_equivalent_node_func(op_Mul, equivalent_node_Mul); register_equivalent_node_func(op_Mux, equivalent_node_Mux); - register_equivalent_node_func(op_Not, equivalent_node_idempotent_unop); + register_equivalent_node_func(op_Not, equivalent_node_involution); register_equivalent_node_func(op_Or, equivalent_node_Or); register_equivalent_node_func(op_Phi, equivalent_node_Phi); register_equivalent_node_func(op_Proj, equivalent_node_Proj); diff --git a/ir/stat/stat_dmp.c b/ir/stat/stat_dmp.c index ab28727f3..a41df263e 100644 --- a/ir/stat/stat_dmp.c +++ b/ir/stat/stat_dmp.c @@ -114,7 +114,7 @@ static const struct { { (hook_opt_kind)FS_OPT_MUX_TO_MIN, "algebraic simplification: Mux(a < b, a, b) = Min(a,b)" }, { (hook_opt_kind)FS_OPT_MUX_TO_MAX, "algebraic simplification: Mux(a > b, a, b) = Max(a,b)" }, { (hook_opt_kind)FS_OPT_MUX_TO_BITOP, "algebraic simplification: Mux((a & 2^x) ==/!= 0, 2^x, 0) = (a & 2^x) (xor 2^x)" }, - { (hook_opt_kind)FS_OPT_IDEM_UNARY, "algebraic simplification: Idempotent unary operation" }, + { (hook_opt_kind)FS_OPT_INVOLUTION, "algebraic simplification: OP(OP(x)) = x" }, { (hook_opt_kind)FS_OPT_MINUS_NOT, "algebraic simplification: -(~x) = x + 1" }, { (hook_opt_kind)FS_OPT_NOT_MINUS_1, "algebraic simplification: ~(x - 1) = -x" }, { (hook_opt_kind)FS_OPT_NOT_PLUS_1, "algebraic simplification: ~x + 1 = -x" }, -- 2.20.1