LLVM 23.0.0git
AccelTable.h
Go to the documentation of this file.
1//==- include/llvm/CodeGen/AccelTable.h - Accelerator Tables -----*- C++ -*-==//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8/// \file
9/// This file contains support for writing accelerator tables.
10///
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CODEGEN_ACCELTABLE_H
14#define LLVM_CODEGEN_ACCELTABLE_H
15
16#include "llvm/ADT/ArrayRef.h"
17#include "llvm/ADT/MapVector.h"
19#include "llvm/ADT/StringRef.h"
21#include "llvm/CodeGen/DIE.h"
25#include "llvm/Support/DJB.h"
26#include "llvm/Support/Debug.h"
27#include <cstdint>
28#include <variant>
29#include <vector>
30
31/// \file
32/// The DWARF and Apple accelerator tables are an indirect hash table optimized
33/// for null lookup rather than access to known data. The Apple accelerator
34/// tables are a precursor of the newer DWARF v5 accelerator tables. Both
35/// formats share common design ideas.
36///
37/// The Apple accelerator table are output into an on-disk format that looks
38/// like this:
39///
40/// .------------------.
41/// | HEADER |
42/// |------------------|
43/// | BUCKETS |
44/// |------------------|
45/// | HASHES |
46/// |------------------|
47/// | OFFSETS |
48/// |------------------|
49/// | DATA |
50/// `------------------'
51///
52/// The header contains a magic number, version, type of hash function,
53/// the number of buckets, total number of hashes, and room for a special struct
54/// of data and the length of that struct.
55///
56/// The buckets contain an index (e.g. 6) into the hashes array. The hashes
57/// section contains all of the 32-bit hash values in contiguous memory, and the
58/// offsets contain the offset into the data area for the particular hash.
59///
60/// For a lookup example, we could hash a function name and take it modulo the
61/// number of buckets giving us our bucket. From there we take the bucket value
62/// as an index into the hashes table and look at each successive hash as long
63/// as the hash value is still the same modulo result (bucket value) as earlier.
64/// If we have a match we look at that same entry in the offsets table and grab
65/// the offset in the data for our final match.
66///
67/// The DWARF v5 accelerator table consists of zero or more name indices that
68/// are output into an on-disk format that looks like this:
69///
70/// .------------------.
71/// | HEADER |
72/// |------------------|
73/// | CU LIST |
74/// |------------------|
75/// | LOCAL TU LIST |
76/// |------------------|
77/// | FOREIGN TU LIST |
78/// |------------------|
79/// | HASH TABLE |
80/// |------------------|
81/// | NAME TABLE |
82/// |------------------|
83/// | ABBREV TABLE |
84/// |------------------|
85/// | ENTRY POOL |
86/// `------------------'
87///
88/// For the full documentation please refer to the DWARF 5 standard.
89///
90///
91/// This file defines the class template AccelTable, which is represents an
92/// abstract view of an Accelerator table, without any notion of an on-disk
93/// layout. This class is parameterized by an entry type, which should derive
94/// from AccelTableData. This is the type of individual entries in the table,
95/// and it should store the data necessary to emit them. AppleAccelTableData is
96/// the base class for Apple Accelerator Table entries, which have a uniform
97/// structure based on a sequence of Atoms. There are different sub-classes
98/// derived from AppleAccelTable, which differ in the set of Atoms and how they
99/// obtain their values.
100///
101/// An Apple Accelerator Table can be serialized by calling emitAppleAccelTable
102/// function.
103
104namespace llvm {
105
106class AsmPrinter;
107class DwarfDebug;
108class DwarfTypeUnit;
109class MCSymbol;
110class raw_ostream;
111
112/// Interface which the different types of accelerator table data have to
113/// conform. It serves as a base class for different values of the template
114/// argument of the AccelTable class template.
116public:
117 virtual ~AccelTableData() = default;
118
119 bool operator<(const AccelTableData &Other) const {
120 return order() < Other.order();
121 }
122
123 // Subclasses should implement:
124 // static uint32_t hash(StringRef Name);
125
126#ifndef NDEBUG
127 virtual void print(raw_ostream &OS) const = 0;
128#endif
129protected:
130 virtual uint64_t order() const = 0;
131};
132
133/// A base class holding non-template-dependant functionality of the AccelTable
134/// class. Clients should not use this class directly but rather instantiate
135/// AccelTable with a type derived from AccelTableData.
137public:
139
140 /// Represents a group of entries with identical name (and hence, hash value).
141 struct HashData {
144 std::vector<AccelTableData *> Values;
146
147 /// Get all AccelTableData cast as a `T`.
148 template <typename T = AccelTableData *> auto getValues() const {
149 static_assert(std::is_pointer<T>());
150 static_assert(
151 std::is_base_of<AccelTableData, std::remove_pointer_t<T>>());
152 return map_range(
153 Values, [](AccelTableData *Data) { return static_cast<T>(Data); });
154 }
155
156#ifndef NDEBUG
157 void print(raw_ostream &OS) const;
158 void dump() const { print(dbgs()); }
159#endif
160 };
161 using HashList = std::vector<HashData *>;
162 using BucketList = std::vector<HashList>;
163
164protected:
165 /// Allocator for HashData and Values.
167
170
174
177
179
181
182public:
183 LLVM_ABI void finalize(AsmPrinter *Asm, StringRef Prefix);
187 uint32_t getUniqueNameCount() const { return Entries.size(); }
188
189#ifndef NDEBUG
190 void print(raw_ostream &OS) const;
191 void dump() const { print(dbgs()); }
192#endif
193
195 void operator=(const AccelTableBase &) = delete;
196};
197
198/// This class holds an abstract representation of an Accelerator Table,
199/// consisting of a sequence of buckets, each bucket containint a sequence of
200/// HashData entries. The class is parameterized by the type of entries it
201/// holds. The type template parameter also defines the hash function to use for
202/// hashing names.
203template <typename DataT> class AccelTable : public AccelTableBase {
204public:
205 AccelTable() : AccelTableBase(DataT::hash) {}
206
207 template <typename... Types>
208 void addName(DwarfStringPoolEntryRef Name, Types &&... Args);
209 void clear() { Entries.clear(); }
211 const StringEntries getEntries() const { return Entries; }
212};
213
214template <typename AccelTableDataT>
215template <typename... Types>
217 Types &&... Args) {
218 assert(Buckets.empty() && "Already finalized!");
219 // If the string is in the list already then add this die to the list
220 // otherwise add a new one.
221 auto &It = Entries[Name.getString()];
222 if (It.Values.empty()) {
223 It.Name = Name;
224 It.HashValue = Hash(Name.getString());
225 }
226 It.Values.push_back(new (Allocator)
227 AccelTableDataT(std::forward<Types>(Args)...));
228}
229
230/// A base class for different implementations of Data classes for Apple
231/// Accelerator Tables. The columns in the table are defined by the static Atoms
232/// variable defined on the subclasses.
234public:
235 /// An Atom defines the form of the data in an Apple accelerator table.
236 /// Conceptually it is a column in the accelerator consisting of a type and a
237 /// specification of the form of its data.
238 struct Atom {
239 /// Atom Type.
241 /// DWARF Form.
243
245
246#ifndef NDEBUG
247 void print(raw_ostream &OS) const;
248 void dump() const { print(dbgs()); }
249#endif
250 };
251 // Subclasses should define:
252 // static constexpr Atom Atoms[];
253
254 virtual void emit(AsmPrinter *Asm) const = 0;
255
256 static uint32_t hash(StringRef Buffer) { return djbHash(Buffer); }
257};
258
259/// Helper class to identify an entry in DWARF5AccelTable based on their DIE
260/// offset and UnitID.
264 bool IsTU = false;
265 OffsetAndUnitID() = delete;
268 uint64_t offset() const { return Offset; };
269 uint32_t unitID() const { return UnitID; };
270 bool isTU() const { return IsTU; }
271};
272
273template <> struct DenseMapInfo<OffsetAndUnitID> {
274 static unsigned getHashValue(const OffsetAndUnitID &Val) {
275 return (unsigned)llvm::hash_combine(Val.offset(), Val.unitID(), Val.IsTU);
276 }
277 static bool isEqual(const OffsetAndUnitID &LHS, const OffsetAndUnitID &RHS) {
278 return LHS.offset() == RHS.offset() && LHS.unitID() == RHS.unitID() &&
279 LHS.IsTU == RHS.isTU();
280 }
281};
282
283/// The Data class implementation for DWARF v5 accelerator table. Unlike the
284/// Apple Data classes, this class is just a DIE wrapper, and does not know to
285/// serialize itself. The complete serialization logic is in the
286/// emitDWARF5AccelTable function.
288public:
289 static uint32_t hash(StringRef Name) { return caseFoldingDjbHash(Name); }
290
292 const bool IsTU);
294 const std::optional<uint64_t> DefiningParentOffset,
295 const unsigned DieTag, const unsigned UnitID,
296 const bool IsTU)
297 : OffsetVal(DieOffset), ParentOffset(DefiningParentOffset),
299
300#ifndef NDEBUG
301 void print(raw_ostream &OS) const override;
302#endif
303
305 assert(isNormalized() && "Accessing DIE Offset before normalizing.");
306 return std::get<uint64_t>(OffsetVal);
307 }
308
310 return {getDieOffset(), getUnitID(), isTU()};
311 }
312
313 unsigned getDieTag() const { return DieTag; }
314 unsigned getUnitID() const { return UnitID; }
315 bool isTU() const { return IsTU; }
317 assert(!isNormalized() && "Accessing offset after normalizing.");
318 const DIE *Entry = std::get<const DIE *>(OffsetVal);
320 OffsetVal = Entry->getOffset();
321 }
322 bool isNormalized() const {
323 return std::holds_alternative<uint64_t>(OffsetVal);
324 }
325
326 std::optional<uint64_t> getParentDieOffset() const {
327 if (auto OffsetAndId = getParentDieOffsetAndUnitID())
328 return OffsetAndId->offset();
329 return {};
330 }
331
332 std::optional<OffsetAndUnitID> getParentDieOffsetAndUnitID() const {
333 assert(isNormalized() && "Accessing DIE Offset before normalizing.");
334 if (!ParentOffset)
335 return std::nullopt;
337 }
338
339 /// Sets AbbrevIndex for an Entry.
340 void setAbbrevNumber(uint16_t AbbrevNum) { AbbrevNumber = AbbrevNum; }
341
342 /// Returns AbbrevIndex for an Entry.
344
345 /// If `Die` has a non-null parent and the parent is not a declaration,
346 /// return its offset.
347 LLVM_ABI static std::optional<uint64_t>
349
350protected:
351 std::variant<const DIE *, uint64_t> OffsetVal;
352 std::optional<uint64_t> ParentOffset;
357 uint64_t order() const override { return getDieOffset(); }
358};
359
361public:
369 /// Add attribute encoding to an abbreviation.
371 AttrVect.push_back(Attr);
372 }
373 /// Set abbreviation tag index.
374 void setNumber(uint32_t AbbrevNumber) { Number = AbbrevNumber; }
375 /// Get abbreviation tag index.
376 uint32_t getNumber() const { return Number; }
377 /// Get DIE Tag.
378 uint32_t getDieTag() const { return DieTag; }
379 /// Used to gather unique data for the abbreviation folding set.
380 LLVM_ABI void Profile(FoldingSetNodeID &ID) const;
381 /// Returns attributes for an abbreviation.
383 return AttrVect;
384 }
385
386private:
388};
389
391 // Symbol for start of the TU section or signature if this is SplitDwarf.
392 std::variant<MCSymbol *, uint64_t> LabelOrSignature;
393 // Unique ID of Type Unit.
394 unsigned UniqueID;
395};
397class DWARF5AccelTable : public AccelTable<DWARF5AccelTableData> {
398 // Symbols to start of all the TU sections that were generated.
399 TUVectorTy TUSymbolsOrHashes;
400
401public:
406 /// Returns type units that were constructed.
407 const TUVectorTy &getTypeUnitsSymbols() { return TUSymbolsOrHashes; }
408 /// Add a type unit start symbol.
410 /// Add a type unit Signature.
412 /// Convert DIE entries to explicit offset.
413 /// Needs to be called after DIE offsets are computed.
415 for (auto &Entry : Entries) {
416 for (auto *Data : Entry.second.getValues<DWARF5AccelTableData *>()) {
417 // For TU we normalize as each Unit is emitted.
418 // So when this is invoked after CU construction we will be in mixed
419 // state.
420 if (!Data->isNormalized())
421 Data->normalizeDIEToOffset();
422 }
423 }
424 }
425
427 for (auto &Entry : Table.getEntries()) {
428 for (auto *Data : Entry.second.getValues<DWARF5AccelTableData *>()) {
429 addName(Entry.second.Name, Data->getDieOffset(),
430 Data->getParentDieOffset(), Data->getDieTag(),
431 Data->getUnitID(), Data->isTU());
432 }
433 }
434 }
435};
436
437LLVM_ABI void
438emitAppleAccelTableImpl(AsmPrinter *Asm, AccelTableBase &Contents,
439 StringRef Prefix, const MCSymbol *SecBegin,
441
442/// Emit an Apple Accelerator Table consisting of entries in the specified
443/// AccelTable. The DataT template parameter should be derived from
444/// AppleAccelTableData.
445template <typename DataT>
447 StringRef Prefix, const MCSymbol *SecBegin) {
448 static_assert(std::is_convertible<DataT *, AppleAccelTableData *>::value);
449 emitAppleAccelTableImpl(Asm, Contents, Prefix, SecBegin, DataT::Atoms);
450}
451
452LLVM_ABI void
453emitDWARF5AccelTable(AsmPrinter *Asm, DWARF5AccelTable &Contents,
454 const DwarfDebug &DD,
455 ArrayRef<std::unique_ptr<DwarfCompileUnit>> CUs);
456
457/// Emit a DWARFv5 Accelerator Table consisting of entries in the specified
458/// AccelTable. The \p CUs contains either symbols keeping offsets to the
459/// start of compilation unit, either offsets to the start of compilation
460/// unit themselves.
462 AsmPrinter *Asm, DWARF5AccelTable &Contents,
463 ArrayRef<std::variant<MCSymbol *, uint64_t>> CUs,
464 llvm::function_ref<std::optional<DWARF5AccelTable::UnitIndexAndEncoding>(
465 const DWARF5AccelTableData &)>
466 getIndexForEntry);
467
468/// Accelerator table data implementation for simple Apple accelerator tables
469/// with just a DIE reference.
471public:
473
474 void emit(AsmPrinter *Asm) const override;
475
476 static constexpr Atom Atoms[] = {
477 Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4)};
478
479#ifndef NDEBUG
480 void print(raw_ostream &OS) const override;
481#endif
482protected:
483 uint64_t order() const override { return Die.getOffset(); }
484
485 const DIE &Die;
486};
487
488/// Accelerator table data implementation for Apple type accelerator tables.
490public:
492
493 void emit(AsmPrinter *Asm) const override;
494
495 static constexpr Atom Atoms[] = {
496 Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4),
497 Atom(dwarf::DW_ATOM_die_tag, dwarf::DW_FORM_data2),
498 Atom(dwarf::DW_ATOM_type_flags, dwarf::DW_FORM_data1)};
499
500#ifndef NDEBUG
501 void print(raw_ostream &OS) const override;
502#endif
503};
504
505/// Accelerator table data implementation for simple Apple accelerator tables
506/// with a DIE offset but no actual DIE pointer.
508public:
510
511 void emit(AsmPrinter *Asm) const override;
512
513 static constexpr Atom Atoms[] = {
514 Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4)};
515
516#ifndef NDEBUG
517 void print(raw_ostream &OS) const override;
518#endif
519protected:
520 uint64_t order() const override { return Offset; }
521
523};
524
525/// Accelerator table data implementation for type accelerator tables with
526/// a DIE offset but no actual DIE pointer.
529public:
536
537 void emit(AsmPrinter *Asm) const override;
538
539 static constexpr Atom Atoms[] = {
540 Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4),
541 Atom(dwarf::DW_ATOM_die_tag, dwarf::DW_FORM_data2),
542 Atom(5, dwarf::DW_FORM_data1), Atom(6, dwarf::DW_FORM_data4)};
543
544#ifndef NDEBUG
545 void print(raw_ostream &OS) const override;
546#endif
547protected:
548 uint64_t order() const override { return Offset; }
549
553};
554
555} // end namespace llvm
556
557#endif // LLVM_CODEGEN_ACCELTABLE_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
arc branch finalize
This file defines the BumpPtrAllocator interface.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
#define LLVM_ABI
Definition Compiler.h:213
This file contains constants used for implementing Dwarf debug support.
Load MIR Sample Profile
This file implements a map that provides insertion order iteration.
#define T
Value * RHS
Value * LHS
uint32_t getUniqueNameCount() const
Definition AccelTable.h:187
std::vector< HashData * > HashList
Definition AccelTable.h:161
std::vector< HashList > BucketList
Definition AccelTable.h:162
BumpPtrAllocator Allocator
Allocator for HashData and Values.
Definition AccelTable.h:166
void operator=(const AccelTableBase &)=delete
LLVM_ABI void computeBucketCount()
uint32_t getUniqueHashCount() const
Definition AccelTable.h:186
void print(raw_ostream &OS) const
void dump() const
Definition AccelTable.h:191
AccelTableBase(const AccelTableBase &)=delete
AccelTableBase(HashFn *Hash)
Definition AccelTable.h:180
MapVector< StringRef, HashData > StringEntries
Definition AccelTable.h:168
ArrayRef< HashList > getBuckets() const
Definition AccelTable.h:184
uint32_t getBucketCount() const
Definition AccelTable.h:185
uint32_t(StringRef) HashFn
Definition AccelTable.h:138
StringEntries Entries
Definition AccelTable.h:169
Interface which the different types of accelerator table data have to conform.
Definition AccelTable.h:115
virtual uint64_t order() const =0
virtual ~AccelTableData()=default
virtual void print(raw_ostream &OS) const =0
bool operator<(const AccelTableData &Other) const
Definition AccelTable.h:119
This class holds an abstract representation of an Accelerator Table, consisting of a sequence of buck...
Definition AccelTable.h:203
const StringEntries getEntries() const
Definition AccelTable.h:211
void addEntries(AccelTable< DataT > &Table)
void addName(DwarfStringPoolEntryRef Name, Types &&... Args)
Definition AccelTable.h:216
A base class for different implementations of Data classes for Apple Accelerator Tables.
Definition AccelTable.h:233
virtual void emit(AsmPrinter *Asm) const =0
static uint32_t hash(StringRef Buffer)
Definition AccelTable.h:256
uint64_t order() const override
Definition AccelTable.h:483
AppleAccelTableOffsetData(const DIE &D)
Definition AccelTable.h:472
static constexpr Atom Atoms[]
Definition AccelTable.h:476
AppleAccelTableStaticOffsetData(uint32_t Offset)
Definition AccelTable.h:509
static constexpr Atom Atoms[]
Definition AccelTable.h:513
uint64_t order() const override
Definition AccelTable.h:520
uint64_t order() const override
Definition AccelTable.h:548
static constexpr Atom Atoms[]
Definition AccelTable.h:539
AppleAccelTableStaticTypeData(uint32_t Offset, uint16_t Tag, bool ObjCClassIsImplementation, uint32_t QualifiedNameHash)
Definition AccelTable.h:530
static constexpr Atom Atoms[]
Definition AccelTable.h:495
AppleAccelTableTypeData(const DIE &D)
Definition AccelTable.h:491
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
This class is intended to be used as a driving class for all asm writers.
Definition AsmPrinter.h:91
A structured debug information entry.
Definition DIE.h:828
The Data class implementation for DWARF v5 accelerator table.
Definition AccelTable.h:287
static uint32_t hash(StringRef Name)
Definition AccelTable.h:289
void print(raw_ostream &OS) const override
unsigned getDieTag() const
Definition AccelTable.h:313
std::optional< OffsetAndUnitID > getParentDieOffsetAndUnitID() const
Definition AccelTable.h:332
std::optional< uint64_t > getParentDieOffset() const
Definition AccelTable.h:326
std::variant< const DIE *, uint64_t > OffsetVal
Definition AccelTable.h:351
LLVM_ABI DWARF5AccelTableData(const DIE &Die, const uint32_t UnitID, const bool IsTU)
unsigned getUnitID() const
Definition AccelTable.h:314
void setAbbrevNumber(uint16_t AbbrevNum)
Sets AbbrevIndex for an Entry.
Definition AccelTable.h:340
uint64_t order() const override
Definition AccelTable.h:357
OffsetAndUnitID getDieOffsetAndUnitID() const
Definition AccelTable.h:309
static LLVM_ABI 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)
Definition AccelTable.h:293
uint16_t getAbbrevNumber() const
Returns AbbrevIndex for an Entry.
Definition AccelTable.h:343
uint64_t getDieOffset() const
Definition AccelTable.h:304
std::optional< uint64_t > ParentOffset
Definition AccelTable.h:352
LLVM_ABI void addTypeUnitSignature(DwarfTypeUnit &U)
Add a type unit Signature.
void convertDieToOffset()
Convert DIE entries to explicit offset.
Definition AccelTable.h:414
const TUVectorTy & getTypeUnitsSymbols()
Returns type units that were constructed.
Definition AccelTable.h:407
LLVM_ABI void addTypeUnitSymbol(DwarfTypeUnit &U)
Add a type unit start symbol.
void addTypeEntries(DWARF5AccelTable &Table)
Definition AccelTable.h:426
void addAttribute(const DebugNamesAbbrev::AttributeEncoding &Attr)
Add attribute encoding to an abbreviation.
Definition AccelTable.h:370
void setNumber(uint32_t AbbrevNumber)
Set abbreviation tag index.
Definition AccelTable.h:374
const SmallVector< AttributeEncoding, 1 > & getAttributes() const
Returns attributes for an abbreviation.
Definition AccelTable.h:382
uint32_t getNumber() const
Get abbreviation tag index.
Definition AccelTable.h:376
uint32_t getDieTag() const
Get DIE Tag.
Definition AccelTable.h:378
DebugNamesAbbrev(uint32_t DieTag)
Definition AccelTable.h:368
Collects and handles dwarf debug information.
Definition DwarfDebug.h:352
DwarfStringPoolEntryRef: Dwarf string pool entry reference.
This class is used to gather all the unique data bits of a node.
Definition FoldingSet.h:208
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
This class implements a map that also provides access to all stored values in a deterministic order.
Definition MapVector.h:38
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
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.
Definition raw_ostream.h:53
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
@ DW_ATOM_type_flags
Definition Dwarf.h:950
@ DW_ATOM_die_tag
Definition Dwarf.h:949
@ DW_ATOM_die_offset
Marker as the end of a list of atoms.
Definition Dwarf.h:946
This is an optimization pass for GlobalISel generic memory operations.
SmallVector< TypeUnitMetaInfo, 1 > TUVectorTy
Definition AccelTable.h:396
FoldingSetBase::Node FoldingSetNode
Definition FoldingSet.h:404
auto map_range(ContainerTy &&C, FuncTy F)
Return a range that applies F to the elements of C.
Definition STLExtras.h:365
LLVM_ABI void emitAppleAccelTableImpl(AsmPrinter *Asm, AccelTableBase &Contents, StringRef Prefix, const MCSymbol *SecBegin, ArrayRef< AppleAccelTableData::Atom > Atoms)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:209
@ Other
Any other memory.
Definition ModRef.h:68
FunctionAddr VTableAddr uintptr_t uintptr_t Data
Definition InstrProf.h:221
void emitAppleAccelTable(AsmPrinter *Asm, AccelTable< DataT > &Contents, StringRef Prefix, const MCSymbol *SecBegin)
Emit an Apple Accelerator Table consisting of entries in the specified AccelTable.
Definition AccelTable.h:446
LLVM_ABI 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...
Definition DJB.cpp:72
ArrayRef(const T &OneElt) -> ArrayRef< T >
uint32_t djbHash(StringRef Buffer, uint32_t H=5381)
The Bernstein hash function used by the DWARF accelerator tables.
Definition DJB.h:22
LLVM_ABI 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.
Definition Hashing.h:305
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383
Represents a group of entries with identical name (and hence, hash value).
Definition AccelTable.h:141
void print(raw_ostream &OS) const
auto getValues() const
Get all AccelTableData cast as a T.
Definition AccelTable.h:148
DwarfStringPoolEntryRef Name
Definition AccelTable.h:142
std::vector< AccelTableData * > Values
Definition AccelTable.h:144
An Atom defines the form of the data in an Apple accelerator table.
Definition AccelTable.h:238
const uint16_t Form
DWARF Form.
Definition AccelTable.h:242
void print(raw_ostream &OS) const
const uint16_t Type
Atom Type.
Definition AccelTable.h:240
constexpr Atom(uint16_t Type, uint16_t Form)
Definition AccelTable.h:244
DebugNamesAbbrev::AttributeEncoding Encoding
Definition AccelTable.h:404
static bool isEqual(const OffsetAndUnitID &LHS, const OffsetAndUnitID &RHS)
Definition AccelTable.h:277
static unsigned getHashValue(const OffsetAndUnitID &Val)
Definition AccelTable.h:274
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.
Definition AccelTable.h:261
uint32_t unitID() const
Definition AccelTable.h:269
uint64_t offset() const
Definition AccelTable.h:268
OffsetAndUnitID(uint64_t Offset, uint32_t UnitID, bool IsTU)
Definition AccelTable.h:266
std::variant< MCSymbol *, uint64_t > LabelOrSignature
Definition AccelTable.h:392