[llvm-commits] [llvm] r50762 - in /llvm/trunk/tools/llvmc2: CompilationGraph.cpp doc/LLVMC-Enhancements.rst
Mikhail Glushenkov
foldr at codedgers.com
Tue May 6 11:16:53 PDT 2008
Author: foldr
Date: Tue May 6 13:16:52 2008
New Revision: 50762
URL: http://llvm.org/viewvc/llvm-project?rev=50762&view=rev
Log:
Some cosmetic changes (change some comments, move code around a bit).
Modified:
llvm/trunk/tools/llvmc2/CompilationGraph.cpp
llvm/trunk/tools/llvmc2/doc/LLVMC-Enhancements.rst
Modified: llvm/trunk/tools/llvmc2/CompilationGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/CompilationGraph.cpp?rev=50762&r1=50761&r2=50762&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc2/CompilationGraph.cpp (original)
+++ llvm/trunk/tools/llvmc2/CompilationGraph.cpp Tue May 6 13:16:52 2008
@@ -20,7 +20,6 @@
#include <algorithm>
#include <iterator>
-#include <iostream>
#include <limits>
#include <queue>
#include <stdexcept>
@@ -88,6 +87,7 @@
return I->second;
}
+// Find the language name corresponding to the given file.
const std::string& CompilationGraph::getLanguage(const sys::Path& File) const {
LanguageMap::const_iterator Lang = ExtsToLangs.find(File.getSuffix());
if (Lang == ExtsToLangs.end())
@@ -95,6 +95,7 @@
return Lang->second;
}
+// Find the tools list corresponding to the given language name.
const CompilationGraph::tools_vector_type&
CompilationGraph::getToolsVector(const std::string& LangName) const
{
@@ -189,42 +190,7 @@
}
}
-// Sort the nodes in topological order.
-void CompilationGraph::TopologicalSort(std::vector<const Node*>& Out) {
- std::queue<const Node*> Q;
- Q.push(&getNode("root"));
-
- while (!Q.empty()) {
- const Node* A = Q.front();
- Q.pop();
- Out.push_back(A);
- for (Node::const_iterator EB = A->EdgesBegin(), EE = A->EdgesEnd();
- EB != EE; ++EB) {
- Node* B = &getNode((*EB)->ToolName());
- B->DecrInEdges();
- if (B->HasNoInEdges())
- Q.push(B);
- }
- }
-}
-
-namespace {
- bool NotJoinNode(const Node* N) {
- return N->ToolPtr ? !N->ToolPtr->IsJoin() : true;
- }
-}
-
-// Call TopologicalSort and filter the resulting list to include
-// only Join nodes.
-void CompilationGraph::
-TopologicalSortFilterJoinNodes(std::vector<const Node*>& Out) {
- std::vector<const Node*> TopSorted;
- TopologicalSort(TopSorted);
- std::remove_copy_if(TopSorted.begin(), TopSorted.end(),
- std::back_inserter(Out), NotJoinNode);
-}
-
-// Find head of the toolchain corresponding to the given file.
+// Find the head of the toolchain corresponding to the given file.
// Also, insert an input language into InLangs.
const Node* CompilationGraph::
FindToolChain(const sys::Path& In, const std::string* forceLanguage,
@@ -304,8 +270,43 @@
}
}
-// Build the targets. Command-line options are passed through
-// temporary variables.
+// Sort the nodes in topological order.
+void CompilationGraph::TopologicalSort(std::vector<const Node*>& Out) {
+ std::queue<const Node*> Q;
+ Q.push(&getNode("root"));
+
+ while (!Q.empty()) {
+ const Node* A = Q.front();
+ Q.pop();
+ Out.push_back(A);
+ for (Node::const_iterator EB = A->EdgesBegin(), EE = A->EdgesEnd();
+ EB != EE; ++EB) {
+ Node* B = &getNode((*EB)->ToolName());
+ B->DecrInEdges();
+ if (B->HasNoInEdges())
+ Q.push(B);
+ }
+ }
+}
+
+namespace {
+ bool NotJoinNode(const Node* N) {
+ return N->ToolPtr ? !N->ToolPtr->IsJoin() : true;
+ }
+}
+
+// Call TopologicalSort and filter the resulting list to include
+// only Join nodes.
+void CompilationGraph::
+TopologicalSortFilterJoinNodes(std::vector<const Node*>& Out) {
+ std::vector<const Node*> TopSorted;
+ TopologicalSort(TopSorted);
+ std::remove_copy_if(TopSorted.begin(), TopSorted.end(),
+ std::back_inserter(Out), NotJoinNode);
+}
+
+// Build the targets. Command-line options are accessed through global
+// variables.
int CompilationGraph::Build (const sys::Path& TempDir) {
InputLanguagesSet InLangs;
@@ -325,12 +326,12 @@
JoinTool* JT = &dynamic_cast<JoinTool&>(*CurNode->ToolPtr.getPtr());
bool IsLast = false;
- // Are there any files to be joined?
+ // Are there any files in the join list?
if (JT->JoinListEmpty())
continue;
- // Is this the last tool in the chain?
- // NOTE: we can process several chains in parallel.
+ // Is this the last tool in the toolchain?
+ // NOTE: we can process several toolchains in parallel.
if (!CurNode->HasChildren() || JT->IsLast()) {
if (OutputFilename.empty()) {
Out.set("a");
Modified: llvm/trunk/tools/llvmc2/doc/LLVMC-Enhancements.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/doc/LLVMC-Enhancements.rst?rev=50762&r1=50761&r2=50762&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc2/doc/LLVMC-Enhancements.rst (original)
+++ llvm/trunk/tools/llvmc2/doc/LLVMC-Enhancements.rst Tue May 6 13:16:52 2008
@@ -2,7 +2,7 @@
============
Disclaimer: this document is currently somewhat out-of-date and is
-retained for reference; for documentation, refer to
+retained for reference; for more recent documentation please refer to
LLVMC-Tutorial.rst.
A complete rewrite of the LLVMC compiler driver is proposed, aimed at
More information about the llvm-commits
mailing list