/* Add local dominance frontiers */ foreach_block_succ(blk, edge) { ir_node *y = get_edge_src_irn(edge); if (get_idom(y) != blk) { ARR_APP1(ir_node *, df_list, y); } }
/* It should be initialized to the size of the SGraph */ void build_dominance_frontiers (SGraphBit *df_graph, const SGraph *the_sgraph, const SGraph *immediate_dominators, SGraphNode x, bool do_forward) { unsigned n; size_t num = df_graph->max_num_nodes(); /* graph_edge_list *nodes; if (forward) { nodes = entry->successors(); } else { df_graph = rdf; nodes = entry->predecessors(); } */ /* visit all children (i.e. immediate dominatees) first */ for (n = 0; n < num; n++) { if (n == x) continue; if (!has_idom(immediate_dominators, n)) continue; // if (x == get_top_region()->>is_exit()) continue; if (get_idom(immediate_dominators, n) == x) { build_dominance_frontiers(df_graph, the_sgraph, immediate_dominators, n, do_forward); } } /* calculate dominance frontier, from paper RCytron_89 */ // df_graph[x->number()].expand(0, num); /* local loop, uses CFG */ for (SNodeIter succ_iter(the_sgraph->get_node_successor_iterator(x, do_forward)); !succ_iter.done(); succ_iter.increment()) { SGraphNode s = succ_iter.get(); if (x != get_idom(immediate_dominators, s)) { df_graph->add_edge(SGraphEdge(x, s)); } } /* up loop, uses dominator tree */ for (n = 0; n < num; n++) { if (has_idom(immediate_dominators, n) && (get_idom(immediate_dominators, n) == x) && df_graph->node_has_successors(n)) { for (unsigned y = 0; y < num; y++) { if (df_graph->is_edge_member(SGraphEdge(n, y)) && (x != get_idom(immediate_dominators, y))) { df_graph->add_edge(SGraphEdge(x, y)); } } } } }