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
long increment = round_up2(get_mode_size_bytes(resmode), 8);
ir_mode *offset_mode = get_reference_offset_mode(mode_P);
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, mode_stack_args);
ir_node *stack_args_inc = new_rd_Add(dbgi, block, stack_args, sizeof_resmode);
make_store(dbgi, block, stack_args_ptr, stack_args_inc, stack_args_type, mem);
return result;
......@@ -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 *offset_mode = get_reference_offset_mode(mode_reg_save);
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);
// 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);
// False side: Load from the stack
......
......@@ -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 *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 *add1 = new_rd_Add(dbgi, block, mul2, mul1, mode);
ir_node *add2 = new_rd_Add(dbgi, block, add1, umull_high, mode);
ir_node *add1 = new_rd_Add(dbgi, block, mul2, mul1);
ir_node *add2 = new_rd_Add(dbgi, block, add1, umull_high);
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,
ir_mode *mode_ref = get_irn_mode(addr);
ir_mode *mode_offs = get_reference_offset_mode(mode_ref);
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,
tp, cons_none);
mem = new_r_Proj(store1, mode_M, pn_Store_M);
......
......@@ -46,7 +46,7 @@ void be_default_lower_va_arg(ir_node *node)
be_params->stack_param_align);
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 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 };
turn_into_tuple(node, ARRAY_SIZE(in), in);
......
......@@ -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));
if (cr == no_carry) {
ir_node *add_low = new_rd_Add(dbg, block, left_low, right_low, low_mode);
ir_node *add_high = new_rd_Add(dbg, block, left_high, right_high, high_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);
ir_set_dw_lowered(node, add_low, add_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.
......@@ -167,9 +167,9 @@ static void ia32_lower_add64(ir_node *node, ir_mode *mode)
ir_graph *irg = get_irn_irg(right_high);
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 *add_high = new_rd_Add(dbg, block, other, const_plus_one, high_mode);
ir_node *add_low = new_rd_Add(dbg, block, left_low, right_low, low_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);
ir_node *add_low = new_rd_Add(dbg, block, left_low, right_low);
ir_set_dw_lowered(node, add_low, add_high);
} else {
/* l_res = a_l + b_l */
......@@ -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));
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);
} else if (is_Const(left_high)) {
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)
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 *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 *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);
}
......@@ -413,7 +413,7 @@ static void ia32_lower_conv64(ir_node *node, ir_mode *mode)
pn_ia32_l_FloattoLL_res_low);
h_res = new_r_Proj(float_to_ll, mode,
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 */
set_nodes_block(node, lower_blk);
......
......@@ -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_node *reloc = be_new_Relocation(irg, (unsigned)kind, entity, offset_mode);
/* 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. */
mark_irn_visited(add);
return add;
......
......@@ -171,7 +171,7 @@ static void rewrite_unsigned_float_Conv(ir_node *node)
ir_tarval *correction = new_tarval_from_double(4294967296., mode_d);
ir_node *c_const = new_r_Const(irg, correction);
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 *phi_in[2] = { fadd, res };
......
......@@ -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 *c = new_r_Const_long(irg, env->shf_mode, inst->shift_count);
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: {
ir_node *l = build_graph(env, inst->in[0]);
......@@ -415,7 +415,7 @@ static ir_node *build_graph(mul_env *env, instruction *inst)
case ADD: {
ir_node *l = build_graph(env, inst->in[0]);
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:
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)
/* do we need an Add or Sub */
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)
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)
/* final */
ir_node *c2 = new_r_Const_long(irg, mode_Iu, bits - 1);
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 {
struct magicu_info mafo = get_magic_info(tv);
ir_graph *irg = get_irn_irg(div);
......@@ -949,7 +949,7 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn)
* 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);
......@@ -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);
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
= 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)
case iro_Add:
return new_rd_Add(dbg, block,
duplicate_subgraph(dbg, get_Add_left(n), block),
duplicate_subgraph(dbg, get_Add_right(n), block),
mode);
duplicate_subgraph(dbg, get_Add_right(n), block));
case iro_Sub:
return new_rd_Sub(dbg, 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
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 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 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 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 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)
ir_tarval *mask = tarval_shl_unsigned(shr, po2_stack_alignment);
ir_tarval *invmask = tarval_not(mask);
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 *and = new_rd_And(dbgi, block, add, maskc);
return and;
......
......@@ -634,7 +634,7 @@ static void fix_int_return(cl_entry const *const entry,
if (offset > 0) {
ir_mode *mode_offset = get_reference_offset_mode(mode_ref);
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_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)
= get_reference_offset_mode(mode_ref);
ir_node *const 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_mode *const mode = ret_spec->modes[i];
ir_node *const load = new_r_Load(block, mem, addr, mode,
......
......@@ -68,16 +68,14 @@ static void lower_small_copyb_node(ir_node *irn)
/* construct 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,
mode_ref);
ir_node *add = new_r_Add(block, addr_src, addr_const);
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_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 *add2 = new_r_Add(block, addr_dst, addr_const2,
mode_ref);
ir_node *add2 = new_r_Add(block, addr_dst, addr_const2);
ir_node *store = new_r_Store(block, load_mem, add2, load_res,
tp, cons_none);
......
......@@ -354,16 +354,15 @@ static void lower_Load(ir_node *node, ir_mode *mode)
ir_node *mem = get_Load_mem(node);
ir_type *type = get_Load_type(node);
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 *low;
ir_node *high;
if (env.p.big_endian) {
low = new_r_Add(block, adr, cnst, adr_mode);
low = new_r_Add(block, adr, cnst);
high = adr;
} else {
low = adr;
high = new_r_Add(block, adr, cnst, adr_mode);
high = new_r_Add(block, adr, cnst);
}
/* create two loads */
......@@ -420,15 +419,14 @@ static void lower_Store(ir_node *node, ir_mode *mode)
ir_type *type = get_Store_type(node);
ir_node *block = get_nodes_block(node);
ir_node *cnst = new_r_Const(irg, env.tv_mode_bytes);
ir_mode *adr_mode = get_irn_mode(adr);
ir_node *low;
ir_node *high;
if (env.p.big_endian) {
low = new_r_Add(block, adr, cnst, adr_mode);
low = new_r_Add(block, adr, cnst);
high = adr;
} else {
low = adr;
high = new_r_Add(block, adr, cnst, adr_mode);
high = new_r_Add(block, adr, cnst);
}
/* create two Stores */
......@@ -1422,10 +1420,9 @@ transform:
ir_node *addr = new_r_Member(block, frame_ptr, entity);
dbg_info *dbgi = get_irn_dbg_info(node);
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 *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);
/* big endian requires different order for lower/higher word */
if (env.p.big_endian) {
......@@ -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 *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 = 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 *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);
......@@ -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 *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 *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);
if (!allow_ifconv(cmp_high, high, low))
......@@ -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 *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 *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 *low = new_r_Proj(ffs_low, result_mode, pn_Builtin_max+1);
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)
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);
res = new_rd_Add(dbgi, block, high, low, result_mode);
res = new_rd_Add(dbgi, block, high, low);
break;
}
case ir_bk_parity: {
......
......@@ -49,7 +49,7 @@ static void lower_sel(ir_node *sel)
element_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);
......@@ -81,7 +81,7 @@ static void lower_member(ir_node *member)
ir_mode *const mode_offset = get_reference_offset_mode(mode);
ir_node *const cnst
= 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 {
newn = ptr;
}
......
......@@ -2704,8 +2704,7 @@ static ir_node *transform_node_Or(ir_node *n)
ir_node *block = get_nodes_block(n);
ir_node *left = get_Or_left(n);
ir_node *right = get_Or_right(n);
ir_mode *mode = get_irn_mode(n);
return new_rd_Add(dbgi, block, left, right, mode);
return new_rd_Add(dbgi, block, left, right);
}
return transform_node_Or_(n);
}
......@@ -2803,7 +2802,7 @@ static ir_node *transform_node_Eor_(ir_node *n)
ir_tarval *taa = get_Const_tarval(aa);
ir_tarval *tc = tarval_sub(tb, taa);
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)
dbg_info *dbgi = get_irn_dbg_info(n);
ir_node *block = get_nodes_block(n);
ir_node *op = get_Minus_op(a);
return new_rd_Add(dbgi, block, op, b, mode);
return new_rd_Add(dbgi, block, op, b);
}
}
}
......@@ -2991,8 +2990,7 @@ static ir_node *transform_node_Eor(ir_node *n)
ir_node *block = get_nodes_block(n);
ir_node *left = get_Eor_left(n);
ir_node *right = get_Eor_right(n);
ir_mode *mode = get_irn_mode(n);
return new_rd_Add(dbgi, block, left, right, mode);
return new_rd_Add(dbgi, block, left, right);
}
return transform_node_Eor_(n);
}
......@@ -3165,7 +3163,7 @@ mul_y_plus_1:;
mul_y_plus_z:;
dbg_info *const dbgi = get_irn_dbg_info(n);
ir_node *const block = get_nodes_block(n);
ir_node *const sum = new_rd_Add(dbgi, block, y, z, mode);
ir_node *const sum = new_rd_Add(dbgi, block, y, z);
return new_rd_Mul(dbgi, block, x, sum);
}
}
......@@ -3197,8 +3195,7 @@ normalize_p:;
= get_reference_offset_mode(ref_mode);
ir_node *const conv_o = new_r_Conv(block, other_op,
offset_mode);
ir_node *const new_add = new_rd_Add(dbgi, block, conv_op,
conv_o, ref_mode);
ir_node *const new_add = new_rd_Add(dbgi, block, conv_op, conv_o);
ir_node *const conv = new_r_Conv(block, new_add, mode);
return conv;
}
......@@ -3301,7 +3298,7 @@ static ir_node *transform_node_Sub(ir_node *n)
ir_node *block = get_nodes_block(n);
dbg_info *dbgi = get_irn_dbg_info(n);
n = new_rd_Add(dbgi, block, a, cnst, mode);
n = new_rd_Add(dbgi, block, a, cnst);
DBG_OPT_ALGSIM0(oldn, n);
return n;
}
......@@ -3332,7 +3329,7 @@ static ir_node *transform_node_Sub(ir_node *n)
dbg_info *dbg = get_irn_dbg_info(n);
ir_node *block = get_nodes_block(n);
ir_node *left = get_Minus_op(a);
ir_node *add = new_rd_Add(dbg, block, left, b, mode);
ir_node *add = new_rd_Add(dbg, block, left, b);
n = new_rd_Minus(dbg, block, add);
DBG_OPT_ALGSIM0(oldn, n);
......@@ -3345,7 +3342,7 @@ static ir_node *transform_node_Sub(ir_node *n)
ir_node *block = get_nodes_block(n);
ir_node *right = get_Minus_op(b);
n = new_rd_Add(dbg, block, a, right, mode);
n = new_rd_Add(dbg, block, a, right);
DBG_OPT_ALGSIM0(oldn, n);
return n;
}
......@@ -3364,14 +3361,14 @@ static ir_node *transform_node_Sub(ir_node *n)
if (s_mode != mode)
s_right = new_r_Conv(lowest_block, s_right, mode);
n = new_rd_Add(a_dbg, lowest_block, sub, s_right, mode);
n = new_rd_Add(a_dbg, lowest_block, sub, s_right);
} else {
ir_node *s_block = get_nodes_block(b);
ir_node *sub = new_rd_Sub(s_dbg, s_block, s_right, s_left, s_mode);
dbg_info *a_dbg = get_irn_dbg_info(n);
ir_node *a_block = get_nodes_block(n);
n = new_rd_Add(a_dbg, a_block, a, sub, mode);
n = new_rd_Add(a_dbg, a_block, a, sub);
}
DBG_OPT_ALGSIM0(oldn, n);
return n;
......@@ -3468,30 +3465,9 @@ static ir_node *transform_node_Sub(ir_node *n)
}
if (is_Sub(a)) { /* (x - y) - b -> x - (y + b) */
ir_node *y = get_Sub_right(a);
ir_mode *m_b = get_irn_mode(b);
ir_mode *m_y = get_irn_mode(y);
ir_mode *add_mode;
/* Determine the right mode for the Add. */
if (m_b == m_y) {
add_mode = m_b;
} else if (mode_is_reference(m_b)) {
add_mode = m_b;
} else if (mode_is_reference(m_y)) {
add_mode = m_y;
} else {
/*
* Both modes are different but none is reference,
* happens for instance in SubP(SubP(P, Iu), Is).
* We have two possibilities here: Cast or ignore.
* Currently we ignore this case.
*/
return n;
}
ir_node *x = get_Sub_left(a);
ir_node *blk = get_nodes_block(n);
ir_node *add = new_r_Add(blk, y, b, add_mode);
ir_node *add = new_r_Add(blk, y, b);
n = new_rd_Sub(get_irn_dbg_info(n), blk, x, add, mode);
DBG_OPT_ALGSIM0(oldn, n);
......@@ -3509,7 +3485,7 @@ static ir_node *transform_node_Sub(ir_node *n)
ir_node *blk = get_nodes_block(n);
ir_graph *irg = get_irn_irg(n);
ir_node *c = new_r_Const(irg, add);
n = new_rd_Add(get_irn_dbg_info(n), blk, get_Not_op(b), c, mode);
n = new_rd_Add(get_irn_dbg_info(n), blk, get_Not_op(b), c);
DBG_OPT_ALGSIM0(oldn, n);
return n;
}
......@@ -3532,8 +3508,7 @@ static ir_node *transform_node_Sub(ir_node *n)
if (is_Not(a)) {
dbg_info *dbgi = get_irn_dbg_info(n);
ir_node *block = get_nodes_block(n);
ir_mode *mode = get_irn_mode(n);
ir_node *add = new_rd_Add(dbgi, block, get_Not_op(a), b, mode);
ir_node *add = new_rd_Add(dbgi, block, get_Not_op(a), b);
ir_node *not = new_rd_Not(dbgi, block, add);
return not;
}
......@@ -3645,7 +3620,7 @@ static ir_node *can_negate_cheaply(dbg_info *const dbgi, ir_node *const node)
ir_node *c1 = new_r_Const_one(irg, mode);
ir_node *block = get_nodes_block(node);
ir_node *op = get_Not_op(node);
return new_rd_Add(dbgi, block, op, c1, mode);
return new_rd_Add(dbgi, block, op, c1);
}
/* -(a >>u (size-1)) = a >>s (size-1)
* -(a >>s (size-1)) = a >>u (size-1) */
......@@ -3702,7 +3677,6 @@ static ir_node *transform_node_Mul(ir_node *n)
/* Normalize (x+C1) * C2 => x*C2 + (C1*C2),
* but only do this if we can be sure that the add has only 1 user */
if (is_Add(a) && only_one_user(a)) {
ir_mode *mode = get_irn_mode(a);
ir_node *add_right = get_Add_right(a);
if (is_Const(add_right) && arith == irma_twos_complement) {
ir_tarval *c2 = get_Const_tarval(add_right);
......@@ -3714,7 +3688,7 @@ static ir_node *transform_node_Mul(ir_node *n)
ir_tarval *c1_c2 = tarval_mul(c1, c2);
ir_graph *irg = get_irn_irg(n);
ir_node *cnst = new_r_Const(irg, c1_c2);
ir_node *add = new_rd_Add(dbgi, block, mul, cnst, mode);
ir_node *add = new_rd_Add(dbgi, block, mul, cnst);
return add;
}
}
......@@ -3805,7 +3779,7 @@ static ir_node *transform_node_Mul(ir_node *n)
if (tarval_get_exponent(tv) == 1 && tarval_zero_mantissa(tv)
&& !tarval_is_negative(tv)) {
/* 2.0 * b = b + b */
n = new_rd_Add(get_irn_dbg_info(n), get_nodes_block(n), b, b, mode);
n = new_rd_Add(get_irn_dbg_info(n), get_nodes_block(n), b, b);
DBG_OPT_ALGSIM1(oldn, a, b, n);
return n;
}
......@@ -3814,7 +3788,7 @@ static ir_node *transform_node_Mul(ir_node *n)
if (tarval_get_exponent(tv) == 1 && tarval_zero_mantissa(tv)
&& !tarval_is_negative(tv)) {
/* a * 2.0 = a + a */
n = new_rd_Add(get_irn_dbg_info(n), get_nodes_block(n), a, a, mode);
n = new_rd_Add(get_irn_dbg_info(n), get_nodes_block(n), a, a);
DBG_OPT_ALGSIM1(oldn, a, b, n);
return n;
}
......@@ -4591,7 +4565,7 @@ static ir_node *transform_node_Not(ir_node *n)
ir_node *block = get_nodes_block(n);
ir_node *add_l = get_Minus_op(a);
ir_node *add_r = new_rd_Const(dbg, irg, get_mode_all_one(mode));
return new_rd_Add(dbg, block, add_l, add_r, mode);
return new_rd_Add(dbg, block, add_l, add_r);
}
if (is_Add(a) || is_Or_Eor_Add(a)) {
ir_node *add_r = get_binop_right(a);
......@@ -4626,7 +4600,7 @@ static ir_node *transform_node_Not(ir_node *n)
ir_node *block = get_nodes_block(a);
ir_node *sub_r = get_Sub_right(a);
return new_rd_Add(dbg, block, sub_r, cnst, mode);
return new_rd_Add(dbg, block, sub_r, cnst);
}
}
}
......@@ -4806,7 +4780,7 @@ static ir_node *transform_node_Proj_Builtin(ir_node *proj)
ir_mode *const mode = get_irn_mode(proj);
ir_tarval *const one = get_mode_one(mode);
ir_node *const c = new_rd_Const(dbgi, irg, one);
return new_rd_Add(dbgi, block, op, c, mode);
return new_rd_Add(dbgi, block, op, c);
}
return proj;
......@@ -6077,7 +6051,7 @@ static ir_node *transform_node_shift_modulo(ir_node *n,
dbg_info *dbgi = get_irn_dbg_info(right);
ir_node *newconst = new_r_Const(irg, tv_mod);
newop = new_rd_Add(dbgi, block, get_binop_left(right), newconst, mode_right);
newop = new_rd_Add(dbgi, block, get_binop_left(right), newconst);
}
} else if (is_Sub(right)) {
ir_node *sub_left = get_Sub_left(right);
......
......@@ -543,7 +543,7 @@ static changes_t try_load_after_load(track_load_env_t *env, ir_node *prev_load)
ir_mode *const ptr_mode = get_irn_mode(prev_ptr);
ir_mode *const ptr_mode_offs = get_reference_offset_mode(ptr_mode);
ir_node *const c = new_r_Const_long(irg, ptr_mode_offs, delta);
ir_node *const add = new_r_Add(block, prev_ptr, c, ptr_mode);
ir_node *const add = new_r_Add(block, prev_ptr, c);
set_Load_ptr(prev_load, add);
/* Change mode of previous load. */
......@@ -606,7 +606,7 @@ static bool try_update_ptr_CopyB(track_load_env_t *env, ir_node *copyb)
ir_mode *mode_offset = get_reference_offset_mode(mode_ref);