mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 19:25:00 +00:00
DwarfAccelTable: Store the string symbol in the accelerator table to avoid duplicate lookup.
This also avoids the need for subtly side-effecting calls to manifest strings in the string table at the point where items are added to the accelerator tables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207281 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -179,12 +179,18 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
// String Data
|
||||
struct DataArray {
|
||||
MCSymbol *StrSym;
|
||||
std::vector<HashDataContents *> Values;
|
||||
};
|
||||
friend struct HashData;
|
||||
struct HashData {
|
||||
StringRef Str;
|
||||
uint32_t HashValue;
|
||||
MCSymbol *Sym;
|
||||
ArrayRef<HashDataContents *> Data; // offsets
|
||||
HashData(StringRef S, ArrayRef<HashDataContents *> Data)
|
||||
DwarfAccelTable::DataArray &Data; // offsets
|
||||
HashData(StringRef S, DwarfAccelTable::DataArray &Data)
|
||||
: Str(S), Data(Data) {
|
||||
HashValue = DwarfAccelTable::HashDJB(S);
|
||||
}
|
||||
@@ -198,10 +204,10 @@ private:
|
||||
else
|
||||
O << "<none>";
|
||||
O << "\n";
|
||||
for (size_t i = 0; i < Data.size(); i++) {
|
||||
O << " Offset: " << Data[i]->Die->getOffset() << "\n";
|
||||
O << " Tag: " << dwarf::TagString(Data[i]->Die->getTag()) << "\n";
|
||||
O << " Flags: " << Data[i]->Flags << "\n";
|
||||
for (HashDataContents *C : Data.Values) {
|
||||
O << " Offset: " << C->Die->getOffset() << "\n";
|
||||
O << " Tag: " << dwarf::TagString(C->Die->getTag()) << "\n";
|
||||
O << " Flags: " << C->Flags << "\n";
|
||||
}
|
||||
}
|
||||
void dump() { print(dbgs()); }
|
||||
@@ -226,8 +232,6 @@ private:
|
||||
TableHeaderData HeaderData;
|
||||
std::vector<HashData *> Data;
|
||||
|
||||
// String Data
|
||||
typedef std::vector<HashDataContents *> DataArray;
|
||||
typedef StringMap<DataArray, BumpPtrAllocator &> StringEntries;
|
||||
StringEntries Entries;
|
||||
|
||||
@@ -240,7 +244,8 @@ private:
|
||||
// Public Implementation
|
||||
public:
|
||||
DwarfAccelTable(ArrayRef<DwarfAccelTable::Atom>);
|
||||
void AddName(StringRef, const DIE *, char = 0);
|
||||
void AddName(StringRef Name, MCSymbol *StrSym, const DIE *Die,
|
||||
char Flags = 0);
|
||||
void FinalizeTable(AsmPrinter *, StringRef);
|
||||
void Emit(AsmPrinter *, MCSymbol *, DwarfFile *);
|
||||
#ifndef NDEBUG
|
||||
|
Reference in New Issue
Block a user