14 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFACCELTABLE_H
15 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFACCELTABLE_H
22 #include "llvm/Support/DataTypes.h"
71 for (
unsigned i = 0, e = Str.
size(); i != e; ++i)
72 h = ((h << 5) + h) + Str[i];
78 void ComputeBucketCount(
void);
83 uint16_t hash_function;
84 uint32_t bucket_count;
85 uint32_t hashes_count;
87 uint32_t header_data_len;
91 static const uint32_t MagicHash = 0x48415348;
93 TableHeader(uint32_t data_len)
94 : magic(MagicHash), version(1),
96 hashes_count(0), header_data_len(data_len) {}
100 O <<
"Magic: " <<
format(
"0x%x", magic) <<
"\n"
101 <<
"Version: " << version <<
"\n"
102 <<
"Hash Function: " << hash_function <<
"\n"
103 <<
"Bucket Count: " << bucket_count <<
"\n"
104 <<
"Header Data Length: " << header_data_len <<
"\n";
130 : type(type), form(form) {}
141 struct TableHeaderData {
142 uint32_t die_offset_base;
146 : die_offset_base(offset), Atoms(AtomList.
begin(), AtomList.
end()) {}
149 void print(raw_ostream &O) {
150 O <<
"die_offset_base: " << die_offset_base <<
"\n";
151 for (
size_t i = 0; i < Atoms.size(); i++)
176 O <<
" Flags: " <<
Flags <<
"\n";
185 std::vector<HashDataContents *> Values;
192 DwarfAccelTable::DataArray &
Data;
194 : Str(S), Data(Data) {
195 HashValue = DwarfAccelTable::HashDJB(S);
199 O <<
"Name: " << Str <<
"\n";
200 O <<
" Hash Value: " <<
format(
"0x%x", HashValue) <<
"\n";
207 for (HashDataContents *
C :
Data.Values) {
208 O <<
" Offset: " << C->Die->getOffset() <<
"\n";
210 O <<
" Flags: " << C->Flags <<
"\n";
217 DwarfAccelTable(
const DwarfAccelTable &) =
delete;
218 void operator=(
const DwarfAccelTable &) =
delete;
221 void EmitHeader(AsmPrinter *);
222 void EmitBuckets(AsmPrinter *);
223 void EmitHashes(AsmPrinter *);
224 void emitOffsets(AsmPrinter *,
const MCSymbol *);
225 void EmitData(AsmPrinter *, DwarfDebug *D);
232 TableHeaderData HeaderData;
233 std::vector<HashData *> Data;
235 typedef StringMap<DataArray, BumpPtrAllocator &> StringEntries;
236 StringEntries Entries;
239 typedef std::vector<HashData *> HashList;
240 typedef std::vector<HashList> BucketList;
246 DwarfAccelTable(ArrayRef<DwarfAccelTable::Atom>);
249 void emit(AsmPrinter *,
const MCSymbol *, DwarfDebug *);
251 void print(raw_ostream &O);
const_iterator end(StringRef path)
Get end iterator over path.
size_t size() const
size - Get the string size.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void print(raw_ostream &O) const
void emit(AsmPrinter *, const MCSymbol *, DwarfDebug *)
const_iterator begin(StringRef path)
Get begin iterator over path.
LLVM_CONSTEXPR Atom(uint16_t type, uint16_t form)
const char * TagString(unsigned Tag)
String pool entry reference.
HashDataContents(const DIE *D, char Flags)
void FinalizeTable(AsmPrinter *, StringRef)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
void AddName(DwarfStringPoolEntryRef Name, const DIE *Die, char Flags=0)
dwarf::Tag getTag() const
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
const char * AtomTypeString(unsigned Atom)
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template paramaters.
DIE - A structured debug information entry.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
unsigned getOffset() const
void print(raw_ostream &O)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
const char * FormEncodingString(unsigned Encoding)
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
void print(raw_ostream &O)