[llvm-commits] [llvm] r63364 - /llvm/trunk/tools/llvmc/driver/CompilationGraph.cpp

Mikhail Glushenkov foldr at codedgers.com
Thu Jan 29 18:12:57 PST 2009


Author: foldr
Date: Thu Jan 29 20:12:57 2009
New Revision: 63364

URL: http://llvm.org/viewvc/llvm-project?rev=63364&view=rev
Log:
Add some comments.

Modified:
    llvm/trunk/tools/llvmc/driver/CompilationGraph.cpp

Modified: llvm/trunk/tools/llvmc/driver/CompilationGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/driver/CompilationGraph.cpp?rev=63364&r1=63363&r2=63364&view=diff

==============================================================================
--- llvm/trunk/tools/llvmc/driver/CompilationGraph.cpp (original)
+++ llvm/trunk/tools/llvmc/driver/CompilationGraph.cpp Thu Jan 29 20:12:57 2009
@@ -390,6 +390,8 @@
   int ret = 0;
   InputLanguagesSet Dummy;
 
+  // For all nodes, just iterate over the outgoing edges and check if there is
+  // more than one edge with maximum weight.
   for (const_nodes_iterator B = this->NodesMap.begin(),
          E = this->NodesMap.end(); B != E; ++B) {
     const Node& N = B->second;
@@ -423,6 +425,9 @@
   std::queue<Node*> Q;
   Q.push(&getNode("root"));
 
+  // Try to delete all nodes that have no ingoing edges, starting from the
+  // root. If there are any nodes left after this operation, then we have a
+  // cycle. This relies on '--check-graph' not performing the topological sort.
   while (!Q.empty()) {
     Node* A = Q.front();
     Q.pop();
@@ -447,7 +452,6 @@
   return 0;
 }
 
-
 int CompilationGraph::Check () {
   // We try to catch as many errors as we can in one go.
   int ret = 0;





More information about the llvm-commits mailing list