summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-08-16 05:46:05 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-08-16 05:46:05 +0000
commitcdbcbf7477c40cc27f85370088221ddf4759c2e4 (patch)
treeaff9e7e7c824f5744f48c34278ade2dc27846c41 /llvm/lib/LTO/LTO.cpp
parent19b84a02247cc805bd720b2b3f0cc9162438998e (diff)
downloadbcm5719-llvm-cdbcbf7477c40cc27f85370088221ddf4759c2e4.tar.gz
bcm5719-llvm-cdbcbf7477c40cc27f85370088221ddf4759c2e4.zip
[LTO] Simplify APIs and constify (NFC)
Summary: Multiple APIs were taking a StringMap for the ImportLists containing the entries for for all the modules while operating on a single entry for the current module. Instead we can pass the desired ModuleImport directly. Also some of the APIs were not const, I believe just to be able to use operator[] on the StringMap. Reviewers: tejohnson Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23537 llvm-svn: 278776
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r--llvm/lib/LTO/LTO.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index c12a8ee32e2..30317b9376a 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -409,7 +409,7 @@ public:
virtual ~ThinBackendProc() {}
virtual Error start(unsigned Task, MemoryBufferRef MBRef,
- StringMap<FunctionImporter::ImportMapTy> &ImportLists,
+ const FunctionImporter::ImportMapTy &ImportList,
MapVector<StringRef, MemoryBufferRef> &ModuleMap) = 0;
virtual Error wait() = 0;
};
@@ -447,7 +447,7 @@ public:
}
Error start(unsigned Task, MemoryBufferRef MBRef,
- StringMap<FunctionImporter::ImportMapTy> &ImportLists,
+ const FunctionImporter::ImportMapTy &ImportList,
MapVector<StringRef, MemoryBufferRef> &ModuleMap) override {
StringRef ModulePath = MBRef.getBufferIdentifier();
BackendThreadPool.async(
@@ -466,7 +466,7 @@ public:
Err = std::move(E);
}
},
- MBRef, std::ref(CombinedIndex), std::ref(ImportLists[ModulePath]),
+ MBRef, std::ref(CombinedIndex), std::ref(ImportList),
std::ref(ModuleToDefinedGVSummaries[ModulePath]), std::ref(ModuleMap));
return Error();
}
@@ -530,7 +530,7 @@ public:
}
Error start(unsigned Task, MemoryBufferRef MBRef,
- StringMap<FunctionImporter::ImportMapTy> &ImportLists,
+ const FunctionImporter::ImportMapTy &ImportList,
MapVector<StringRef, MemoryBufferRef> &ModuleMap) override {
StringRef ModulePath = MBRef.getBufferIdentifier();
std::string NewModulePath =
@@ -549,7 +549,7 @@ public:
std::map<std::string, GVSummaryMapTy> ModuleToSummariesForIndex;
gatherImportedSummariesForModule(ModulePath, ModuleToDefinedGVSummaries,
- ImportLists, ModuleToSummariesForIndex);
+ ImportList, ModuleToSummariesForIndex);
raw_fd_ostream OS(NewModulePath + ".thinlto.bc", EC,
sys::fs::OpenFlags::F_None);
@@ -558,8 +558,8 @@ public:
WriteIndexToFile(CombinedIndex, OS, &ModuleToSummariesForIndex);
if (ShouldEmitImportsFiles)
- return errorCodeToError(EmitImportsFiles(
- ModulePath, NewModulePath + ".imports", ImportLists));
+ return errorCodeToError(
+ EmitImportsFiles(ModulePath, NewModulePath + ".imports", ImportList));
return Error();
}
@@ -633,7 +633,7 @@ Error LTO::runThinLTO(AddStreamFn AddStream) {
unsigned Partition = 1;
for (auto &Mod : ThinLTO.ModuleMap) {
- if (Error E = BackendProc->start(Task, Mod.second, ImportLists,
+ if (Error E = BackendProc->start(Task, Mod.second, ImportLists[Mod.first],
ThinLTO.ModuleMap))
return E;
OpenPOWER on IntegriCloud