+ size_t i, n;
+ int n_runs = 0;
+ bool rerun = true;
+
+ /* init_tables has added main_irg to _live_graphs */
+
+ /* Need to take care of graphs that are externally
+ visible or sticky. Pretend that they are called: */
+ for (i = 0, n = get_irp_n_irgs(); i < n; ++i) {
+ ir_graph *graph = get_irp_irg(i);
+ ir_entity *ent = get_irg_entity(graph);
+ ir_linkage linkage = get_entity_linkage(ent);
+
+ if ((linkage & IR_LINKAGE_HIDDEN_USER) || entity_is_externally_visible(ent))
+ pset_new_insert(_live_graphs, graph);
+ }
+
+ while (rerun) {
+ ir_graph *graph;
+ pset_new_iterator_t iter;
+
+ /* start off new */
+ pset_new_t *live_graphs = _live_graphs;
+ _live_graphs = XMALLOC(pset_new_t);
+ pset_new_init(_live_graphs);
+
+ DB((dbg, LEVEL_2, "RTA: RUN %i\n", n_runs));
+
+ /* collect what we have found previously */
+ foreach_pset_new(live_graphs, ir_graph*, graph, iter) {
+ pset_new_insert(_live_graphs, graph);
+ }
+
+ rerun = false;
+ foreach_pset_new(live_graphs, ir_graph*, graph, iter) {
+ DB((dbg, LEVEL_2, "RTA: RUN %i: considering graph of %+F\n", n_runs, graph));
+ rerun |= rta_fill_graph(graph);
+ }
+ pset_new_destroy(live_graphs);
+ free(live_graphs);
+ ++n_runs;
+ }
+
+ return n_runs;