[llvm] 173f62d - [Alignment][NFC] Use Align in StringTableBuilder ctor
Guillaume Chatelet via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 2 04:43:14 PST 2022
Author: Guillaume Chatelet
Date: 2022-12-02T12:43:01Z
New Revision: 173f62d98fcaa2d3e5afc477f0c3bb65cd502fd6
URL: https://github.com/llvm/llvm-project/commit/173f62d98fcaa2d3e5afc477f0c3bb65cd502fd6
DIFF: https://github.com/llvm/llvm-project/commit/173f62d98fcaa2d3e5afc477f0c3bb65cd502fd6.diff
LOG: [Alignment][NFC] Use Align in StringTableBuilder ctor
Added:
Modified:
lld/COFF/Chunks.cpp
lld/ELF/SyntheticSections.cpp
lld/wasm/InputChunks.h
llvm/include/llvm/MC/StringTableBuilder.h
llvm/lib/MC/StringTableBuilder.cpp
Removed:
################################################################################
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp
index ee222cb6f08da..f626458fea959 100644
--- a/lld/COFF/Chunks.cpp
+++ b/lld/COFF/Chunks.cpp
@@ -941,7 +941,7 @@ uint8_t Baserel::getDefaultType() {
}
MergeChunk::MergeChunk(uint32_t alignment)
- : builder(StringTableBuilder::RAW, alignment) {
+ : builder(StringTableBuilder::RAW, llvm::Align(alignment)) {
setAlignment(alignment);
}
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 24a6f40dbb934..6162edac2130c 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -3210,7 +3210,7 @@ void MergeSyntheticSection::addSection(MergeInputSection *ms) {
MergeTailSection::MergeTailSection(StringRef name, uint32_t type,
uint64_t flags, uint32_t alignment)
: MergeSyntheticSection(name, type, flags, alignment),
- builder(StringTableBuilder::RAW, alignment) {}
+ builder(StringTableBuilder::RAW, llvm::Align(alignment)) {}
size_t MergeTailSection::getSize() const { return builder.getSize(); }
@@ -3252,7 +3252,7 @@ void MergeNoTailSection::writeTo(uint8_t *buf) {
void MergeNoTailSection::finalizeContents() {
// Initializes string table builders.
for (size_t i = 0; i < numShards; ++i)
- shards.emplace_back(StringTableBuilder::RAW, addralign);
+ shards.emplace_back(StringTableBuilder::RAW, llvm::Align(addralign));
// Concurrency level. Must be a power of 2 to avoid expensive modulo
// operations in the following tight loop.
diff --git a/lld/wasm/InputChunks.h b/lld/wasm/InputChunks.h
index 203ad5ad947d3..fb2c438619452 100644
--- a/lld/wasm/InputChunks.h
+++ b/lld/wasm/InputChunks.h
@@ -223,7 +223,8 @@ class SyntheticMergedChunk : public InputChunk {
public:
SyntheticMergedChunk(StringRef name, uint32_t alignment, uint32_t flags)
: InputChunk(nullptr, InputChunk::MergedChunk, name, alignment, flags),
- builder(llvm::StringTableBuilder::RAW, 1ULL << alignment) {}
+ builder(llvm::StringTableBuilder::RAW, llvm::Align(1ULL << alignment)) {
+ }
static bool classof(const InputChunk *c) {
return c->kind() == InputChunk::MergedChunk;
diff --git a/llvm/include/llvm/MC/StringTableBuilder.h b/llvm/include/llvm/MC/StringTableBuilder.h
index 5e12e2d527344..d0d5aaa037389 100644
--- a/llvm/include/llvm/MC/StringTableBuilder.h
+++ b/llvm/include/llvm/MC/StringTableBuilder.h
@@ -46,7 +46,7 @@ class StringTableBuilder {
void initSize();
public:
- StringTableBuilder(Kind K, unsigned Alignment = 1);
+ StringTableBuilder(Kind K, Align Alignment = Align(1));
~StringTableBuilder();
/// Add a string to the builder. Returns the position of S in the
diff --git a/llvm/lib/MC/StringTableBuilder.cpp b/llvm/lib/MC/StringTableBuilder.cpp
index f78460edafabc..bb948fe3d13bf 100644
--- a/llvm/lib/MC/StringTableBuilder.cpp
+++ b/llvm/lib/MC/StringTableBuilder.cpp
@@ -52,7 +52,7 @@ void StringTableBuilder::initSize() {
}
}
-StringTableBuilder::StringTableBuilder(Kind K, unsigned Alignment)
+StringTableBuilder::StringTableBuilder(Kind K, Align Alignment)
: K(K), Alignment(Alignment) {
initSize();
}
More information about the llvm-commits
mailing list