Correct name: OP(OP(x)) = x is involution, not idempotence.
authorChristoph Mallon <christoph.mallon@gmx.de>
Sun, 4 Nov 2012 16:22:53 +0000 (17:22 +0100)
committerChristoph Mallon <christoph.mallon@gmx.de>
Sun, 4 Nov 2012 16:27:43 +0000 (17:27 +0100)
include/libfirm/firmstat.h
ir/ir/iropt.c
ir/stat/stat_dmp.c

index 65ad211..c52edb1 100644 (file)
@@ -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 */
index c43ae4d..02c3a4b 100644 (file)
@@ -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);
index ab28727..a41df26 100644 (file)
@@ -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" },