summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2008-11-12 00:05:17 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2008-11-12 00:05:17 +0000
commit1cb041242f33b6404f9d79551ce29f326eac3723 (patch)
tree94656d05204203b90b0f9dc886c8d42f2faa478c /llvm/utils/TableGen
parentc1e7dbb1f74fce90d890fcc27de0ed93497faa5d (diff)
downloadbcm5719-llvm-1cb041242f33b6404f9d79551ce29f326eac3723.tar.gz
bcm5719-llvm-1cb041242f33b6404f9d79551ce29f326eac3723.zip
Add a bit of lazy evaluation to PopulateCompilationGraph().
Only the tools that are mentioned in the compilation graph definition are now inserted by PopulateCompilationGraph(). This should cut down plugin loading time a little. llvm-svn: 59097
Diffstat (limited to 'llvm/utils/TableGen')
-rw-r--r--llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp b/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp
index 7836172a44c..33b0e3d8cb2 100644
--- a/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp
+++ b/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp
@@ -1595,26 +1595,33 @@ void EmitPopulateCompilationGraph (Record* CompilationGraph,
{
ListInit* edges = CompilationGraph->getValueAsListInit("edges");
- // Generate code
O << "namespace {\n\n";
O << "void PopulateCompilationGraphLocal(CompilationGraph& G) {\n";
- // Insert vertices
+ // Insert vertices.
+ // Only tools mentioned in the graph definition are inserted.
- RecordVector Tools = Records.getAllDerivedDefinitions("Tool");
- if (Tools.empty())
- throw std::string("No tool definitions found!");
+ llvm::StringSet<> ToolsInGraph;
- for (RecordVector::iterator B = Tools.begin(), E = Tools.end(); B != E; ++B) {
- const std::string& Name = (*B)->getName();
- if (Name != "root")
- O << Indent1 << "G.insertNode(new "
- << Name << "());\n";
+ for (unsigned i = 0; i < edges->size(); ++i) {
+ Record* Edge = edges->getElementAsRecord(i);
+ Record* A = Edge->getValueAsDef("a");
+ Record* B = Edge->getValueAsDef("b");
+
+ if (A->getName() != "root")
+ ToolsInGraph.insert(A->getName());
+ if (B->getName() != "root")
+ ToolsInGraph.insert(B->getName());
}
+ for (llvm::StringSet<>::iterator B = ToolsInGraph.begin(),
+ E = ToolsInGraph.end(); B != E; ++B)
+ O << Indent1 << "G.insertNode(new " << B->first() << "());\n";
+
O << '\n';
- // Insert edges
+ // Insert edges.
+
for (unsigned i = 0; i < edges->size(); ++i) {
Record* Edge = edges->getElementAsRecord(i);
Record* A = Edge->getValueAsDef("a");
OpenPOWER on IntegriCloud