summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bestate.c
diff options
context:
space:
mode:
authorChristoph Mallon <mallon@cs.uni-saarland.de>2015-01-10 18:08:18 +0100
committerChristoph Mallon <mallon@cs.uni-saarland.de>2015-01-10 18:08:18 +0100
commit7ff1ee79f3b68884faf0ab2fbf1cdf90eef163c3 (patch)
treeb7ee6f648e8304a122aeb1c95955a3cc64344e70 /ir/be/bestate.c
parent41d66eda83a38cc1a044fac06372baca18ad0acf (diff)
be: Use be_new_Phi0() and be_complete_Phi() instead of using dummy/unknown inputs.
Diffstat (limited to 'ir/be/bestate.c')
-rw-r--r--ir/be/bestate.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/ir/be/bestate.c b/ir/be/bestate.c
index e281b6f..fb66e71 100644
--- a/ir/be/bestate.c
+++ b/ir/be/bestate.c
@@ -131,12 +131,7 @@ static void create_reload(minibelady_env_t *env, ir_node *state,
static void spill_phi(minibelady_env_t *env, ir_node *phi)
{
- ir_graph *irg = get_irn_irg(phi);
- ir_node *block = get_nodes_block(phi);
- int arity = get_irn_arity(phi);
- ir_node **phi_in = ALLOCAN(ir_node*, arity);
- ir_node *dummy = new_r_Dummy(irg, mode_M);
- ir_node *spill_to_kill = NULL;
+ ir_node *spill_to_kill = NULL;
/* does a spill exist for the phis value? */
spill_info_t *spill_info = get_spill_info(env, phi);
@@ -146,28 +141,27 @@ static void spill_phi(minibelady_env_t *env, ir_node *phi)
spill_info = create_spill_info(env, phi);
}
- /* create a new phi-M with bad preds */
- for (int i = 0; i < arity; ++i) {
- phi_in[i] = dummy;
- }
-
DBG((dbg, LEVEL_2, "\tcreate Phi-M for %+F\n", phi));
/* create a Phi-M */
- spill_info->spill = be_new_Phi(block, arity, phi_in, mode_M,
- arch_no_register_req);
- sched_add_after(block, spill_info->spill);
+ ir_node *const block = get_nodes_block(phi);
+ ir_node *const phim = be_new_Phi0(block, mode_M, arch_no_register_req);
+ spill_info->spill = phim;
+ sched_add_after(block, phim);
if (spill_to_kill != NULL) {
- exchange(spill_to_kill, spill_info->spill);
sched_remove(spill_to_kill);
+ exchange(spill_to_kill, phim);
}
/* create spills for the phi values */
+ unsigned const arity = get_irn_arity(phi);
+ ir_node **const phi_in = ALLOCAN(ir_node*, arity);
foreach_irn_in(phi, i, in) {
spill_info_t *pred_spill = create_spill(env, in, true);
- set_irn_n(spill_info->spill, i, pred_spill->spill);
+ phi_in[i] = pred_spill->spill;
}
+ be_complete_Phi(phim, arity, phi_in);
}
static void belady(minibelady_env_t *env, ir_node *block);