Skip to content

Commit 7d0c1c8

Browse files
committed
[DTLTO][LLVM] Add a setup() member to the ThinLTO backends
The new setup() member is now called to allow the ThinLTO backends to prepare for code generation. For the DTLTO backend, this will be used to preallocate storage for the information required to perform the backend compilation jobs.
1 parent bc7f32e commit 7d0c1c8

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

llvm/include/llvm/LTO/LTO.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ class ThinBackendProc {
225225
BackendThreadPool(ThinLTOParallelism) {}
226226

227227
virtual ~ThinBackendProc() = default;
228+
virtual void setup(unsigned MaxTasks) {}
228229
virtual Error start(
229230
unsigned Task, BitcodeModule BM,
230231
const FunctionImporter::ImportMapTy &ImportList,

llvm/lib/LTO/LTO.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,6 +2036,8 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache Cache,
20362036
ResolvedODR[Mod.first], ThinLTO.ModuleMap, ThinLTO.ModuleTriples);
20372037
};
20382038

2039+
BackendProcess->setup(ModuleMap.size());
2040+
20392041
if (BackendProcess->getThreadCount() == 1 ||
20402042
BackendProcess->isSensitiveToInputOrder()) {
20412043
// Process the modules in the order they were provided on the

0 commit comments

Comments
 (0)