1//===- llvm/CodeGen/DwarfDebug.h - Dwarf Debug Framework --------*- C++ -*-===// 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 7//===----------------------------------------------------------------------===// 9// This file contains support for writing dwarf debug info into asm files. 11//===----------------------------------------------------------------------===// 13#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H 14#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H 61//===----------------------------------------------------------------------===// 62/// This class is defined as the common parent of DbgVariable and DbgLabel 63/// such that it could levarage polymorphism to extract common code for 64/// DbgVariable and DbgLabel. 80 : Entity(
N), InlinedAt(IA), SubclassID(
ID) {}
94switch (
N->getDbgEntityID()) {
110/// Proxy for one MMI entry. 115 /// Operator enabling sorting based on fragment offset. 119/// Represents an entry-value location, or a fragment of one. 124 /// Operator enabling sorting based on fragment offset. 128// Namespace for alternatives of a DbgVariable. 130/// Single value location description. 132 std::unique_ptr<DbgValueLoc> ValueLoc;
141/// Multi-value location description. 143 /// Index of the entry list in DebugLocs. 144unsigned DebugLocListIndex;
145 /// DW_OP_LLVM_tag_offset value from DebugLocs. 146 std::optional<uint8_t> DebugLocListTagOffset;
149explicitMulti(
unsigned DebugLocListIndex,
150 std::optional<uint8_t> DebugLocListTagOffset)
151 : DebugLocListIndex(DebugLocListIndex),
152 DebugLocListTagOffset(DebugLocListTagOffset) {}
155return DebugLocListTagOffset;
158/// Single location defined by (potentially multiple) MMI entries. 164assert((!
E ||
E->isValid()) &&
"Expected valid expression");
165assert(FI != std::numeric_limits<int>::max() &&
"Expected valid index");
168 /// Get the FI entries, sorted by fragment offset. 171/// Single location defined by (potentially multiple) EntryValueInfo. 177// Add the pair Reg, Expr to the list of entry values describing the variable. 178// If multiple expressions are added, it is the callers responsibility to 179// ensure they are all non-overlapping fragments. 181 std::optional<const DIExpression *> NonVariadicExpr =
183assert(NonVariadicExpr && *NonVariadicExpr);
188/// Alias for the std::variant specialization base class of DbgVariable. 193//===----------------------------------------------------------------------===// 194/// This class is used to track local variable information. 196/// Variables that have been optimized out hold the \c monostate alternative. 197/// This is not distinguished from the case of a constructed \c DbgVariable 198/// which has not be initialized yet. 200/// Variables can be created from allocas, in which case they're generated from 201/// the MMI table. Such variables hold the \c Loc::MMI alternative which can 202/// have multiple expressions and frame indices. 204/// Variables can be created from the entry value of registers, in which case 205/// they're generated from the MMI table. Such variables hold the \c 206/// EntryValueLoc alternative which can either have a single expression or 207/// multiple *fragment* expressions. 209/// Variables can be created from \c DBG_VALUE instructions. Those whose 210/// location changes over time hold a \c Loc::Multi alternative which uses \c 211/// DebugLocListIndex and (optionally) \c DebugLocListTagOffset, while those 212/// with a single location hold a \c Loc::Single alternative which use \c 213/// ValueLoc and (optionally) a single \c Expr. 217 /// To workaround P2162R0 https://github.com/cplusplus/papers/issues/873 the 218 /// base class subobject needs to be passed directly to std::visit, so expose 219 /// it directly here. 224 /// Member shorthand for std::holds_alternative 225template <
typename T>
boolholds()
const{
226return std::holds_alternative<T>(*
this);
228 /// Asserting, noexcept member alternative to std::get 229template <
typename T>
auto &
get() noexcept {
231return *std::get_if<T>(
this);
233 /// Asserting, noexcept member alternative to std::get 234template <
typename T>
constauto &
get()
const noexcept {
236return *std::get_if<T>(
this);
239 /// Construct a DbgVariable. 241 /// Creates a variable without any DW_AT_location. 247return cast<DILocalVariable>(
getEntity());
252// Translate tag to proper Dwarf tag. 254// FIXME: Why don't we just infer this tag and store it all along? 256return dwarf::DW_TAG_formal_parameter;
258return dwarf::DW_TAG_variable;
261 /// Return true if DbgVariable is artificial. 285//===----------------------------------------------------------------------===// 286/// This class is used to track label information. 288/// Labels are collected from \c DBG_LABEL instructions. 290constMCSymbol *Sym;
/// Symbol before DBG_LABEL instruction. 293 /// We need MCSymbol information to generate DW_AT_low_pc. 305 /// Translate tag to proper Dwarf tag. 307return dwarf::DW_TAG_label;
315/// Used for tracking debug info about call site parameters. 318unsignedRegister;
///< Parameter register at the callee entry point. 324assert(
Reg &&
"Parameter register cannot be undef");
331/// Collection used for storing debug call site parameters. 334/// Helper used to pair up a symbol and its DWARF compile unit. 342/// The kind of accelerator tables we should emit. 346Apple,
///< .apple_names, .apple_namespaces, .apple_types, .apple_objc. 347Dwarf,
///< DWARF v5 .debug_names. 350/// Collects and handles dwarf debug information. 352 /// All DIEValues are allocated through this allocator. 355 /// Maps MDNode with its corresponding DwarfCompileUnit. 358 /// Maps a CU DIE with its corresponding DwarfCompileUnit. 361 /// List of all labels used in aranges generation. 362 std::vector<SymbolCU> ArangeLabels;
364 /// Size of each symbol emitted (for those symbols that have a specific size). 367 /// Collection of abstract variables/labels. 370 /// Collection of DebugLocEntry. Stored in a linked list so that DIELocLists 371 /// can refer to them in spite of insertions into this list. 374 /// This is a collection of subprogram MDNodes that are processed to 378 /// Map function-local imported entities to their parent local scope 379 /// (either DILexicalBlock or DISubprogram) for a processed function 380 /// (including inlined subprograms). 387 /// If nonnull, stores the current machine function we're processing. 390 /// If nonnull, stores the CU in which the previous subprogram was contained. 393 /// As an optimization, there is no need to emit an entry in the directory 394 /// table for the same directory as DW_AT_comp_dir. 397 /// Holder for the file specific debug information. 400 /// Holders for the various debug information flags that we might need to 401 /// have exposed. See accessor functions below for description. 403 /// Map from MDNodes for user-defined types to their type signatures. Also 404 /// used to keep track of which types we have emitted type units for. 411 TypeUnitsUnderConstruction;
413 /// Symbol pointing to the current function's DWARF line table entries. 416 /// Used to set a uniqe ID for a Type Unit. 417 /// This counter represents number of DwarfTypeUnits created, not necessarily 418 /// number of type units that will be emitted. 419unsigned NumTypeUnitsCreated = 0;
421 /// Whether to use the GNU TLS opcode (instead of the standard opcode). 424 /// Whether to use DWARF 2 bitfields (instead of the DWARF 4 format). 425bool UseDWARF2Bitfields;
427 /// Whether to emit all linkage names, or just abstract subprograms. 428bool UseAllLinkageNames;
430 /// Use inlined strings. 431bool UseInlineStrings =
false;
433 /// Allow emission of .debug_ranges section. 434bool UseRangesSection =
true;
436 /// True if the sections itself must be used as references and don't create 437 /// temp symbols inside DWARF sections. 438bool UseSectionsAsReferences =
false;
440 /// Allow emission of .debug_aranges section 441bool UseARangesSection =
false;
443 /// Generate DWARF v4 type units. 444bool GenerateTypeUnits;
446 /// Emit a .debug_macro section instead of .debug_macinfo. 447bool UseDebugMacroSection;
449 /// Avoid using DW_OP_convert due to consumer incompatibilities. 467 /// Force the use of DW_AT_ranges even for single-entry range lists. 470 /// DWARF5 Experimental Options 473bool HasAppleExtensionAttributes;
476 /// Whether to generate the DWARF v5 string offsets table. 477 /// It consists of a series of contributions, each preceded by a header. 478 /// The pre-DWARF v5 string offsets table for split dwarf is, in contrast, 479 /// a monolithic sequence of string offsets. 480bool UseSegmentedStringOffsetsTable;
482 /// Enable production of call site parameters needed to print the debug entry 483 /// values. Useful for testing purposes when a debugger does not support the 485bool EmitDebugEntryValues;
487 /// Separated Dwarf Variables 488 /// In general these will all be for bits that are left in the 489 /// original object file, rather than things that are meant 490 /// to be in the .dwo sections. 492 /// Holder for the skeleton information. 495 /// Store file names for type units under fission in a line table 496 /// header that will be emitted into debug_line.dwo. 497// FIXME: replace this with a map from comp_dir to table so that we 498// can emit multiple tables during LTO each of which uses directory 499// 0, referencing the comp_dir of all the type units that use it. 503 /// True iff there are multiple CUs in this module. 507 /// Map for tracking Fortran deferred CHARACTER lengths. 512 /// Accelerator tables. 515 /// Used to hide which DWARF5AccelTable we are using now. 522 /// Identify a debugger for "tuning" the debug info. 524 /// The "tuning" should be used to set defaults for individual feature flags 525 /// in DwarfDebug; if a given feature has a more specific command-line option, 526 /// that option should take precedence over the tuning. 537void ensureAbstractEntityIsCreatedIfScoped(DwarfCompileUnit &
CU,
541 DbgEntity *createConcreteEntity(DwarfCompileUnit &TheCU,
544const DILocation *Location,
545const MCSymbol *
Sym =
nullptr);
547 /// Construct a DIE for this abstract scope. 548void constructAbstractSubprogramScopeDIE(DwarfCompileUnit &SrcCU, LexicalScope *Scope);
550 /// Construct DIEs for call site entries describing the calls in \p MF. 551void constructCallSiteEntryDIEs(
const DISubprogram &SP, DwarfCompileUnit &
CU,
552 DIE &ScopeDIE,
const MachineFunction &MF);
554template <
typename DataT>
555void addAccelNameImpl(
const DwarfUnit &Unit,
557 AccelTable<DataT> &AppleAccel, StringRef
Name,
560void finishEntityDefinitions();
562void finishSubprogramDefinitions();
564 /// Finish off debug information after all functions have been 566void finalizeModuleInfo();
568 /// Emit the debug info section. 571 /// Emit the abbreviation section. 572void emitAbbreviations();
574 /// Emit the string offsets table header. 575void emitStringOffsetsTableHeader();
577 /// Emit a specified accelerator table. 578template <
typename AccelTableT>
579void emitAccel(AccelTableT &Accel, MCSection *Section, StringRef TableName);
581 /// Emit DWARF v5 accelerator table. 582void emitAccelDebugNames();
584 /// Emit visible names into a hashed accelerator table section. 585void emitAccelNames();
587 /// Emit objective C classes and categories into a hashed 588 /// accelerator table section. 591 /// Emit namespace dies into a hashed accelerator table. 592void emitAccelNamespaces();
594 /// Emit type dies into a hashed accelerator table. 595void emitAccelTypes();
597 /// Emit visible names and types into debug pubnames and pubtypes sections. 598void emitDebugPubSections();
600void emitDebugPubSection(
bool GnuStyle, StringRef
Name,
601 DwarfCompileUnit *TheU,
602const StringMap<const DIE *> &Globals);
604 /// Emit null-terminated strings into a debug str section. 607 /// Emit variable locations into a debug loc section. 610 /// Emit variable locations into a debug loc dwo section. 611void emitDebugLocDWO();
613void emitDebugLocImpl(MCSection *Sec);
615 /// Emit address ranges into a debug aranges section. 616void emitDebugARanges();
618 /// Emit address ranges into a debug ranges section. 619void emitDebugRanges();
620void emitDebugRangesDWO();
621void emitDebugRangesImpl(
const DwarfFile &Holder, MCSection *Section);
623 /// Emit macros into a debug macinfo section. 624void emitDebugMacinfo();
625 /// Emit macros into a debug macinfo.dwo section. 626void emitDebugMacinfoDWO();
627void emitDebugMacinfoImpl(MCSection *Section);
628void emitMacro(DIMacro &M);
629void emitMacroFile(DIMacroFile &
F, DwarfCompileUnit &U);
630void emitMacroFileImpl(DIMacroFile &
F, DwarfCompileUnit &U,
631unsigned StartFile,
unsigned EndFile,
632 StringRef (*MacroFormToString)(
unsignedForm));
633void handleMacroNodes(DIMacroNodeArray Nodes, DwarfCompileUnit &U);
635 /// DWARF 5 Experimental Split Dwarf Emitters 637 /// Initialize common features of skeleton units. 638void initSkeletonUnit(
const DwarfUnit &U, DIE &Die,
639 std::unique_ptr<DwarfCompileUnit> NewU);
641 /// Construct the split debug info compile unit for the debug info section. 642 /// In DWARF v5, the skeleton unit DIE may have the following attributes: 643 /// DW_AT_addr_base, DW_AT_comp_dir, DW_AT_dwo_name, DW_AT_high_pc, 644 /// DW_AT_low_pc, DW_AT_ranges, DW_AT_stmt_list, and DW_AT_str_offsets_base. 645 /// Prior to DWARF v5 it may also have DW_AT_GNU_dwo_id. DW_AT_GNU_dwo_name 646 /// is used instead of DW_AT_dwo_name, Dw_AT_GNU_addr_base instead of 647 /// DW_AT_addr_base, and DW_AT_GNU_ranges_base instead of DW_AT_rnglists_base. 648 DwarfCompileUnit &constructSkeletonCU(
const DwarfCompileUnit &
CU);
650 /// Emit the debug info dwo section. 651void emitDebugInfoDWO();
653 /// Emit the debug abbrev dwo section. 654void emitDebugAbbrevDWO();
656 /// Emit the debug line dwo section. 657void emitDebugLineDWO();
659 /// Emit the dwo stringoffsets table header. 660void emitStringOffsetsTableHeaderDWO();
662 /// Emit the debug str dwo section. 663void emitDebugStrDWO();
665 /// Emit DWO addresses. 668 /// Flags to let the linker know we have emitted new style pubnames. Only 669 /// emit it here if we don't have a skeleton CU for split dwarf. 670void addGnuPubAttributes(DwarfCompileUnit &U, DIE &
D)
const;
672 /// Create new DwarfCompileUnit for the given metadata node with tag 673 /// DW_TAG_compile_unit. 674 DwarfCompileUnit &getOrCreateDwarfCompileUnit(
const DICompileUnit *DIUnit);
675void finishUnitAttributes(
const DICompileUnit *DIUnit,
676 DwarfCompileUnit &NewCU);
678 /// Register a source line with debug info. Returns the unique 679 /// label that was emitted and which provides correspondence to the 680 /// source line list. 681void recordSourceLine(
unsigned Line,
unsigned Col,
const MDNode *Scope,
684 /// Populate LexicalScope entries with variables' info. 685void collectEntityInfo(DwarfCompileUnit &TheCU,
const DISubprogram *SP,
686 DenseSet<InlinedEntity> &ProcessedVars);
688 /// Build the location list for all DBG_VALUEs in the 689 /// function that describe the same variable. If the resulting 690 /// list has only one entry that is valid for entire variable's 691 /// scope return true. 692bool buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
695 /// Collect variable information from the side table maintained by MF. 696void collectVariableInfoFromMFTable(DwarfCompileUnit &TheCU,
697 DenseSet<InlinedEntity> &
P);
699 /// Emit the reference to the section. 700void emitSectionReference(
const DwarfCompileUnit &
CU);
702void findForceIsStmtInstrs(
const MachineFunction *MF);
705 /// Gather pre-function debug information. 708 /// Gather and emit post-function debug information. 711 /// Get Dwarf compile unit ID for line table. 717//===--------------------------------------------------------------------===// 720 DwarfDebug(AsmPrinter *
A);
724 /// Emit all Dwarf sections that should come prior to the 728 /// Emit all Dwarf sections that should come after the content. 731 /// Emits inital debug location directive. Returns instruction at which 732 /// the function prologue ends. 736 /// Process beginning of an instruction. 739 /// Process beginning of code alignment. 742 /// Perform an MD5 checksum of \p Identifier and return the lower 64 bits. 745 /// Add a DIE to the set of types that we're going to pull into 750 /// Add a label so that arange data can be generated for it. 753 /// For symbols that have a size designated (e.g. common symbols), 754 /// this tracks that size. 759 /// Returns whether we should emit all DW_AT_[MIPS_]linkage_name. 760 /// If not, we still might emit certain cases. 763 /// Returns whether to use DW_OP_GNU_push_tls_address, instead of the 764 /// standard DW_OP_form_tls_address opcode 767 /// Returns whether to use the DWARF2 format for bitfields instyead of the 771 /// Returns whether to use inline strings. 774 /// Returns whether ranges section should be emitted. 777 /// Returns whether range encodings should be used for single entry range 781// Returns whether novel exprloc addrx+offset encodings should be used to 782// reduce debug_addr size. 787// Returns whether addrx+offset LLVM extension form should be used to reduce 793 /// Returns whether to use sections as labels rather than temp symbols. 795return UseSectionsAsReferences;
798 /// Returns whether to generate DWARF v4 type units. 801// Experimental DWARF5 features. 803 /// Returns what kind (if any) of accelerator tables to emit. 806 /// Seet TheAccelTableKind 810return HasAppleExtensionAttributes;
813 /// Returns whether or not to change the current debug info for the 814 /// split dwarf proposal support. 817 /// Returns whether to generate a string offsets table with (possibly shared) 818 /// contributions from each CU and type unit. This implies the use of 819 /// DW_FORM_strx* indirect references with DWARF v5 and beyond. Note that 820 /// DW_FORM_GNU_str_index is also an indirect reference, but it is used with 821 /// a pre-DWARF v5 implementation of split DWARF sections, which uses a 822 /// monolithic string offsets table. 824return UseSegmentedStringOffsetsTable;
828return EmitDebugEntryValues;
832return EnableOpConvert;
837 /// Returns the Dwarf Version. 840 /// Returns a suitable DWARF form to represent a section offset, i.e. 841 /// * DW_FORM_sec_offset for DWARF version >= 4; 842 /// * DW_FORM_data8 for 64-bit DWARFv3; 843 /// * DW_FORM_data4 for 32-bit DWARFv3 and DWARFv2. 846 /// Returns the previous CU that was being updated 850 /// Terminate the line table by adding the last range label. 853 /// Returns the entries for the .debug_loc section. 856 /// Emit an entry for the debug loc section. This can be used to 857 /// handle an entry that's going to be emitted into the debug loc section. 862 /// Emit the location for a debug loc entry, including the size header. 890 /// A helper function to check whether the DIE for a given Scope is 891 /// going to be null. 894 /// Find the matching DwarfCompileUnit for the given CU DIE. 897return CUDieMap.
lookup(Die);
901return StringTypeLocMap.
lookup(ST);
907 StringTypeLocMap[ST] = Loc;
910 /// \defgroup DebuggerTuning Predicates to tune DWARF for a given debugger. 912 /// Returns whether we are "tuning" for a given debugger. 927 /// If the \p File has an MD5 checksum, return it as an MD5Result 928 /// allocated in the MCContext. 932return LocalDeclsPerLS[S];
935 /// Sets the current DWARF5AccelTable to use. 939 CurrentDebugNames = &AccelDebugNames;
942 CurrentDebugNames = &AccelTypeUnitsDebugNames;
945 /// Returns either CU or TU DWARF5AccelTable. 949}
// end namespace llvm 951#endif// LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H This file defines the StringMap class.
This file contains support for writing accelerator tables.
This file defines the BumpPtrAllocator interface.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
This file contains constants used for implementing Dwarf debug support.
Machine Check Debug Module
This file implements a map that provides insertion order iteration.
This file contains the declarations for metadata subclasses.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
Class recording the (high level) value of a variable.
This class holds an abstract representation of an Accelerator Table, consisting of a sequence of buck...
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.
Basic type, like 'int' or 'float'.
A structured debug information entry.
static std::optional< const DIExpression * > convertToNonVariadicExpression(const DIExpression *Expr)
If Expr is a valid single-location expression, i.e.
StringRef getName() const
Tagged DWARF-like metadata node.
String type, Fortran CHARACTER(n)
StringRef getName() const
Used for tracking debug info about call site parameters.
unsigned getRegister() const
DbgCallSiteParam(unsigned Reg, DbgValueLoc Val)
DbgValueLoc getValue() const
This class is defined as the common parent of DbgVariable and DbgLabel such that it could levarage po...
virtual ~DbgEntity()=default
static bool classof(const DbgEntity *N)
const DINode * getEntity() const
Accessors.
DbgEntityKind getDbgEntityID() const
DbgEntity(const DINode *N, const DILocation *IA, DbgEntityKind ID)
const DILocation * getInlinedAt() const
This class is used to track label information.
dwarf::Tag getTag() const
Translate tag to proper Dwarf tag.
static bool classof(const DbgEntity *N)
DbgLabel(const DILabel *L, const DILocation *IA, const MCSymbol *Sym=nullptr)
Symbol before DBG_LABEL instruction.
StringRef getName() const
const MCSymbol * getSymbol() const
const DILabel * getLabel() const
Accessors.
SmallVector< Entry, 4 > Entries
std::pair< const DINode *, const DILocation * > InlinedEntity
The location of a single variable, composed of an expression and 0 or more DbgValueLocEntries.
This class is used to track local variable information.
const Loc::Variant & asVariant() const
bool isArtificial() const
Return true if DbgVariable is artificial.
dwarf::Tag getTag() const
bool isObjectPointer() const
const DILocalVariable * getVariable() const
DbgVariable(const DILocalVariable *V, const DILocation *IA)
Construct a DbgVariable.
auto & get() noexcept
Asserting, noexcept member alternative to std::get.
StringRef getName() const
const DIType * getType() const
const auto & get() const noexcept
Asserting, noexcept member alternative to std::get.
Loc::Variant & asVariant()
To workaround P2162R0 https://github.com/cplusplus/papers/issues/873 the base class subobject needs t...
static bool classof(const DbgEntity *N)
bool holds() const
Member shorthand for std::holds_alternative.
Base class for debug information backends.
Byte stream of .debug_loc entries.
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
Collects and handles dwarf debug information.
bool useSegmentedStringOffsetsTable() const
Returns whether to generate a string offsets table with (possibly shared) contributions from each CU ...
MDNodeSet & getLocalDeclsForScope(const DILocalScope *S)
std::optional< MD5::MD5Result > getMD5AsBytes(const DIFile *File) const
If the File has an MD5 checksum, return it as an MD5Result allocated in the MCContext.
bool useGNUTLSOpcode() const
Returns whether to use DW_OP_GNU_push_tls_address, instead of the standard DW_OP_form_tls_address opc...
bool useAddrOffsetForm() const
const DwarfCompileUnit * getPrevCU() const
Returns the previous CU that was being updated.
void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override
For symbols that have a size designated (e.g.
bool emitDebugEntryValues() const
const DwarfCompileUnit * lookupCU(const DIE *Die) const
uint16_t getDwarfVersion() const
Returns the Dwarf Version.
void emitDebugLocEntry(ByteStreamer &Streamer, const DebugLocStream::Entry &Entry, const DwarfCompileUnit *CU)
Emit an entry for the debug loc section.
void addAccelNamespace(const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die)
void setCurrentDWARF5AccelTable(const DWARF5AccelTableKind Kind)
Sets the current DWARF5AccelTable to use.
bool alwaysUseRanges(const DwarfCompileUnit &) const
Returns whether range encodings should be used for single entry range lists.
void beginModule(Module *M) override
Emit all Dwarf sections that should come prior to the content.
void addSubprogramNames(const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, const DISubprogram *SP, DIE &Die)
bool useAllLinkageNames() const
Returns whether we should emit all DW_AT_[MIPS_]linkage_name.
void insertSectionLabel(const MCSymbol *S)
void addAccelObjC(const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die)
dwarf::Form getDwarfSectionOffsetForm() const
Returns a suitable DWARF form to represent a section offset, i.e.
bool useAppleExtensionAttributes() const
void setPrevCU(const DwarfCompileUnit *PrevCU)
const MachineFunction * getCurrentFunction() const
void skippedNonDebugFunction() override
bool useInlineStrings() const
Returns whether to use inline strings.
void addArangeLabel(SymbolCU SCU)
Add a label so that arange data can be generated for it.
bool generateTypeUnits() const
Returns whether to generate DWARF v4 type units.
void beginInstruction(const MachineInstr *MI) override
Process beginning of an instruction.
AddressPool & getAddressPool()
DWARF5AccelTable & getCurrentDWARF5AccelTable()
Returns either CU or TU DWARF5AccelTable.
bool useSectionsAsReferences() const
Returns whether to use sections as labels rather than temp symbols.
const DebugLocStream & getDebugLocs() const
Returns the entries for the .debug_loc section.
bool shareAcrossDWOCUs() const
bool useOpConvert() const
void terminateLineTable(const DwarfCompileUnit *CU)
Terminate the line table by adding the last range label.
void endFunctionImpl(const MachineFunction *MF) override
Gather and emit post-function debug information.
void addStringTypeLoc(const DIStringType *ST, unsigned Loc)
void emitDebugLocEntryLocation(const DebugLocStream::Entry &Entry, const DwarfCompileUnit *CU)
Emit the location for a debug loc entry, including the size header.
DwarfCompileUnit * lookupCU(const DIE *Die)
Find the matching DwarfCompileUnit for the given CU DIE.
const MCSymbol * getSectionLabel(const MCSection *S)
static void emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT, const DbgValueLoc &Value, DwarfExpression &DwarfExpr)
bool useSplitDwarf() const
Returns whether or not to change the current debug info for the split dwarf proposal support.
unsigned getDwarfCompileUnitIDForLineTable(const DwarfCompileUnit &CU)
Get Dwarf compile unit ID for line table.
const MachineInstr * emitInitialLocDirective(const MachineFunction &MF, unsigned CUID)
Emits inital debug location directive.
void setTheAccelTableKind(AccelTableKind K)
Seet TheAccelTableKind.
bool useDWARF2Bitfields() const
Returns whether to use the DWARF2 format for bitfields instyead of the DWARF4 format.
bool useAddrOffsetExpressions() const
bool useRangesSection() const
Returns whether ranges section should be emitted.
void addAccelName(const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die)
unsigned getStringTypeLoc(const DIStringType *ST) const
bool isLexicalScopeDIENull(LexicalScope *Scope)
A helper function to check whether the DIE for a given Scope is going to be null.
void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier, DIE &Die, const DICompositeType *CTy)
Add a DIE to the set of types that we're going to pull into type units.
void endModule() override
Emit all Dwarf sections that should come after the content.
void addAccelType(const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die, char Flags)
void beginCodeAlignment(const MachineBasicBlock &MBB) override
Process beginning of code alignment.
void beginFunctionImpl(const MachineFunction *MF) override
Gather pre-function debug information.
AccelTableKind getAccelTableKind() const
Returns what kind (if any) of accelerator tables to emit.
static uint64_t makeTypeSignature(StringRef Identifier)
Perform an MD5 checksum of Identifier and return the lower 64 bits.
Base class containing the logic for constructing DWARF expressions independently of whether they are ...
const SmallVectorImpl< std::unique_ptr< DwarfCompileUnit > > & getUnits()
This dwarf writer support class manages information associated with a source file.
LexicalScope - This class is used to track scope information.
Multi-value location description.
Multi(unsigned DebugLocListIndex, std::optional< uint8_t > DebugLocListTagOffset)
unsigned getDebugLocListIndex() const
std::optional< uint8_t > getDebugLocListTagOffset() const
Single value location description.
const DbgValueLoc & getValueLoc() const
const DIExpression * getExpr() const
Wrapper class representing physical registers. Should be passed by value.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Representation of each machine instruction.
This class implements a map that also provides access to all stored values in a deterministic order.
A Module instance is used to store all the information related to an LLVM module.
Wrapper class representing virtual and physical registers.
A vector that has set insertion semantics.
Implements a dense probed hash-table based set with some number of buckets stored inline.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
A SetVector that performs no allocations if smaller than a certain size.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
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.
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::variant< std::monostate, Loc::Single, Loc::Multi, Loc::MMI, Loc::EntryValue > Variant
Alias for the std::variant specialization base class of DbgVariable.
This is an optimization pass for GlobalISel generic memory operations.
bool operator<(int64_t V1, const APSInt &V2)
AccelTableKind
The kind of accelerator tables we should emit.
@ Apple
.apple_names, .apple_namespaces, .apple_types, .apple_objc.
@ Dwarf
DWARF v5 .debug_names.
DebuggerKind
Identify a debugger for "tuning" the debug info.
@ SCE
Tune debug info for SCE targets (e.g. PS4).
@ DBX
Tune debug info for dbx.
@ Default
No specific tuning requested.
@ GDB
Tune debug info for gdb.
@ LLDB
Tune debug info for lldb.
@ Default
The result values are uniform if and only if all operands are uniform.
Represents an entry-value location, or a fragment of one.
friend bool operator<(const EntryValueInfo &LHS, const EntryValueInfo &RHS)
Operator enabling sorting based on fragment offset.
const DIExpression & Expr
const DIExpression * Expr
friend bool operator<(const FrameIndexExpr &LHS, const FrameIndexExpr &RHS)
Operator enabling sorting based on fragment offset.
Single location defined by (potentially multiple) EntryValueInfo.
void addExpr(MCRegister Reg, const DIExpression &Expr)
std::set< EntryValueInfo > EntryValues
EntryValue(MCRegister Reg, const DIExpression &Expr)
Single location defined by (potentially multiple) MMI entries.
void addFrameIndexExpr(const DIExpression *Expr, int FI)
std::set< FrameIndexExpr > FrameIndexExprs
const std::set< FrameIndexExpr > & getFrameIndexExprs() const
Get the FI entries, sorted by fragment offset.
MMI(const DIExpression *E, int FI)
Helper used to pair up a symbol and its DWARF compile unit.
SymbolCU(DwarfCompileUnit *CU, const MCSymbol *Sym)