[PATCH] D126800: Write output sections in parallel
Michael Eisel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 1 11:52:57 PDT 2022
michaeleisel created this revision.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
michaeleisel requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D126800
Files:
lld/MachO/Writer.cpp
Index: lld/MachO/Writer.cpp
===================================================================
--- lld/MachO/Writer.cpp
+++ lld/MachO/Writer.cpp
@@ -20,6 +20,7 @@
#include "SyntheticSections.h"
#include "Target.h"
#include "UnwindInfoSection.h"
+#include "llvm/Support/Parallel.h"
#include "lld/Common/Arrays.h"
#include "lld/Common/CommonLinkerContext.h"
@@ -1081,9 +1082,14 @@
void Writer::writeSections() {
uint8_t *buf = buffer->getBufferStart();
+ std::vector<const OutputSection *> osecs;
for (const OutputSegment *seg : outputSegments)
for (const OutputSection *osec : seg->getSections())
- osec->writeTo(buf + osec->fileOff);
+ osecs.emplace_back(osec);
+
+ parallelForEach(osecs.begin(), osecs.end(), [&](const OutputSection *osec) {
+ osec->writeTo(buf + osec->fileOff);
+ });
}
// In order to utilize multiple cores, we first split the buffer into chunks,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126800.433483.patch
Type: text/x-patch
Size: 909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220601/0f797cde/attachment.bin>
More information about the llvm-commits
mailing list