[llvm] r238118 - AsmPrinter: Use DwarfStringPoolEntry in DwarfAccelTable, NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Sun May 24 09:44:32 PDT 2015
Author: dexonsmith
Date: Sun May 24 11:44:32 2015
New Revision: 238118
URL: http://llvm.org/viewvc/llvm-project?rev=238118&view=rev
Log:
AsmPrinter: Use DwarfStringPoolEntry in DwarfAccelTable, NFC
This is just an API change, but it prepares to stop using
`EmitLabelDifference()` when possible.
Modified:
llvm/trunk/include/llvm/CodeGen/DwarfStringPoolEntry.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Modified: llvm/trunk/include/llvm/CodeGen/DwarfStringPoolEntry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DwarfStringPoolEntry.h?rev=238118&r1=238117&r2=238118&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/DwarfStringPoolEntry.h (original)
+++ llvm/trunk/include/llvm/CodeGen/DwarfStringPoolEntry.h Sun May 24 11:44:32 2015
@@ -38,6 +38,9 @@ public:
unsigned getOffset() const { return I->second.Offset; }
unsigned getIndex() const { return I->second.Index; }
StringRef getString() const { return I->first(); }
+
+ bool operator==(const DwarfStringPoolEntryRef &X) const { return I == X.I; }
+ bool operator!=(const DwarfStringPoolEntryRef &X) const { return I != X.I; }
};
} // end namespace llvm
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp?rev=238118&r1=238117&r2=238118&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp Sun May 24 11:44:32 2015
@@ -30,14 +30,14 @@ DwarfAccelTable::DwarfAccelTable(ArrayRe
: Header(8 + (atomList.size() * 4)), HeaderData(atomList),
Entries(Allocator) {}
-void DwarfAccelTable::AddName(StringRef Name, MCSymbol *StrSym, const DIE *die,
+void DwarfAccelTable::AddName(DwarfStringPoolEntryRef Name, const DIE *die,
char Flags) {
assert(Data.empty() && "Already finalized!");
// If the string is in the list already then add this die to the list
// otherwise add a new one.
- DataArray &DIEs = Entries[Name];
- assert(!DIEs.StrSym || DIEs.StrSym == StrSym);
- DIEs.StrSym = StrSym;
+ DataArray &DIEs = Entries[Name.getString()];
+ assert(!DIEs.Name || DIEs.Name == Name);
+ DIEs.Name = Name;
DIEs.Values.push_back(new (Allocator) HashDataContents(die, Flags));
}
@@ -216,7 +216,7 @@ void DwarfAccelTable::EmitData(AsmPrinte
// Remember to emit the label for our offset.
Asm->OutStreamer->EmitLabel((*HI)->Sym);
Asm->OutStreamer->AddComment((*HI)->Str);
- Asm->emitSectionOffset((*HI)->Data.StrSym);
+ Asm->emitSectionOffset((*HI)->Data.Name.getSymbol());
Asm->OutStreamer->AddComment("Num DIEs");
Asm->EmitInt32((*HI)->Data.Values.size());
for (HashDataContents *HD : (*HI)->Data.Values) {
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h?rev=238118&r1=238117&r2=238118&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h Sun May 24 11:44:32 2015
@@ -181,9 +181,8 @@ public:
private:
// String Data
struct DataArray {
- MCSymbol *StrSym;
+ DwarfStringPoolEntryRef Name;
std::vector<HashDataContents *> Values;
- DataArray() : StrSym(nullptr) {}
};
friend struct HashData;
struct HashData {
@@ -245,8 +244,7 @@ private:
// Public Implementation
public:
DwarfAccelTable(ArrayRef<DwarfAccelTable::Atom>);
- void AddName(StringRef Name, MCSymbol *StrSym, const DIE *Die,
- char Flags = 0);
+ void AddName(DwarfStringPoolEntryRef Name, const DIE *Die, char Flags = 0);
void FinalizeTable(AsmPrinter *, StringRef);
void emit(AsmPrinter *, const MCSymbol *, DwarfDebug *);
#ifndef NDEBUG
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=238118&r1=238117&r2=238118&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sun May 24 11:44:32 2015
@@ -1977,27 +1977,23 @@ void DwarfDebug::addDwarfTypeUnitType(Dw
void DwarfDebug::addAccelName(StringRef Name, const DIE &Die) {
if (!useDwarfAccelTables())
return;
- AccelNames.AddName(Name, InfoHolder.getStringPool().getSymbol(*Asm, Name),
- &Die);
+ AccelNames.AddName(InfoHolder.getStringPool().getEntry(*Asm, Name), &Die);
}
void DwarfDebug::addAccelObjC(StringRef Name, const DIE &Die) {
if (!useDwarfAccelTables())
return;
- AccelObjC.AddName(Name, InfoHolder.getStringPool().getSymbol(*Asm, Name),
- &Die);
+ AccelObjC.AddName(InfoHolder.getStringPool().getEntry(*Asm, Name), &Die);
}
void DwarfDebug::addAccelNamespace(StringRef Name, const DIE &Die) {
if (!useDwarfAccelTables())
return;
- AccelNamespace.AddName(Name, InfoHolder.getStringPool().getSymbol(*Asm, Name),
- &Die);
+ AccelNamespace.AddName(InfoHolder.getStringPool().getEntry(*Asm, Name), &Die);
}
void DwarfDebug::addAccelType(StringRef Name, const DIE &Die, char Flags) {
if (!useDwarfAccelTables())
return;
- AccelTypes.AddName(Name, InfoHolder.getStringPool().getSymbol(*Asm, Name),
- &Die);
+ AccelTypes.AddName(InfoHolder.getStringPool().getEntry(*Asm, Name), &Die);
}
More information about the llvm-commits
mailing list