10 #ifndef LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H 11 #define LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H 72 : AccelSection(AccelSection), StringSection(StringSection) {}
88 uint16_t HashFunction;
97 using AtomType = uint16_t;
107 struct HeaderData HdrData;
108 bool IsValid =
false;
118 const HeaderData *HdrData =
nullptr;
144 class ValueIterator :
public std::iterator<std::input_iterator_tag, Entry> {
147 unsigned DataOffset = 0;
149 unsigned NumData = 0;
167 return A.NumData == B.NumData && A.DataOffset == B.DataOffset;
187 bool validateForms();
197 std::pair<uint32_t, dwarf::Tag> readAtoms(
uint32_t &HashDataOffset);
259 : Index(Index), Form(Form) {}
274 std::vector<AttributeEncoding> Attributes)
275 : Code(Code), Tag(Tag), Attributes(
std::move(Attributes)) {}
329 std::error_code convertToErrorCode()
const override;
334 struct AbbrevMapInfo {
335 static Abbrev getEmptyKey();
336 static Abbrev getTombstoneKey();
337 static unsigned getHashValue(
uint32_t Code) {
340 static unsigned getHashValue(
const Abbrev &Abbr) {
341 return getHashValue(Abbr.
Code);
344 return LHS == RHS.
Code;
364 : StrData(StrData), Index(Index), StringOffset(StringOffset),
365 EntryOffset(EntryOffset) {}
413 extractAttributeEncodings(
uint32_t *Offset);
419 : Section(Section), Base(Base) {}
430 uint64_t getForeignTUSignature(
uint32_t TU)
const;
471 class ValueIterator :
public std::iterator<std::input_iterator_tag, Entry> {
483 unsigned DataOffset = 0;
487 bool getEntryAtCurrentOffset();
489 bool findInCurrentIndex();
490 void searchFromStartOfCurrentIndex();
521 return A.CurrentIndex == B.CurrentIndex && A.DataOffset == B.DataOffset;
537 assert(CurrentName <= CurrentIndex->getNameCount());
551 : CurrentIndex(CurrentIndex), CurrentName(CurrentName) {}
567 return A.CurrentIndex == B.CurrentIndex && A.CurrentName == B.CurrentName;
600 #endif // LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H The accelerator tables are designed to allow efficient random access (using a symbol name as a key) i...
Abbrev(uint32_t Code, dwarf::Tag Tag, std::vector< AttributeEncoding > Attributes)
uint32_t getEntryOffset() const
Returns the offset of the first Entry in the list.
uint32_t getNextUnitOffset() const
typename SuperClass::const_iterator const_iterator
This class represents lattice values for constants.
const Abbrev & getAbbrev() const
Return the Abbreviation that can be used to interpret the raw values of this Accelerator Entry...
uint32_t getUnitOffset() const
std::vector< AttributeEncoding > Attributes
List of index attributes.
Entry & operator=(const Entry &)=default
ValueIterator & operator++()
SmallVector< DWARFFormValue, 3 > Values
Implements a dense probed hash-table based set.
ValueIterator & operator++()
This class holds an abstract representation of an Accelerator Table, consisting of a sequence of buck...
uint32_t getStringOffset() const
Returns the offset of the name of the described entities.
Abbreviation describing the encoding of Name Index entries.
An abstract class representing a single entry in the accelerator tables.
void log(raw_ostream &OS) const override
Print an error message to an output stream.
NameIterator(const NameIndex *CurrentIndex, uint32_t CurrentName)
Creates an iterator whose initial position is name CurrentName in CurrentIndex.
virtual void dump(raw_ostream &OS) const =0
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
friend bool operator==(const AttributeEncoding &LHS, const AttributeEncoding &RHS)
DWARFDataExtractor AccelSection
Tagged union holding either a T or a Error.
dwarf::Tag tag() const
.debug_names-specific getter, which always succeeds (DWARF v5 index entries always have a tag)...
Index attribute and its encoding.
static const uint16_t * lookup(unsigned opcode, unsigned domain, ArrayRef< uint16_t[3]> Table)
dwarf::Tag Tag
Dwarf Tag of the described entity.
uint32_t getLocalTUCount() const
Apple-specific implementation of an Accelerator Entry.
static bool isEqual(const Function &Caller, const Function &Callee)
friend bool operator!=(const ValueIterator &A, const ValueIterator &B)
Optional< dwarf::Tag > getTag() const override
Returns the Tag of the Debug Info Entry associated with this Accelerator Entry or None if the Tag is ...
friend bool operator!=(const ValueIterator &A, const ValueIterator &B)
const DenseSet< Abbrev, AbbrevMapInfo > & getAbbrevs() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Represents a single accelerator table within the Dwarf 5 .debug_names section.
const_iterator end() const
uint32_t getNameCount() const
NameTableEntry operator*() const
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
DWARF v5-specific implementation of an Accelerator Entry.
This implements the Apple accelerator table format, a precursor of the DWARF 5 accelerator table form...
friend bool operator==(const NameIterator &A, const NameIterator &B)
uint32_t getForeignTUCount() const
virtual ~DWARFAcceleratorTable()
const Entry & operator*() const
DWARFDebugNames(const DWARFDataExtractor &AccelSection, DataExtractor StringSection)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
virtual Optional< uint64_t > getCUOffset() const =0
Returns the Offset of the Compilation Unit associated with this Accelerator Entry or None if the Comp...
NameTableEntry getNameTableEntry(uint32_t Index) const
Reads an entry in the Name Table for the given Index.
virtual llvm::Error extract()=0
uint32_t getBucketCount() const
DWARFAcceleratorTable(const DWARFDataExtractor &AccelSection, DataExtractor StringSection)
SmallVector< NameIndex, 0 >::const_iterator const_iterator
static const char *const Magic
ValueIterator operator++(int)
const char * getString() const
Return the string referenced by this name table entry or nullptr if the string offset is not valid...
.debug_names section consists of one or more units.
NameIterator & operator++()
A single entry in the Name Table (Dwarf 5 sect.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
const_iterator begin() const
ArrayRef< DWARFFormValue > getValues() const
Returns the raw values of fields in the Accelerator Entry.
constexpr AttributeEncoding(dwarf::Index Index, dwarf::Form Form)
uint32_t getIndex() const
Return the index of this name in the parent Name Index.
friend bool operator==(const ValueIterator &A, const ValueIterator &B)
ValueIterator operator++(int)
A range adaptor for a pair of iterators.
This file contains constants used for implementing Dwarf debug support.
Base class for user error types.
Error returned by NameIndex::getEntry to report it has reached the end of the entry list...
NameTableEntry(const DataExtractor &StrData, uint32_t Index, uint32_t StringOffset, uint32_t EntryOffset)
NameIterator operator++(int)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
NameIndex(const DWARFDebugNames &Section, uint32_t Base)
virtual Optional< dwarf::Tag > getTag() const =0
Returns the Tag of the Debug Info Entry associated with this Accelerator Entry or None if the Tag is ...
AppleAcceleratorTable(const DWARFDataExtractor &AccelSection, DataExtractor StringSection)
NameIterator begin() const
friend bool operator==(const ValueIterator &A, const ValueIterator &B)
uint32_t getCUCount() const
uint32_t Code
Abbreviation code.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
std::input_iterator_tag iterator_category
LLVM Value Representation.
Lightweight error class with error context and mandatory checking.
This class implements an extremely fast bulk output stream that can only output to a stream...
friend bool operator!=(const NameIterator &A, const NameIterator &B)
const Entry & operator*() const
StringRef - Represent a constant reference to a string, i.e.
DataExtractor StringSection