13#ifndef LLVM_CODEGEN_ACCELTABLE_H
14#define LLVM_CODEGEN_ACCELTABLE_H
198 template <
typename... Types>
205template <
typename AccelTableDataT>
206template <
typename... Types>
209 assert(Buckets.empty() &&
"Already finalized!");
212 auto &It = Entries[
Name.getString()];
213 if (It.Values.empty()) {
215 It.HashValue = Hash(
Name.getString());
218 AccelTableDataT(std::forward<Types>(Args)...));
264 const bool IsTU =
false);
266 const unsigned UnitID,
const bool IsTU =
false)
275 "Accessing DIE Offset before normalizing.");
283 "Accessing offset after normalizing.");
287 return std::holds_alternative<uint64_t>(
OffsetVal);
328 if (!
Data->isNormalized())
329 Data->normalizeDIEToOffset();
339 Data->getUnitID(),
true);
346 StringRef Prefix,
const MCSymbol *SecBegin,
347 ArrayRef<AppleAccelTableData::Atom> Atoms);
352template <
typename DataT>
355 static_assert(std::is_convertible<DataT *, AppleAccelTableData *>::value);
360 const DwarfDebug &DD,
361 ArrayRef<std::unique_ptr<DwarfCompileUnit>> CUs);
368 AsmPrinter *Asm, DWARF5AccelTable &Contents,
369 ArrayRef<std::variant<MCSymbol *, uint64_t>> CUs,
371 const DWARF5AccelTableData &)>
447 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.
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 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 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)
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::variant< const DIE *, uint64_t > OffsetVal
unsigned getUnitID() const
uint64_t order() const override
bool isNormalized() const
uint64_t getDieOffset() const
DWARF5AccelTableData(const uint64_t DieOffset, const unsigned DieTag, const unsigned UnitID, const bool IsTU=false)
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)
DwarfStringPoolEntryRef: Dwarf string pool entry reference.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
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.
LLVM Value Representation.
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.
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)
Represents a group of entries with identical name (and hence, hash value).
void print(raw_ostream &OS) const
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)
DWARF5AccelTableData::AttributeEncoding Endoding