Added a phase that normalizes the proj positions
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Fri, 26 Nov 2004 10:11:12 +0000 (10:11 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Fri, 26 Nov 2004 10:11:12 +0000 (10:11 +0000)
[r4468]

ir/ir/irgraph.c
ir/ir/irgraph.h

index 3f00b28..22da0c0 100644 (file)
@@ -684,3 +684,27 @@ void
 (inc_irg_block_visited)(ir_graph *irg) {
   __inc_irg_block_visited(irg);
 }
+
+
+/**
+ * walker Start->End: places Proj nodes into the same block
+ * as it's predecessors
+ *
+ * @param n    the node
+ * @param env  ignored
+ */
+static void normalize_proj_walker(ir_node *n, void *env)
+{
+  if (is_Proj(n)) {
+    ir_node *pred  = get_Proj_pred(n);
+    ir_node *block = get_nodes_block(pred);
+
+    set_nodes_block(n, block);
+  }
+}
+
+/* put the proj's into the same block as its predecessors */
+void normalize_proj_nodes(ir_graph *irg)
+{
+  irg_walk_graph(irg, NULL, normalize_proj_walker, NULL);
+}
index 78d74b1..06bdf8b 100644 (file)
@@ -363,4 +363,7 @@ void          inc_irg_block_visited (ir_graph *irg);
 unsigned long get_irg_block_visited (const ir_graph *irg);
 void          set_irg_block_visited (ir_graph *irg, unsigned long i);
 
+/** put the proj's into the same block as its predecessors */
+void normalize_proj_nodes(ir_graph *irg);
+
 # endif /* _IRGRAPH_H_ */