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

When making an 'Add', automatically infer its mode from its operands.

parent 77c35e4a
...@@ -203,8 +203,7 @@ static ir_node *load_va_from_stack(dbg_info *dbgi, ir_node *block, ir_mode *resm ...@@ -203,8 +203,7 @@ static ir_node *load_va_from_stack(dbg_info *dbgi, ir_node *block, ir_mode *resm
long increment = round_up2(get_mode_size_bytes(resmode), 8); long increment = round_up2(get_mode_size_bytes(resmode), 8);
ir_mode *offset_mode = get_reference_offset_mode(mode_P); ir_mode *offset_mode = get_reference_offset_mode(mode_P);
ir_node *sizeof_resmode = new_r_Const_long(irg, offset_mode, increment); ir_node *sizeof_resmode = new_r_Const_long(irg, offset_mode, increment);
ir_mode *mode_stack_args = get_irn_mode(stack_args); ir_node *stack_args_inc = new_rd_Add(dbgi, block, stack_args, sizeof_resmode);
ir_node *stack_args_inc = new_rd_Add(dbgi, block, stack_args, sizeof_resmode, mode_stack_args);
make_store(dbgi, block, stack_args_ptr, stack_args_inc, stack_args_type, mem); make_store(dbgi, block, stack_args_ptr, stack_args_inc, stack_args_type, mem);
return result; return result;
...@@ -251,11 +250,11 @@ static ir_node *load_va_from_register_or_stack(dbg_info *dbgi, ir_node *block, ...@@ -251,11 +250,11 @@ static ir_node *load_va_from_register_or_stack(dbg_info *dbgi, ir_node *block,
ir_mode *mode_reg_save = get_irn_mode(reg_save); ir_mode *mode_reg_save = get_irn_mode(reg_save);
ir_mode *offset_mode = get_reference_offset_mode(mode_reg_save); ir_mode *offset_mode = get_reference_offset_mode(mode_reg_save);
ir_node *conv_offset = new_r_Conv(true_block, offset, offset_mode); ir_node *conv_offset = new_r_Conv(true_block, offset, offset_mode);
ir_node *true_result_ptr = new_rd_Add(dbgi, true_block, reg_save, conv_offset, mode_reg_save); ir_node *true_result_ptr = new_rd_Add(dbgi, true_block, reg_save, conv_offset);
ir_node *true_result = load_result(dbgi, true_block, true_result_ptr, restype, &true_mem); ir_node *true_result = load_result(dbgi, true_block, true_result_ptr, restype, &true_mem);
// Increment offset and write back // Increment offset and write back
ir_node *offset_inc = new_rd_Add(dbgi, true_block, offset, stride, mode_Is); ir_node *offset_inc = new_rd_Add(dbgi, true_block, offset, stride);
make_store(dbgi, true_block, offset_ptr, offset_inc, offset_type, &true_mem); make_store(dbgi, true_block, offset_ptr, offset_inc, offset_type, &true_mem);
// False side: Load from the stack // False side: Load from the stack
......
...@@ -96,8 +96,8 @@ static void lower64_mul(ir_node *node, ir_mode *mode) ...@@ -96,8 +96,8 @@ static void lower64_mul(ir_node *node, ir_mode *mode)
ir_node *umull_high = new_r_Proj(umull, mode, pn_arm_UMulL_t_high); ir_node *umull_high = new_r_Proj(umull, mode, pn_arm_UMulL_t_high);
ir_node *conv_r_low = new_rd_Conv(dbgi, block, right_low, mode); ir_node *conv_r_low = new_rd_Conv(dbgi, block, right_low, mode);
ir_node *mul2 = new_rd_Mul(dbgi, block, conv_r_low, left_high); ir_node *mul2 = new_rd_Mul(dbgi, block, conv_r_low, left_high);
ir_node *add1 = new_rd_Add(dbgi, block, mul2, mul1, mode); ir_node *add1 = new_rd_Add(dbgi, block, mul2, mul1);
ir_node *add2 = new_rd_Add(dbgi, block, add1, umull_high, mode); ir_node *add2 = new_rd_Add(dbgi, block, add1, umull_high);
ir_set_dw_lowered(node, umull_low, add2); ir_set_dw_lowered(node, umull_low, add2);
} }
......
...@@ -740,7 +740,7 @@ void be_add_parameter_entity_stores_list(ir_graph *irg, unsigned n_entities, ...@@ -740,7 +740,7 @@ void be_add_parameter_entity_stores_list(ir_graph *irg, unsigned n_entities,
ir_mode *mode_ref = get_irn_mode(addr); ir_mode *mode_ref = get_irn_mode(addr);
ir_mode *mode_offs = get_reference_offset_mode(mode_ref); ir_mode *mode_offs = get_reference_offset_mode(mode_ref);
ir_node *cnst = new_r_Const_long(irg, mode_offs, offset); ir_node *cnst = new_r_Const_long(irg, mode_offs, offset);
ir_node *next_addr = new_r_Add(start_block, addr, cnst, mode_ref); ir_node *next_addr = new_r_Add(start_block, addr, cnst);
ir_node *store1 = new_r_Store(start_block, mem0, next_addr, val1, ir_node *store1 = new_r_Store(start_block, mem0, next_addr, val1,
tp, cons_none); tp, cons_none);
mem = new_r_Proj(store1, mode_M, pn_Store_M); mem = new_r_Proj(store1, mode_M, pn_Store_M);
......
...@@ -46,7 +46,7 @@ void be_default_lower_va_arg(ir_node *node) ...@@ -46,7 +46,7 @@ void be_default_lower_va_arg(ir_node *node)
be_params->stack_param_align); be_params->stack_param_align);
ir_mode *const offset_mode = get_reference_offset_mode(mode_P); ir_mode *const offset_mode = get_reference_offset_mode(mode_P);
ir_node *const offset = new_r_Const_long(irg, offset_mode, round_up); ir_node *const offset = new_r_Const_long(irg, offset_mode, round_up);
ir_node *const new_ap = new_rd_Add(dbgi, block, ap, offset, mode_P); ir_node *const new_ap = new_rd_Add(dbgi, block, ap, offset);
ir_node *const in[] = { new_mem, res, new_ap }; ir_node *const in[] = { new_mem, res, new_ap };
turn_into_tuple(node, ARRAY_SIZE(in), in); turn_into_tuple(node, ARRAY_SIZE(in), in);
......
...@@ -149,8 +149,8 @@ static void ia32_lower_add64(ir_node *node, ir_mode *mode) ...@@ -149,8 +149,8 @@ static void ia32_lower_add64(ir_node *node, ir_mode *mode)
assert(get_irn_mode(left_high) == get_irn_mode(right_high)); assert(get_irn_mode(left_high) == get_irn_mode(right_high));
if (cr == no_carry) { if (cr == no_carry) {
ir_node *add_low = new_rd_Add(dbg, block, left_low, right_low, low_mode); ir_node *add_low = new_rd_Add(dbg, block, left_low, right_low);
ir_node *add_high = new_rd_Add(dbg, block, left_high, right_high, high_mode); ir_node *add_high = new_rd_Add(dbg, block, left_high, right_high);
ir_set_dw_lowered(node, add_low, add_high); ir_set_dw_lowered(node, add_low, add_high);
} else if (cr == must_carry && (is_Const(left_high) || is_Const(right_high))) { } else if (cr == must_carry && (is_Const(left_high) || is_Const(right_high))) {
// We cannot assume that left_high and right_high form a normalized Add. // We cannot assume that left_high and right_high form a normalized Add.
...@@ -167,9 +167,9 @@ static void ia32_lower_add64(ir_node *node, ir_mode *mode) ...@@ -167,9 +167,9 @@ static void ia32_lower_add64(ir_node *node, ir_mode *mode)
ir_graph *irg = get_irn_irg(right_high); ir_graph *irg = get_irn_irg(right_high);
ir_node *one = new_rd_Const(dbg, irg, get_mode_one(high_mode)); ir_node *one = new_rd_Const(dbg, irg, get_mode_one(high_mode));
ir_node *const_plus_one = new_rd_Add(dbg, block, constant, one, high_mode); ir_node *const_plus_one = new_rd_Add(dbg, block, constant, one);
ir_node *add_high = new_rd_Add(dbg, block, other, const_plus_one, high_mode); ir_node *add_high = new_rd_Add(dbg, block, other, const_plus_one);
ir_node *add_low = new_rd_Add(dbg, block, left_low, right_low, low_mode); ir_node *add_low = new_rd_Add(dbg, block, left_low, right_low);
ir_set_dw_lowered(node, add_low, add_high); ir_set_dw_lowered(node, add_low, add_high);
} else { } else {
/* l_res = a_l + b_l */ /* l_res = a_l + b_l */
...@@ -217,7 +217,7 @@ static void ia32_lower_sub64(ir_node *node, ir_mode *mode) ...@@ -217,7 +217,7 @@ static void ia32_lower_sub64(ir_node *node, ir_mode *mode)
ir_node *one = new_rd_Const(dbg, irg, get_mode_one(high_mode)); ir_node *one = new_rd_Const(dbg, irg, get_mode_one(high_mode));
if (is_Const(right_high)) { if (is_Const(right_high)) {
ir_node *new_const = new_rd_Add(dbg, block, right_high, one, high_mode); ir_node *new_const = new_rd_Add(dbg, block, right_high, one);
sub_high = new_rd_Sub(dbg, block, left_high, new_const, high_mode); sub_high = new_rd_Sub(dbg, block, left_high, new_const, high_mode);
} else if (is_Const(left_high)) { } else if (is_Const(left_high)) {
ir_node *new_const = new_rd_Sub(dbg, block, left_high, one, high_mode); ir_node *new_const = new_rd_Sub(dbg, block, left_high, one, high_mode);
...@@ -314,10 +314,10 @@ static void ia32_lower_mul64(ir_node *node, ir_mode *mode) ...@@ -314,10 +314,10 @@ static void ia32_lower_mul64(ir_node *node, ir_mode *mode)
ir_node *right_lowc = new_rd_Conv(dbg, block, right_low, mode); ir_node *right_lowc = new_rd_Conv(dbg, block, right_low, mode);
ir_node *mul1 = new_rd_Mul(dbg, block, left_high, right_lowc); ir_node *mul1 = new_rd_Mul(dbg, block, left_high, right_lowc);
ir_node *add = new_rd_Add(dbg, block, mul1, pEDX, mode); ir_node *add = new_rd_Add(dbg, block, mul1, pEDX);
ir_node *left_lowc = new_rd_Conv(dbg, block, left_low, mode); ir_node *left_lowc = new_rd_Conv(dbg, block, left_low, mode);
ir_node *mul2 = new_rd_Mul(dbg, block, left_lowc, right_high); ir_node *mul2 = new_rd_Mul(dbg, block, left_lowc, right_high);
h_res = new_rd_Add(dbg, block, add, mul2, mode); h_res = new_rd_Add(dbg, block, add, mul2);
} }
ir_set_dw_lowered(node, l_res, h_res); ir_set_dw_lowered(node, l_res, h_res);
} }
...@@ -413,7 +413,7 @@ static void ia32_lower_conv64(ir_node *node, ir_mode *mode) ...@@ -413,7 +413,7 @@ static void ia32_lower_conv64(ir_node *node, ir_mode *mode)
pn_ia32_l_FloattoLL_res_low); pn_ia32_l_FloattoLL_res_low);
h_res = new_r_Proj(float_to_ll, mode, h_res = new_r_Proj(float_to_ll, mode,
pn_ia32_l_FloattoLL_res_high); pn_ia32_l_FloattoLL_res_high);
h_res = new_rd_Add(dbg, lower_blk, h_res, int_phi, mode); h_res = new_rd_Add(dbg, lower_blk, h_res, int_phi);
/* move the call and its Proj's to the lower block */ /* move the call and its Proj's to the lower block */
set_nodes_block(node, lower_blk); set_nodes_block(node, lower_blk);
......
...@@ -91,7 +91,7 @@ static ir_node *get_eip_relative(ir_graph *const irg, ...@@ -91,7 +91,7 @@ static ir_node *get_eip_relative(ir_graph *const irg,
ir_mode *const offset_mode = get_reference_offset_mode(mode_P); ir_mode *const offset_mode = get_reference_offset_mode(mode_P);
ir_node *reloc = be_new_Relocation(irg, (unsigned)kind, entity, offset_mode); ir_node *reloc = be_new_Relocation(irg, (unsigned)kind, entity, offset_mode);
/* All ok now for locally constructed stuff. */ /* All ok now for locally constructed stuff. */
ir_node *add = new_rd_Add(NULL, block, pic_base, reloc, mode_P); ir_node *const add = new_rd_Add(NULL, block, pic_base, reloc);
/* Make sure the walker doesn't visit this add again. */ /* Make sure the walker doesn't visit this add again. */
mark_irn_visited(add); mark_irn_visited(add);
return add; return add;
......
...@@ -171,7 +171,7 @@ static void rewrite_unsigned_float_Conv(ir_node *node) ...@@ -171,7 +171,7 @@ static void rewrite_unsigned_float_Conv(ir_node *node)
ir_tarval *correction = new_tarval_from_double(4294967296., mode_d); ir_tarval *correction = new_tarval_from_double(4294967296., mode_d);
ir_node *c_const = new_r_Const(irg, correction); ir_node *c_const = new_r_Const(irg, correction);
collect_new_start_block_node(c_const); collect_new_start_block_node(c_const);
ir_node *fadd = new_rd_Add(dbgi, true_block, res, c_const, mode_d); ir_node *fadd = new_rd_Add(dbgi, true_block, res, c_const);
ir_node *lower_in[2] = { true_jmp, false_jmp }; ir_node *lower_in[2] = { true_jmp, false_jmp };
ir_node *phi_in[2] = { fadd, res }; ir_node *phi_in[2] = { fadd, res };
......
...@@ -400,7 +400,7 @@ static ir_node *build_graph(mul_env *env, instruction *inst) ...@@ -400,7 +400,7 @@ static ir_node *build_graph(mul_env *env, instruction *inst)
ir_node *r = build_graph(env, inst->in[1]); ir_node *r = build_graph(env, inst->in[1]);
ir_node *c = new_r_Const_long(irg, env->shf_mode, inst->shift_count); ir_node *c = new_r_Const_long(irg, env->shf_mode, inst->shift_count);
ir_node *s = new_rd_Shl(env->dbg, env->blk, r, c); ir_node *s = new_rd_Shl(env->dbg, env->blk, r, c);
return inst->irn = new_rd_Add(env->dbg, env->blk, l, s, env->mode); return inst->irn = new_rd_Add(env->dbg, env->blk, l, s);
} }
case SHIFT: { case SHIFT: {
ir_node *l = build_graph(env, inst->in[0]); ir_node *l = build_graph(env, inst->in[0]);
...@@ -415,7 +415,7 @@ static ir_node *build_graph(mul_env *env, instruction *inst) ...@@ -415,7 +415,7 @@ static ir_node *build_graph(mul_env *env, instruction *inst)
case ADD: { case ADD: {
ir_node *l = build_graph(env, inst->in[0]); ir_node *l = build_graph(env, inst->in[0]);
ir_node *r = build_graph(env, inst->in[1]); ir_node *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);
} }
case ZERO: case ZERO:
return inst->irn = new_r_Const_null(irg, env->mode); return inst->irn = new_r_Const_null(irg, env->mode);
...@@ -836,7 +836,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, ir_tarval *tv) ...@@ -836,7 +836,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, ir_tarval *tv)
/* do we need an Add or Sub */ /* do we need an Add or Sub */
if (mag.need_add) if (mag.need_add)
q = new_rd_Add(dbg, block, q, n, mode); q = new_rd_Add(dbg, block, q, n);
else if (mag.need_sub) else if (mag.need_sub)
q = new_rd_Sub(dbg, block, q, n, mode); q = new_rd_Sub(dbg, block, q, n, mode);
...@@ -849,7 +849,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, ir_tarval *tv) ...@@ -849,7 +849,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, ir_tarval *tv)
/* final */ /* final */
ir_node *c2 = new_r_Const_long(irg, mode_Iu, bits - 1); ir_node *c2 = new_r_Const_long(irg, mode_Iu, bits - 1);
ir_node *t = new_rd_Shr(dbg, block, q, c2); ir_node *t = new_rd_Shr(dbg, block, q, c2);
res = new_rd_Add(dbg, block, q, t, mode); res = new_rd_Add(dbg, block, q, t);
} else { } else {
struct magicu_info mafo = get_magic_info(tv); struct magicu_info mafo = get_magic_info(tv);
ir_graph *irg = get_irn_irg(div); ir_graph *irg = get_irn_irg(div);
...@@ -949,7 +949,7 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn) ...@@ -949,7 +949,7 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn)
* but simply shifting right by one computes -2. * but simply shifting right by one computes -2.
*/ */
curr = new_rd_Add(dbg, block, left, curr, mode); curr = new_rd_Add(dbg, block, left, curr);
} }
ir_node *k_node = new_r_Const_long(irg, mode_Iu, k); ir_node *k_node = new_r_Const_long(irg, mode_Iu, k);
...@@ -1031,7 +1031,7 @@ ir_node *arch_dep_replace_mod_by_const(ir_node *irn) ...@@ -1031,7 +1031,7 @@ ir_node *arch_dep_replace_mod_by_const(ir_node *irn)
ir_node *k_node = new_r_Const_long(irg, mode_Iu, bits - k); ir_node *k_node = new_r_Const_long(irg, mode_Iu, bits - k);
curr = new_rd_Shr(dbg, block, curr, k_node); curr = new_rd_Shr(dbg, block, curr, k_node);
curr = new_rd_Add(dbg, block, left, curr, mode); curr = new_rd_Add(dbg, block, left, curr);
ir_tarval *k_val ir_tarval *k_val
= tarval_shl_unsigned(get_mode_all_one(mode), k); = tarval_shl_unsigned(get_mode_all_one(mode), k);
......
...@@ -330,8 +330,7 @@ ir_node *duplicate_subgraph(dbg_info *dbg, ir_node *n, ir_node *block) ...@@ -330,8 +330,7 @@ ir_node *duplicate_subgraph(dbg_info *dbg, ir_node *n, ir_node *block)
case iro_Add: case iro_Add:
return new_rd_Add(dbg, block, return new_rd_Add(dbg, block,
duplicate_subgraph(dbg, get_Add_left(n), block), duplicate_subgraph(dbg, get_Add_left(n), block),
duplicate_subgraph(dbg, get_Add_right(n), block), duplicate_subgraph(dbg, get_Add_right(n), block));
mode);
case iro_Sub: case iro_Sub:
return new_rd_Sub(dbg, block, return new_rd_Sub(dbg, block,
duplicate_subgraph(dbg, get_Sub_left(n), block), duplicate_subgraph(dbg, get_Sub_left(n), block),
......
...@@ -220,12 +220,12 @@ static void instrument_block(ir_node *const bb, ir_node *const address, unsigned ...@@ -220,12 +220,12 @@ static void instrument_block(ir_node *const bb, ir_node *const address, unsigned
ir_type *const type_Iu = get_entity_type(get_irn_entity_attr(address)); ir_type *const type_Iu = get_entity_type(get_irn_entity_attr(address));
ir_node *const unknown = new_r_Unknown(irg, mode_M); ir_node *const unknown = new_r_Unknown(irg, mode_M);
ir_node *const cnst = new_r_Const_long(irg, mode_Iu, get_mode_size_bytes(mode_Iu) * id); ir_node *const cnst = new_r_Const_long(irg, mode_Iu, get_mode_size_bytes(mode_Iu) * id);
ir_node *const offset = new_r_Add(bb, address, cnst, mode_P); ir_node *const offset = new_r_Add(bb, address, cnst);
ir_node *const load = new_r_Load(bb, unknown, offset, mode_Iu, type_Iu, cons_none); ir_node *const load = new_r_Load(bb, unknown, offset, mode_Iu, type_Iu, cons_none);
ir_node *const lmem = new_r_Proj(load, mode_M, pn_Load_M); ir_node *const lmem = new_r_Proj(load, mode_M, pn_Load_M);
ir_node *const proji = new_r_Proj(load, mode_Iu, pn_Load_res); ir_node *const proji = new_r_Proj(load, mode_Iu, pn_Load_res);
ir_node *const one = new_r_Const_one(irg, mode_Iu); ir_node *const one = new_r_Const_one(irg, mode_Iu);
ir_node *const add = new_r_Add(bb, proji, one, mode_Iu); ir_node *const add = new_r_Add(bb, proji, one);
ir_node *const store = new_r_Store(bb, lmem, offset, add, type_Iu, cons_none); ir_node *const store = new_r_Store(bb, lmem, offset, add, type_Iu, cons_none);
ir_node *const smem = new_r_Proj(store, mode_M, pn_Store_M); ir_node *const smem = new_r_Proj(store, mode_M, pn_Store_M);
......
...@@ -36,7 +36,7 @@ static ir_node *adjust_alloc_size(dbg_info *dbgi, ir_node *size, ir_node *block) ...@@ -36,7 +36,7 @@ static ir_node *adjust_alloc_size(dbg_info *dbgi, ir_node *size, ir_node *block)
ir_tarval *mask = tarval_shl_unsigned(shr, po2_stack_alignment); ir_tarval *mask = tarval_shl_unsigned(shr, po2_stack_alignment);
ir_tarval *invmask = tarval_not(mask); ir_tarval *invmask = tarval_not(mask);
ir_node *addv = new_r_Const(irg, invmask); ir_node *addv = new_r_Const(irg, invmask);
ir_node *add = new_rd_Add(dbgi, block, size, addv, mode); ir_node *add = new_rd_Add(dbgi, block, size, addv);
ir_node *maskc = new_r_Const(irg, mask); ir_node *maskc = new_r_Const(irg, mask);
ir_node *and = new_rd_And(dbgi, block, add, maskc); ir_node *and = new_rd_And(dbgi, block, add, maskc);
return and; return and;
......
...@@ -634,7 +634,7 @@ static void fix_int_return(cl_entry const *const entry, ...@@ -634,7 +634,7 @@ static void fix_int_return(cl_entry const *const entry,
if (offset > 0) { if (offset > 0) {
ir_mode *mode_offset = get_reference_offset_mode(mode_ref); ir_mode *mode_offset = get_reference_offset_mode(mode_ref);
ir_node *offset_cnst = new_r_Const_long(irg, mode_offset, offset); ir_node *offset_cnst = new_r_Const_long(irg, mode_offset, offset);
addr = new_r_Add(block, addr, offset_cnst, mode_ref); addr = new_r_Add(block, addr, offset_cnst);
} }
ir_node *const value = new_r_Proj(proj_res, mode, pn+i); ir_node *const value = new_r_Proj(proj_res, mode, pn+i);
ir_type *const type = get_type_for_mode(mode); ir_type *const type = get_type_for_mode(mode);
...@@ -803,7 +803,7 @@ static void transform_return(ir_node *ret, size_t n_ret_com, wlk_env *env) ...@@ -803,7 +803,7 @@ static void transform_return(ir_node *ret, size_t n_ret_com, wlk_env *env)
= get_reference_offset_mode(mode_ref); = get_reference_offset_mode(mode_ref);
ir_node *const offset_cnst ir_node *const offset_cnst
= new_r_Const_long(irg, mode_offset, offset); = new_r_Const_long(irg, mode_offset, offset);
addr = new_r_Add(block, addr, offset_cnst, mode_ref); addr = new_r_Add(block, addr, offset_cnst);
} }
ir_mode *const mode = ret_spec->modes[i]; ir_mode *const mode = ret_spec->modes[i];
ir_node *const load = new_r_Load(block, mem, addr, mode, ir_node *const load = new_r_Load(block, mem, addr, mode,
......
...@@ -68,16 +68,14 @@ static void lower_small_copyb_node(ir_node *irn) ...@@ -68,16 +68,14 @@ static void lower_small_copyb_node(ir_node *irn)
/* construct offset */ /* construct offset */
ir_node *addr_const = new_r_Const_long(irg, mode_ref_int, offset); ir_node *addr_const = new_r_Const_long(irg, mode_ref_int, offset);
ir_node *add = new_r_Add(block, addr_src, addr_const, ir_node *add = new_r_Add(block, addr_src, addr_const);
mode_ref);
ir_node *load = new_r_Load(block, mem, add, mode, tp, cons_none); ir_node *load = new_r_Load(block, mem, add, mode, tp, cons_none);
ir_node *load_res = new_r_Proj(load, mode, pn_Load_res); ir_node *load_res = new_r_Proj(load, mode, pn_Load_res);
ir_node *load_mem = new_r_Proj(load, mode_M, pn_Load_M); ir_node *load_mem = new_r_Proj(load, mode_M, pn_Load_M);
ir_node *addr_const2 = new_r_Const_long(irg, mode_ref_int, offset); ir_node *addr_const2 = new_r_Const_long(irg, mode_ref_int, offset);
ir_node *add2 = new_r_Add(block, addr_dst, addr_const2, ir_node *add2 = new_r_Add(block, addr_dst, addr_const2);
mode_ref);
ir_node *store = new_r_Store(block, load_mem, add2, load_res, ir_node *store = new_r_Store(block, load_mem, add2, load_res,
tp, cons_none); tp, cons_none);
......
...@@ -354,16 +354,15 @@ static void lower_Load(ir_node *node, ir_mode *mode) ...@@ -354,16 +354,15 @@ static void lower_Load(ir_node *node, ir_mode *mode)
ir_node *mem = get_Load_mem(node); ir_node *mem = get_Load_mem(node);
ir_type *type = get_Load_type(node); ir_type *type = get_Load_type(node);
ir_node *cnst = new_r_Const(irg, env.tv_mode_bytes); ir_node *cnst = new_r_Const(irg, env.tv_mode_bytes);
ir_mode *adr_mode = get_irn_mode(adr);
ir_node *block = get_nodes_block(node); ir_node *block = get_nodes_block(node);
ir_node *low; ir_node *low;
ir_node *high; ir_node *high;
if (env.p.big_endian) { if (env.p.big_endian) {
low = new_r_Add(block, adr, cnst, adr_mode); low = new_r_Add(block, adr, cnst);
high = adr; high = adr;
} else { } else {
low = adr; low = adr;
high = new_r_Add(block, adr, cnst, adr_mode); high = new_r_Add(block, adr, cnst);
} }
/* create two loads */ /* create two loads */
...@@ -420,15 +419,14 @@ static void lower_Store(ir_node *node, ir_mode *mode) ...@@ -420,15 +419,14 @@ static void lower_Store(ir_node *node, ir_mode *mode)
ir_type *type = get_Store_type(node); ir_type *type = get_Store_type(node);
ir_node *block = get_nodes_block(node); ir_node *block = get_nodes_block(node);
ir_node *cnst = new_r_Const(irg, env.tv_mode_bytes); ir_node *cnst = new_r_Const(irg, env.tv_mode_bytes);
ir_mode *adr_mode = get_irn_mode(adr);
ir_node *low; ir_node *low;
ir_node *high; ir_node *high;
if (env.p.big_endian) { if (env.p.big_endian) {
low = new_r_Add(block, adr, cnst, adr_mode); low = new_r_Add(block, adr, cnst);
high = adr; high = adr;
} else { } else {
low = adr; low = adr;
high = new_r_Add(block, adr, cnst, adr_mode); high = new_r_Add(block, adr, cnst);
} }
/* create two Stores */ /* create two Stores */
...@@ -1422,10 +1420,9 @@ transform: ...@@ -1422,10 +1420,9 @@ transform:
ir_node *addr = new_r_Member(block, frame_ptr, entity); ir_node *addr = new_r_Member(block, frame_ptr, entity);
dbg_info *dbgi = get_irn_dbg_info(node); dbg_info *dbgi = get_irn_dbg_info(node);
ir_node *nomem = get_irg_no_mem(irg); ir_node *nomem = get_irg_no_mem(irg);
ir_mode *addr_mode = get_irn_mode(addr);
ir_node *cnst = new_r_Const(irg, env.tv_mode_bytes); ir_node *cnst = new_r_Const(irg, env.tv_mode_bytes);
ir_node *low = addr; ir_node *low = addr;
ir_node *high = new_r_Add(block, addr, cnst, addr_mode); ir_node *high = new_r_Add(block, addr, cnst);
ir_type *src_type = get_type_for_mode(src_mode); ir_type *src_type = get_type_for_mode(src_mode);
/* big endian requires different order for lower/higher word */ /* big endian requires different order for lower/higher word */
if (env.p.big_endian) { if (env.p.big_endian) {
...@@ -2274,7 +2271,7 @@ static void lower_reduce_builtin(ir_node *builtin, ir_mode *mode) ...@@ -2274,7 +2271,7 @@ static void lower_reduce_builtin(ir_node *builtin, ir_mode *mode)
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);
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);
ir_node *high = new_rd_Add(dbgi, block, high_proj, number_of_bits, result_mode); ir_node *high = new_rd_Add(dbgi, block, high_proj, number_of_bits);
ir_node *ffs_low = new_rd_Builtin(dbgi, block, mem, 1, in_low, kind, lowered_type_low); ir_node *ffs_low = new_rd_Builtin(dbgi, block, mem, 1, in_low, kind, lowered_type_low);
ir_node *low = new_r_Proj(ffs_low, result_mode, pn_Builtin_max+1); ir_node *low = new_r_Proj(ffs_low, result_mode, pn_Builtin_max+1);
ir_node *mux_high = new_rd_Mux(dbgi, block, cmp_high, high, zero_result); ir_node *mux_high = new_rd_Mux(dbgi, block, cmp_high, high, zero_result);
...@@ -2295,7 +2292,7 @@ static void lower_reduce_builtin(ir_node *builtin, ir_mode *mode) ...@@ -2295,7 +2292,7 @@ static void lower_reduce_builtin(ir_node *builtin, ir_mode *mode)
ir_node *clz_low = new_rd_Builtin(dbgi, block, mem, 1, in_low, kind, lowered_type_low); ir_node *clz_low = new_rd_Builtin(dbgi, block, mem, 1, in_low, kind, lowered_type_low);
ir_node *low_proj = new_r_Proj(clz_low, result_mode, pn_Builtin_max+1); ir_node *low_proj = new_r_Proj(clz_low, result_mode, pn_Builtin_max+1);
ir_node *number_of_bits = new_r_Const_long(irg, result_mode, get_mode_size_bits(mode)); ir_node *number_of_bits = new_r_Const_long(irg, result_mode, get_mode_size_bits(mode));
ir_node *low = new_rd_Add(dbgi, block, low_proj, number_of_bits, result_mode); ir_node *low = new_rd_Add(dbgi, block, low_proj, number_of_bits);
res = new_rd_Mux(dbgi, block, cmp_high, high, low); res = new_rd_Mux(dbgi, block, cmp_high, high, low);
if (!allow_ifconv(cmp_high, high, low)) if (!allow_ifconv(cmp_high, high, low))
...@@ -2308,7 +2305,7 @@ static void lower_reduce_builtin(ir_node *builtin, ir_mode *mode) ...@@ -2308,7 +2305,7 @@ static void lower_reduce_builtin(ir_node *builtin, ir_mode *mode)
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);
ir_node *number_of_bits = new_r_Const_long(irg, result_mode, get_mode_size_bits(env.p.word_unsigned)); ir_node *number_of_bits = new_r_Const_long(irg, result_mode, get_mode_size_bits(env.p.word_unsigned));
ir_node *high = new_rd_Add(dbgi, block, high_proj, number_of_bits, result_mode); ir_node *high = new_rd_Add(dbgi, block, high_proj, number_of_bits);
ir_node *ffs_low = new_rd_Builtin(dbgi, block, mem, 1, in_low, kind, lowered_type_low); ir_node *ffs_low = new_rd_Builtin(dbgi, block, mem, 1, in_low, kind, lowered_type_low);
ir_node *low = new_r_Proj(ffs_low, result_mode, pn_Builtin_max+1); ir_node *low = new_r_Proj(ffs_low, result_mode, pn_Builtin_max+1);
res = new_rd_Mux(dbgi, block, cmp_low, low, high); res = new_rd_Mux(dbgi, block, cmp_low, low, high);
...@@ -2323,7 +2320,7 @@ static void lower_reduce_builtin(ir_node *builtin, ir_mode *mode) ...@@ -2323,7 +2320,7 @@ static void lower_reduce_builtin(ir_node *builtin, ir_mode *mode)
ir_node *high = new_r_Proj(popcount_high, result_mode, pn_Builtin_max+1); ir_node *high = new_r_Proj(popcount_high, result_mode, pn_Builtin_max+1);
ir_node *low = new_r_Proj(popcount_low, result_mode, pn_Builtin_max+1); ir_node *low = new_r_Proj(popcount_low, result_mode, pn_Builtin_max+1);
res = new_rd_Add(dbgi, block, high, low, result_mode); res = new_rd_Add(dbgi, block, high, low);
break; break;
} }
case ir_bk_parity: { case ir_bk_parity: {
......
...@@ -49,7 +49,7 @@ static void lower_sel(ir_node *sel) ...@@ -49,7 +49,7 @@ static void lower_sel(ir_node *sel)
element_size); element_size);
scaled_index = new_rd_Mul(dbg, bl, idx_conv, el_size); scaled_index = new_rd_Mul(dbg, bl, idx_conv, el_size);
} }
newn = new_rd_Add(dbg, bl, ptr, scaled_index, mode); newn = new_rd_Add(dbg, bl, ptr, scaled_index);
} }
hook_lower(sel); hook_lower(sel);
...@@ -81,7 +81,7 @@ static void lower_member(ir_node *member) ...@@ -81,7 +81,7 @@ static void lower_member(ir_node *member)
ir_mode *const mode_offset = get_reference_offset_mode(mode); ir_mode *const mode_offset = get_reference_offset_mode(mode);
ir_node *const cnst ir_node *const cnst
= new_r_Const_long(irg, mode_offset, offset); = new_r_Const_long(irg, mode_offset, offset);
newn = new_rd_Add(dbg, bl, ptr, cnst, mode); newn = new_rd_Add(dbg, bl, ptr, cnst);
} else { } else {
newn = ptr; newn = ptr;
} }
......
...@@ -2704,8 +2704,7 @@ static ir_node *transform_node_Or(ir_node *n) ...@@ -2704,8 +2704,7 @@ static ir_node *transform_node_Or(ir_node *n)
ir_node *block = get_nodes_block(n); ir_node *block = get_nodes_block(n);
ir_node *left = get_Or_left(n); ir_node *left = get_Or_left(n);
ir_node *right = get_Or_right(n); ir_node *right = get_Or_right(n);
ir_mode *mode = get_irn_mode(n); return new_rd_Add(dbgi, block, left, right);
return new_rd_Add(dbgi, block, left, right, mode);
} }
return transform_node_Or_(n); return transform_node_Or_(n);
} }
...@@ -2803,7 +2802,7 @@ static ir_node *transform_node_Eor_(ir_node *n) ...@@ -2803,7 +2802,7 @@ static ir_node *transform_node_Eor_(ir_node *n)
ir_tarval *taa = get_Const_tarval(aa); ir_tarval *taa = get_Const_tarval(aa);
ir_tarval *tc = tarval_sub(tb, taa); ir_tarval *tc = tarval_sub(tb, taa);
ir_node *c = new_rd_Const(dbgi, irg, tc); ir_node *c = new_rd_Const(dbgi, irg, tc);
return new_rd_Add(dbgi, block, ab, c, mode); return new_rd_Add(dbgi, block, ab, c);
} }
} }
} }
...@@ -2816,7 +2815,7 @@ static ir_node *transform_node_Eor_(ir_node *n) ...@@ -2816,7 +2815,7 @@ static ir_node *transform_node_Eor_(ir_node *n)
dbg_info *dbgi = get_irn_dbg_info(n); dbg_info *dbgi = get_irn_dbg_info(n);
ir_node *block = get_nodes_block(n); ir_node *block = get_nodes_block(n);
ir_node *op = get_Minus_op(a); ir_node *op = get_Minus_op(a);
return new_rd_Add(dbgi, block, op, b, mode); return new_rd_Add(dbgi, block, op, b);
} }