14 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H
15 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H
46 class DwarfCompileUnit;
50 class MachineModuleInfo;
67 DIE *TheDIE =
nullptr;
68 unsigned DebugLocListIndex = ~0u;
71 struct FrameIndexExpr {
88 assert(FrameIndexExprs.
empty() &&
"Already initialized?");
89 assert(!MInsn &&
"Already initialized?");
92 assert(FI != INT_MAX &&
"Expected valid index");
99 assert(FrameIndexExprs.
empty() &&
"Already initialized?");
100 assert(!MInsn &&
"Already initialized?");
107 if (
E->getNumElements())
115 assert(MInsn && FrameIndexExprs.size() <= 1);
116 return FrameIndexExprs.size() ? FrameIndexExprs[0].Expr :
nullptr;
129 assert(DebugLocListIndex == ~0U && !MInsn &&
"not an MMI entry");
130 assert(V.DebugLocListIndex == ~0U && !V.MInsn &&
"not an MMI entry");
131 assert(V.Var == Var &&
"conflicting variable");
132 assert(V.IA == IA &&
"conflicting inlined-at location");
134 assert(!FrameIndexExprs.empty() &&
"Expected an MMI entry");
135 assert(!V.FrameIndexExprs.
empty() &&
"Expected an MMI entry");
137 if (FrameIndexExprs.size()) {
138 auto *Expr = FrameIndexExprs.back().Expr;
141 if (!Expr || !Expr->isFragment())
144 FrameIndexExprs.append(V.FrameIndexExprs.
begin(), V.FrameIndexExprs.
end());
146 [](FrameIndexExpr &FIE) {
147 return FIE.Expr && FIE.Expr->isFragment();
149 "conflicting locations for variable");
155 if (Var->isParameter())
156 return dwarf::DW_TAG_formal_parameter;
158 return dwarf::DW_TAG_variable;
162 if (Var->isArtificial())
170 if (Var->isObjectPointer())
172 if (
getType()->isObjectPointer())
178 assert(MInsn &&
"Expected DBG_VALUE, not MMI variable");
179 assert((FrameIndexExprs.empty() ||
180 (FrameIndexExprs.size() == 1 &&
181 FrameIndexExprs[0].Expr->getNumElements())) &&
182 "Invalid Expr for DBG_VALUE");
183 return !FrameIndexExprs.empty();
185 bool isBlockByrefVariable()
const;
214 std::vector<SymbolCU> ArangeLabels;
254 TypeUnitsUnderConstruction;
257 bool UseGNUTLSOpcode;
260 bool UseDWARF2Bitfields;
263 bool UseAllLinkageNames;
267 bool HasDwarfAccelTables;
268 bool HasAppleExtensionAttributes;
306 bool tuneForGDB()
const {
return DebuggerTuning == DebuggerKind::GDB; }
307 bool tuneForLLDB()
const {
return DebuggerTuning == DebuggerKind::LLDB; }
308 bool tuneForSCE()
const {
return DebuggerTuning == DebuggerKind::SCE; }
314 return InfoHolder.getUnits();
319 void ensureAbstractVariableIsCreated(
DwarfCompileUnit &CU, InlinedVariable Var,
321 void ensureAbstractVariableIsCreatedIfScoped(
DwarfCompileUnit &CU, InlinedVariable Var,
330 void finishVariableDefinitions();
332 void finishSubprogramDefinitions();
336 void finalizeModuleInfo();
339 void emitDebugInfo();
342 void emitAbbreviations();
349 void emitAccelNames();
353 void emitAccelObjC();
356 void emitAccelNamespaces();
359 void emitAccelTypes();
365 void emitDebugPubNames(
bool GnuStyle =
false);
371 void emitDebugPubTypes(
bool GnuStyle =
false);
373 void emitDebugPubSection(
384 void emitDebugLocDWO();
387 void emitDebugARanges();
390 void emitDebugRanges();
393 void emitDebugMacinfo();
402 std::unique_ptr<DwarfCompileUnit> NewU);
409 void emitDebugInfoDWO();
412 void emitDebugAbbrevDWO();
415 void emitDebugLineDWO();
418 void emitDebugStrDWO();
435 void recordSourceLine(
unsigned Line,
unsigned Col,
const MDNode *Scope,
458 void skippedNonDebugFunction()
override;
473 void endModule()
override;
514 return HasAppleExtensionAttributes;
521 bool shareAcrossDWOCUs()
const;
524 uint16_t getDwarfVersion()
const;
556 void addAccelType(
StringRef Name,
const DIE &Die,
char Flags);
564 bool hasDwarfPubSections(
bool includeMinimalInlineScopes)
const;
Instances of this class represent a uniqued identifier for a section in the current translation unit...
void push_back(const T &Elt)
void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override
For symbols that have a size designated (e.g.
const MachineInstr * getMInsn() const
bool useAppleExtensionAttributes() const
unsigned getDebugLocListIndex() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
A Module instance is used to store all the information related to an LLVM module. ...
const MachineFunction * getCurrentFunction() const
Implements a dense probed hash-table based set.
const DIExpression * getSingleExpression() const
Collects and handles dwarf debug information.
bool useDwarfAccelTables() const
Returns whether or not to emit tables that dwarf consumers can use to accelerate lookup.
This class implements a map that also provides access to all stored values in a deterministic order...
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
StringRef getName() const
bool hasComplexAddress() const
LexicalScope - This class is used to track scope information.
bool useGNUTLSOpcode() const
Returns whether to use DW_OP_GNU_push_tls_address, instead of the standard DW_OP_form_tls_address opc...
const DILocation * getInlinedAt() const
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
DebuggerKind
Identify a debugger for "tuning" the debug info.
void initializeDbgValue(const MachineInstr *DbgValue)
Initialize from a DBG_VALUE instruction.
bool useDWARF2Bitfields() const
Returns whether to use the DWARF2 format for bitfields instyead of the DWARF4 format.
void addArangeLabel(SymbolCU SCU)
Add a label so that arange data can be generated for it.
bool isArtificial() const
Return true if DbgVariable is artificial.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Holds a subclass of DINode.
LLVM_NODISCARD bool empty() const
AddressPool & getAddressPool()
This class is used to track local variable information.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool useSplitDwarf() const
Returns whether or not to change the current debug info for the split dwarf proposal support...
This dwarf writer support class manages information associated with a source file.
Allocate memory in an ever growing pool, as if by bump-pointer.
void addMMIEntry(const DbgVariable &V)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
A structured debug information entry.
This class is intended to be used as a driving class for all asm writers.
T * resolve(TypedDINodeRef< T > Ref) const
Find the MDNode for the given reference.
const DIExpression * getDebugExpression() const
Return the complex address expression referenced by this DBG_VALUE instruction.
Helper used to pair up a symbol and its DWARF compile unit.
void initializeMMI(const DIExpression *E, int FI)
Initialize from the MMI table.
static wasm::ValType getType(const TargetRegisterClass *RC)
SymbolCU(DwarfCompileUnit *CU, const MCSymbol *Sym)
An imported module (C++ using directive or similar).
void setPrevCU(const DwarfCompileUnit *PrevCU)
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
const DebugLocStream & getDebugLocs() const
Returns the entries for the .debug_loc section.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
const DILocalVariable * getVariable() const
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
bool useAllLinkageNames() const
Returns whether we should emit all DW_AT_[MIPS_]linkage_name.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static std::vector< std::string > Flags
Representation of each machine instruction.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
Base class for debug information backends.
dwarf::Tag getTag() const
const DILocalVariable * getDebugVariable() const
Return the debug variable referenced by this DBG_VALUE instruction.
void setDebugLocListIndex(unsigned O)
const DwarfCompileUnit * getPrevCU() const
Returns the previous CU that was being updated.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isObjectPointer() const
A vector that has set insertion semantics.
std::pair< const DILocalVariable *, const DILocation * > InlinedVariable
unsigned getUnits(MCInstrInfo const &MCII, MCSubtargetInfo const &STI, MCInst const &MCI)
Return the slots used by the insn.
DbgVariable(const DILocalVariable *V, const DILocation *IA)
Frame index + expression.
StringRef - Represent a constant reference to a string, i.e.
Byte stream of .debug_loc entries.
bool hasFrameIndexExprs() const