Commit f86e2456 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

ircons: Add and use new_{r,rd}_Const_null().

parent 033a7b6d
...@@ -489,7 +489,7 @@ static void insert_non_null(ir_node *ptr, ir_node *block, env_t *env) ...@@ -489,7 +489,7 @@ static void insert_non_null(ir_node *ptr, ir_node *block, env_t *env)
if (c == NULL) { if (c == NULL) {
ir_mode *mode = get_irn_mode(ptr); ir_mode *mode = get_irn_mode(ptr);
ir_graph *irg = get_irn_irg(block); ir_graph *irg = get_irn_irg(block);
c = new_r_Const(irg, get_mode_null(mode)); c = new_r_Const_null(irg, mode);
c = new_r_Confirm(block, ptr, c, ir_relation_less_greater); c = new_r_Confirm(block, ptr, c, ir_relation_less_greater);
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "irgmod.h" #include "irgmod.h"
#include "irop.h" #include "irop.h"
#include "irnode_t.h" #include "irnode_t.h"
#include "ircons.h" #include "ircons_t.h"
#include "irprog_t.h" #include "irprog_t.h"
#include "iroptimize.h" #include "iroptimize.h"
#include "lower_dw.h" #include "lower_dw.h"
...@@ -228,7 +228,7 @@ static void ia32_lower_conv64(ir_node *node, ir_mode *mode) ...@@ -228,7 +228,7 @@ static void ia32_lower_conv64(ir_node *node, ir_mode *mode)
/* create to Phis */ /* create to Phis */
ir_node *phi_in[] = { ir_node *phi_in[] = {
new_r_Const(irg, get_mode_null(mode)), new_r_Const_null(irg, mode),
new_r_Const_long(irg, mode, 0x80000000) new_r_Const_long(irg, mode, 0x80000000)
}; };
ir_node *int_phi ir_node *int_phi
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "irgwalk.h" #include "irgwalk.h"
#include "irprog.h" #include "irprog.h"
#include "ircons.h" #include "ircons_t.h"
#include "irgmod.h" #include "irgmod.h"
#include "irgopt.h" #include "irgopt.h"
#include "iroptimize.h" #include "iroptimize.h"
...@@ -256,7 +256,7 @@ static void rewrite_unsigned_float_Conv(ir_node *node) ...@@ -256,7 +256,7 @@ static void rewrite_unsigned_float_Conv(ir_node *node)
ir_mode *mode_d = mode_D; ir_mode *mode_d = mode_D;
ir_node *signed_x = new_rd_Conv(dbgi, block, unsigned_x, mode_s); ir_node *signed_x = new_rd_Conv(dbgi, block, unsigned_x, mode_s);
ir_node *res = new_rd_Conv(dbgi, block, signed_x, mode_d); ir_node *res = new_rd_Conv(dbgi, block, signed_x, mode_d);
ir_node *zero = new_r_Const(irg, get_mode_null(mode_s)); ir_node *zero = new_r_Const_null(irg, mode_s);
ir_node *cmp = new_rd_Cmp(dbgi, block, signed_x, zero, ir_node *cmp = new_rd_Cmp(dbgi, block, signed_x, zero,
ir_relation_less); ir_relation_less);
ir_node *cond = new_rd_Cond(dbgi, block, cmp); ir_node *cond = new_rd_Cond(dbgi, block, cmp);
......
...@@ -62,8 +62,8 @@ static void lower64_minus(ir_node *node, ir_mode *mode) ...@@ -62,8 +62,8 @@ static void lower64_minus(ir_node *node, ir_mode *mode)
ir_node *right_low = get_lowered_low(op); ir_node *right_low = get_lowered_low(op);
ir_node *right_high = get_lowered_high(op); ir_node *right_high = get_lowered_high(op);
ir_mode *low_unsigned = get_irn_mode(right_low); ir_mode *low_unsigned = get_irn_mode(right_low);
ir_node *left_low = new_r_Const(irg, get_mode_null(low_unsigned)); ir_node *left_low = new_r_Const_null(irg, low_unsigned);
ir_node *left_high = new_r_Const(irg, get_mode_null(mode)); ir_node *left_high = new_r_Const_null(irg, mode);
ir_node *subcc = new_bd_sparc_SubCC_t(dbgi, block, left_low, ir_node *subcc = new_bd_sparc_SubCC_t(dbgi, block, left_low,
right_low); right_low);
ir_node *res_low = new_r_Proj(subcc, mode_Iu, pn_sparc_SubCC_t_res); ir_node *res_low = new_r_Proj(subcc, mode_Iu, pn_sparc_SubCC_t_res);
......
...@@ -438,7 +438,7 @@ static ir_node *build_graph(mul_env *env, instruction *inst) ...@@ -438,7 +438,7 @@ static ir_node *build_graph(mul_env *env, instruction *inst)
r = build_graph(env, inst->in[1]); r = build_graph(env, inst->in[1]);
return inst->irn = new_rd_Add(env->dbg, env->blk, l, r, env->mode); return inst->irn = new_rd_Add(env->dbg, env->blk, l, r, env->mode);
case ZERO: case ZERO:
return inst->irn = new_r_Const(irg, get_mode_null(env->mode)); return inst->irn = new_r_Const_null(irg, env->mode);
default: default:
panic("Unsupported instruction kind"); panic("Unsupported instruction kind");
} }
...@@ -1006,7 +1006,7 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn) ...@@ -1006,7 +1006,7 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn)
res = new_rd_Shrs(dbg, block, curr, k_node, mode); res = new_rd_Shrs(dbg, block, curr, k_node, mode);
if (n_flag) { /* negate the result */ if (n_flag) { /* negate the result */
k_node = new_r_Const(irg, get_mode_null(mode)); k_node = new_r_Const_null(irg, mode);
res = new_rd_Sub(dbg, block, k_node, res, mode); res = new_rd_Sub(dbg, block, k_node, res, mode);
} }
} else { /* unsigned case */ } else { /* unsigned case */
...@@ -1080,7 +1080,7 @@ ir_node *arch_dep_replace_mod_by_const(ir_node *irn) ...@@ -1080,7 +1080,7 @@ ir_node *arch_dep_replace_mod_by_const(ir_node *irn)
if (k == 0) { if (k == 0) {
ir_graph *irg = get_irn_irg(irn); ir_graph *irg = get_irn_irg(irn);
res = new_r_Const(irg, get_mode_null(mode)); res = new_r_Const_null(irg, mode);
} }
else if (k > 0) { else if (k > 0) {
ir_graph *irg = get_irn_irg(irn); ir_graph *irg = get_irn_irg(irn);
......
...@@ -648,3 +648,13 @@ void (verify_new_node)(ir_graph *irg, ir_node *node) ...@@ -648,3 +648,13 @@ void (verify_new_node)(ir_graph *irg, ir_node *node)
{ {
verify_new_node_(irg, node); verify_new_node_(irg, node);
} }
ir_node *new_rd_Const_null(dbg_info *const dbgi, ir_graph *const irg, ir_mode *const mode)
{
return new_rd_Const(dbgi, irg, get_mode_null(mode));
}
ir_node *new_r_Const_null(ir_graph *const irg, ir_mode *const mode)
{
return new_r_Const(irg, get_mode_null(mode));
}
...@@ -81,4 +81,8 @@ void ssa_cons_start(ir_graph *irg, int n_loc); ...@@ -81,4 +81,8 @@ void ssa_cons_start(ir_graph *irg, int n_loc);
*/ */
void ssa_cons_finish(ir_graph *irg); void ssa_cons_finish(ir_graph *irg);
ir_node *new_rd_Const_null(dbg_info *dbgi, ir_graph *irg, ir_mode *mode);
ir_node *new_r_Const_null(ir_graph *irg, ir_mode *mode);
#endif #endif
...@@ -1902,17 +1902,6 @@ static ir_node *transform_node_AddSub(ir_node *n) ...@@ -1902,17 +1902,6 @@ static ir_node *transform_node_AddSub(ir_node *n)
} \ } \
} while(0) } while(0)
/**
* Create a 0 constant of given mode.
*/
static ir_node *create_zero_const(ir_graph *irg, ir_mode *mode)
{
ir_tarval *tv = get_mode_null(mode);
ir_node *cnst = new_r_Const(irg, tv);
return cnst;
}
static ir_node *create_bool_const(ir_graph *const irg, bool const val) static ir_node *create_bool_const(ir_graph *const irg, bool const val)
{ {
ir_tarval *const tv = val ? get_tarval_b_true() : get_tarval_b_false(); ir_tarval *const tv = val ? get_tarval_b_true() : get_tarval_b_false();
...@@ -2405,7 +2394,7 @@ static ir_node *transform_node_Or_(ir_node *n) ...@@ -2405,7 +2394,7 @@ static ir_node *transform_node_Or_(ir_node *n)
ir_node *xorb = new_rd_Eor(dbgi, block, b_left, b_right, b_mode); ir_node *xorb = new_rd_Eor(dbgi, block, b_left, b_right, b_mode);
ir_node *conv = new_rd_Conv(dbgi, block, xora, b_mode); ir_node *conv = new_rd_Conv(dbgi, block, xora, b_mode);
ir_node *orn = new_rd_Or(dbgi, block, conv, xorb, b_mode); ir_node *orn = new_rd_Or(dbgi, block, conv, xorb, b_mode);
ir_node *zero = create_zero_const(irg, b_mode); ir_node *zero = new_r_Const_null(irg, b_mode);
return new_rd_Cmp(dbgi, block, orn, zero, ir_relation_less_greater); return new_rd_Cmp(dbgi, block, orn, zero, ir_relation_less_greater);
} }
if (values_in_mode(get_irn_mode(b_left), get_irn_mode(a_left))) { if (values_in_mode(get_irn_mode(b_left), get_irn_mode(a_left))) {
...@@ -2418,7 +2407,7 @@ static ir_node *transform_node_Or_(ir_node *n) ...@@ -2418,7 +2407,7 @@ static ir_node *transform_node_Or_(ir_node *n)
ir_node *xorb = new_rd_Eor(dbgi, block, b_left, b_right, b_mode); ir_node *xorb = new_rd_Eor(dbgi, block, b_left, b_right, b_mode);
ir_node *conv = new_rd_Conv(dbgi, block, xorb, a_mode); ir_node *conv = new_rd_Conv(dbgi, block, xorb, a_mode);
ir_node *orn = new_rd_Or(dbgi, block, xora, conv, a_mode); ir_node *orn = new_rd_Or(dbgi, block, xora, conv, a_mode);
ir_node *zero = create_zero_const(irg, a_mode); ir_node *zero = new_r_Const_null(irg, a_mode);
return new_rd_Cmp(dbgi, block, orn, zero, ir_relation_less_greater); return new_rd_Cmp(dbgi, block, orn, zero, ir_relation_less_greater);
} }
} }
...@@ -3376,7 +3365,7 @@ static ir_node *transform_node_Mod(ir_node *n) ...@@ -3376,7 +3365,7 @@ static ir_node *transform_node_Mod(ir_node *n)
ir_node *b = get_Mod_right(n); ir_node *b = get_Mod_right(n);
if (a == b && value_not_null(a, NULL)) { if (a == b && value_not_null(a, NULL)) {
/* BEWARE: we can optimize a%a to 0 only if this cannot cause a exception */ /* BEWARE: we can optimize a%a to 0 only if this cannot cause a exception */
value = create_zero_const(irg, mode); value = new_r_Const_null(irg, mode);
DBG_OPT_CSTEVAL(n, value); DBG_OPT_CSTEVAL(n, value);
goto make_tuple; goto make_tuple;
} else { } else {
...@@ -3385,7 +3374,7 @@ static ir_node *transform_node_Mod(ir_node *n) ...@@ -3385,7 +3374,7 @@ static ir_node *transform_node_Mod(ir_node *n)
if (tarval_is_minus_one(tv)) { if (tarval_is_minus_one(tv)) {
/* a % -1 = 0 */ /* a % -1 = 0 */
value = create_zero_const(irg, mode); value = new_r_Const_null(irg, mode);
DBG_OPT_CSTEVAL(n, value); DBG_OPT_CSTEVAL(n, value);
goto make_tuple; goto make_tuple;
} }
...@@ -3619,7 +3608,7 @@ static ir_node *transform_node_And(ir_node *n) ...@@ -3619,7 +3608,7 @@ static ir_node *transform_node_And(ir_node *n)
ir_node *conv = new_rd_Conv(dbgi, block, xora, b_mode); ir_node *conv = new_rd_Conv(dbgi, block, xora, b_mode);
ir_node *orn = new_rd_Or(dbgi, block, conv, xorb, b_mode); ir_node *orn = new_rd_Or(dbgi, block, conv, xorb, b_mode);
ir_graph *irg = get_irn_irg(n); ir_graph *irg = get_irn_irg(n);
ir_node *zero = create_zero_const(irg, b_mode); ir_node *zero = new_r_Const_null(irg, b_mode);
return new_rd_Cmp(dbgi, block, orn, zero, ir_relation_equal); return new_rd_Cmp(dbgi, block, orn, zero, ir_relation_equal);
} }
if (values_in_mode(get_irn_mode(b_left), get_irn_mode(a_left))) { if (values_in_mode(get_irn_mode(b_left), get_irn_mode(a_left))) {
...@@ -3632,7 +3621,7 @@ static ir_node *transform_node_And(ir_node *n) ...@@ -3632,7 +3621,7 @@ static ir_node *transform_node_And(ir_node *n)
ir_node *conv = new_rd_Conv(dbgi, block, xorb, a_mode); ir_node *conv = new_rd_Conv(dbgi, block, xorb, a_mode);
ir_node *orn = new_rd_Or(dbgi, block, xora, conv, a_mode); ir_node *orn = new_rd_Or(dbgi, block, xora, conv, a_mode);
ir_graph *irg = get_irn_irg(n); ir_graph *irg = get_irn_irg(n);
ir_node *zero = create_zero_const(irg, a_mode); ir_node *zero = new_r_Const_null(irg, a_mode);
return new_rd_Cmp(dbgi, block, orn, zero, ir_relation_equal); return new_rd_Cmp(dbgi, block, orn, zero, ir_relation_equal);
} }
} }
...@@ -4031,7 +4020,7 @@ static ir_node *transform_node_Proj_Mod(ir_node *proj) ...@@ -4031,7 +4020,7 @@ static ir_node *transform_node_Proj_Mod(ir_node *proj)
/* a % a = 0 if a != 0 */ /* a % a = 0 if a != 0 */
ir_graph *irg = get_irn_irg(proj); ir_graph *irg = get_irn_irg(proj);
ir_mode *mode = get_irn_mode(proj); ir_mode *mode = get_irn_mode(proj);
ir_node *res = create_zero_const(irg, mode); ir_node *res = new_r_Const_null(irg, mode);
DBG_OPT_CSTEVAL(mod, res); DBG_OPT_CSTEVAL(mod, res);
return res; return res;
...@@ -4275,7 +4264,7 @@ static ir_node *transform_node_Cmp(ir_node *n) ...@@ -4275,7 +4264,7 @@ static ir_node *transform_node_Cmp(ir_node *n)
cmp_x_eq_0:; cmp_x_eq_0:;
ir_graph *irg = get_irn_irg(n); ir_graph *irg = get_irn_irg(n);
left = x; left = x;
right = create_zero_const(irg, mode); right = new_r_Const_null(irg, mode);
changed = true; changed = true;
DBG_OPT_ALGSIM0(n, n, FS_OPT_CMP_OP_OP); DBG_OPT_ALGSIM0(n, n, FS_OPT_CMP_OP_OP);
} }
...@@ -4344,7 +4333,7 @@ cmp_x_eq_0:; ...@@ -4344,7 +4333,7 @@ cmp_x_eq_0:;
relation = relation =
relation == ir_relation_equal ? ir_relation_less_greater relation == ir_relation_equal ? ir_relation_less_greater
: ir_relation_equal; : ir_relation_equal;
right = create_zero_const(irg, mode); right = new_r_Const_null(irg, mode);
changed |= 1; changed |= 1;
goto is_bittest; goto is_bittest;
} }
...@@ -4999,7 +4988,7 @@ static ir_node *transform_node_shift(ir_node *n) ...@@ -4999,7 +4988,7 @@ static ir_node *transform_node_shift(ir_node *n)
return new_rd_Shrs(dbgi, block, get_binop_left(left), cnst, mode); return new_rd_Shrs(dbgi, block, get_binop_left(left), cnst, mode);
} }
return create_zero_const(irg, mode); return new_r_Const_null(irg, mode);
} }
/* ok, we can replace it */ /* ok, we can replace it */
...@@ -6310,10 +6299,9 @@ static ir_node *extract_from_initializer(const ir_type *type, ...@@ -6310,10 +6299,9 @@ static ir_node *extract_from_initializer(const ir_type *type,
ir_tarval *tv; ir_tarval *tv;
switch (get_initializer_kind(initializer)) { switch (get_initializer_kind(initializer)) {
case IR_INITIALIZER_NULL: { case IR_INITIALIZER_NULL:
ir_tarval *tv = get_mode_null(mode); return new_r_Const_null(irg, mode);
return new_r_Const(irg, tv);
}
case IR_INITIALIZER_TARVAL: { case IR_INITIALIZER_TARVAL: {
tv = get_initializer_tarval_value(initializer); tv = get_initializer_tarval_value(initializer);
handle_tv:; handle_tv:;
...@@ -6390,7 +6378,7 @@ handle_tv:; ...@@ -6390,7 +6378,7 @@ handle_tv:;
return extract_from_initializer(member_type, sub_initializer, return extract_from_initializer(member_type, sub_initializer,
new_offset, mode, dbgi, irg); new_offset, mode, dbgi, irg);
} }
return create_zero_const(irg, mode); return new_r_Const_null(irg, mode);
} }
} }
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "irflag_t.h" #include "irflag_t.h"
#include "firmstat.h" #include "firmstat.h"
#include "irgwalk.h" #include "irgwalk.h"
#include "ircons.h" #include "ircons_t.h"
#include "irflag.h" #include "irflag.h"
#include "iroptimize.h" #include "iroptimize.h"
#include "debug.h" #include "debug.h"
...@@ -801,7 +801,7 @@ static void lower_shr_helper(ir_node *node, ir_mode *mode, ...@@ -801,7 +801,7 @@ static void lower_shr_helper(ir_node *node, ir_mode *mode,
* than half the word width */ * than half the word width */
ir_node *cnst = new_r_Const_long(irg, low_unsigned, modulo_shift2); ir_node *cnst = new_r_Const_long(irg, low_unsigned, modulo_shift2);
ir_node *andn = new_r_And(block, right, cnst, low_unsigned); ir_node *andn = new_r_And(block, right, cnst, low_unsigned);
ir_node *cnst2 = new_r_Const(irg, get_mode_null(low_unsigned)); ir_node *cnst2 = new_r_Const_null(irg, low_unsigned);
ir_node *cmp = new_rd_Cmp(dbgi, block, andn, cnst2, ir_relation_equal); ir_node *cmp = new_rd_Cmp(dbgi, block, andn, cnst2, ir_relation_equal);
ir_node *cond = new_rd_Cond(dbgi, block, cmp); ir_node *cond = new_rd_Cond(dbgi, block, cmp);
ir_node *proj_true = new_r_Proj(cond, mode_X, pn_Cond_true); ir_node *proj_true = new_r_Proj(cond, mode_X, pn_Cond_true);
...@@ -844,7 +844,7 @@ static void lower_shr_helper(ir_node *node, ir_mode *mode, ...@@ -844,7 +844,7 @@ static void lower_shr_helper(ir_node *node, ir_mode *mode,
if (new_rd_shrs == new_rd_Shrs) { if (new_rd_shrs == new_rd_Shrs) {
fres_high = new_rd_shrs(dbgi, block_false, left_high, cnst3, mode); fres_high = new_rd_shrs(dbgi, block_false, left_high, cnst3, mode);
} else { } else {
fres_high = new_r_Const(irg, get_mode_null(mode)); fres_high = new_r_Const_null(irg, mode);
} }
/* patch lower block */ /* patch lower block */
...@@ -915,7 +915,7 @@ static void lower_Shl(ir_node *node, ir_mode *mode) ...@@ -915,7 +915,7 @@ static void lower_Shl(ir_node *node, ir_mode *mode)
* than half the word width */ * than half the word width */
ir_node *cnst = new_r_Const_long(irg, low_unsigned, modulo_shift2); ir_node *cnst = new_r_Const_long(irg, low_unsigned, modulo_shift2);
ir_node *andn = new_r_And(block, right, cnst, low_unsigned); ir_node *andn = new_r_And(block, right, cnst, low_unsigned);
ir_node *cnst2 = new_r_Const(irg, get_mode_null(low_unsigned)); ir_node *cnst2 = new_r_Const_null(irg, low_unsigned);
ir_node *cmp = new_rd_Cmp(dbgi, block, andn, cnst2, ir_node *cmp = new_rd_Cmp(dbgi, block, andn, cnst2,
ir_relation_equal); ir_relation_equal);
ir_node *cond = new_rd_Cond(dbgi, block, cmp); ir_node *cond = new_rd_Cond(dbgi, block, cmp);
...@@ -943,7 +943,7 @@ static void lower_Shl(ir_node *node, ir_mode *mode) ...@@ -943,7 +943,7 @@ static void lower_Shl(ir_node *node, ir_mode *mode)
/* false block => shift_width > 1word */ /* false block => shift_width > 1word */
ir_node *fin[1] = { proj_false }; ir_node *fin[1] = { proj_false };
ir_node *block_false = new_r_Block(irg, ARRAY_SIZE(fin), fin); ir_node *block_false = new_r_Block(irg, ARRAY_SIZE(fin), fin);
ir_node *fres_low = new_r_Const(irg, get_mode_null(low_unsigned)); ir_node *fres_low = new_r_Const_null(irg, low_unsigned);
ir_node *fconv = create_conv(block_false, left_low, mode); ir_node *fconv = create_conv(block_false, left_low, mode);
ir_node *fres_high = new_rd_Shl(dbgi, block_false, fconv, right, mode); ir_node *fres_high = new_rd_Shl(dbgi, block_false, fconv, right, mode);
...@@ -1170,8 +1170,9 @@ static void lower_Cond(ir_node *node, ir_mode *high_mode) ...@@ -1170,8 +1170,9 @@ static void lower_Cond(ir_node *node, ir_mode *high_mode)
ir_node *high_right = new_rd_Conv(dbg, block, rentry->high_word, mode); ir_node *high_right = new_rd_Conv(dbg, block, rentry->high_word, mode);
ir_node *xor_low = new_rd_Eor(dbg, block, low_left, low_right, mode); ir_node *xor_low = new_rd_Eor(dbg, block, low_left, low_right, mode);
ir_node *xor_high = new_rd_Eor(dbg, block, high_left, high_right, mode); ir_node *xor_high = new_rd_Eor(dbg, block, high_left, high_right, mode);
ir_node *ornode = new_rd_Or(dbg, block, xor_low, xor_high, mode); ir_node *ornode = new_rd_Or(dbg, block, xor_low, xor_high, mode);
ir_node *cmp = new_rd_Cmp(dbg, block, ornode, new_r_Const(irg, get_mode_null(mode)), relation); ir_node *null = new_r_Const_null(irg, mode);
ir_node *cmp = new_rd_Cmp(dbg, block, ornode, null, relation);
set_Cond_selector(node, cmp); set_Cond_selector(node, cmp);
return; return;
} }
...@@ -1334,12 +1335,12 @@ static void lower_Conv_to_Ll(ir_node *node) ...@@ -1334,12 +1335,12 @@ static void lower_Conv_to_Ll(ir_node *node)
op = new_rd_Conv(dbg, block, op, low_signed); op = new_rd_Conv(dbg, block, op, low_signed);
res_high = new_rd_Shrs(dbg, block, op, cnst, low_signed); res_high = new_rd_Shrs(dbg, block, op, cnst, low_signed);
} else { } else {
res_high = new_r_Const(irg, get_mode_null(low_signed)); res_high = new_r_Const_null(irg, low_signed);
} }
} }
} else if (imode == mode_b) { } else if (imode == mode_b) {
res_low = new_rd_Conv(dbg, block, op, low_unsigned); res_low = new_rd_Conv(dbg, block, op, low_unsigned);
res_high = new_r_Const(irg, get_mode_null(low_signed)); res_high = new_r_Const_null(irg, low_signed);
} else { } else {
ir_node *irn, *call; ir_node *irn, *call;
ir_type *mtp = get_conv_type(imode, omode); ir_type *mtp = get_conv_type(imode, omode);
...@@ -1439,7 +1440,8 @@ static void lower_Cmp(ir_node *cmp, ir_mode *m) ...@@ -1439,7 +1440,8 @@ static void lower_Cmp(ir_node *cmp, ir_mode *m)
ir_node *xor_low = new_rd_Eor(dbg, block, low_left, low_right, mode); ir_node *xor_low = new_rd_Eor(dbg, block, low_left, low_right, mode);
ir_node *xor_high = new_rd_Eor(dbg, block, high_left, high_right, mode); ir_node *xor_high = new_rd_Eor(dbg, block, high_left, high_right, mode);
ir_node *ornode = new_rd_Or(dbg, block, xor_low, xor_high, mode); ir_node *ornode = new_rd_Or(dbg, block, xor_low, xor_high, mode);
ir_node *new_cmp = new_rd_Cmp(dbg, block, ornode, new_r_Const(irg, get_mode_null(mode)), relation); ir_node *null = new_r_Const_null(irg, mode);
ir_node *new_cmp = new_rd_Cmp(dbg, block, ornode, null, relation);
exchange(cmp, new_cmp); exchange(cmp, new_cmp);
return; return;
} }
...@@ -2353,9 +2355,9 @@ static void lower_reduce_builtin(ir_node *builtin, ir_mode *mode) ...@@ -2353,9 +2355,9 @@ static void lower_reduce_builtin(ir_node *builtin, ir_mode *mode)
switch (kind) { switch (kind) {
case ir_bk_ffs: { case ir_bk_ffs: {
ir_node *number_of_bits = new_r_Const_long(irg, result_mode, get_mode_size_bits(env->low_unsigned)); ir_node *number_of_bits = new_r_Const_long(irg, result_mode, get_mode_size_bits(env->low_unsigned));
ir_node *zero_high = new_rd_Const(dbgi, irg, get_mode_null(high_mode)); ir_node *zero_high = new_rd_Const_null(dbgi, irg, high_mode);
ir_node *zero_unsigned = new_rd_Const(dbgi, irg, get_mode_null(env->low_unsigned)); ir_node *zero_unsigned = new_rd_Const_null(dbgi, irg, env->low_unsigned);
ir_node *zero_result = new_rd_Const(dbgi, irg, get_mode_null(result_mode)); ir_node *zero_result = new_rd_Const_null(dbgi, irg, result_mode);
ir_node *cmp_low = new_rd_Cmp(dbgi, block, entry->low_word, zero_unsigned, ir_relation_equal); ir_node *cmp_low = new_rd_Cmp(dbgi, block, entry->low_word, zero_unsigned, ir_relation_equal);
ir_node *cmp_high = new_rd_Cmp(dbgi, block, entry->high_word, zero_high, ir_relation_equal); ir_node *cmp_high = new_rd_Cmp(dbgi, block, entry->high_word, zero_high, ir_relation_equal);
ir_node *ffs_high = new_rd_Builtin(dbgi, block, mem, 1, in_high, kind, lowered_type_high); ir_node *ffs_high = new_rd_Builtin(dbgi, block, mem, 1, in_high, kind, lowered_type_high);
...@@ -2375,7 +2377,7 @@ static void lower_reduce_builtin(ir_node *builtin, ir_mode *mode) ...@@ -2375,7 +2377,7 @@ static void lower_reduce_builtin(ir_node *builtin, ir_mode *mode)
break; break;
} }
case ir_bk_clz: { case ir_bk_clz: {
ir_node *zero = new_rd_Const(dbgi, irg, get_mode_null(high_mode)); ir_node *zero = new_rd_Const_null(dbgi, irg, high_mode);
ir_node *cmp_high = new_rd_Cmp(dbgi, block, entry->high_word, zero, ir_relation_equal); ir_node *cmp_high = new_rd_Cmp(dbgi, block, entry->high_word, zero, ir_relation_equal);
ir_node *clz_high = new_rd_Builtin(dbgi, block, mem, 1, in_high, kind, lowered_type_high); ir_node *clz_high = new_rd_Builtin(dbgi, block, mem, 1, in_high, kind, lowered_type_high);
ir_node *high = new_r_Proj(clz_high, result_mode, pn_Builtin_max+1); ir_node *high = new_r_Proj(clz_high, result_mode, pn_Builtin_max+1);
...@@ -2391,7 +2393,7 @@ static void lower_reduce_builtin(ir_node *builtin, ir_mode *mode) ...@@ -2391,7 +2393,7 @@ static void lower_reduce_builtin(ir_node *builtin, ir_mode *mode)
break; break;
} }
case ir_bk_ctz: { case ir_bk_ctz: {
ir_node *zero_unsigned = new_rd_Const(dbgi, irg, get_mode_null(env->low_unsigned)); ir_node *zero_unsigned = new_rd_Const_null(dbgi, irg, env->low_unsigned);
ir_node *cmp_low = new_rd_Cmp(dbgi, block, entry->low_word, zero_unsigned, ir_relation_equal); ir_node *cmp_low = new_rd_Cmp(dbgi, block, entry->low_word, zero_unsigned, ir_relation_equal);
ir_node *ffs_high = new_rd_Builtin(dbgi, block, mem, 1, in_high, kind, lowered_type_high); ir_node *ffs_high = new_rd_Builtin(dbgi, block, mem, 1, in_high, kind, lowered_type_high);
ir_node *high_proj = new_r_Proj(ffs_high, result_mode, pn_Builtin_max+1); ir_node *high_proj = new_r_Proj(ffs_high, result_mode, pn_Builtin_max+1);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "irnode_t.h" #include "irnode_t.h"
#include "irprog_t.h" #include "irprog_t.h"
#include "irgwalk.h" #include "irgwalk.h"
#include "ircons.h" #include "ircons_t.h"
#include "irgmod.h" #include "irgmod.h"
#include "irgopt.h" #include "irgopt.h"
#include "trouts.h" #include "trouts.h"
...@@ -172,7 +172,7 @@ int i_mapper_abs(ir_node *call) ...@@ -172,7 +172,7 @@ int i_mapper_abs(ir_node *call)
if (mode_has_signed_zero(mode)) if (mode_has_signed_zero(mode))
return 0; return 0;
ir_node *zero = new_r_Const(irg, get_mode_null(mode)); ir_node *zero = new_r_Const_null(irg, mode);
ir_node *cmp = new_rd_Cmp(dbg, block, op, zero, ir_relation_less); ir_node *cmp = new_rd_Cmp(dbg, block, op, zero, ir_relation_less);
ir_node *minus_op = new_rd_Minus(dbg, block, op, mode); ir_node *minus_op = new_rd_Minus(dbg, block, op, mode);
ir_node *mux; ir_node *mux;
...@@ -395,7 +395,7 @@ static int i_mapper_one_to_zero(ir_node *call, int reason) ...@@ -395,7 +395,7 @@ static int i_mapper_one_to_zero(ir_node *call, int reason)
/* acos(1.0) = 0.0 */ /* acos(1.0) = 0.0 */
ir_graph *irg = get_irn_irg(val); ir_graph *irg = get_irn_irg(val);
ir_mode *mode = get_irn_mode(val); ir_mode *mode = get_irn_mode(val);
ir_node *irn = new_r_Const(irg, get_mode_null(mode)); ir_node *irn = new_r_Const_null(irg, mode);
ir_node *mem = get_Call_mem(call); ir_node *mem = get_Call_mem(call);
DBG_OPT_ALGSIM0(call, irn, reason); DBG_OPT_ALGSIM0(call, irn, reason);
replace_call(irn, call, mem, NULL, NULL); replace_call(irn, call, mem, NULL, NULL);
...@@ -725,10 +725,8 @@ static ir_node *eval_strcmp(ir_graph *irg, ir_entity *left, ir_entity *right, ...@@ -725,10 +725,8 @@ static ir_node *eval_strcmp(ir_graph *irg, ir_entity *left, ir_entity *right,
return new_r_Const(irg, tv); return new_r_Const(irg, tv);
} }
if (tarval_is_null(tv_l)) { if (tarval_is_null(tv_l))
ir_tarval *const tv = get_mode_null(get_type_mode(res_tp)); return new_r_Const_null(irg, get_type_mode(res_tp));
return new_r_Const(irg, tv);
}
} }
return NULL; return NULL;
...@@ -799,7 +797,7 @@ int i_mapper_strcmp(ir_node *call) ...@@ -799,7 +797,7 @@ int i_mapper_strcmp(ir_node *call)
ir_graph *irg = get_irn_irg(call); ir_graph *irg = get_irn_irg(call);
ir_mode *mode = get_type_mode(res_tp); ir_mode *mode = get_type_mode(res_tp);
irn = new_r_Const(irg, get_mode_null(mode)); irn = new_r_Const_null(irg, mode);
DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_STRCMP); DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_STRCMP);
replace_call(irn, call, mem, NULL, NULL); replace_call(irn, call, mem, NULL, NULL);
return 1; return 1;
...@@ -881,7 +879,7 @@ int i_mapper_strncmp(ir_node *call) ...@@ -881,7 +879,7 @@ int i_mapper_strncmp(ir_node *call)
ir_type *res_tp = get_method_res_type(call_tp, 0); ir_type *res_tp = get_method_res_type(call_tp, 0);
ir_mode *mode = get_type_mode(res_tp); ir_mode *mode = get_type_mode(res_tp);
irn = new_r_Const(irg, get_mode_null(mode)); irn = new_r_Const_null(irg, mode);
DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_STRNCMP); DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_STRNCMP);
replace_call(irn, call, mem, NULL, NULL); replace_call(irn, call, mem, NULL, NULL);
return 1; return 1;
...@@ -998,7 +996,7 @@ int i_mapper_memcmp(ir_node *call) ...@@ -998,7 +996,7 @@ int i_mapper_memcmp(ir_node *call)