13 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H 14 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H 54 class DwarfCompileUnit;
55 class DwarfExpression;
59 class MachineFunction;
72 DIE *TheDIE =
nullptr;
82 : Entity(N), InlinedAt(IA), SubclassID(ID) {}
120 unsigned DebugLocListIndex = ~0u;
125 std::unique_ptr<DbgValueLoc> ValueLoc =
nullptr;
127 struct FrameIndexExpr {
144 assert(FrameIndexExprs.
empty() &&
"Already initialized?");
145 assert(!ValueLoc.get() &&
"Already initialized?");
155 assert(FrameIndexExprs.
empty() &&
"Already initialized?");
156 assert(!ValueLoc &&
"Already initialized?");
159 ValueLoc = std::make_unique<DbgValueLoc>(
Value);
160 if (
auto *
E = ValueLoc->getExpression())
161 if (
E->getNumElements())
170 return cast<DILocalVariable>(
getEntity());
174 assert(ValueLoc.get() && FrameIndexExprs.
size() <= 1);
175 return FrameIndexExprs.
size() ? FrameIndexExprs[0].Expr :
nullptr;
192 if (getVariable()->isParameter())
193 return dwarf::DW_TAG_formal_parameter;
195 return dwarf::DW_TAG_variable;
200 if (getVariable()->isArtificial())
208 if (getVariable()->isObjectPointer())
210 if (
getType()->isObjectPointer())
216 assert(ValueLoc.get() &&
"Expected DBG_VALUE, not MMI variable");
218 (FrameIndexExprs.
size() == 1 &&
219 FrameIndexExprs[0].Expr->getNumElements())) &&
220 "Invalid Expr for DBG_VALUE");
221 return !FrameIndexExprs.
empty();
253 return dwarf::DW_TAG_label;
269 : Register(Reg), Value(Val) {
270 assert(Reg &&
"Parameter register cannot be undef");
308 std::vector<SymbolCU> ArangeLabels;
350 TypeUnitsUnderConstruction;
353 bool UseGNUTLSOpcode;
356 bool UseDWARF2Bitfields;
359 bool UseAllLinkageNames;
362 bool UseInlineStrings =
false;
365 bool UseRangesSection =
true;
369 bool UseSectionsAsReferences =
false;
372 bool UseLocSection =
true;
375 bool GenerateTypeUnits;
380 bool HasAppleExtensionAttributes;
387 bool UseSegmentedStringOffsetsTable;
449 template <
typename DataT>
453 void finishEntityDefinitions();
455 void finishSubprogramDefinitions();
459 void finalizeModuleInfo();
462 void emitDebugInfo();
465 void emitAbbreviations();
468 void emitStringOffsetsTableHeader();
471 template <
typename AccelTableT>
475 void emitAccelDebugNames();
478 void emitAccelNames();
482 void emitAccelObjC();
485 void emitAccelNamespaces();
488 void emitAccelTypes();
491 void emitDebugPubSections();
493 void emitDebugPubSection(
bool GnuStyle,
StringRef Name,
504 void emitDebugLocDWO();
509 void emitDebugARanges();
512 void emitDebugRanges();
513 void emitDebugRangesDWO();
517 void emitDebugMacinfo();
519 void emitDebugMacinfoDWO();
520 void emitDebugMacinfoImpl(
MCSection *Section);
529 std::unique_ptr<DwarfCompileUnit> NewU);
541 void emitDebugInfoDWO();
544 void emitDebugAbbrevDWO();
547 void emitDebugLineDWO();
550 void emitStringOffsetsTableHeaderDWO();
553 void emitDebugStrDWO();
556 void emitDebugAddr();
603 void skippedNonDebugFunction()
override;
618 void endModule()
override;
621 DebugLoc emitInitialLocDirective(
const MachineFunction &MF,
unsigned CUID);
627 static uint64_t makeTypeSignature(
StringRef Identifier);
632 DIE &Die,
const DICompositeType *CTy);
637 decltype(DwarfDebug::TypeUnitsUnderConstruction) TypeUnitsUnderConstruction;
676 return UseSectionsAsReferences;
691 return HasAppleExtensionAttributes;
705 return UseSegmentedStringOffsetsTable;
708 bool shareAcrossDWOCUs()
const;
754 return CUDieMap.
lookup(Die);
766 void addSectionLabel(
const MCSymbol *Sym);
776 #endif // LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface ...
Instances of this class represent a uniqued identifier for a section in the current translation unit...
void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override
For symbols that have a size designated (e.g.
unsigned getDebugLocListIndex() const
static bool classof(const DbgEntity *N)
This class represents lattice values for constants.
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. ...
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
Implements a dense probed hash-table based set.
void push_back(const T &Elt)
AccelTableKind getAccelTableKind() const
Returns what kind (if any) of accelerator tables to emit.
const DebugLocStream & getDebugLocs() const
Returns the entries for the .debug_loc section.
Collects and handles dwarf debug information.
This class holds an abstract representation of an Accelerator Table, consisting of a sequence of buck...
Base class containing the logic for constructing DWARF expressions independently of whether they are ...
bool useGNUTLSOpcode() const
Returns whether to use DW_OP_GNU_push_tls_address, instead of the standard DW_OP_form_tls_address opc...
This class is defined as the common parent of DbgVariable and DbgLabel such that it could levarage po...
This class implements a map that also provides access to all stored values in a deterministic order...
LexicalScope - This class is used to track scope information.
const MachineFunction * getCurrentFunction() const
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
Tagged DWARF-like metadata node.
DebuggerKind
Identify a debugger for "tuning" the debug info.
bool useSplitDwarf() const
Returns whether or not to change the current debug info for the split dwarf proposal support...
static bool classof(const DbgEntity *N)
const MCSymbol * getSymbol() const
void addArangeLabel(SymbolCU SCU)
Add a label so that arange data can be generated for it.
Used for tracking debug info about call site parameters.
bool isObjectPointer() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
AccelTableKind
The kind of accelerator tables we should emit.
AddressPool & getAddressPool()
const DIExpression * getSingleExpression() const
This class is used to track local variable information.
const DILocalVariable * getVariable() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
.apple_names, .apple_namespaces, .apple_types, .apple_objc.
const SmallVectorImpl< std::unique_ptr< DwarfCompileUnit > > & getUnits()
unsigned getRegister() const
const DwarfCompileUnit * getPrevCU() const
Returns the previous CU that was being updated.
bool hasComplexAddress() const
This class is used to track label information.
const DIExpression * getExpression() const
This dwarf writer support class manages information associated with a source file.
Allocate memory in an ever growing pool, as if by bump-pointer.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
A structured debug information entry.
This class is intended to be used as a driving class for all asm writers.
bool useDWARF2Bitfields() const
Returns whether to use the DWARF2 format for bitfields instyead of the DWARF4 format.
bool hasFrameIndexExprs() const
bool useSegmentedStringOffsetsTable() const
Returns whether to generate a string offsets table with (possibly shared) contributions from each CU ...
const DILabel * getLabel() const
Accessors.
dwarf::Tag getTag() const
Helper used to pair up a symbol and its DWARF compile unit.
void initializeMMI(const DIExpression *E, int FI)
Initialize from the MMI table.
bool useAllLinkageNames() const
Returns whether we should emit all DW_AT_[MIPS_]linkage_name.
static wasm::ValType getType(const TargetRegisterClass *RC)
SymbolCU(DwarfCompileUnit *CU, const MCSymbol *Sym)
const DILocation * getInlinedAt() const
static void recordSourceLine(AsmPrinter &Asm, unsigned Line, unsigned Col, const MDNode *S, unsigned Flags, unsigned CUID, uint16_t DwarfVersion, ArrayRef< std::unique_ptr< DwarfCompileUnit >> DCUs)
Register a source line with debug info.
std::pair< const DINode *, const DILocation * > InlinedEntity
An imported module (C++ using directive or similar).
void initializeDbgValue(DbgValueLoc Value)
bool useLocSection() const
Returns whether .debug_loc section should be emitted.
void setDebugLocListTagOffset(uint8_t O)
bool useSectionsAsReferences() const
Returns whether to use sections as labels rather than temp symbols.
StringRef getName() const
void setPrevCU(const DwarfCompileUnit *PrevCU)
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
Align max(MaybeAlign Lhs, Align Rhs)
DbgCallSiteParam(unsigned Reg, DbgValueLoc Val)
DwarfCompileUnit * lookupCU(const DIE *Die)
Find the matching DwarfCompileUnit for the given CU DIE.
Promote Memory to Register
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static bool classof(const DbgEntity *N)
bool useAppleExtensionAttributes() const
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
This file contains constants used for implementing Dwarf debug support.
StringRef getName() const
const DwarfCompileUnit * lookupCU(const DIE *Die) const
dwarf::Tag getTag() const
Translate tag to proper Dwarf tag.
Representation of each machine instruction.
LLVM_NODISCARD bool empty() const
bool useRangesSection() const
Returns whether ranges section should be emitted.
DbgLabel(const DILabel *L, const DILocation *IA, const MCSymbol *Sym=nullptr)
Symbol before DBG_LABEL instruction.
unsigned getDbgEntityID() const
Base class for debug information backends.
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...
void setDebugLocListIndex(unsigned O)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Optional< uint8_t > getDebugLocListTagOffset() const
LLVM Value Representation.
A vector that has set insertion semantics.
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.
const DINode * getEntity() const
Accessors.
StringRef - Represent a constant reference to a string, i.e.
const DbgValueLoc * getValueLoc() const
DbgValueLoc getValue() const
Byte stream of .debug_loc entries.
bool isFragment() const
Return whether this is a piece of an aggregate variable.
bool generateTypeUnits() const
Returns whether to generate DWARF v4 type units.
bool isArtificial() const
Return true if DbgVariable is artificial.
DbgEntity(const DINode *N, const DILocation *IA, unsigned ID)
bool useInlineStrings() const
Returns whether to use inline strings.
A single location or constant.
Basic type, like 'int' or 'float'.