/// <summary> /// Build the weakly connected component for a cluster by following /// both predecessors and successors in the graph. However, we never /// follow the predecessors of nodes that are marked directly called, /// and we never follow successors that are marked directly called /// (tail calls). /// </summary> /// <param name="node"></param> /// <param name="cluster"></param> /// <param name="wl"></param> private void BuildWCC( RtlBlock node, Cluster cluster, WorkList <RtlBlock> wl) { wl.Remove(node); cluster.Blocks.Add(node); foreach (var s in sr.ICFG.Successors(node)) { if (wl.Contains(s)) { // Only add if successor is not CALLed. if (!procedures.Contains(s.Address)) { BuildWCC(s, cluster, wl); } } } if (!procedures.Contains(node.Address)) { // Only backtrack through predecessors if the node // is not CALLed. foreach (var p in sr.ICFG.Predecessors(node)) { if (wl.Contains(p)) { BuildWCC(p, cluster, wl); } } } }