- free += n_outs;
- /* We count the successors again, the space will be sufficient.
- We use this counter to remember the position for the next back
- edge. */
- n->out[0] = (ir_node *)0;
-
- start = is_Block(n) ? 0 : -1;
- irn_arity = get_irn_arity(n);
-
- for (i = start; i < irn_arity; i++) {
- succ = get_irn_n(n, i);
- /* Recursion */
- if (get_irn_visited(succ) < get_irg_visited(current_ir_graph))
- free = set_out_edges(succ, free);
- /* Remember our back edge */
- succ->out[get_irn_n_outs(succ)+1] = n;
- succ->out[0] = (ir_node *) (get_irn_n_outs(succ) + 1);
- }
- return free;
-}
-
-/* We want that the out of ProjX from Start contains the next block at
- position 1, the Start block at position 2. This is necessary for
- the out block walker. */
-static INLINE void fix_start_proj(ir_graph *irg) {
- ir_node *proj = NULL;
- ir_node *startbl = get_irg_start_block(irg);
- int i;
-
- if (get_Block_n_cfg_outs(startbl)) {
- for (i = 0; i < get_irn_n_outs(startbl); i++)
- if (get_irn_mode(get_irn_out(startbl, i)) == mode_X) {
- proj = get_irn_out(startbl, i);
- break;
- }
-
- if (get_irn_out(proj, 0) == startbl) {
- assert(get_irn_n_outs(proj) == 2);
- set_irn_out(proj, 0, get_irn_out(proj, 1));
- set_irn_out(proj, 1, startbl);
- }
- }
+ free += n_outs;
+ /* We count the successors again, the space will be sufficient.
+ We use this counter to remember the position for the next back
+ edge. */
+ use->out[0].pos = 0;
+
+ start = is_Block(use) ? 0 : -1;
+ irn_arity = get_irn_arity(use);
+
+ for (i = start; i < irn_arity; ++i) {
+ ir_node *def = get_irn_n(use, i);
+
+ /* Recursion */
+ if (!irn_visited(def))
+ free = _set_out_edges(def, free);
+
+ /* Remember this Def-Use edge */
+ pos = def->out[0].pos + 1;
+ def->out[pos].use = use;
+ def->out[pos].pos = i;
+
+ /* increase the number of Def-Use edges so far */
+ def->out[0].pos = pos;
+ }
+ return free;
+}
+
+/**
+ * Enter memory for the outs to a node. Handles special nodes
+ *
+ * @param irg the graph
+ * @param free current free address in the chunk allocated for the outs
+ *
+ * @return The next free address
+ */
+static ir_def_use_edge *set_out_edges(ir_graph *irg, ir_def_use_edge *free) {
+ ir_node *n;
+ int i, n_outs;
+
+ inc_irg_visited(irg);
+ free = _set_out_edges(get_irg_end(irg), free);
+
+ /* handle anchored nodes */
+ for (i = anchor_last - 1; i >= 0; --i) {
+ n = get_irg_anchor(irg, i);
+ if (!irn_visited_else_mark(n)) {
+ n_outs = PTR_TO_INT(n->out);
+ n->out = free;
+#ifdef DEBUG_libfirm
+ n->out_valid = 1;
+#endif /* defined DEBUG_libfirm */
+ free += n_outs;
+ }
+ }
+
+ return free;