- /* Walk all endless loops in inner procedures.
- * We recognize an inner procedure if the End node is not visited. */
- for (i = 0; i < get_irp_n_irgs(); i++) {
- ir_node *e;
- current_ir_graph = get_irp_irg(i);
- e = get_irg_end(current_ir_graph);
- if (get_irn_visited(e) < get_irg_visited(current_ir_graph)) {
- int j;
- /* Don't visit the End node. */
- /* for (j = 0; j < get_End_n_keepalives(e); j++)
- cg_walk_2(get_End_keepalive(e, j), pre, post, env);*/
- compute_outs(current_ir_graph);
- }
+
+/*
+ * Inits all nodes for setting the outedges
+ * Returns the overall count of edges
+ */
+int count_ip_outs(void) {
+
+ int res = 0;
+
+ cg_walk(init_count, node_arity_count, &res);
+
+ return(res);
+}
+
+static int dummy_count = 0, global_count; /* Only for debugging */
+
+/**
+ * For each node: Sets the pointer to array
+ * in which the outedges are written later.
+ * The current array start is transported in env
+ */
+static void set_array_pointer(ir_node *node, void *env) {
+
+ int n_outs;
+ ir_node ***free = (ir_node ***) env;
+
+ /* Allocate my array */
+ n_outs = (int) node -> out; /* We wrote the count here in count_ip_outs */
+ dummy_count += n_outs;
+ assert(dummy_count <= global_count && "More outedges than initially counted!");
+ node -> out = *free;
+ *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. */
+ node -> out[0] = (ir_node *) 0;
+}
+
+
+/**
+ * Adds an outedge from the predecessor to the
+ * current node.
+ */
+static void set_out_pointer(ir_node * node, void * env) {
+ int i, arity = get_irn_arity(node);
+ ir_node *succ;
+ int start = (!is_Block(node)) ? -1 : 0;
+
+ for(i = start; i < arity; i++) {
+ succ = get_irn_n(node, i);
+ succ->out[get_irn_n_outs(succ)+1] = node;
+ succ->out[0] = (ir_node *) (get_irn_n_outs(succ) + 1);