Commit 3af72e1a authored by Christoph Mallon's avatar Christoph Mallon
Browse files

bespillutil: Add and use be_new_Copy_for_input().

parent 7670bd0d
...@@ -678,6 +678,14 @@ void be_insert_spills_reloads(spill_env_t *env) ...@@ -678,6 +678,14 @@ void be_insert_spills_reloads(spill_env_t *env)
be_timer_pop(T_RA_SPILL_APPLY); be_timer_pop(T_RA_SPILL_APPLY);
} }
static void be_new_Copy_for_input(ir_node *const val, ir_node *const before, int const pos)
{
ir_node *const block = get_nodes_block(before);
ir_node *const copy = be_new_Copy(block, val);
sched_add_before(before, copy);
set_irn_n(before, pos, copy);
}
static be_irg_t *birg; static be_irg_t *birg;
static be_lv_t *lv; static be_lv_t *lv;
static unsigned long precol_copies; static unsigned long precol_copies;
...@@ -707,13 +715,9 @@ static void prepare_constr_insn(ir_node *const node) ...@@ -707,13 +715,9 @@ static void prepare_constr_insn(ir_node *const node)
if (rbitset_is_set(req->limited, reg->index)) if (rbitset_is_set(req->limited, reg->index))
continue; continue;
ir_node *block = get_nodes_block(node); be_new_Copy_for_input(op, node, i);
ir_node *copy = be_new_Copy(block, op);
sched_add_before(node, copy);
set_irn_n(node, i, copy);
++precol_copies; ++precol_copies;
DBG((dbg_constr, LEVEL_3, "inserting ignore arg copy %+F for %+F pos %d\n", DBG((dbg_constr, LEVEL_3, "inserting ignore arg copy for %+F pos %d\n", node, i));
copy, node, i));
} }
/* insert copies for nodes that occur constrained more than once. */ /* insert copies for nodes that occur constrained more than once. */
...@@ -745,14 +749,9 @@ static void prepare_constr_insn(ir_node *const node) ...@@ -745,14 +749,9 @@ static void prepare_constr_insn(ir_node *const node)
if (rbitsets_equal(req->limited, req2->limited, cls->n_regs)) if (rbitsets_equal(req->limited, req2->limited, cls->n_regs))
continue; continue;
ir_node *block = get_nodes_block(node); be_new_Copy_for_input(in, node, i2);
ir_node *copy = be_new_Copy(block, in);
sched_add_before(node, copy);
set_irn_n(node, i2, copy);
++multi_precol_copies; ++multi_precol_copies;
DBG((dbg_constr, LEVEL_3, DBG((dbg_constr, LEVEL_3, "inserting multiple constr copy for %+F pos %d\n", node, i2));
"inserting multiple constr copy %+F for %+F pos %d\n",
copy, node, i2));
} }
} }
...@@ -814,13 +813,9 @@ static void prepare_constr_insn(ir_node *const node) ...@@ -814,13 +813,9 @@ static void prepare_constr_insn(ir_node *const node)
* register change for free), need to add some SSA-reconstruction code * register change for free), need to add some SSA-reconstruction code
* to achieve this. */ * to achieve this. */
ir_node *block = get_nodes_block(node); be_new_Copy_for_input(in, node, i);
ir_node *copy = be_new_Copy(block, in);
sched_add_before(node, copy);
set_irn_n(node, i, copy);
++constrained_livethrough_copies; ++constrained_livethrough_copies;
DBG((dbg_constr, LEVEL_3, "inserting constr copy %+F for %+F pos %d\n", DBG((dbg_constr, LEVEL_3, "inserting constr copy for %+F pos %d\n", node, i));
copy, node, i));
be_liveness_update(lv, in); be_liveness_update(lv, in);
} }
} }
......
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