summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-lto2/llvm-lto2.cpp
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-08-19 23:54:40 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-08-19 23:54:40 +0000
commit458f80546857bfb908ebe64e754de7d7df1956db (patch)
tree09a92f52811f28e5a63d2b69de827d4f5b327f8c /llvm/tools/llvm-lto2/llvm-lto2.cpp
parent8a4d2ddd19489ea994c3a0493504b0a1012ccadb (diff)
downloadbcm5719-llvm-458f80546857bfb908ebe64e754de7d7df1956db.tar.gz
bcm5719-llvm-458f80546857bfb908ebe64e754de7d7df1956db.zip
[LTO] Add the ability to test -thinlto-emit-imports-files through llvm-lto2
Summary: Start bringing llvm-lto2 to a level where we can test the LTO API a bit deeper. Reviewers: tejohnson Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23681 llvm-svn: 279349
Diffstat (limited to 'llvm/tools/llvm-lto2/llvm-lto2.cpp')
-rw-r--r--llvm/tools/llvm-lto2/llvm-lto2.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp
index e29185d6438..b2a83213bb8 100644
--- a/llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -33,6 +33,15 @@ static cl::opt<std::string> OutputFilename("o", cl::Required,
static cl::opt<bool> SaveTemps("save-temps", cl::desc("Save temporary files"));
+static cl::opt<bool>
+ ThinLTODistributedIndexes("thinlto-distributed-indexes", cl::init(false),
+ cl::desc("Write out individual index and "
+ "import files for the "
+ "distributed backend case"));
+
+static cl::opt<int> Threads("-thinlto-threads",
+ cl::init(thread::hardware_concurrency()));
+
static cl::list<std::string> SymbolResolutions(
"r",
cl::desc("Specify a symbol resolution: filename,symbolname,resolution\n"
@@ -135,7 +144,12 @@ int main(int argc, char **argv) {
check(Conf.addSaveTemps(OutputFilename + "."),
"Config::addSaveTemps failed");
- LTO Lto(std::move(Conf));
+ ThinBackend Backend;
+ if (ThinLTODistributedIndexes)
+ Backend = createWriteIndexesThinBackend("", "", true, "");
+ else
+ Backend = createInProcessThinBackend(Threads);
+ LTO Lto(std::move(Conf), std::move(Backend));
bool HasErrors = false;
for (std::string F : InputFilenames) {
OpenPOWER on IntegriCloud