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 &&
"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 FrameIndexExprs.append(V.FrameIndexExprs.
begin(), V.FrameIndexExprs.
end());
139 [](FrameIndexExpr &FIE) {
140 return FIE.Expr && FIE.Expr->isFragment();
142 "conflicting locations for variable");
148 if (Var->isParameter())
149 return dwarf::DW_TAG_formal_parameter;
151 return dwarf::DW_TAG_variable;
155 if (Var->isArtificial())
163 if (Var->isObjectPointer())
165 if (
getType()->isObjectPointer())
171 assert(MInsn &&
"Expected DBG_VALUE, not MMI variable");
172 assert((FrameIndexExprs.empty() ||
173 (FrameIndexExprs.size() == 1 &&
174 FrameIndexExprs[0].Expr->getNumElements())) &&
175 "Invalid Expr for DBG_VALUE");
176 return !FrameIndexExprs.empty();
178 bool isBlockByrefVariable()
const;
207 std::vector<SymbolCU> ArangeLabels;
248 TypeUnitsUnderConstruction;
251 bool HasDwarfPubSections;
254 bool UseGNUTLSOpcode;
257 bool UseDWARF2Bitfields;
260 bool UseAllLinkageNames;
264 bool HasDwarfAccelTables;
265 bool HasAppleExtensionAttributes;
303 bool tuneForGDB()
const {
return DebuggerTuning == DebuggerKind::GDB; }
304 bool tuneForLLDB()
const {
return DebuggerTuning == DebuggerKind::LLDB; }
305 bool tuneForSCE()
const {
return DebuggerTuning == DebuggerKind::SCE; }
311 return InfoHolder.getUnits();
317 DbgVariable *getExistingAbstractVariable(InlinedVariable IV,
319 DbgVariable *getExistingAbstractVariable(InlinedVariable IV);
321 void ensureAbstractVariableIsCreated(InlinedVariable Var,
323 void ensureAbstractVariableIsCreatedIfScoped(InlinedVariable Var,
329 void constructAbstractSubprogramScopeDIE(
LexicalScope *Scope);
331 void finishVariableDefinitions();
333 void finishSubprogramDefinitions();
337 void finalizeModuleInfo();
340 void emitDebugInfo();
343 void emitAbbreviations();
350 void emitAccelNames();
354 void emitAccelObjC();
357 void emitAccelNamespaces();
360 void emitAccelTypes();
366 void emitDebugPubNames(
bool GnuStyle =
false);
372 void emitDebugPubTypes(
bool GnuStyle =
false);
374 void emitDebugPubSection(
385 void emitDebugLocDWO();
388 void emitDebugARanges();
391 void emitDebugRanges();
394 void emitDebugMacinfo();
403 std::unique_ptr<DwarfCompileUnit> NewU);
410 void emitDebugInfoDWO();
413 void emitDebugAbbrevDWO();
416 void emitDebugLineDWO();
419 void emitDebugStrDWO();
436 void recordSourceLine(
unsigned Line,
unsigned Col,
const MDNode *Scope,
464 void endModule()
override;
476 static uint64_t makeTypeSignature(
StringRef Identifier);
511 return HasAppleExtensionAttributes;
519 uint16_t getDwarfVersion()
const;
551 void addAccelType(
StringRef Name,
const DIE &Die,
char Flags);
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
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
Return the function type for an intrinsic.
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.
struct fuzzer::@269 Flags
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...
static GCRegistry::Add< StatepointGC > D("statepoint-example","an example strategy for statepoint")
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)...
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
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.
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.
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.
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
bool hasFrameIndexExprs() const