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

ir: Use new_r_Const_long() instead of new_tarval_from_long() + new_r_Const().

parent e23dbb8c
......@@ -686,13 +686,11 @@ static ir_node *adjust_alloc_size(unsigned stack_alignment, ir_node *size,
if (stack_alignment <= 1)
return size;
ir_mode *mode = get_irn_mode(size);
ir_tarval *tv = new_tarval_from_long(stack_alignment-1, mode);
ir_graph *irg = get_Block_irg(block);
ir_node *mask = new_r_Const(irg, tv);
ir_mode *mode = get_irn_mode(size);
ir_graph *irg = get_Block_irg(block);
ir_node *mask = new_r_Const_long(irg, mode, stack_alignment - 1);
size = new_rd_Add(dbg, block, size, mask, mode);
tv = new_tarval_from_long(-(long)stack_alignment, mode);
mask = new_r_Const(irg, tv);
mask = new_r_Const_long(irg, mode, -(long)stack_alignment);
size = new_rd_And(dbg, block, size, mask, mode);
return size;
}
......@@ -779,10 +777,8 @@ static ir_node *adjust_free(be_abi_irg_t *env, ir_node *free, ir_node *curr_sp)
dbg_info *dbg = get_irn_dbg_info(free);
ir_node *size;
if (!is_unknown_type(type) && get_type_size_bytes(type) != 1) {
ir_tarval *tv = new_tarval_from_long(get_type_size_bytes(type), mode_Iu);
ir_node *cnst = new_rd_Const(dbg, irg, tv);
ir_node *mul = new_rd_Mul(dbg, block, get_Free_count(free),
cnst, mode_Iu);
ir_node *const cnst = new_rd_Const(dbg, irg, mode_Iu, get_type_size_bytes(type));
ir_node *const mul = new_rd_Mul(dbg, block, get_Free_count(free), cnst, mode_Iu);
size = mul;
} else {
size = get_Free_count(free);
......
......@@ -44,18 +44,16 @@ static ir_entity *create_ent(int value, const char *name)
ir_graph *cnst_irg;
ir_entity *ent;
ir_node *cnst;
ir_tarval *tv;
set_type_alignment_bytes(type, 4);
tv = new_tarval_from_long(value, mode);
ent = new_entity(glob, new_id_from_str(name), type);
set_entity_ld_ident(ent, get_entity_ident(ent));
set_entity_visibility(ent, ir_visibility_local);
add_entity_linkage(ent, IR_LINKAGE_CONSTANT);
cnst_irg = get_const_code_irg();
cnst = new_r_Const(cnst_irg, tv);
cnst = new_r_Const_long(cnst_irg, mode, value);
set_atomic_ent_value(ent, cnst);
return ent;
......
......@@ -324,8 +324,7 @@ static void rewrite_float_unsigned_Conv(ir_node *node)
ir_node *true_jmp = new_r_Jmp(true_block);
ir_node *false_jmp = new_r_Jmp(false_block);
ir_tarval *correction = new_tarval_from_long(0x80000000l, mode_s);
ir_node *c_const = new_r_Const(irg, correction);
ir_node *c_const = new_r_Const_long(irg, mode_s, 0x80000000L);
ir_node *sub = new_rd_Sub(dbgi, true_block, float_x, limitc,
mode_f);
ir_node *sub_conv = new_rd_Conv(dbgi, true_block, sub, mode_s);
......
......@@ -36,13 +36,11 @@ static ir_node *adjust_alloc_size(dbg_info *dbgi, ir_node *size, ir_node *block)
if (is_Const(size) && !lower_constant_sizes)
return size;
ir_mode *mode = get_irn_mode(size);
ir_tarval *tv = new_tarval_from_long(stack_alignment-1, mode);
ir_graph *irg = get_Block_irg(block);
ir_node *mask = new_r_Const(irg, tv);
ir_mode *mode = get_irn_mode(size);
ir_graph *irg = get_Block_irg(block);
ir_node *mask = new_r_Const_long(irg, mode, stack_alignment - 1);
size = new_rd_Add(dbgi, block, size, mask, mode);
tv = new_tarval_from_long(-(long)stack_alignment, mode);
mask = new_r_Const(irg, tv);
mask = new_r_Const_long(irg, mode, -(long)stack_alignment);
size = new_rd_And(dbgi, block, size, mask, mode);
return size;
}
......
......@@ -78,9 +78,8 @@ static void lower_sel(ir_node *sel)
/* replace Sel by add(obj, const(ent.offset)) */
newn = get_Sel_ptr(sel);
if (offset != 0) {
ir_mode *mode_UInt = get_reference_mode_unsigned_eq(mode);
ir_tarval *tv = new_tarval_from_long(offset, mode_UInt);
ir_node *cnst = new_r_Const(irg, tv);
ir_mode *const mode_UInt = get_reference_mode_unsigned_eq(mode);
ir_node *const cnst = new_r_Const_long(irg, mode_UInt, offset);
newn = new_rd_Add(dbg, bl, newn, cnst, mode);
}
}
......
......@@ -620,8 +620,7 @@ static ir_node *eval_strlen(ir_graph *irg, ir_entity *ent, ir_type *res_tp)
for (i = 0; i < size; ++i) {
ir_initializer_t *val = get_initializer_compound_value(initializer, i);
if (initializer_val_is_null(val)) {
ir_tarval *tv = new_tarval_from_long(i, get_type_mode(res_tp));
return new_r_Const(irg, tv);
return new_r_Const_long(irg, get_type_mode(res_tp), i);
}
}
......
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