summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bestack.c
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2011-03-07 14:47:07 +0100
committerMatthias Braun <matze@braunis.de>2011-03-16 19:33:23 +0100
commit51a7dbfd76da23a3f8b927d1113b95545ef43b8b (patch)
tree0cccacf387c3ff2dee705f6cabed60179d150fa0 /ir/be/bestack.c
parentbb523cb9ad91bcdc9af9e8e23093b637f3cba096 (diff)
bestack: remove unnecessary keep edges from IncSP nodes
Diffstat (limited to 'ir/be/bestack.c')
-rw-r--r--ir/be/bestack.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/ir/be/bestack.c b/ir/be/bestack.c
index 18522b1..a5cb662 100644
--- a/ir/be/bestack.c
+++ b/ir/be/bestack.c
@@ -379,6 +379,28 @@ void be_abi_fix_stack_nodes(ir_graph *irg)
arch_set_irn_register(phi, arch_env->sp);
}
be_ssa_construction_destroy(&senv);
-
DEL_ARR_F(walker_env.sp_nodes);
+
+ /* when doing code with frame-pointers then often the last incsp-nodes are
+ * not used anymore because we copy the framepointer to the stack pointer
+ * when leaving the function. Though the last incsp is often keeped (because
+ * you often don't know which incsp is the last one and fixstack should find
+ * them all). Remove unnecessary keeps and IncSP nodes */
+ {
+ ir_node *end = get_irg_end(irg);
+ int arity = get_irn_arity(end);
+ int i;
+ for (i = arity-1; i >= 0; --i) {
+ ir_node *in = get_irn_n(end, i);
+ if (!be_is_IncSP(in)) {
+ continue;
+ }
+
+ remove_End_keepalive(end, in);
+ if (get_irn_n_edges(in) == 0) {
+ sched_remove(in);
+ kill_node(in);
+ }
+ }
+ }
}