Commit 9500e1cb authored by Christoph Mallon's avatar Christoph Mallon
Browse files

When making a 'Sub', automatically infer its mode from its operands.

parent d4e62cfa
......@@ -290,7 +290,7 @@ static void rewrite_float_unsigned_Conv(ir_node *node)
/* true block: Do some arithmetic to use the signed conversion */
ir_node *true_block = new_r_Block(irg, ARRAY_SIZE(in_true), in_true);
ir_node *true_jmp = new_r_Jmp(true_block);
ir_node *sub = new_r_Sub(true_block, fp_const, fp_x, src_mode);
ir_node *sub = new_r_Sub(true_block, fp_const, fp_x);
ir_node *sub_conv = new_rd_Conv(dbgi, true_block, sub, mode_Ls);
ir_node *sign_bit = create_sign_bit_const(irg);
collect_new_start_block_node(sign_bit);
......
......@@ -238,11 +238,11 @@ static void lower64_shl(ir_node *node, ir_mode *mode)
ir_node *shl1 = new_rd_Shl(dbgi, block, left_high, right_low);
ir_graph *irg = get_irn_irg(node);
ir_node *c32 = new_r_Const_long(irg, umode, 32);
ir_node *sub = new_rd_Sub(dbgi, block, right_low, c32, umode);
ir_node *sub = new_rd_Sub(dbgi, block, right_low, c32);
ir_node *llo_conv = new_rd_Conv(dbgi, block, left_low, mode);
ir_node *shl2 = new_rd_Shl(dbgi, block, llo_conv, sub);
ir_node *or = new_rd_Or(dbgi, block, shl1, shl2);
ir_node *sub2 = new_rd_Sub(dbgi, block, c32, right_low, umode);
ir_node *sub2 = new_rd_Sub(dbgi, block, c32, right_low);
ir_node *shr = new_rd_Shr(dbgi, block, llo_conv, sub2);
ir_node *or2 = new_rd_Or(dbgi, block, or, shr);
/* Res_lo = L_lo << R */
......@@ -271,11 +271,11 @@ static void lower64_shr(ir_node *node, ir_mode *mode)
ir_node *shr1 = new_rd_Shr(dbgi, block, left_low, right_low);
ir_graph *irg = get_irn_irg(node);
ir_node *c32 = new_r_Const_long(irg, umode, 32);
ir_node *sub = new_rd_Sub(dbgi, block, right_low, c32, umode);
ir_node *sub = new_rd_Sub(dbgi, block, right_low, c32);
ir_node *lhi_conv = new_rd_Conv(dbgi, block, left_high, umode);
ir_node *shr2 = new_rd_Shr(dbgi, block, lhi_conv, sub);
ir_node *or = new_rd_Or(dbgi, block, shr1, shr2);
ir_node *sub2 = new_rd_Sub(dbgi, block, c32, right_low, umode);
ir_node *sub2 = new_rd_Sub(dbgi, block, c32, right_low);
ir_node *shl = new_rd_Shl(dbgi, block, lhi_conv, sub2);
ir_node *or2 = new_rd_Or(dbgi, block, or, shl);
/* Res_hi = L_hi >> R */
......@@ -304,7 +304,7 @@ static void lower64_shrs(ir_node *node, ir_mode *mode)
ir_node *shr = new_rd_Shr(dbgi, block, left_low, right_low);
ir_graph *irg = get_irn_irg(node);
ir_node *c32 = new_r_Const_long(irg, umode, 32);
ir_node *sub = new_rd_Sub(dbgi, block, c32, right_low, umode);
ir_node *sub = new_rd_Sub(dbgi, block, c32, right_low);
ir_node *subs = new_bd_arm_SubS_t(dbgi, block, right_low, c32);
ir_node *subs_res = new_r_Proj(subs, umode, pn_arm_SubS_t_res);
ir_node *subs_flags = new_r_Proj(subs, mode_ANY, pn_arm_SubS_t_flags);
......
......@@ -201,32 +201,32 @@ static void ia32_lower_sub64(ir_node *node, ir_mode *mode)
ir_node *right_low = get_lowered_low(right);
ir_node *right_high = get_lowered_high(right);
ir_mode *low_mode = get_irn_mode(left_low);
ir_mode *high_mode = get_irn_mode(left_high);
carry_result cr = lower_sub_borrow(left, right, low_mode);
assert(get_irn_mode(left_low) == get_irn_mode(right_low));
assert(get_irn_mode(left_high) == get_irn_mode(right_high));
if (cr == no_carry) {
ir_node *sub_low = new_rd_Sub(dbg, block, left_low, right_low, low_mode);
ir_node *sub_high = new_rd_Sub(dbg, block, left_high, right_high, high_mode);
ir_node *sub_low = new_rd_Sub(dbg, block, left_low, right_low);
ir_node *sub_high = new_rd_Sub(dbg, block, left_high, right_high);
ir_set_dw_lowered(node, sub_low, sub_high);
} else if (cr == must_carry && (is_Const(left_high) || is_Const(right_high))) {
ir_node *sub_high;
ir_graph *irg = get_irn_irg(right_high);
ir_mode *high_mode = get_irn_mode(left_high);
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);
sub_high = new_rd_Sub(dbg, block, left_high, new_const, high_mode);
sub_high = new_rd_Sub(dbg, block, left_high, new_const);
} else if (is_Const(left_high)) {
ir_node *new_const = new_rd_Sub(dbg, block, left_high, one, high_mode);
sub_high = new_rd_Sub(dbg, block, new_const, right_high, high_mode);
ir_node *new_const = new_rd_Sub(dbg, block, left_high, one);
sub_high = new_rd_Sub(dbg, block, new_const, right_high);
} else {
panic("logic error");
}
ir_node *sub_low = new_rd_Sub(dbg, block, left_low, right_low, low_mode);
ir_node *sub_low = new_rd_Sub(dbg, block, left_low, right_low);
ir_set_dw_lowered(node, sub_low, sub_high);
} else {
/* l_res = a_l - b_l */
......@@ -396,7 +396,7 @@ static void ia32_lower_conv64(ir_node *node, ir_mode *mode)
ir_node *fphi_in[] = {
opc,
new_rd_Sub(dbg, upper_blk, opc, flt_corr, x86_mode_E)
new_rd_Sub(dbg, upper_blk, opc, flt_corr)
};
ir_node *flt_phi
= new_r_Phi(lower_blk, ARRAY_SIZE(fphi_in), fphi_in,
......
......@@ -226,8 +226,7 @@ static void rewrite_float_unsigned_Conv(ir_node *node)
ir_node *c_const = new_r_Const_long(irg, mode_s, 0x80000000L);
collect_new_start_block_node(c_const);
ir_node *sub = new_rd_Sub(dbgi, true_block, float_x, limitc,
mode_f);
ir_node *sub = new_rd_Sub(dbgi, true_block, float_x, limitc);
ir_node *sub_conv = new_rd_Conv(dbgi, true_block, sub, mode_s);
ir_node *xorn = new_rd_Eor(dbgi, true_block, sub_conv, c_const);
......
......@@ -410,7 +410,7 @@ static ir_node *build_graph(mul_env *env, instruction *inst)
case SUB: {
ir_node *l = build_graph(env, inst->in[0]);
ir_node *r = build_graph(env, inst->in[1]);
return inst->irn = new_rd_Sub(env->dbg, env->blk, l, r, env->mode);
return inst->irn = new_rd_Sub(env->dbg, env->blk, l, r);
}
case ADD: {
ir_node *l = build_graph(env, inst->in[0]);
......@@ -838,7 +838,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, ir_tarval *tv)
if (mag.need_add)
q = new_rd_Add(dbg, block, q, n);
else if (mag.need_sub)
q = new_rd_Sub(dbg, block, q, n, mode);
q = new_rd_Sub(dbg, block, q, n);
/* Do we need the shift */
if (mag.s > 0) {
......@@ -957,7 +957,7 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn)
if (n_flag) { /* negate the result */
ir_node *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);
}
} else { /* unsigned case */
ir_node *k_node = new_r_Const_long(irg, mode_Iu, k);
......@@ -1037,7 +1037,7 @@ ir_node *arch_dep_replace_mod_by_const(ir_node *irn)
= tarval_shl_unsigned(get_mode_all_one(mode), k);
k_node = new_r_Const(irg, k_val);
curr = new_rd_And(dbg, block, curr, k_node);
res = new_rd_Sub(dbg, block, left, curr, mode);
res = new_rd_Sub(dbg, block, left, curr);
} else { /* unsigned case */
ir_tarval *k_val
= tarval_shr_unsigned(get_mode_all_one(mode),
......@@ -1049,7 +1049,7 @@ ir_node *arch_dep_replace_mod_by_const(ir_node *irn)
} else if (allow_Mulh(params, mode)) {
res = replace_div_by_mulh(irn, tv);
res = new_rd_Mul(dbg, block, res, c);
res = new_rd_Sub(dbg, block, left, res, mode);
res = new_rd_Sub(dbg, block, left, res);
}
return res;
......
......@@ -334,8 +334,7 @@ ir_node *duplicate_subgraph(dbg_info *dbg, ir_node *n, ir_node *block)
case iro_Sub:
return new_rd_Sub(dbg, block,
duplicate_subgraph(dbg, get_Sub_left(n), block),
duplicate_subgraph(dbg, get_Sub_right(n), block),
mode);
duplicate_subgraph(dbg, get_Sub_right(n), block));
case iro_Mul:
return new_rd_Mul(dbg, block,
duplicate_subgraph(dbg, get_Mul_left(n), block),
......
......@@ -243,7 +243,7 @@ static bool normalize_switch(switch_info_t *info, ir_mode *selector_mode)
ir_graph *irg = get_irn_irg(switchn);
ir_node *min_const = new_r_Const(irg, min);
dbg_info *dbgi = get_irn_dbg_info(switchn);
selector = new_rd_Sub(dbgi, block, selector, min_const, mode);
selector = new_rd_Sub(dbgi, block, selector, min_const);
info->switch_max = tarval_sub(info->switch_max, min);
info->switch_min = get_mode_null(mode);
......@@ -286,8 +286,7 @@ static ir_node *create_case_cond(const ir_switch_table_entry *entry,
cmp = new_rd_Cmp(dbgi, block, selector, minconst, ir_relation_equal);
} else {
ir_tarval *adjusted_max = tarval_sub(entry->max, entry->min);
ir_node *sub = new_rd_Sub(dbgi, block, selector, minconst,
get_tarval_mode(adjusted_max));
ir_node *sub = new_rd_Sub(dbgi, block, selector, minconst);
ir_node *maxconst = new_r_Const(irg, adjusted_max);
cmp = new_rd_Cmp(dbgi, block, sub, maxconst, ir_relation_less_equal);
}
......
......@@ -232,7 +232,7 @@ static ir_node *bool_and(cond_pair* const cpair, ir_node *dst_block)
return NULL;
}
c = new_r_Const(irg, tv_lo);
sub = new_r_Sub(block, x, c, mode);
sub = new_r_Sub(block, x, c);
subc = new_r_Const(irg, tarval_sub(tv_hi, tv_lo));
cmp = new_r_Cmp(block, sub, subc, rel_hi);
return cmp;
......@@ -363,7 +363,7 @@ static ir_node *bool_or(cond_pair *const cpair, ir_node *dst_block)
return NULL;
}
c = new_r_Const(irg, tv_lo);
sub = new_r_Sub(block, x, c, mode);
sub = new_r_Sub(block, x, c);
subc = new_r_Const(irg, tarval_sub(tv_hi, tv_lo));
cmp = new_r_Cmp(block, sub, subc, rel_hi);
return cmp;
......
......@@ -2789,7 +2789,7 @@ static ir_node *transform_node_Eor_(ir_node *n)
ir_tarval *tab = get_Const_tarval(ab);
ir_tarval *tc = tarval_sub(tb, tab);
ir_node *c = new_rd_Const(dbgi, irg, tc);
return new_rd_Sub(dbgi, block, c, aa, mode);
return new_rd_Sub(dbgi, block, c, aa);
}
} else if (is_Sub(a)) {
ir_node *aa = get_Sub_left(a);
......@@ -3041,7 +3041,7 @@ static ir_node *transform_node_Add(ir_node *n)
ir_node *block = get_nodes_block(n);
ir_node *cnst = new_r_Const(irg, tv);
ir_node *sub_r = get_Sub_right(a);
return new_rd_Sub(dbgi, block, cnst, sub_r, mode);
return new_rd_Sub(dbgi, block, cnst, sub_r);
}
}
}
......@@ -3079,7 +3079,7 @@ static ir_node *transform_node_Add(ir_node *n)
/* -a + b -> b - a */
dbg_info *const dbgi = get_irn_dbg_info(n);
ir_node *const block = get_nodes_block(n);
n = new_rd_Sub(dbgi, block, b, get_Minus_op(a), mode);
n = new_rd_Sub(dbgi, block, b, get_Minus_op(a));
DBG_OPT_ALGSIM0(oldn, n);
return n;
}
......@@ -3087,7 +3087,7 @@ static ir_node *transform_node_Add(ir_node *n)
/* a + -b -> a - b */
dbg_info *const dbgi = get_irn_dbg_info(n);
ir_node *const block = get_nodes_block(n);
n = new_rd_Sub(dbgi, block, a, get_Minus_op(b), mode);
n = new_rd_Sub(dbgi, block, a, get_Minus_op(b));
DBG_OPT_ALGSIM0(oldn, n);
return n;
}
......@@ -3106,7 +3106,7 @@ static ir_node *transform_node_Add(ir_node *n)
dbg_info *const dbgi = get_irn_dbg_info(n);
ir_node *const block = get_nodes_block(n);
ir_node *const c = new_rd_Const(dbgi, irg, add);
n = new_rd_Sub(dbgi, block, c, op, mode);
n = new_rd_Sub(dbgi, block, c, op);
DBG_OPT_ALGSIM0(oldn, n);
return n;
}
......@@ -3319,7 +3319,7 @@ static ir_node *transform_node_Sub(ir_node *n)
ir_node *block = get_nodes_block(n);
ir_node *cnst = new_r_Const(irg, tv);
ir_node *add_l = get_Add_left(b);
return new_rd_Sub(dbgi, block, cnst, add_l, mode);
return new_rd_Sub(dbgi, block, cnst, add_l);
}
}
}
......@@ -3356,7 +3356,7 @@ static ir_node *transform_node_Sub(ir_node *n)
ir_mode *s_mode = get_irn_mode(b);
if (mode_is_reference(s_mode)) {
ir_node *lowest_block = get_nodes_block(n); /* a and b are live here */
ir_node *sub = new_rd_Sub(s_dbg, lowest_block, a, s_left, mode);
ir_node *sub = new_rd_Sub(s_dbg, lowest_block, a, s_left);
dbg_info *a_dbg = get_irn_dbg_info(n);
if (s_mode != mode)
......@@ -3364,7 +3364,7 @@ static ir_node *transform_node_Sub(ir_node *n)
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);
ir_node *sub = new_rd_Sub(s_dbg, s_block, s_right, s_left);
dbg_info *a_dbg = get_irn_dbg_info(n);
ir_node *a_block = get_nodes_block(n);
......@@ -3435,12 +3435,11 @@ static ir_node *transform_node_Sub(ir_node *n)
unsigned const mode_size = get_mode_size_bits(mode);
unsigned const ma_size = get_mode_size_bits(ma);
if (ma_size == mode_size) {
ir_mode *const offset_mode = get_reference_offset_mode(ma);
/* SubInt(ConvInt(aP), ConvInt(bP)) -> SubInt(aP,bP) */
dbg_info *const dbgi = get_irn_dbg_info(n);
ir_node *const block = get_nodes_block(n);
ir_node *const new_sub
= new_rd_Sub(dbgi, block, op_a, op_b, offset_mode);
= new_rd_Sub(dbgi, block, op_a, op_b);
ir_node *const conv
= new_rd_Conv(dbgi, block, new_sub, mode);
return conv;
......@@ -3457,7 +3456,7 @@ static ir_node *transform_node_Sub(ir_node *n)
ir_node *const blk = get_nodes_block(n);
ir_graph *const irg = get_irn_irg(n);
ir_node *const one = new_r_Const_one(irg, mode);
ir_node *const sub = new_rd_Sub(dbg, blk, y, one, mode);
ir_node *const sub = new_rd_Sub(dbg, blk, y, one);
n = new_rd_Mul(dbg, blk, x, sub);
DBG_OPT_ALGSIM0(oldn, n);
return n;
......@@ -3469,7 +3468,7 @@ static ir_node *transform_node_Sub(ir_node *n)
ir_node *blk = get_nodes_block(n);
ir_node *add = new_r_Add(blk, y, b);
n = new_rd_Sub(get_irn_dbg_info(n), blk, x, add, mode);
n = new_rd_Sub(get_irn_dbg_info(n), blk, x, add);
DBG_OPT_ALGSIM0(oldn, n);
return n;
}
......@@ -3553,8 +3552,7 @@ static ir_node *transform_node_Sub(ir_node *n)
= get_reference_offset_mode(ref_mode);
ir_node *const conv_b = new_r_Conv(block, b,
offset_mode);
ir_node *const new_sub = new_rd_Sub(dbgi, block, conv_op,
conv_b, ref_mode);
ir_node *const new_sub = new_rd_Sub(dbgi, block, conv_op, conv_b);
ir_node *const conv = new_r_Conv(block, new_sub, mode);
return conv;
}
......@@ -3585,7 +3583,7 @@ static ir_node *can_negate_cheaply(dbg_info *const dbgi, ir_node *const node)
ir_node *block = get_nodes_block(node);
ir_node *left = get_Sub_left(node);
ir_node *right = get_Sub_right(node);
return new_rd_Sub(dbgi, block, right, left, mode);
return new_rd_Sub(dbgi, block, right, left);
}
/* -(a*const) => a * -const */
if (is_Mul(node)) {
......@@ -3610,7 +3608,7 @@ static ir_node *can_negate_cheaply(dbg_info *const dbgi, ir_node *const node)
ir_graph *irg = get_irn_irg(node);
ir_node *newc = new_r_Const(irg, negtv);
ir_node *block = get_nodes_block(node);
return new_rd_Sub(dbgi, block, newc, left, mode);
return new_rd_Sub(dbgi, block, newc, left);
}
}
/* -(~x) => x+1 */
......@@ -3833,8 +3831,7 @@ transform_div_mul:
assert((int)pn_Div_X_except == (int)pn_Mod_X_except);
exchange(div, mod);
ir_node *block = get_nodes_block(n);
return new_rd_Sub(dbgi, block, div_left, div_proj,
mode);
return new_rd_Sub(dbgi, block, div_left, div_proj);
}
}
}
......@@ -4031,7 +4028,7 @@ static ir_node *transform_node_Mod(ir_node *n)
ir_node *c = new_rd_Const(dbgi, irg, tv_mul);
ir_node *block = get_nodes_block(n);
value = new_rd_Sub(dbgi, block, a, c, mode);
value = new_rd_Sub(dbgi, block, a, c);
goto make_tuple;
}
}
......@@ -4582,7 +4579,7 @@ static ir_node *transform_node_Not(ir_node *n)
ir_node *block = get_nodes_block(a);
ir_node *add_l = get_binop_left(a);
return new_rd_Sub(dbg, block, cnst, add_l, mode);
return new_rd_Sub(dbg, block, cnst, add_l);
}
}
} else if (is_Sub(a)) {
......@@ -4639,15 +4636,13 @@ static ir_node *transform_node_Minus(ir_node *n)
if (negated_l != NULL) {
/* -((a - b) + c) -> (b - a) - c */
ir_node *block = get_nodes_block(n);
ir_mode *mode = get_irn_mode(n);
return new_rd_Sub(dbgi, block, negated_l, r, mode);
return new_rd_Sub(dbgi, block, negated_l, r);
}
ir_node *negated_r = can_negate_cheaply(NULL, r);
if (negated_r != NULL) {
/* -(a + (b - c)) -> (c - b) - a */
ir_node *block = get_nodes_block(n);
ir_mode *mode = get_irn_mode(n);
return new_rd_Sub(dbgi, block, negated_r, l, mode);
return new_rd_Sub(dbgi, block, negated_r, l);
}
}
if (is_And(op) && only_one_user(op)) {
......@@ -6032,7 +6027,6 @@ static ir_node *transform_node_shift_modulo(ir_node *n,
ir_graph *irg = get_irn_irg(n);
ir_node *block = get_nodes_block(n);
ir_node *right = get_binop_right(n);
ir_mode *mode_right = get_irn_mode(right);
ir_node *newop = NULL;
if (is_Const(right)) {
ir_tarval *tv = get_Const_tarval(right);
......@@ -6063,7 +6057,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_Sub(dbgi, block, newconst, get_Sub_right(right), mode_right);
newop = new_rd_Sub(dbgi, block, newconst, get_Sub_right(right));
}
} else {
return n;
......@@ -6779,7 +6773,7 @@ static ir_node *transform_Mux_set(ir_node *n, ir_relation relation)
calc_mode = dest_mode;
}
ir_node *sub = new_rd_Sub(dbgi, block, a, b, calc_mode);
ir_node *sub = new_rd_Sub(dbgi, block, a, b);
if (need_not)
sub = new_rd_Not(dbgi, block, sub);
......@@ -6818,9 +6812,9 @@ static ir_node *transform_node_Mux(ir_node *n)
ir_node *xorn = new_rd_Eor(dbgi, block, op, sext);
ir_node *res;
if (abs > 0) {
res = new_rd_Sub(dbgi, block, xorn, sext, mode);
res = new_rd_Sub(dbgi, block, xorn, sext);
} else {
res = new_rd_Sub(dbgi, block, sext, xorn, mode);
res = new_rd_Sub(dbgi, block, sext, xorn);
}
return res;
}
......@@ -6897,7 +6891,7 @@ static ir_node *transform_node_Mux(ir_node *n)
} else {
/* Mux((a & 1) == 0, 0, b) => (a - 1) & b */
ir_node *one = new_rd_Const_one(dbgi, irg, mode);
cmp_l = new_rd_Sub(dbgi, block, cmp_l, one, mode);
cmp_l = new_rd_Sub(dbgi, block, cmp_l, one);
}
return new_rd_And(dbgi, block, cmp_l, t);
......
......@@ -1447,7 +1447,7 @@ static void create_duffs_block(ir_graph *const irg)
}
ir_mode *const mode = get_irn_mode(loop_info.end_val);
ir_node *const ems = new_r_Sub(block1, loop_info.end_val, loop_info.start_val, mode);
ir_node *const ems = new_r_Sub(block1, loop_info.end_val, loop_info.start_val);
DB((dbg, LEVEL_4, "BLOCK1 sub %N\n", ems));
DB((dbg, LEVEL_4, "mod ins %N %N\n", ems, loop_info.step));
......
......@@ -279,12 +279,10 @@ static ir_node *find_location(ir_node *block1, ir_node *block2)
* @param db debug info to add to the new node
* @param op1 the first operand
* @param op2 the second operand
* @param mode the mode of the new operation
*
* @return the newly created node
*/
static ir_node *do_apply(unsigned code, dbg_info *db, ir_node *op1,
ir_node *op2, ir_mode *mode)
static ir_node *do_apply(unsigned code, dbg_info *db, ir_node *op1, ir_node *op2)
{
ir_node *block = find_location(get_nodes_block(op1), get_nodes_block(op2));
switch (code) {
......@@ -293,7 +291,7 @@ static ir_node *do_apply(unsigned code, dbg_info *db, ir_node *op1,
case iro_Add:
return new_rd_Add(db, block, op1, op2);
case iro_Sub:
return new_rd_Sub(db, block, op1, op2, mode);
return new_rd_Sub(db, block, op1, op2);
default:
panic("unsupported opcode");
}
......@@ -326,7 +324,7 @@ static ir_node *apply(ir_node *header, ir_node *orig, ir_node *op1,
} else if (op2_header == header && is_rc(op1, op2_header)) {
result = reduce(orig, op2, op1, env);
} else {
result = do_apply(code, db, op1, op2, get_irn_mode(orig));
result = do_apply(code, db, op1, op2);
get_irn_ne(result, env)->header = NULL;
}
}
......@@ -988,7 +986,7 @@ static ir_node *apply_one_edge(ir_node *iv, ir_node *rc, ldtr_edge_t *e,
if (e->code == iro_Add && mode_is_reference(get_irn_mode(e->rc))) {
/* However we allow ONE Pointer Add, as pointer arithmetic with
* wrap around is undefined anyway */
return do_apply(e->code, NULL, rc, e->rc, get_irn_mode(e->rc));
return do_apply(e->code, NULL, rc, e->rc);
}
DB((dbg, LEVEL_4, " = UNKNOWN (%+F)", e->rc));
return NULL;
......@@ -1062,7 +1060,7 @@ static ir_node *apply_one_edge(ir_node *iv, ir_node *rc, ldtr_edge_t *e,
ir_graph *irg = get_irn_irg(iv);
return new_r_Const(irg, tv);
}
return do_apply(e->code, NULL, rc, e->rc, get_irn_mode(e->dst));
return do_apply(e->code, NULL, rc, e->rc);
}
/**
......
......@@ -429,13 +429,12 @@ transform:;
ir_node *curr_blk = get_nodes_block(n);
ir_node *blk = earliest_block(a, b, curr_blk);
dbg_info *dbg = get_irn_dbg_info(n);
ir_mode *mode = get_irn_mode(n);
ir_node *irn;
if (is_Add(n))
irn = new_rd_Add(dbg, blk, a, b);
else
irn = new_rd_Sub(dbg, blk, a, b, mode);
irn = new_rd_Sub(dbg, blk, a, b);
blk = earliest_block(irn, x, curr_blk);
if (op == op_Mul)
......@@ -1706,7 +1705,6 @@ static void rebuild(multi_op_env *multi_env)
ir_node *block = get_nodes_block(o->base_node);
dbg_info *dbgi = get_irn_dbg_info(o->base_node);
ir_mode *mode = get_irn_mode(o->base_node);
ir_node *curr = NULL;
......@@ -1810,7 +1808,7 @@ static void rebuild(multi_op_env *multi_env)
assert(inner);
if (negativ_set) {
foreach_pset(negativ_set, ir_node, node) {
inner = new_rd_Sub(dbgi, block, inner, node, mode);
inner = new_rd_Sub(dbgi, block, inner, node);
}
}
......@@ -1861,7 +1859,7 @@ static void rebuild(multi_op_env *multi_env)
if (!curr) {
curr = new_rd_Minus(dbgi, block, inner);
} else {
curr = new_rd_Sub(dbgi, block, curr, inner, mode);
curr = new_rd_Sub(dbgi, block, curr, inner);
}
}
......
......@@ -830,6 +830,7 @@ class Store(Node):
@op
class Sub(Binop):
"""returns the difference of its operands"""
mode = "mode_is_reference(get_irn_mode(irn_right)) ? get_reference_offset_mode(get_irn_mode(irn_left)) : get_irn_mode(irn_left)"
flags = []
@op
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment