[PATCH] D139181: [lld][Alignment][NFC] Use Align instead of log2 of alignment in Wasm Sections
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 2 08:30:02 PST 2022
sbc100 added inline comments.
================
Comment at: lld/wasm/InputChunks.h:112
uint32_t flags = 0)
- : name(name), file(f), alignment(alignment), flags(flags), sectionKind(k),
- live(!config->gcSections), discarded(false) {}
+ : name(name), file(f), alignment(1ULL << alignment), flags(flags),
+ sectionKind(k), live(!config->gcSections), discarded(false) {}
----------------
It would be nice if there was a way to explicitly construct an llvm::Align from a p2align constant such as this? fromP2Align?
================
Comment at: lld/wasm/OutputSegment.cpp:28
+ << " size=" << inSeg->getSize() << " align="
+ << Log2(inSeg->alignment) << " at:" << size << "\n");
inSeg->outputSeg = this;
----------------
How about we skip the Log2 here and write `p2align=` in the log message just to be explict?
================
Comment at: lld/wasm/OutputSegment.cpp:61
+ auto *syn =
+ make<SyntheticMergedChunk>(name, Log2(ms->alignment), ms->flags);
syn->outputSeg = this;
----------------
ditto
================
Comment at: lld/wasm/Writer.cpp:291
for (OutputSegment *seg : segments) {
- out.dylinkSec->memAlign = std::max(out.dylinkSec->memAlign, seg->alignment);
- memoryPtr = alignTo(memoryPtr, 1ULL << seg->alignment);
+ out.dylinkSec->memAlign =
+ std::max(out.dylinkSec->memAlign, Log2(seg->alignment));
----------------
Can we use Align for the `memAlign` member here too?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139181/new/
https://reviews.llvm.org/D139181
More information about the llvm-commits
mailing list