[PATCH] D126958: [Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef - remove isIndexed().
Alexey Lapshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 3 04:16:51 PDT 2022
avl created this revision.
avl added reviewers: aprantl, JDevlieghere, dblaikie, probinson.
Herald added subscribers: arphaman, hiraditya.
Herald added a project: All.
avl requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This patch is extraction from the https://reviews.llvm.org/D126883.
It removes DwarfStringPoolEntryRef::isIndexed() and isIndexed bit
since they are not used.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D126958
Files:
llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
llvm/lib/CodeGen/NonRelocatableStringpool.cpp
llvm/unittests/CodeGen/DIEHashTest.cpp
Index: llvm/unittests/CodeGen/DIEHashTest.cpp
===================================================================
--- llvm/unittests/CodeGen/DIEHashTest.cpp
+++ llvm/unittests/CodeGen/DIEHashTest.cpp
@@ -41,8 +41,8 @@
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() {
Index: llvm/lib/CodeGen/NonRelocatableStringpool.cpp
===================================================================
--- llvm/lib/CodeGen/NonRelocatableStringpool.cpp
+++ llvm/lib/CodeGen/NonRelocatableStringpool.cpp
@@ -25,7 +25,7 @@
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 @@
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();
Index: llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
@@ -39,7 +39,7 @@
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 @@
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,
Index: llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
===================================================================
--- llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
+++ llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
@@ -29,18 +29,16 @@
/// 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 @@
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126958.433997.patch
Type: text/x-patch
Size: 3690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220603/f86c5a45/attachment.bin>
More information about the llvm-commits
mailing list