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 */
* 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;
}
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);
{ (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" },