13#ifndef LLVM_CODEGEN_ACCELTABLE_H
14#define LLVM_CODEGEN_ACCELTABLE_H
147 template <
typename T = AccelTableData *>
auto getValues()
const {
148 static_assert(std::is_pointer<T>());
150 std::is_base_of<AccelTableData, std::remove_pointer_t<T>>());
206 template <
typename... Types>
213template <
typename AccelTableDataT>
214template <
typename... Types>
217 assert(Buckets.empty() &&
"Already finalized!");
220 auto &It = Entries[
Name.getString()];
221 if (It.Values.empty()) {
223 It.HashValue = Hash(
Name.getString());
226 AccelTableDataT(std::forward<Types>(Args)...));
283 return LHS.offset() ==
RHS.offset() &&
LHS.unitID() ==
RHS.unitID() &&
298 const std::optional<uint64_t> DefiningParentOffset,
327 return std::holds_alternative<uint64_t>(
OffsetVal);
332 return OffsetAndId->offset();
374 AttrVect.push_back(Attr);
423 if (!
Data->isNormalized())
424 Data->normalizeDIEToOffset();
433 Data->getParentDieOffset(),
Data->getDieTag(),
441 StringRef Prefix,
const MCSymbol *SecBegin,
442 ArrayRef<AppleAccelTableData::Atom> Atoms);
447template <
typename DataT>
450 static_assert(std::is_convertible<DataT *, AppleAccelTableData *>::value);
455 const DwarfDebug &DD,
456 ArrayRef<std::unique_ptr<DwarfCompileUnit>> CUs);
463 AsmPrinter *Asm, DWARF5AccelTable &Contents,
464 ArrayRef<std::variant<MCSymbol *, uint64_t>> CUs,
466 const DWARF5AccelTableData &)>
542 Atom(5, dwarf::DW_FORM_data1),
Atom(6, dwarf::DW_FORM_data4)};
This file defines the BumpPtrAllocator interface.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
This file contains constants used for implementing Dwarf debug support.
This file implements a map that provides insertion order iteration.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A base class holding non-template-dependant functionality of the AccelTable class.
uint32_t getUniqueNameCount() const
std::vector< HashData * > HashList
std::vector< HashList > BucketList
BumpPtrAllocator Allocator
Allocator for HashData and Values.
void operator=(const AccelTableBase &)=delete
void computeBucketCount()
uint32_t getUniqueHashCount() const
void print(raw_ostream &OS) const
AccelTableBase(const AccelTableBase &)=delete
AccelTableBase(HashFn *Hash)
ArrayRef< HashList > getBuckets() const
uint32_t getBucketCount() const
uint32_t(StringRef) HashFn
Interface which the different types of accelerator table data have to conform.
virtual uint64_t order() const =0
virtual ~AccelTableData()=default
virtual void print(raw_ostream &OS) const =0
bool operator<(const AccelTableData &Other) const
This class holds an abstract representation of an Accelerator Table, consisting of a sequence of buck...
const StringEntries getEntries() const
void addEntries(AccelTable< DataT > &Table)
void addName(DwarfStringPoolEntryRef Name, Types &&... Args)
A base class for different implementations of Data classes for Apple Accelerator Tables.
virtual void emit(AsmPrinter *Asm) const =0
static uint32_t hash(StringRef Buffer)
Accelerator table data implementation for simple Apple accelerator tables with just a DIE reference.
void emit(AsmPrinter *Asm) const override
uint64_t order() const override
void print(raw_ostream &OS) const override
static constexpr Atom Atoms[]
AppleAccelTableOffsetData(const DIE &D)
Accelerator table data implementation for simple Apple accelerator tables with a DIE offset but no ac...
AppleAccelTableStaticOffsetData(uint32_t Offset)
static constexpr Atom Atoms[]
void emit(AsmPrinter *Asm) const override
void print(raw_ostream &OS) const override
uint64_t order() const override
Accelerator table data implementation for type accelerator tables with a DIE offset but no actual DIE...
uint32_t QualifiedNameHash
void emit(AsmPrinter *Asm) const override
void print(raw_ostream &OS) const override
bool ObjCClassIsImplementation
static constexpr Atom Atoms[]
uint64_t order() const override
AppleAccelTableStaticTypeData(uint32_t Offset, uint16_t Tag, bool ObjCClassIsImplementation, uint32_t QualifiedNameHash)
Accelerator table data implementation for Apple type accelerator tables.
void print(raw_ostream &OS) const override
AppleAccelTableTypeData(const DIE &D)
void emit(AsmPrinter *Asm) const override
static constexpr Atom Atoms[]
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This class is intended to be used as a driving class for all asm writers.
Allocate memory in an ever growing pool, as if by bump-pointer.
A structured debug information entry.
unsigned getOffset() const
Get the compile/type unit relative offset of this DIE.
The Data class implementation for DWARF v5 accelerator table.
static uint32_t hash(StringRef Name)
void print(raw_ostream &OS) const override
unsigned getDieTag() const
void normalizeDIEToOffset()
std::optional< OffsetAndUnitID > getParentDieOffsetAndUnitID() const
std::optional< uint64_t > getParentDieOffset() const
std::variant< const DIE *, uint64_t > OffsetVal
unsigned getUnitID() const
void setAbbrevNumber(uint16_t AbbrevNum)
Sets AbbrevIndex for an Entry.
uint64_t order() const override
OffsetAndUnitID getDieOffsetAndUnitID() const
static std::optional< uint64_t > getDefiningParentDieOffset(const DIE &Die)
If Die has a non-null parent and the parent is not a declaration, return its offset.
DWARF5AccelTableData(const uint64_t DieOffset, const std::optional< uint64_t > DefiningParentOffset, const unsigned DieTag, const unsigned UnitID, const bool IsTU)
uint16_t getAbbrevNumber() const
Returns AbbrevIndex for an Entry.
bool isNormalized() const
uint64_t getDieOffset() const
std::optional< uint64_t > ParentOffset
void addTypeUnitSignature(DwarfTypeUnit &U)
Add a type unit Signature.
void convertDieToOffset()
Convert DIE entries to explicit offset.
const TUVectorTy & getTypeUnitsSymbols()
Returns type units that were constructed.
void addTypeUnitSymbol(DwarfTypeUnit &U)
Add a type unit start symbol.
void addTypeEntries(DWARF5AccelTable &Table)
void addAttribute(const DebugNamesAbbrev::AttributeEncoding &Attr)
Add attribute encoding to an abbreviation.
void setNumber(uint32_t AbbrevNumber)
Set abbreviation tag index.
const SmallVector< AttributeEncoding, 1 > & getAttributes() const
Returns attributes for an abbreviation.
uint32_t getNumber() const
Get abbreviation tag index.
uint32_t getDieTag() const
Get DIE Tag.
DebugNamesAbbrev(uint32_t DieTag)
DwarfStringPoolEntryRef: Dwarf string pool entry reference.
Node - This class is used to maintain the singly linked bucket list in a folding set.
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
@ DW_ATOM_die_offset
Marker as the end of a list of atoms.
This is an optimization pass for GlobalISel generic memory operations.
auto map_range(ContainerTy &&C, FuncTy F)
void emitAppleAccelTableImpl(AsmPrinter *Asm, AccelTableBase &Contents, StringRef Prefix, const MCSymbol *SecBegin, ArrayRef< AppleAccelTableData::Atom > Atoms)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void emitAppleAccelTable(AsmPrinter *Asm, AccelTable< DataT > &Contents, StringRef Prefix, const MCSymbol *SecBegin)
Emit an Apple Accelerator Table consisting of entries in the specified AccelTable.
uint32_t caseFoldingDjbHash(StringRef Buffer, uint32_t H=5381)
Computes the Bernstein hash after folding the input according to the Dwarf 5 standard case folding ru...
uint32_t djbHash(StringRef Buffer, uint32_t H=5381)
The Bernstein hash function used by the DWARF accelerator tables.
void emitDWARF5AccelTable(AsmPrinter *Asm, DWARF5AccelTable &Contents, const DwarfDebug &DD, ArrayRef< std::unique_ptr< DwarfCompileUnit > > CUs)
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
Represents a group of entries with identical name (and hence, hash value).
void print(raw_ostream &OS) const
auto getValues() const
Get all AccelTableData cast as a T.
DwarfStringPoolEntryRef Name
std::vector< AccelTableData * > Values
An Atom defines the form of the data in an Apple accelerator table.
const uint16_t Form
DWARF Form.
void print(raw_ostream &OS) const
const uint16_t Type
Atom Type.
constexpr Atom(uint16_t Type, uint16_t Form)
DebugNamesAbbrev::AttributeEncoding Encoding
static bool isEqual(const OffsetAndUnitID &LHS, const OffsetAndUnitID &RHS)
static OffsetAndUnitID getEmptyKey()
static unsigned getHashValue(const OffsetAndUnitID &Val)
static OffsetAndUnitID getTombstoneKey()
An information struct used to provide DenseMap with the various necessary components for a given valu...
Helper class to identify an entry in DWARF5AccelTable based on their DIE offset and UnitID.
OffsetAndUnitID(uint64_t Offset, uint32_t UnitID, bool IsTU)