Commit 127a6ad9 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

arm, sparc: Place the initial IncSP directly after Start to avoid problems with endless loops.

In case of endless loops, there is no user of Start, so the missing keeps walker keeps Start's results.
Then the be_keep_if_unused() workaround does not trigger, because after rewiring the initial SP's users (here the Keep) to the IncSP it has one user.
But the IncSP is placed after the Keep in the schedule.
This either makes the verifier unhappy (arm) or gets erroneously removed by the dead nodes walker (sparc).
This solution is not entierly correct, but is consistent with what the ia32 backend does.
The correct solution would be a memory output for IncSP.
parent 483553b4
......@@ -86,8 +86,7 @@ static void introduce_prolog_epilog(ir_graph *irg)
ir_node *const incsp = be_new_IncSP(sp_reg, block, initial_sp, frame_size, 0);
edges_reroute_except(initial_sp, incsp, incsp);
ir_node *const schedpoint = be_move_after_schedule_first(start);
sched_add_after(schedpoint, incsp);
sched_add_after(start, incsp);
}
static int get_first_same(const arch_register_req_t* req)
......
......@@ -182,11 +182,10 @@ static void sparc_introduce_prolog_epilog(ir_graph *irg)
introduce_epilog(ret);
}
ir_node *const schedpoint = be_move_after_schedule_first(start);
if (!layout->sp_relative) {
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);
sched_add_after(start, save);
edges_reroute_except(initial_sp, save, save);
......@@ -199,7 +198,7 @@ static void sparc_introduce_prolog_epilog(ir_graph *irg)
} else {
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);
sched_add_after(start, incsp);
}
}
......
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