Commit 3614f0b8 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

ia32: Pass an ir_graph* to ia32_immediate_from_long() instead of using current_ir_graph.

parent 934327b9
......@@ -773,12 +773,10 @@ static inline int is_noreg(const ir_node *node)
return is_ia32_NoReg_GP(node);
}
ir_node *ia32_immediate_from_long(long val)
ir_node *ia32_immediate_from_long(ir_graph *const irg, long const val)
{
ir_graph *irg = current_ir_graph;
ir_node *start_block = get_irg_start_block(irg);
ir_node *immediate
= new_bd_ia32_Immediate(NULL, start_block, NULL, 0, val);
ir_node *start_block = get_irg_start_block(irg);
ir_node *immediate = new_bd_ia32_Immediate(NULL, start_block, NULL, 0, val);
arch_set_irn_register(immediate, &ia32_registers[REG_GP_NOREG]);
return immediate;
......@@ -890,8 +888,9 @@ static void peephole_ia32_Lea(ir_node *node)
op1 = index;
goto make_add_immediate;
} else if (!has_immediates && scale > 0) {
ir_graph *const irg = get_irn_irg(node);
op1 = index;
op2 = ia32_immediate_from_long(scale);
op2 = ia32_immediate_from_long(irg, scale);
goto make_shl;
} else if (!has_immediates) {
#ifdef DEBUG_libfirm
......
......@@ -38,6 +38,6 @@ void ia32_init_optimize(void);
/**
* Creates an immediate node.
*/
ir_node *ia32_immediate_from_long(long val);
ir_node *ia32_immediate_from_long(ir_graph *irg, long val);
#endif /* FIRM_BE_IA32_IA32_OPTIMIZE_H */
......@@ -3420,12 +3420,16 @@ static ir_node *gen_Mux(ir_node *node)
set_ia32_am_offs_int(new_node, res.steps[step].val);
SET_IA32_ORIG_NODE(new_node, node);
break;
case SETCC_TR_SHL:
imm = ia32_immediate_from_long(res.steps[step].scale);
case SETCC_TR_SHL: {
ir_graph *const irg = get_Block_irg(new_block);
imm = ia32_immediate_from_long(irg, res.steps[step].scale);
SET_IA32_ORIG_NODE(imm, node);
new_node = new_bd_ia32_Shl(dbgi, new_block, new_node, imm);
SET_IA32_ORIG_NODE(new_node, node);
break;
}
case SETCC_TR_NEG:
new_node = new_bd_ia32_Neg(dbgi, new_block, new_node);
SET_IA32_ORIG_NODE(new_node, node);
......@@ -3434,12 +3438,16 @@ static ir_node *gen_Mux(ir_node *node)
new_node = new_bd_ia32_Not(dbgi, new_block, new_node);
SET_IA32_ORIG_NODE(new_node, node);
break;
case SETCC_TR_AND:
imm = ia32_immediate_from_long(res.steps[step].val);
case SETCC_TR_AND: {
ir_graph *const irg = get_Block_irg(new_block);
imm = ia32_immediate_from_long(irg, res.steps[step].val);
SET_IA32_ORIG_NODE(imm, node);
new_node = new_bd_ia32_And(dbgi, new_block, noreg_GP, noreg_GP, nomem, new_node, imm);
SET_IA32_ORIG_NODE(new_node, node);
break;
}
case SETCC_TR_SET:
new_node = create_set_32bit(dbgi, new_block, flags, res.cc, node);
break;
......
Supports Markdown
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