Skip to content

Commit 501d5b2

Browse files
committed
[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
1 parent 1bfc5e7 commit 501d5b2

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,24 @@ struct DwarfStringPoolEntry {
2929

3030
/// String pool entry reference.
3131
class DwarfStringPoolEntryRef {
32-
PointerIntPair<const StringMapEntry<DwarfStringPoolEntry> *, 1, bool>
33-
MapEntryAndIndexed;
32+
const StringMapEntry<DwarfStringPoolEntry> *MapEntry = nullptr;
3433

3534
const StringMapEntry<DwarfStringPoolEntry> *getMapEntry() const {
36-
return MapEntryAndIndexed.getPointer();
35+
return MapEntry;
3736
}
3837

3938
public:
4039
DwarfStringPoolEntryRef() = default;
41-
DwarfStringPoolEntryRef(const StringMapEntry<DwarfStringPoolEntry> &Entry,
42-
bool Indexed)
43-
: MapEntryAndIndexed(&Entry, Indexed) {}
40+
DwarfStringPoolEntryRef(const StringMapEntry<DwarfStringPoolEntry> &Entry)
41+
: MapEntry(&Entry) {}
4442

4543
explicit operator bool() const { return getMapEntry(); }
4644
MCSymbol *getSymbol() const {
4745
assert(getMapEntry()->second.Symbol && "No symbol available!");
4846
return getMapEntry()->second.Symbol;
4947
}
5048
uint64_t getOffset() const { return getMapEntry()->second.Offset; }
51-
bool isIndexed() const { return MapEntryAndIndexed.getInt(); }
5249
unsigned getIndex() const {
53-
assert(isIndexed());
5450
assert(getMapEntry()->getValue().isIndexed());
5551
return getMapEntry()->second.Index;
5652
}

llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ DwarfStringPool::getEntryImpl(AsmPrinter &Asm, StringRef Str) {
3939
DwarfStringPool::EntryRef DwarfStringPool::getEntry(AsmPrinter &Asm,
4040
StringRef Str) {
4141
auto &MapEntry = getEntryImpl(Asm, Str);
42-
return EntryRef(MapEntry, false);
42+
return EntryRef(MapEntry);
4343
}
4444

4545
DwarfStringPool::EntryRef DwarfStringPool::getIndexedEntry(AsmPrinter &Asm,
4646
StringRef Str) {
4747
auto &MapEntry = getEntryImpl(Asm, Str);
4848
if (!MapEntry.getValue().isIndexed())
4949
MapEntry.getValue().Index = NumIndexedStrings++;
50-
return EntryRef(MapEntry, true);
50+
return EntryRef(MapEntry);
5151
}
5252

5353
void DwarfStringPool::emitStringOffsetsTableHeader(AsmPrinter &Asm,

llvm/lib/CodeGen/NonRelocatableStringpool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ DwarfStringPoolEntryRef NonRelocatableStringpool::getEntry(StringRef S) {
2525
Entry.Symbol = nullptr;
2626
CurrentEndOffset += S.size() + 1;
2727
}
28-
return DwarfStringPoolEntryRef(*I.first, true);
28+
return DwarfStringPoolEntryRef(*I.first);
2929
}
3030

3131
StringRef NonRelocatableStringpool::internString(StringRef S) {
@@ -44,7 +44,7 @@ NonRelocatableStringpool::getEntriesForEmission() const {
4444
Result.reserve(Strings.size());
4545
for (const auto &E : Strings)
4646
if (E.getValue().isIndexed())
47-
Result.emplace_back(E, true);
47+
Result.emplace_back(E);
4848
llvm::sort(Result, [](const DwarfStringPoolEntryRef A,
4949
const DwarfStringPoolEntryRef B) {
5050
return A.getIndex() < B.getIndex();

llvm/unittests/CodeGen/DIEHashTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class DIEHashTest : public testing::Test {
4141
public:
4242
DIEString getString(StringRef S) {
4343
DwarfStringPoolEntry Entry = {nullptr, 1, 1};
44-
return DIEString(DwarfStringPoolEntryRef(
45-
*Pool.insert(std::make_pair(S, Entry)).first, Entry.isIndexed()));
44+
return DIEString(
45+
DwarfStringPoolEntryRef(*Pool.insert(std::make_pair(S, Entry)).first));
4646
}
4747

4848
AsmPrinter *getAsmPrinter() {

0 commit comments

Comments
 (0)