- free = &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;
-
- if (get_irn_op(n) == op_Block) start = 0; else start = -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;
+ 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) {
+ pred = get_irn_n(n, i);
+ /* Recursion */
+ if (get_irn_visited(pred) < get_irg_visited(current_ir_graph))
+ free = _set_out_edges(pred, free);
+ /* Remember our back edge */
+ pred->out[get_irn_n_outs(pred)+1] = n;
+ pred->out[0] = INT_TO_PTR(get_irn_n_outs(pred) + 1);
+ }
+ 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_node **set_out_edges(ir_graph *irg, ir_node **free) {
+ ir_node *n, *special[2];
+ int i, n_outs;
+
+ inc_irg_visited(irg);
+ free = _set_out_edges(get_irg_end(irg), free);
+
+ /* handle special nodes */
+ special[0] = get_irg_frame(irg);
+ special[1] = get_irg_args(irg);
+
+ for (i = 1; i >= 0; --i) {
+ n = special[i];
+
+ if (get_irn_visited(n) < get_irg_visited(current_ir_graph)) {
+ 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;