summaryrefslogtreecommitdiffhomepage
path: root/ir/be/beutil.c
diff options
context:
space:
mode:
authorChristoph Mallon <mallon@cs.uni-saarland.de>2014-12-25 17:02:14 +0100
committerChristoph Mallon <mallon@cs.uni-saarland.de>2014-12-26 22:20:54 +0100
commit90c9c9628c3dcaae9abfafbacf43416b455616da (patch)
tree54686fd261b17599bf8454ef71e450b73989294e /ir/be/beutil.c
parent509c01cb352dbbfe3b46e5f154c16395b023f6d3 (diff)
be: Add and use be_keep_unused().
Diffstat (limited to 'ir/be/beutil.c')
-rw-r--r--ir/be/beutil.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ir/be/beutil.c b/ir/be/beutil.c
index 40cf8d1..e368187 100644
--- a/ir/be/beutil.c
+++ b/ir/be/beutil.c
@@ -167,3 +167,13 @@ void be_remove_dead_nodes_from_schedule(ir_graph *irg)
/* walk schedule and remove non-marked nodes */
irg_block_walk_graph(irg, remove_dead_nodes_walker, NULL, &env);
}
+
+void be_keep_if_unused(ir_node *node)
+{
+ if (get_irn_n_edges(node) == 0) {
+ ir_node *const in[] = { node };
+ ir_node *const block = get_nodes_block(node);
+ ir_node *const keep = be_new_Keep(block, ARRAY_SIZE(in), in);
+ sched_add_after(node, keep);
+ }
+}