LLVM 23.0.0git
NVPTXDwarfDebug.h
Go to the documentation of this file.
1//===-- NVPTXDwarfDebug.h - NVPTX DwarfDebug Implementation ---*- 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//
9// This file declares the NVPTXDwarfDebug class, the NVPTX-specific subclass
10// of DwarfDebug. It customizes DWARF emission for PTX: address space
11// attributes, compile-unit range suppression, base address handling, and
12// enhanced line information with inlined_at directives.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXDWARFDEBUG_H
17#define LLVM_LIB_TARGET_NVPTX_NVPTXDWARFDEBUG_H
18
20#include "llvm/ADT/DenseSet.h"
21
22namespace llvm {
23
24/// NVPTX-specific DwarfDebug implementation.
25///
26/// Customizes DWARF emission for PTX targets: DWARF v2 defaults, address
27/// space attributes (DW_AT_address_class) for cuda-gdb, compile-unit range
28/// suppression, range-list base address handling, and enhanced line
29/// information with inlined_at directives.
31private:
32 /// Set of inlined_at locations that have already been emitted.
33 /// Used to avoid redundant emission of parent chain .loc directives.
34 DenseSet<const DILocation *> EmittedInlinedAtLocs;
35
36public:
38
39 bool shouldResetBaseAddress(const MCSection &Section) const override;
41 const DIExpression *Expr,
42 std::optional<unsigned> &TargetAddrSpace) const override;
44 DwarfCompileUnit &CU, DIE &Die, std::optional<unsigned> TargetAddrSpace,
45 VariableLocationKind VarLocKind,
46 const GlobalVariable *GV = nullptr) const override;
47
48protected:
49 void initializeTargetDebugInfo(const MachineFunction &MF) override;
50 void recordTargetSourceLine(const DebugLoc &DL, unsigned Flags) override;
51 bool shouldAttachCompileUnitRanges() const override;
52};
53
54} // end namespace llvm
55
56#endif // LLVM_LIB_TARGET_NVPTX_NVPTXDWARFDEBUG_H
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file defines the DenseSet and SmallDenseSet classes.
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
DWARF expression.
A debug info location.
Definition DebugLoc.h:123
Implements a dense probed hash-table based set.
Definition DenseSet.h:279
VariableLocationKind
Describes the storage kind of a debug variable for target hooks.
Definition DwarfDebug.h:752
DwarfDebug(AsmPrinter *A)
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h:516
bool shouldResetBaseAddress(const MCSection &Section) const override
Whether the target requires resetting the base address in range/loc lists.
bool shouldAttachCompileUnitRanges() const override
Whether to attach ranges/low_pc to the compile unit DIE in endModule.
void recordTargetSourceLine(const DebugLoc &DL, unsigned Flags) override
NVPTX-specific source line recording with inlined_at support.
const DIExpression * adjustExpressionForTarget(const DIExpression *Expr, std::optional< unsigned > &TargetAddrSpace) const override
Extract target-specific address space information from a DIExpression.
NVPTXDwarfDebug(AsmPrinter *A)
void initializeTargetDebugInfo(const MachineFunction &MF) override
NVPTX-specific debug info initialization.
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.
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26