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;
91 static const uint32_t MagicHash = 0x48415348;
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";
129 constexpr
Atom(uint16_t
type, uint16_t
form) : type(type), form(form) {}
140 struct TableHeaderData {
145 : die_offset_base(offset), Atoms(AtomList.
begin(), AtomList.
end()) {}
148 void print(raw_ostream &O) {
149 O <<
"die_offset_base: " << die_offset_base <<
"\n";
150 for (
size_t i = 0;
i < Atoms.size();
i++)
175 O <<
" Flags: " <<
Flags <<
"\n";
184 std::vector<HashDataContents *> Values;
191 DwarfAccelTable::DataArray &Data;
193 : Str(S), Data(Data) {
194 HashValue = DwarfAccelTable::HashDJB(S);
198 O <<
"Name: " << Str <<
"\n";
199 O <<
" Hash Value: " <<
format(
"0x%x", HashValue) <<
"\n";
206 for (HashDataContents *
C : Data.Values) {
207 O <<
" Offset: " << C->Die->getOffset() <<
"\n";
209 O <<
" Flags: " << C->Flags <<
"\n";
216 DwarfAccelTable(
const DwarfAccelTable &) =
delete;
217 void operator=(
const DwarfAccelTable &) =
delete;
220 void EmitHeader(AsmPrinter *);
221 void EmitBuckets(AsmPrinter *);
222 void EmitHashes(AsmPrinter *);
223 void emitOffsets(AsmPrinter *,
const MCSymbol *);
224 void EmitData(AsmPrinter *, DwarfDebug *
D);
231 TableHeaderData HeaderData;
232 std::vector<HashData *> Data;
234 typedef StringMap<DataArray, BumpPtrAllocator &> StringEntries;
235 StringEntries Entries;
238 typedef std::vector<HashData *> HashList;
239 typedef std::vector<HashList> BucketList;
245 DwarfAccelTable(ArrayRef<DwarfAccelTable::Atom>);
248 void emit(AsmPrinter *,
const MCSymbol *, DwarfDebug *);
250 void print(raw_ostream &O);
const_iterator end(StringRef path)
Get end iterator over path.
StringRef AtomTypeString(unsigned Atom)
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.
struct fuzzer::@269 Flags
StringRef FormEncodingString(unsigned Encoding)
String pool entry reference.
static GCRegistry::Add< StatepointGC > D("statepoint-example","an example strategy for statepoint")
constexpr Atom(uint16_t type, uint16_t form)
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)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
dwarf::Tag getTag() const
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template paramaters.
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
Get the compile/type unit relative offset of this DIE.
void print(raw_ostream &O)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
StringRef TagString(unsigned Tag)
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)