|
LLVM 23.0.0git
|
NVPTX-specific DwarfDebug implementation. More...
#include "Target/NVPTX/NVPTXDwarfDebug.h"
Public Member Functions | |
| NVPTXDwarfDebug (AsmPrinter *A) | |
| bool | shouldResetBaseAddress (const MCSection &Section) const override |
| Whether the target requires resetting the base address in range/loc lists. | |
| const DIExpression * | adjustExpressionForTarget (const DIExpression *Expr, std::optional< unsigned > &TargetAddrSpace) const override |
| Extract target-specific address space information from a DIExpression. | |
| void | addTargetVariableAttributes (DwarfCompileUnit &CU, DIE &Die, std::optional< unsigned > TargetAddrSpace, VariableLocationKind VarLocKind, const GlobalVariable *GV=nullptr) const override |
| Add target-specific attributes to a variable DIE (e.g. | |
| Public Member Functions inherited from llvm::DwarfDebug | |
| DwarfDebug (AsmPrinter *A) | |
| ~DwarfDebug () override | |
| void | beginModule (Module *M) override |
| Emit all Dwarf sections that should come prior to the content. | |
| void | endModule () override |
| Emit all Dwarf sections that should come after the content. | |
| const MachineInstr * | emitInitialLocDirective (const MachineFunction &MF, unsigned CUID) |
| Emits inital debug location directive. | |
| void | beginInstruction (const MachineInstr *MI) override |
| Process beginning of an instruction. | |
| void | beginCodeAlignment (const MachineBasicBlock &MBB) override |
| Process beginning of code alignment. | |
| 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 | addArangeLabel (SymbolCU SCU) |
| Add a label so that arange data can be generated for it. | |
| void | setSymbolSize (const MCSymbol *Sym, uint64_t Size) override |
| For symbols that have a size designated (e.g. | |
| bool | useAllLinkageNames () const |
| Returns whether we should emit all DW_AT_[MIPS_]linkage_name. | |
| bool | useGNUTLSOpcode () const |
| Returns whether to use DW_OP_GNU_push_tls_address, instead of the standard DW_OP_form_tls_address opcode. | |
| bool | useDWARF2Bitfields () const |
| Returns whether to use the DWARF2 format for bitfields instyead of the DWARF4 format. | |
| bool | useInlineStrings () const |
| Returns whether to use inline strings. | |
| bool | useRangesSection () const |
| Returns whether ranges section should be emitted. | |
| bool | alwaysUseRanges (const DwarfCompileUnit &) const |
| Returns whether range encodings should be used for single entry range lists. | |
| bool | useAddrOffsetExpressions () const |
| bool | useAddrOffsetForm () const |
| bool | useSectionsAsReferences () const |
| Returns whether to use sections as labels rather than temp symbols. | |
| bool | generateTypeUnits () const |
| Returns whether to generate DWARF v4 type units. | |
| AccelTableKind | getAccelTableKind () const |
| Returns what kind (if any) of accelerator tables to emit. | |
| void | setTheAccelTableKind (AccelTableKind K) |
| Seet TheAccelTableKind. | |
| bool | useAppleExtensionAttributes () const |
| bool | useSplitDwarf () const |
| Returns whether or not to change the current debug info for the split dwarf proposal support. | |
| bool | useSegmentedStringOffsetsTable () const |
| Returns whether to generate a string offsets table with (possibly shared) contributions from each CU and type unit. | |
| bool | emitDebugEntryValues () const |
| bool | useOpConvert () const |
| bool | shareAcrossDWOCUs () const |
| uint16_t | getDwarfVersion () const |
| Returns the Dwarf Version. | |
| dwarf::Form | getDwarfSectionOffsetForm () const |
| Returns a suitable DWARF form to represent a section offset, i.e. | |
| const DwarfCompileUnit * | getPrevCU () const |
| Returns the previous CU that was being updated. | |
| void | setPrevCU (const DwarfCompileUnit *PrevCU) |
| void | terminateLineTable (const DwarfCompileUnit *CU) |
| Terminate the line table by adding the last range label. | |
| const DebugLocStream & | getDebugLocs () const |
| Returns the entries for the .debug_loc section. | |
| void | emitDebugLocEntry (ByteStreamer &Streamer, const DebugLocStream::Entry &Entry, const DwarfCompileUnit *CU) |
| Emit an entry for the debug loc section. | |
| void | emitDebugLocEntryLocation (const DebugLocStream::Entry &Entry, const DwarfCompileUnit *CU) |
| Emit the location for a debug loc entry, including the size header. | |
| void | addSubprogramNames (const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, const DISubprogram *SP, DIE &Die) |
| AddressPool & | getAddressPool () |
| void | addAccelName (const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die) |
| void | addAccelObjC (const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die) |
| void | addAccelNamespace (const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die) |
| void | addAccelType (const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die, char Flags) |
| const MachineFunction * | getCurrentFunction () const |
| bool | isLexicalScopeDIENull (LexicalScope *Scope) |
| A helper function to check whether the DIE for a given Scope is going to be null. | |
| DwarfCompileUnit * | lookupCU (const DIE *Die) |
| Find the matching DwarfCompileUnit for the given CU DIE. | |
| const DwarfCompileUnit * | lookupCU (const DIE *Die) const |
| DwarfCompileUnit & | getOrCreateAbstractSubprogramCU (const DISubprogram *SP, DwarfCompileUnit &SrcCU) |
| Find the matching DwarfCompileUnit for the given SP referenced from SrcCU. | |
| unsigned | getStringTypeLoc (const DIStringType *ST) const |
| void | addStringTypeLoc (const DIStringType *ST, unsigned Loc) |
| bool | tuneForGDB () const |
| bool | tuneForLLDB () const |
| bool | tuneForSCE () const |
| bool | tuneForDBX () const |
| const MCSymbol * | getSectionLabel (const MCSection *S) |
| void | insertSectionLabel (const MCSymbol *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. | |
| MDNodeSet & | getLocalDeclsForScope (const DILocalScope *S) |
| void | setCurrentDWARF5AccelTable (const DWARF5AccelTableKind Kind) |
| Sets the current DWARF5AccelTable to use. | |
| DWARF5AccelTable & | getCurrentDWARF5AccelTable () |
| Returns either CU or TU DWARF5AccelTable. | |
| Public Member Functions inherited from llvm::DebugHandlerBase | |
| ~DebugHandlerBase () override | |
| void | endInstruction () override |
| Process end of an instruction. | |
| void | beginFunction (const MachineFunction *MF) override |
| Gather pre-function debug information. | |
| void | endFunction (const MachineFunction *MF) override |
| Gather post-function debug information. | |
| void | beginBasicBlockSection (const MachineBasicBlock &MBB) override |
| Process the beginning of a new basic-block-section within a function. | |
| void | endBasicBlockSection (const MachineBasicBlock &MBB) override |
| Process the end of a basic-block-section within a function. | |
| MCSymbol * | getLabelBeforeInsn (const MachineInstr *MI) |
| Return Label preceding the instruction. | |
| MCSymbol * | getLabelAfterInsn (const MachineInstr *MI) |
| Return Label immediately following the instruction. | |
| const InstructionOrdering & | getInstOrdering () const |
| const LexicalScopes & | getLexicalScopes () const |
| Public Member Functions inherited from llvm::AsmPrinterHandler | |
| virtual | ~AsmPrinterHandler () |
| Pin vtables to this file. | |
| virtual void | markFunctionEnd () |
| virtual void | beginFunclet (const MachineBasicBlock &MBB, MCSymbol *Sym=nullptr) |
| Emit target-specific EH funclet machinery. | |
| virtual void | endFunclet () |
Protected Member Functions | |
| void | initializeTargetDebugInfo (const MachineFunction &MF) override |
| NVPTX-specific debug info initialization. | |
| void | recordTargetSourceLine (const DebugLoc &DL, unsigned Flags) override |
| NVPTX-specific source line recording with inlined_at support. | |
| bool | shouldAttachCompileUnitRanges () const override |
| Whether to attach ranges/low_pc to the compile unit DIE in endModule. | |
| Protected Member Functions inherited from llvm::DwarfDebug | |
| void | beginFunctionImpl (const MachineFunction *MF) override |
| Gather pre-function debug information. | |
| void | endFunctionImpl (const MachineFunction *MF) override |
| Gather and emit post-function debug information. | |
| unsigned | getDwarfCompileUnitIDForLineTable (const DwarfCompileUnit &CU) |
| Get Dwarf compile unit ID for line table. | |
| void | skippedNonDebugFunction () override |
| void | setUseInlineStrings (bool V) |
| Setters for target-specific DWARF configuration overrides. | |
| void | setUseRangesSection (bool V) |
| void | setUseSectionsAsReferences (bool V) |
| const SmallVectorImpl< std::unique_ptr< DwarfCompileUnit > > & | getUnits () |
| Protected Member Functions inherited from llvm::DebugHandlerBase | |
| DebugHandlerBase (AsmPrinter *A) | |
| void | identifyScopeMarkers () |
| Indentify instructions that are marking the beginning of or ending of a scope. | |
| void | requestLabelBeforeInsn (const MachineInstr *MI) |
| Ensure that a label will be emitted before MI. | |
| void | requestLabelAfterInsn (const MachineInstr *MI) |
| Ensure that a label will be emitted after MI. | |
Additional Inherited Members | |
| Public Types inherited from llvm::DwarfDebug | |
| enum class | MinimizeAddrInV5 { Default , Disabled , Ranges , Expressions , Form } |
| enum class | DWARF5AccelTableKind { CU = 0 , TU = 1 } |
| enum class | VariableLocationKind { Global , Register , FrameIndex } |
| Describes the storage kind of a debug variable for target hooks. More... | |
| Static Public Member Functions inherited from llvm::DwarfDebug | |
| static uint64_t | makeTypeSignature (StringRef Identifier) |
Perform an MD5 checksum of Identifier and return the lower 64 bits. | |
| static void | emitDebugLocValue (const AsmPrinter &AP, const DIBasicType *BT, const DbgValueLoc &Value, DwarfExpression &DwarfExpr) |
| Static Public Member Functions inherited from llvm::DebugHandlerBase | |
| static uint64_t | getBaseTypeSize (const DIType *Ty) |
| If this type is derived from a base type then return base type size. | |
| static bool | isUnsignedDIType (const DIType *Ty) |
| Return true if type encoding is unsigned. | |
| Protected Attributes inherited from llvm::DwarfDebug | |
| DwarfFile | InfoHolder |
| Holder for the file specific debug information. | |
| Protected Attributes inherited from llvm::DebugHandlerBase | |
| AsmPrinter * | Asm = nullptr |
| Target of debug info emission. | |
| MachineModuleInfo * | MMI = nullptr |
| Collected machine module information. | |
| DebugLoc | PrevInstLoc |
| Previous instruction's location information. | |
| MCSymbol * | PrevLabel = nullptr |
| const MachineBasicBlock * | PrevInstBB = nullptr |
| const MachineInstr * | PrologEndLoc |
| This location indicates end of function prologue and beginning of function body. | |
| const MachineBasicBlock * | EpilogBeginBlock = nullptr |
| This block includes epilogue instructions. | |
| const MachineInstr * | CurMI = nullptr |
| If nonnull, stores the current machine instruction we're processing. | |
| LexicalScopes | LScopes |
| DbgValueHistoryMap | DbgValues |
| History of DBG_VALUE and clobber instructions for each user variable. | |
| DbgLabelInstrMap | DbgLabels |
| Mapping of inlined labels and DBG_LABEL machine instruction. | |
| DenseMap< const MachineInstr *, MCSymbol * > | LabelsBeforeInsn |
| Maps instruction with label emitted before instruction. | |
| DenseMap< const MachineInstr *, MCSymbol * > | LabelsAfterInsn |
| Maps instruction with label emitted after instruction. | |
NVPTX-specific DwarfDebug implementation.
Customizes DWARF emission for PTX targets: DWARF v2 defaults, address space attributes (DW_AT_address_class) for cuda-gdb, compile-unit range suppression, range-list base address handling, and enhanced line information with inlined_at directives.
Definition at line 30 of file NVPTXDwarfDebug.h.
| NVPTXDwarfDebug::NVPTXDwarfDebug | ( | AsmPrinter * | A | ) |
Definition at line 39 of file NVPTXDwarfDebug.cpp.
References A(), llvm::DebugHandlerBase::Asm, llvm::DwarfDebug::DwarfDebug(), llvm::DwarfDebug::setUseInlineStrings(), llvm::DwarfDebug::setUseRangesSection(), and llvm::DwarfDebug::setUseSectionsAsReferences().
|
overridevirtual |
Add target-specific attributes to a variable DIE (e.g.
DW_AT_address_class).
Reimplemented from llvm::DwarfDebug.
Definition at line 248 of file NVPTXDwarfDebug.cpp.
References llvm::NVPTXAS::DWARF_ADDR_global_space, llvm::NVPTXAS::DWARF_ADDR_local_space, llvm::NVPTXAS::DWARF_ADDR_reg_space, llvm::DwarfDebug::FrameIndex, llvm::PointerType::getAddressSpace(), llvm::GlobalValue::getType(), llvm::DwarfDebug::Global, llvm::DwarfDebug::Register, translateToNVVMDWARFAddrSpace(), and llvm::DwarfDebug::tuneForGDB().
|
overridevirtual |
Extract target-specific address space information from a DIExpression.
Targets may strip address-space-encoding ops from the expression and return the address space via TargetAddrSpace.
Reimplemented from llvm::DwarfDebug.
Definition at line 228 of file NVPTXDwarfDebug.cpp.
References llvm::DIExpression::extractAddressClass(), and llvm::DwarfDebug::tuneForGDB().
|
overrideprotectedvirtual |
NVPTX-specific debug info initialization.
Reimplemented from llvm::DwarfDebug.
Definition at line 185 of file NVPTXDwarfDebug.cpp.
|
overrideprotectedvirtual |
NVPTX-specific source line recording with inlined_at support.
Why this exists: NVPTX supports an "enhanced lineinfo" mode where inlining context is carried via line-table directives, rather than full DWARF DIEs. This is conceptually similar to proposals[1] for richer DWARF line tables that carry inline call context and callee identity in the line table. NVPTX implements this via target-specific .loc extensions in the PTX ISA[3].
How it impacts PTX assembly generation:
Example (conceptual PTX .loc sequence for an inlined callsite): .loc 1 16 3 // caller location .loc 1 5 3, function_name $L__info_stringN, inlined_at 1 16 3 // inlined callee location Here, $L__info_stringN is a label (or label+immediate) referring into .debug_str.
How this impacts DWARF : DWARF generation tools that consume this PTX(e.g. ptxas assembler) can use the inlined_at and function_name operands to extend the DWARF v2 line table information. This adds:
References:
Reimplemented from llvm::DwarfDebug.
Definition at line 92 of file NVPTXDwarfDebug.cpp.
References llvm::DebugHandlerBase::Asm, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::contains(), DL, llvm::dyn_cast(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::getDISubprogram(), llvm::DwarfDebug::getDwarfVersion(), llvm::MachineFunction::getFunction(), llvm::NVPTXSubtarget::getPTXVersion(), llvm::Function::getSubprogram(), llvm::MachineFunction::getSubtarget(), llvm::DwarfDebug::getUnits(), llvm::DwarfDebug::InfoHolder, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), LineInfoWithInlinedAt, llvm::DICompileUnit::LineTablesOnly, llvm_unreachable, llvm::SmallVectorImpl< T >::pop_back_val(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
|
overrideprotectedvirtual |
Whether to attach ranges/low_pc to the compile unit DIE in endModule.
Reimplemented from llvm::DwarfDebug.
Definition at line 193 of file NVPTXDwarfDebug.cpp.
References llvm::DwarfDebug::tuneForGDB().
Whether the target requires resetting the base address in range/loc lists.
Reimplemented from llvm::DwarfDebug.
Definition at line 200 of file NVPTXDwarfDebug.cpp.
References llvm::DwarfDebug::tuneForGDB().