X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fir%2Firopt.c;h=2510e5f5bc58ea6ff184fb30c3212e1ce2880541;hb=68c75332d891023a982f164d8b642766824844a9;hp=3420e3415391ddc3cba72e1fe2d6d529cda6714a;hpb=3977737475ce98c71e45f363a053e47d5d1bb39d;p=libfirm diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 3420e3415..2510e5f5b 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -925,7 +925,7 @@ static ir_node *equivalent_node_left_zero(ir_node *n) { ir_node *a = get_binop_left(n); ir_node *b = get_binop_right(n); - if (tarval_is_null(value_of(b))) { + if (is_Const(b) && is_Const_null(b)) { n = a; DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_NEUTRAL_0); @@ -959,7 +959,7 @@ static ir_node *equivalent_node_Sub(ir_node *n) { b = get_Sub_right(n); /* Beware: modes might be different */ - if (tarval_is_null(value_of(b))) { + if (is_Const(b) && is_Const_null(b)) { ir_node *a = get_Sub_left(n); if (mode == get_irn_mode(a)) { n = a; @@ -1010,10 +1010,10 @@ static ir_node *equivalent_node_Mul(ir_node *n) { ir_node *b = get_Mul_right(n); /* Mul is commutative and has again an other neutral element. */ - if (tarval_is_one(value_of(a))) { + if (is_Const(a) && is_Const_one(a)) { n = b; DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_NEUTRAL_1); - } else if (tarval_is_one(value_of(b))) { + } else if (is_Const(b) && is_Const_one(b)) { n = a; DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_NEUTRAL_1); } @@ -1029,7 +1029,7 @@ static ir_node *equivalent_node_Div(ir_node *n) { ir_node *b = get_Div_right(n); /* Div is not commutative. */ - if (tarval_is_one(value_of(b))) { /* div(x, 1) == x */ + if (is_Const(b) && is_Const_one(b)) { /* div(x, 1) == x */ /* Turn Div into a tuple (mem, bad, a) */ ir_node *mem = get_Div_mem(n); ir_node *blk = get_irn_n(n, -1); @@ -1050,7 +1050,7 @@ static ir_node *equivalent_node_Quot(ir_node *n) { ir_node *b = get_Quot_right(n); /* Div is not commutative. */ - if (tarval_is_one(value_of(b))) { /* Quot(x, 1) == x */ + if (is_Const(b) && is_Const_one(b)) { /* Quot(x, 1) == x */ /* Turn Quot into a tuple (mem, jmp, bad, a) */ ir_node *mem = get_Quot_mem(n); ir_node *blk = get_irn_n(n, -1); @@ -1070,7 +1070,7 @@ static ir_node *equivalent_node_DivMod(ir_node *n) { ir_node *b = get_DivMod_right(n); /* Div is not commutative. */ - if (tarval_is_one(value_of(b))) { /* div(x, 1) == x */ + if (is_Const(b) && is_Const_one(b)) { /* div(x, 1) == x */ /* Turn DivMod into a tuple (mem, jmp, bad, a, 0) */ ir_node *a = get_DivMod_left(n); ir_node *mem = get_Div_mem(n); @@ -1099,10 +1099,10 @@ static ir_node *equivalent_node_Or(ir_node *n) { if (a == b) { n = a; /* Or has it's own neutral element */ DBG_OPT_ALGSIM0(oldn, n, FS_OPT_OR); - } else if (tarval_is_null(value_of(a))) { + } else if (is_Const(a) && is_Const_null(a)) { n = b; DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_OR); - } else if (tarval_is_null(value_of(b))) { + } else if (is_Const(b) && is_Const_null(b)) { n = a; DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_OR); } @@ -1124,12 +1124,12 @@ static ir_node *equivalent_node_And(ir_node *n) { DBG_OPT_ALGSIM0(oldn, n, FS_OPT_AND); return n; } - if (tarval_is_all_one(value_of(a))) { + if (is_Const(a) && is_Const_all_one(a)) { n = b; DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_AND); return n; } - if (tarval_is_all_one(value_of(b))) { + if (is_Const(b) && is_Const_all_one(b)) { n = a; DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_AND); return n; @@ -3050,14 +3050,14 @@ static ir_node *transform_node_Eor(ir_node *n) { } else if ((mode == mode_b) && (get_irn_op(a) == op_Proj) && (get_irn_mode(a) == mode_b) - && tarval_is_one(value_of(b)) + && is_Const(b) && is_Const_one(b) && (get_irn_op(get_Proj_pred(a)) == op_Cmp)) { /* The Eor negates a Cmp. The Cmp has the negated result anyways! */ n = new_r_Proj(current_ir_graph, get_irn_n(n, -1), get_Proj_pred(a), mode_b, get_negated_pnc(get_Proj_proj(a), mode)); DBG_OPT_ALGSIM0(oldn, n, FS_OPT_EOR_TO_NOT_BOOL); - } else if (mode == mode_b && tarval_is_one(value_of(b))) { + } else if (mode == mode_b && is_Const(b) && is_Const_one(b)) { /* The Eor is a Not. Replace it by a Not. */ /* ????!!!Extend to bitfield 1111111. */ n = new_r_Not(current_ir_graph, get_irn_n(n, -1), a, mode_b); @@ -3426,9 +3426,7 @@ static ir_node *transform_node_Proj_Cmp(ir_node *proj) { } /* TODO extend to arbitrary constants */ - if (is_Conv(left) && - is_Const(right) && - tarval_is_null(get_Const_tarval(right))) { + if (is_Conv(left) && is_Const(right) && is_Const_null(right)) { ir_mode* mode = get_irn_mode(left); ir_node* op = get_Conv_op(left); ir_mode* op_mode = get_irn_mode(op);