summaryrefslogtreecommitdiffhomepage
path: root/ir/lower
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2016-06-07 08:05:54 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2016-06-07 08:05:54 +0200
commitd4e62cfa05163b80b782490cdf51fbf5772dd50a (patch)
treecd73737cd44e66719a09668adb6bc1dd4a714008 /ir/lower
parent77c35e4aae47e4fcf7d125e3af4d51b4b0f874f1 (diff)
When making an 'Add', automatically infer its mode from its operands.
Diffstat (limited to 'ir/lower')
-rw-r--r--ir/lower/lower_alloc.c2
-rw-r--r--ir/lower/lower_calls.c4
-rw-r--r--ir/lower/lower_copyb.c6
-rw-r--r--ir/lower/lower_dw.c33
-rw-r--r--ir/lower/lower_hl.c4
5 files changed, 22 insertions, 27 deletions
diff --git a/ir/lower/lower_alloc.c b/ir/lower/lower_alloc.c
index af2ab13..15827c9 100644
--- a/ir/lower/lower_alloc.c
+++ b/ir/lower/lower_alloc.c
@@ -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;
diff --git a/ir/lower/lower_calls.c b/ir/lower/lower_calls.c
index 686f533..a35cd48 100644
--- a/ir/lower/lower_calls.c
+++ b/ir/lower/lower_calls.c
@@ -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,
diff --git a/ir/lower/lower_copyb.c b/ir/lower/lower_copyb.c
index cf0c28f..572f323 100644
--- a/ir/lower/lower_copyb.c
+++ b/ir/lower/lower_copyb.c
@@ -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);
diff --git a/ir/lower/lower_dw.c b/ir/lower/lower_dw.c
index b7c3e7a..b34daab 100644
--- a/ir/lower/lower_dw.c
+++ b/ir/lower/lower_dw.c
@@ -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 */
@@ -414,21 +413,20 @@ static void lower_Store(ir_node *node, ir_mode *mode)
ir_node *value = get_Store_value(node);
const lower64_entry_t *entry = get_node_entry(value);
- ir_graph *irg = get_irn_irg(node);
- ir_node *adr = get_Store_ptr(node);
- ir_node *mem = get_Store_mem(node);
- 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_graph *irg = get_irn_irg(node);
+ ir_node *adr = get_Store_ptr(node);
+ ir_node *mem = get_Store_mem(node);
+ 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_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: {
diff --git a/ir/lower/lower_hl.c b/ir/lower/lower_hl.c
index 5b4d05d..67c4d87 100644
--- a/ir/lower/lower_hl.c
+++ b/ir/lower/lower_hl.c
@@ -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;
}