-/*
- This computes the outedges for in interprocedural graph.
-*/
-
-void compute_ip_outs(ir_graph *irg) {
- int i;
- ir_graph *rem = current_ir_graph;
- int rem_view = interprocedural_view;
-
- interprocedural_view = true;
-
- inc_max_irg_visited();
- /* Fix all irg_visited flags */
- for (i = 0; i < get_irp_n_irgs(); i++)
- set_irg_visited(get_irp_irg(i), get_max_irg_visited());
-
- /* Walk starting at unreachable procedures. Only these
- * have End blocks visible in interprocedural view. */
- for (i = 0; i < get_irp_n_irgs(); i++) {
- ir_node *sb;
- current_ir_graph = get_irp_irg(i);
-
- sb = get_irg_start_block(current_ir_graph);
-
- if ((get_Block_n_cfgpreds(sb) > 1) ||
- (get_nodes_block(get_Block_cfgpred(sb, 0)) != sb)) continue;
-
- compute_outs(current_ir_graph); /*cg_walk_2(get_irg_end(current_ir_graph), pre, post, env);*/
- }
-
- /* Check whether we walked all procedures: there could be procedures
- with cyclic calls but no call from the outside. */
- for (i = 0; i < get_irp_n_irgs(); i++) {
- ir_node *sb;
- current_ir_graph = get_irp_irg(i);
-
- /* Test start block: if inner procedure end and end block are not
- * visible and therefore not marked. */
- sb = get_irg_start_block(current_ir_graph);
- if (get_irn_visited(sb) < get_irg_visited(current_ir_graph)) {
- compute_outs(current_ir_graph); /*cg_walk_2(sb, pre, post, env); */
- }
- }
-
-
- /* Walk all endless loops in inner procedures.
- * We recognize an inner procedure if the End node is not visited. */
-
- /* AS: Don't know if we need this... Goetz? */
-
-#if 0
- 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)) {
- /* Don't visit the End node. */
- /* int j;
- for (j = 0; j < get_End_n_keepalives(e); j++)
- cg_walk_2(get_End_keepalive(e, j), pre, post, env);*/
- printf("Found one inner procedure\n");
- compute_outs(current_ir_graph);
- }
- }
-#endif
+/**
+ * Enter memory for the outs to a node.
+ *
+ * @param use current node
+ * @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_node *use, ir_def_use_edge *free)
+{
+ int start, i, irn_arity, pos;
+ size_t n_outs;
+
+ mark_irn_visited(use);
+
+ /* Allocate my array */
+ n_outs = PTR_TO_INT(use->out);
+ use->out = free;
+#ifdef DEBUG_libfirm
+ use->out_valid = 1;
+#endif /* defined DEBUG_libfirm */
+ 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;
+}