Commit 24d40727 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Use edges_reroute_except() instead of edges_reroute() + set_irn_n().

parent 499d481d
......@@ -724,10 +724,8 @@ static void create_stores_for_type(ir_graph *irg, ir_type *type)
}
}
if (mem != initial_mem) {
edges_reroute(initial_mem, mem);
set_Store_mem(first_store, initial_mem);
}
if (mem != initial_mem)
edges_reroute_except(initial_mem, mem, first_store);
}
void be_add_parameter_entity_stores(ir_graph *irg)
......
......@@ -1240,8 +1240,7 @@ static void introduce_prolog_epilog(ir_graph *irg)
ir_node *mem = get_irg_initial_mem(irg);
ir_node *noreg = ia32_new_NoReg_gp(irg);
ir_node *initial_bp = be_get_initial_reg_value(irg, bp);
ir_node *curr_bp = initial_bp;
ir_node *push = new_bd_ia32_Push(NULL, block, noreg, noreg, mem, curr_bp, curr_sp);
ir_node *push = new_bd_ia32_Push(NULL, block, noreg, noreg, mem, initial_bp, initial_sp);
ir_node *incsp;
curr_sp = new_r_Proj(push, mode_gp, pn_ia32_Push_stack);
......@@ -1249,18 +1248,16 @@ static void introduce_prolog_epilog(ir_graph *irg)
sched_add_after(start, push);
/* move esp to ebp */
curr_bp = be_new_Copy(block, curr_sp);
ir_node *const curr_bp = be_new_Copy(block, curr_sp);
sched_add_after(push, curr_bp);
be_set_constr_single_reg_out(curr_bp, 0, bp, arch_register_req_type_ignore);
curr_sp = be_new_CopyKeep_single(block, curr_sp, curr_bp);
sched_add_after(curr_bp, curr_sp);
be_set_constr_single_reg_out(curr_sp, 0, sp, arch_register_req_type_produces_sp);
edges_reroute(initial_bp, curr_bp);
set_irn_n(push, n_ia32_Push_val, initial_bp);
edges_reroute_except(initial_bp, curr_bp, push);
incsp = be_new_IncSP(sp, block, curr_sp, frame_size, 0);
edges_reroute(initial_sp, incsp);
set_irn_n(push, n_ia32_Push_stack, initial_sp);
edges_reroute_except(initial_sp, incsp, push);
sched_add_after(curr_sp, incsp);
/* make sure the initial IncSP is really used by someone */
......@@ -1272,9 +1269,8 @@ static void introduce_prolog_epilog(ir_graph *irg)
layout->initial_bias = -4;
} else {
ir_node *incsp = be_new_IncSP(sp, block, curr_sp, frame_size, 0);
edges_reroute(initial_sp, incsp);
be_set_IncSP_pred(incsp, curr_sp);
ir_node *const incsp = be_new_IncSP(sp, block, initial_sp, frame_size, 0);
edges_reroute_except(initial_sp, incsp, incsp);
sched_add_after(start, incsp);
}
......
......@@ -289,10 +289,7 @@ static void peephole_ia32_Test(ir_node *node)
/* If there are other users, reroute them to result proj */
if (get_irn_n_edges(op) != 2) {
ir_node *res = new_r_Proj(op, mode_Iu, pn_ia32_res);
edges_reroute(op, res);
/* Reattach the result proj to left */
set_Proj_pred(res, op);
edges_reroute_except(op, res, res);
}
} else {
if (get_irn_n_edges(left) == 2)
......
......@@ -114,7 +114,6 @@ void sparc_introduce_prolog_epilog(ir_graph *irg)
be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
ir_node *block = get_nodes_block(start);
ir_node *initial_sp = be_get_initial_reg_value(irg, sp_reg);
ir_node *sp = initial_sp;
ir_node *schedpoint = start;
ir_type *frame_type = get_irg_frame_type(irg);
unsigned frame_size = get_type_size_bytes(frame_type);
......@@ -136,14 +135,12 @@ void sparc_introduce_prolog_epilog(ir_graph *irg)
schedpoint = sched_next(schedpoint);
if (!layout->sp_relative) {
ir_node *save = new_bd_sparc_Save_imm(NULL, block, sp, NULL,
-SPARC_MIN_STACKSIZE-frame_size);
ir_node *const save = new_bd_sparc_Save_imm(NULL, block, initial_sp, NULL, -(SPARC_MIN_STACKSIZE + frame_size));
arch_set_irn_register(save, sp_reg);
sched_add_after(schedpoint, save);
schedpoint = save;
edges_reroute(initial_sp, save);
set_irn_n(save, n_sparc_Save_stack, initial_sp);
edges_reroute_except(initial_sp, save, save);
/* we still need the Save even if noone is explicitely using the
* value. (TODO: this isn't 100% correct yet, something at the end of
......@@ -156,9 +153,8 @@ void sparc_introduce_prolog_epilog(ir_graph *irg)
sched_add_after(schedpoint, keep);
}
} else {
ir_node *incsp = be_new_IncSP(sp_reg, block, sp, frame_size, 0);
edges_reroute(initial_sp, incsp);
be_set_IncSP_pred(incsp, sp);
ir_node *const incsp = be_new_IncSP(sp_reg, block, initial_sp, frame_size, 0);
edges_reroute_except(initial_sp, incsp, incsp);
sched_add_after(schedpoint, incsp);
}
}
......
......@@ -34,9 +34,7 @@
void instrument_initcall(ir_graph *irg, ir_entity *ent)
{
ir_node *initial_exec;
ir_node *initial_mem;
ir_node *start_block;
ir_node *adr, *call, *new_mem;
ir_node *first_block = NULL;
int i, idx, need_new_block;
symconst_symbol sym;
......@@ -82,14 +80,12 @@ void instrument_initcall(ir_graph *irg, ir_entity *ent)
/* place the call */
sym.entity_p = ent;
adr = new_r_SymConst(irg, mode_P_code, sym, symconst_addr_ent);
ir_node *const adr = new_r_SymConst(irg, mode_P_code, sym, symconst_addr_ent);
ir_node *const initial_mem = get_irg_initial_mem(irg);
ir_node *const call = new_r_Call(first_block, initial_mem, adr, 0, NULL, get_entity_type(ent));
ir_node *const new_mem = new_r_Proj(call, mode_M, pn_Call_M);
call = new_r_Call(first_block, get_irg_no_mem(irg), adr, 0, NULL, get_entity_type(ent));
new_mem = new_r_Proj(call, mode_M, pn_Call_M);
initial_mem = get_irg_initial_mem(irg);
edges_reroute(initial_mem, new_mem);
edges_reroute_except(initial_mem, new_mem, call);
/* beware: reroute routes anchor edges also, revert this */
set_irg_initial_mem(irg, initial_mem);
set_Call_mem(call, initial_mem);
}
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