summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2008-05-06 18:16:52 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2008-05-06 18:16:52 +0000
commitbe86712de850096b11e12a3a8dcf4f89d5d96f60 (patch)
tree8193a51a359beb809453b876082c2013f0e2564a /tools
parent2e9e0c2951e8f9f167f28efb673f4045977d6bb0 (diff)
downloadllvm-be86712de850096b11e12a3a8dcf4f89d5d96f60.tar.gz
llvm-be86712de850096b11e12a3a8dcf4f89d5d96f60.tar.bz2
llvm-be86712de850096b11e12a3a8dcf4f89d5d96f60.tar.xz
Some cosmetic changes (change some comments, move code around a bit).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50762 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvmc2/CompilationGraph.cpp85
-rw-r--r--tools/llvmc2/doc/LLVMC-Enhancements.rst2
2 files changed, 44 insertions, 43 deletions
diff --git a/tools/llvmc2/CompilationGraph.cpp b/tools/llvmc2/CompilationGraph.cpp
index 4513d4a19a..73664028ca 100644
--- a/tools/llvmc2/CompilationGraph.cpp
+++ b/tools/llvmc2/CompilationGraph.cpp
@@ -20,7 +20,6 @@
#include <algorithm>
#include <iterator>
-#include <iostream>
#include <limits>
#include <queue>
#include <stdexcept>
@@ -88,6 +87,7 @@ const Node& CompilationGraph::getNode(const std::string& ToolName) const {
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 @@ const std::string& CompilationGraph::getLanguage(const sys::Path& File) const {
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 @@ void CompilationGraph::PassThroughGraph (const sys::Path& InFile,
}
}
-// 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 @@ void CompilationGraph::BuildInitial (InputLanguagesSet& InLangs,
}
}
-// 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 @@ int CompilationGraph::Build (const sys::Path& TempDir) {
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");
diff --git a/tools/llvmc2/doc/LLVMC-Enhancements.rst b/tools/llvmc2/doc/LLVMC-Enhancements.rst
index 671c993b89..94919ce58e 100644
--- a/tools/llvmc2/doc/LLVMC-Enhancements.rst
+++ b/tools/llvmc2/doc/LLVMC-Enhancements.rst
@@ -2,7 +2,7 @@ Introduction
============
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