forked from OSchip/llvm-project
AsmPrinter: Use DwarfStringPoolEntry in DwarfAccelTable, NFC
This is just an API change, but it prepares to stop using `EmitLabelDifference()` when possible. llvm-svn: 238118
This commit is contained in:
parent
f73bcf4020
commit
f4599942fb
|
@ -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
|
||||
|
|
|
@ -30,14 +30,14 @@ DwarfAccelTable::DwarfAccelTable(ArrayRef<DwarfAccelTable::Atom> atomList)
|
|||
: 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(AsmPrinter *Asm, DwarfDebug *D) {
|
|||
// 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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1977,27 +1977,23 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue