/// <summary> /// THis method iterates over the remaining extended basic block roots /// and calls visit to assemble the block for each root /// </summary> public override void Init() { int nRoots = m_sourceGraph.GetRootNodes(m_ebbRoots); if (nRoots != 1) { throw new Exception("Wrong type of graph!!! Only single rooted graphs accepted"); } // For all extended basic block leaders while (m_ebbRoots.Count != 0) { // Take the first leader... CGraphNode x = m_ebbRoots.First(); //... and remove it from the list m_ebbRoots.RemoveAt(0); // If leader hasn't already been considered if (!m_allEbbs.ContainsKey(x)) { // Add new extended basic block entry in EbbRoots m_currentEbb = m_allEbbs[x] = new List <CGraphNode>(); // Insert leader to the extended basic block Visit(x); } } // Create exdended basic block graph m_extendedBasicBlockGraph = CCondensedGraph.CreateGraph(m_sourceGraph, m_allEbbs.Values); AddOutputGraph(m_extendedBasicBlockGraph); // Print graph m_extendedBasicBlockGraph.RegisterGraphPrinter(new CCondensedGraphVizPrinter(m_extendedBasicBlockGraph, new CCondensedGraphVizLabelling("cluster", m_extendedBasicBlockGraph))); m_extendedBasicBlockGraph.Generate("extended basic block graph.dot", true); }