[llvm] 501d5b2 - [Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef - remove isIndexed().
Alexey Lapshin via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 5 11:20:38 PDT 2022
Author: Alexey Lapshin
Date: 2022-06-05T21:18:31+03:00
New Revision: 501d5b24db50ac4d8246346a3aa88def085ba015
URL: https://github.com/llvm/llvm-project/commit/501d5b24db50ac4d8246346a3aa88def085ba015
DIFF: https://github.com/llvm/llvm-project/commit/501d5b24db50ac4d8246346a3aa88def085ba015.diff
LOG: [Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef - remove isIndexed().
This patch is extraction from the https://reviews.llvm.org/D126883.
It removes DwarfStringPoolEntryRef::isIndexed() and isIndexed bit
since they are not used.
Differential Revision: https://reviews.llvm.org/D126958
Added:
Modified:
llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
llvm/lib/CodeGen/NonRelocatableStringpool.cpp
llvm/unittests/CodeGen/DIEHashTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h b/llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
index abeba62707c1..79c4c07a720a 100644
--- a/llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
+++ b/llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
@@ -29,18 +29,16 @@ struct DwarfStringPoolEntry {
/// String pool entry reference.
class DwarfStringPoolEntryRef {
- PointerIntPair<const StringMapEntry<DwarfStringPoolEntry> *, 1, bool>
- MapEntryAndIndexed;
+ const StringMapEntry<DwarfStringPoolEntry> *MapEntry = nullptr;
const StringMapEntry<DwarfStringPoolEntry> *getMapEntry() const {
- return MapEntryAndIndexed.getPointer();
+ return MapEntry;
}
public:
DwarfStringPoolEntryRef() = default;
- DwarfStringPoolEntryRef(const StringMapEntry<DwarfStringPoolEntry> &Entry,
- bool Indexed)
- : MapEntryAndIndexed(&Entry, Indexed) {}
+ DwarfStringPoolEntryRef(const StringMapEntry<DwarfStringPoolEntry> &Entry)
+ : MapEntry(&Entry) {}
explicit operator bool() const { return getMapEntry(); }
MCSymbol *getSymbol() const {
@@ -48,9 +46,7 @@ class DwarfStringPoolEntryRef {
return getMapEntry()->second.Symbol;
}
uint64_t getOffset() const { return getMapEntry()->second.Offset; }
- bool isIndexed() const { return MapEntryAndIndexed.getInt(); }
unsigned getIndex() const {
- assert(isIndexed());
assert(getMapEntry()->getValue().isIndexed());
return getMapEntry()->second.Index;
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
index a876f8ccace9..07ae5c8931d0 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
@@ -39,7 +39,7 @@ DwarfStringPool::getEntryImpl(AsmPrinter &Asm, StringRef Str) {
DwarfStringPool::EntryRef DwarfStringPool::getEntry(AsmPrinter &Asm,
StringRef Str) {
auto &MapEntry = getEntryImpl(Asm, Str);
- return EntryRef(MapEntry, false);
+ return EntryRef(MapEntry);
}
DwarfStringPool::EntryRef DwarfStringPool::getIndexedEntry(AsmPrinter &Asm,
@@ -47,7 +47,7 @@ DwarfStringPool::EntryRef DwarfStringPool::getIndexedEntry(AsmPrinter &Asm,
auto &MapEntry = getEntryImpl(Asm, Str);
if (!MapEntry.getValue().isIndexed())
MapEntry.getValue().Index = NumIndexedStrings++;
- return EntryRef(MapEntry, true);
+ return EntryRef(MapEntry);
}
void DwarfStringPool::emitStringOffsetsTableHeader(AsmPrinter &Asm,
diff --git a/llvm/lib/CodeGen/NonRelocatableStringpool.cpp b/llvm/lib/CodeGen/NonRelocatableStringpool.cpp
index db5217469fba..7304bfef55cb 100644
--- a/llvm/lib/CodeGen/NonRelocatableStringpool.cpp
+++ b/llvm/lib/CodeGen/NonRelocatableStringpool.cpp
@@ -25,7 +25,7 @@ DwarfStringPoolEntryRef NonRelocatableStringpool::getEntry(StringRef S) {
Entry.Symbol = nullptr;
CurrentEndOffset += S.size() + 1;
}
- return DwarfStringPoolEntryRef(*I.first, true);
+ return DwarfStringPoolEntryRef(*I.first);
}
StringRef NonRelocatableStringpool::internString(StringRef S) {
@@ -44,7 +44,7 @@ NonRelocatableStringpool::getEntriesForEmission() const {
Result.reserve(Strings.size());
for (const auto &E : Strings)
if (E.getValue().isIndexed())
- Result.emplace_back(E, true);
+ Result.emplace_back(E);
llvm::sort(Result, [](const DwarfStringPoolEntryRef A,
const DwarfStringPoolEntryRef B) {
return A.getIndex() < B.getIndex();
diff --git a/llvm/unittests/CodeGen/DIEHashTest.cpp b/llvm/unittests/CodeGen/DIEHashTest.cpp
index b6dbb7452aa6..b86c36263bd8 100644
--- a/llvm/unittests/CodeGen/DIEHashTest.cpp
+++ b/llvm/unittests/CodeGen/DIEHashTest.cpp
@@ -41,8 +41,8 @@ class DIEHashTest : public testing::Test {
public:
DIEString getString(StringRef S) {
DwarfStringPoolEntry Entry = {nullptr, 1, 1};
- return DIEString(DwarfStringPoolEntryRef(
- *Pool.insert(std::make_pair(S, Entry)).first, Entry.isIndexed()));
+ return DIEString(
+ DwarfStringPoolEntryRef(*Pool.insert(std::make_pair(S, Entry)).first));
}
AsmPrinter *getAsmPrinter() {
More information about the llvm-commits
mailing list