LLVM  15.0.0git
DwarfCompileUnit.h
Go to the documentation of this file.
1 //===- llvm/CodeGen/DwarfCompileUnit.h - Dwarf Compile Unit -----*- 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 contains support for writing dwarf compile unit.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H
14 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H
15 
16 #include "DwarfDebug.h"
17 #include "DwarfUnit.h"
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/DenseMap.h"
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/ADT/StringMap.h"
22 #include "llvm/ADT/StringRef.h"
27 #include "llvm/Support/Casting.h"
28 #include <cassert>
29 #include <cstdint>
30 #include <memory>
31 
32 namespace llvm {
33 
34 class AsmPrinter;
35 class DIE;
36 class DIELoc;
37 class DIEValueList;
38 class DwarfFile;
39 class GlobalVariable;
40 class MCExpr;
41 class MCSymbol;
42 class MDNode;
43 
44 enum class UnitKind { Skeleton, Full };
45 
46 class DwarfCompileUnit final : public DwarfUnit {
47  /// A numeric ID unique among all CUs in the module
48  unsigned UniqueID;
49  bool HasRangeLists = false;
50 
51  /// The start of the unit line section, this is also
52  /// reused in appyStmtList.
53  MCSymbol *LineTableStartSym;
54 
55  /// Skeleton unit associated with this unit.
56  DwarfCompileUnit *Skeleton = nullptr;
57 
58  /// The start of the unit within its section.
59  MCSymbol *LabelBegin = nullptr;
60 
61  /// The start of the unit macro info within macro section.
62  MCSymbol *MacroLabelBegin;
63 
66 
67  ImportedEntityMap ImportedEntities;
68 
69  /// GlobalNames - A map of globally visible named entities for this unit.
70  StringMap<const DIE *> GlobalNames;
71 
72  /// GlobalTypes - A map of globally visible types for this unit.
73  StringMap<const DIE *> GlobalTypes;
74 
75  // List of ranges for a given compile unit.
77 
78  // The base address of this unit, if any. Used for relative references in
79  // ranges/locs.
80  const MCSymbol *BaseAddress = nullptr;
81 
82  DenseMap<const MDNode *, DIE *> AbstractSPDies;
84 
85  /// DWO ID for correlating skeleton and split units.
86  uint64_t DWOId = 0;
87 
88  const DIFile *LastFile = nullptr;
89  unsigned LastFileID;
90 
91  /// Construct a DIE for the given DbgVariable without initializing the
92  /// DbgVariable's DIE reference.
93  DIE *constructVariableDIEImpl(const DbgVariable &DV, bool Abstract);
94 
95  bool isDwoUnit() const override;
96 
97  DenseMap<const MDNode *, DIE *> &getAbstractSPDies() {
98  if (isDwoUnit() && !DD->shareAcrossDWOCUs())
99  return AbstractSPDies;
100  return DU->getAbstractSPDies();
101  }
102 
104  if (isDwoUnit() && !DD->shareAcrossDWOCUs())
105  return AbstractEntities;
106  return DU->getAbstractEntities();
107  }
108 
109  void finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) override;
110 
111 public:
112  DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A,
113  DwarfDebug *DW, DwarfFile *DWU,
115 
116  bool hasRangeLists() const { return HasRangeLists; }
117  unsigned getUniqueID() const { return UniqueID; }
118 
120  return Skeleton;
121  }
122 
123  bool includeMinimalInlineScopes() const;
124 
125  void initStmtList();
126 
127  /// Apply the DW_AT_stmt_list from this compile unit to the specified DIE.
128  void applyStmtList(DIE &D);
129 
130  /// Get line table start symbol for this unit.
131  MCSymbol *getLineTableStartSym() const { return LineTableStartSym; }
132 
133  /// A pair of GlobalVariable and DIExpression.
134  struct GlobalExpr {
137  };
138 
139  struct BaseTypeRef {
142  unsigned BitSize;
144  DIE *Die = nullptr;
145  };
146 
147  std::vector<BaseTypeRef> ExprRefedBaseTypes;
148 
149  /// Get or create global variable DIE.
150  DIE *
152  ArrayRef<GlobalExpr> GlobalExprs);
153 
155  ArrayRef<GlobalExpr> GlobalExprs);
156 
157  void addLocationAttribute(DIE *ToDIE, const DIGlobalVariable *GV,
158  ArrayRef<GlobalExpr> GlobalExprs);
159 
160  /// addLabelAddress - Add a dwarf label attribute data and value using
161  /// either DW_FORM_addr or DW_FORM_GNU_addr_index.
163  const MCSymbol *Label);
164 
165  /// addLocalLabelAddress - Add a dwarf label attribute data and value using
166  /// DW_FORM_addr only.
168  const MCSymbol *Label);
169 
170  DwarfCompileUnit &getCU() override { return *this; }
171 
172  unsigned getOrCreateSourceID(const DIFile *File) override;
173 
175  DIScope *Scope = IE->getScope();
176  assert(Scope && "Invalid Scope encoding!");
177  if (!isa<DILocalScope>(Scope))
178  // No need to add imported enities that are not local declaration.
179  return;
180 
181  auto *LocalScope = cast<DILocalScope>(Scope)->getNonLexicalBlockFileScope();
182  ImportedEntities[LocalScope].push_back(IE);
183  }
184 
185  /// addRange - Add an address range to the list of ranges for this unit.
186  void addRange(RangeSpan Range);
187 
188  void attachLowHighPC(DIE &D, const MCSymbol *Begin, const MCSymbol *End);
189 
190  /// Find DIE for the given subprogram and attach appropriate
191  /// DW_AT_low_pc and DW_AT_high_pc attributes. If there are global
192  /// variables in this scope then create and insert DIEs for these
193  /// variables.
195 
196  void constructScopeDIE(LexicalScope *Scope, DIE &ParentScopeDIE);
197 
198  /// A helper function to construct a RangeSpanList for a given
199  /// lexical scope.
200  void addScopeRangeList(DIE &ScopeDIE, SmallVector<RangeSpan, 2> Range);
201 
203 
205  const SmallVectorImpl<InsnRange> &Ranges);
206 
207  /// This scope represents inlined body of a function. Construct
208  /// DIE to represent this concrete inlined copy of the function.
210 
211  /// Construct new DW_TAG_lexical_block for this scope and
212  /// attach DW_AT_low_pc/DW_AT_high_pc labels.
214 
215  /// constructVariableDIE - Construct a DIE for the given DbgVariable.
216  DIE *constructVariableDIE(DbgVariable &DV, bool Abstract = false);
217 
219  DIE *&ObjectPointer);
220 
221  /// Construct a DIE for the given DbgLabel.
223 
224  void createBaseTypeDIEs();
225 
226  /// Construct a DIE for this subprogram scope.
229 
231 
233 
234  /// Whether to use the GNU analog for a DWARF5 tag, attribute, or location
235  /// atom. Only applicable when emitting otherwise DWARF4-compliant debug info.
236  bool useGNUAnalogForDwarf5Feature() const;
237 
238  /// This takes a DWARF 5 tag and returns it or a GNU analog.
240 
241  /// This takes a DWARF 5 attribute and returns it or a GNU analog.
243 
244  /// This takes a DWARF 5 location atom and either returns it or a GNU analog.
246 
247  /// Construct a call site entry DIE describing a call within \p Scope to a
248  /// callee described by \p CalleeSP.
249  /// \p IsTail specifies whether the call is a tail call.
250  /// \p PCAddr points to the PC value after the call instruction.
251  /// \p CallAddr points to the PC value at the call instruction (or is null).
252  /// \p CallReg is a register location for an indirect call. For direct calls
253  /// the \p CallReg is set to 0.
254  DIE &constructCallSiteEntryDIE(DIE &ScopeDIE, const DISubprogram *CalleeSP,
255  bool IsTail, const MCSymbol *PCAddr,
256  const MCSymbol *CallAddr, unsigned CallReg);
257  /// Construct call site parameter DIEs for the \p CallSiteDIE. The \p Params
258  /// were collected by the \ref collectCallSiteParameters.
259  /// Note: The order of parameters does not matter, since debuggers recognize
260  /// call site parameters by the DW_AT_location attribute.
261  void constructCallSiteParmEntryDIEs(DIE &CallSiteDIE,
263 
264  /// Construct import_module DIE.
266 
268  void finishEntityDefinition(const DbgEntity *Entity);
269 
270  /// Find abstract variable associated with Var.
274 
275  /// Set the skeleton unit associated with this unit.
276  void setSkeleton(DwarfCompileUnit &Skel) { Skeleton = &Skel; }
277 
278  unsigned getHeaderSize() const override {
279  // DWARF v5 added the DWO ID to the header for split/skeleton units.
280  unsigned DWOIdSize =
281  DD->getDwarfVersion() >= 5 && DD->useSplitDwarf() ? sizeof(uint64_t)
282  : 0;
283  return DwarfUnit::getHeaderSize() + DWOIdSize;
284  }
285  unsigned getLength() {
286  return Asm->getUnitLengthFieldByteSize() + // Length field
288  }
289 
290  void emitHeader(bool UseOffsets) override;
291 
292  /// Add the DW_AT_addr_base attribute to the unit DIE.
293  void addAddrTableBase();
294 
296  assert(LabelBegin && "LabelBegin is not initialized");
297  return LabelBegin;
298  }
299 
301  return MacroLabelBegin;
302  }
303 
304  /// Add a new global name to the compile unit.
305  void addGlobalName(StringRef Name, const DIE &Die,
306  const DIScope *Context) override;
307 
308  /// Add a new global name present in a type unit to this compile unit.
310 
311  /// Add a new global type to the compile unit.
312  void addGlobalType(const DIType *Ty, const DIE &Die,
313  const DIScope *Context) override;
314 
315  /// Add a new global type present in a type unit to this compile unit.
316  void addGlobalTypeUnitType(const DIType *Ty, const DIScope *Context);
317 
318  const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; }
319  const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; }
320 
321  /// Add DW_AT_location attribute for a DbgVariable based on provided
322  /// MachineLocation.
323  void addVariableAddress(const DbgVariable &DV, DIE &Die,
324  MachineLocation Location);
325  /// Add an address attribute to a die based on the location provided.
327  const MachineLocation &Location);
328 
329  /// Start with the address based on the location provided, and generate the
330  /// DWARF information necessary to find the actual variable (navigating the
331  /// extra location information encoded in the type) based on the starting
332  /// location. Add the DWARF information to the die.
333  void addComplexAddress(const DbgVariable &DV, DIE &Die,
335  const MachineLocation &Location);
336 
337  /// Add a Dwarf loclistptr attribute data and value.
338  void addLocationList(DIE &Die, dwarf::Attribute Attribute, unsigned Index);
339  void applyVariableAttributes(const DbgVariable &Var, DIE &VariableDie);
340 
341  /// Add a Dwarf expression attribute data and value.
342  void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr);
343 
345  DIE &SPDie);
346 
347  void applyLabelAttributes(const DbgLabel &Label, DIE &LabelDie);
348 
349  /// getRanges - Get the list of ranges for this unit.
350  const SmallVectorImpl<RangeSpan> &getRanges() const { return CURanges; }
352 
353  void setBaseAddress(const MCSymbol *Base) { BaseAddress = Base; }
354  const MCSymbol *getBaseAddress() const { return BaseAddress; }
355 
356  uint64_t getDWOId() const { return DWOId; }
357  void setDWOId(uint64_t DwoId) { DWOId = DwoId; }
358 
359  bool hasDwarfPubSections() const;
360 
361  void addBaseTypeRef(DIEValueList &Die, int64_t Idx);
362 };
363 
364 } // end namespace llvm
365 
366 #endif // LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H
llvm::DwarfCompileUnit::DwarfCompileUnit
DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, UnitKind Kind=UnitKind::Full)
Definition: DwarfCompileUnit.cpp:57
llvm::DwarfCompileUnit::emitHeader
void emitHeader(bool UseOffsets) override
Emit the header for this unit, not including the initial length field.
Definition: DwarfCompileUnit.cpp:1364
llvm::DwarfCompileUnit::addGlobalName
void addGlobalName(StringRef Name, const DIE &Die, const DIScope *Context) override
Add a new global name to the compile unit.
Definition: DwarfCompileUnit.cpp:1397
llvm::DwarfCompileUnit::constructSubprogramScopeDIE
DIE & constructSubprogramScopeDIE(const DISubprogram *Sub, LexicalScope *Scope)
Construct a DIE for this subprogram scope.
Definition: DwarfCompileUnit.cpp:1018
llvm::MachineLocation
Definition: MachineLocation.h:22
llvm::DwarfCompileUnit::getCU
DwarfCompileUnit & getCU() override
Definition: DwarfCompileUnit.h:170
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::DIType
Base class for types.
Definition: DebugInfoMetadata.h:658
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::DwarfCompileUnit::constructInlinedScopeDIE
DIE * constructInlinedScopeDIE(LexicalScope *Scope)
This scope represents inlined body of a function.
Definition: DwarfCompileUnit.cpp:655
llvm::DwarfCompileUnit::getLineTableStartSym
MCSymbol * getLineTableStartSym() const
Get line table start symbol for this unit.
Definition: DwarfCompileUnit.h:131
llvm::DwarfCompileUnit::ExprRefedBaseTypes
std::vector< BaseTypeRef > ExprRefedBaseTypes
Definition: DwarfCompileUnit.h:147
llvm::DwarfCompileUnit::getGlobalNames
const StringMap< const DIE * > & getGlobalNames() const
Definition: DwarfCompileUnit.h:318
llvm::DbgEntity
This class is defined as the common parent of DbgVariable and DbgLabel such that it could levarage po...
Definition: DwarfDebug.h:65
DebugInfoMetadata.h
llvm::Attribute
Definition: Attributes.h:65
StringRef.h
llvm::DwarfCompileUnit
Definition: DwarfCompileUnit.h:46
llvm::DwarfFile::getAbstractSPDies
DenseMap< const MDNode *, DIE * > & getAbstractSPDies()
Definition: DwarfFile.h:165
llvm::DwarfUnit::DU
DwarfFile * DU
Definition: DwarfUnit.h:51
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1185
llvm::DwarfCompileUnit::createAndAddScopeChildren
DIE * createAndAddScopeChildren(LexicalScope *Scope, DIE &ScopeDIE)
Definition: DwarfCompileUnit.cpp:1046
llvm::LexicalScope
LexicalScope - This class is used to track scope information.
Definition: LexicalScopes.h:44
llvm::dwarf::Form
Form
Definition: Dwarf.h:132
llvm::DwarfCompileUnit::addLabelAddress
void addLabelAddress(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label)
addLabelAddress - Add a dwarf label attribute data and value using either DW_FORM_addr or DW_FORM_GNU...
Definition: DwarfCompileUnit.cpp:67
llvm::GlobalVariable
Definition: GlobalVariable.h:39
llvm::RangeSpan
Definition: DwarfFile.h:36
llvm::DwarfCompileUnit::attachRangesOrLowHighPC
void attachRangesOrLowHighPC(DIE &D, SmallVector< RangeSpan, 2 > Ranges)
Definition: DwarfCompileUnit.cpp:604
DenseMap.h
llvm::DwarfCompileUnit::createBaseTypeDIEs
void createBaseTypeDIEs()
Definition: DwarfCompileUnit.cpp:1577
llvm::DwarfCompileUnit::updateSubprogramScopeDIE
DIE & updateSubprogramScopeDIE(const DISubprogram *SP)
Find DIE for the given subprogram and attach appropriate DW_AT_low_pc and DW_AT_high_pc attributes.
Definition: DwarfCompileUnit.cpp:446
llvm::DwarfCompileUnit::getGlobalTypes
const StringMap< const DIE * > & getGlobalTypes() const
Definition: DwarfCompileUnit.h:319
llvm::DIE
A structured debug information entry.
Definition: DIE.h:739
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2558
llvm::DbgLabel
This class is used to track label information.
Definition: DwarfDebug.h:232
llvm::dwarf::Tag
Tag
Definition: Dwarf.h:105
llvm::DwarfCompileUnit::getOrCreateCommonBlock
DIE * getOrCreateCommonBlock(const DICommonBlock *CB, ArrayRef< GlobalExpr > GlobalExprs)
Definition: DwarfCompileUnit.cpp:362
llvm::DwarfCompileUnit::constructLexicalScopeDIE
DIE * constructLexicalScopeDIE(LexicalScope *Scope)
Construct new DW_TAG_lexical_block for this scope and attach DW_AT_low_pc/DW_AT_high_pc labels.
Definition: DwarfCompileUnit.cpp:689
llvm::DwarfCompileUnit::constructLabelDIE
DIE * constructLabelDIE(DbgLabel &DL, const LexicalScope &Scope)
Construct a DIE for the given DbgLabel.
Definition: DwarfCompileUnit.cpp:709
llvm::dwarf::Attribute
Attribute
Attributes.
Definition: Dwarf.h:125
llvm::DwarfCompileUnit::GlobalExpr::Expr
const DIExpression * Expr
Definition: DwarfCompileUnit.h:136
llvm::DwarfCompileUnit::BaseTypeRef::BaseTypeRef
BaseTypeRef(unsigned BitSize, dwarf::TypeKind Encoding)
Definition: DwarfCompileUnit.h:140
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::DwarfCompileUnit::getExistingAbstractEntity
DbgEntity * getExistingAbstractEntity(const DINode *Node)
Definition: DwarfCompileUnit.cpp:1341
llvm::DwarfCompileUnit::constructScopeDIE
void constructScopeDIE(LexicalScope *Scope, DIE &ParentScopeDIE)
Definition: DwarfCompileUnit.cpp:536
llvm::DwarfCompileUnit::takeRanges
SmallVector< RangeSpan, 2 > takeRanges()
Definition: DwarfCompileUnit.h:351
llvm::DwarfCompileUnit::addScopeRangeList
void addScopeRangeList(DIE &ScopeDIE, SmallVector< RangeSpan, 2 > Range)
A helper function to construct a RangeSpanList for a given lexical scope.
Definition: DwarfCompileUnit.cpp:571
llvm::DwarfCompileUnit::setDWOId
void setDWOId(uint64_t DwoId)
Definition: DwarfCompileUnit.h:357
llvm::DwarfCompileUnit::getDwarf5OrGNUAttr
dwarf::Attribute getDwarf5OrGNUAttr(dwarf::Attribute Attr) const
This takes a DWARF 5 attribute and returns it or a GNU analog.
Definition: DwarfCompileUnit.cpp:1152
DbgEntityHistoryCalculator.h
llvm::DwarfCompileUnit::BaseTypeRef::Die
DIE * Die
Definition: DwarfCompileUnit.h:144
llvm::DwarfCompileUnit::constructVariableDIE
DIE * constructVariableDIE(DbgVariable &DV, bool Abstract=false)
constructVariableDIE - Construct a DIE for the given DbgVariable.
Definition: DwarfCompileUnit.cpp:703
llvm::DwarfCompileUnit::addLocationList
void addLocationList(DIE &Die, dwarf::Attribute Attribute, unsigned Index)
Add a Dwarf loclistptr attribute data and value.
Definition: DwarfCompileUnit.cpp:1500
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
llvm::UnitKind
UnitKind
Definition: DwarfCompileUnit.h:44
llvm::DwarfCompileUnit::addLocationAttribute
void addLocationAttribute(DIE *ToDIE, const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)
Definition: DwarfCompileUnit.cpp:202
LexicalScopes.h
llvm::DbgValueHistoryMap::InlinedEntity
std::pair< const DINode *, const DILocation * > InlinedEntity
Definition: DbgEntityHistoryCalculator.h:96
llvm::DwarfCompileUnit::getDWOId
uint64_t getDWOId() const
Definition: DwarfCompileUnit.h:356
llvm::DwarfCompileUnit::addBaseTypeRef
void addBaseTypeRef(DIEValueList &Die, int64_t Idx)
Definition: DwarfCompileUnit.cpp:1572
llvm::DwarfCompileUnit::initStmtList
void initStmtList()
Definition: DwarfCompileUnit.cpp:402
DwarfDebug.h
StringMap.h
llvm::DbgVariable
This class is used to track local variable information.
Definition: DwarfDebug.h:115
llvm::DwarfCompileUnit::applySubprogramAttributesToDefinition
void applySubprogramAttributesToDefinition(const DISubprogram *SP, DIE &SPDie)
Definition: DwarfCompileUnit.cpp:1542
llvm::DwarfCompileUnit::attachLowHighPC
void attachLowHighPC(DIE &D, const MCSymbol *Begin, const MCSymbol *End)
Definition: DwarfCompileUnit.cpp:429
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::DIE::getSize
unsigned getSize() const
Definition: DIE.h:782
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:110
llvm::DwarfCompileUnit::constructAbstractSubprogramScopeDIE
void constructAbstractSubprogramScopeDIE(LexicalScope *Scope)
Definition: DwarfCompileUnit.cpp:1094
llvm::DwarfCompileUnit::getDwarf5OrGNULocationAtom
dwarf::LocationAtom getDwarf5OrGNULocationAtom(dwarf::LocationAtom Loc) const
This takes a DWARF 5 location atom and either returns it or a GNU analog.
Definition: DwarfCompileUnit.cpp:1174
llvm::ARM_PROC::IE
@ IE
Definition: ARMBaseInfo.h:27
llvm::DICommonBlock
Definition: DebugInfoMetadata.h:2999
llvm::DwarfCompileUnit::setSkeleton
void setSkeleton(DwarfCompileUnit &Skel)
Set the skeleton unit associated with this unit.
Definition: DwarfCompileUnit.h:276
llvm::DwarfCompileUnit::addVariableAddress
void addVariableAddress(const DbgVariable &DV, DIE &Die, MachineLocation Location)
Add DW_AT_location attribute for a DbgVariable based on provided MachineLocation.
Definition: DwarfCompileUnit.cpp:1438
llvm::DwarfCompileUnit::GlobalExpr
A pair of GlobalVariable and DIExpression.
Definition: DwarfCompileUnit.h:134
llvm::DwarfCompileUnit::getMacroLabelBegin
MCSymbol * getMacroLabelBegin() const
Definition: DwarfCompileUnit.h:300
llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE
DIE * getOrCreateGlobalVariableDIE(const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)
Get or create global variable DIE.
Definition: DwarfCompileUnit.cpp:136
llvm::DwarfCompileUnit::hasDwarfPubSections
bool hasDwarfPubSections() const
Definition: DwarfCompileUnit.cpp:1379
llvm::DwarfDebug
Collects and handles dwarf debug information.
Definition: DwarfDebug.h:294
uint64_t
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::DwarfCompileUnit::addGlobalNameForTypeUnit
void addGlobalNameForTypeUnit(StringRef Name, const DIScope *Context)
Add a new global name present in a type unit to this compile unit.
Definition: DwarfCompileUnit.cpp:1405
llvm::DIGlobalVariable
Global variables.
Definition: DebugInfoMetadata.h:2914
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::DenseMap< const MDNode *, ImportedEntityList >
llvm::DwarfDebug::useSplitDwarf
bool useSplitDwarf() const
Returns whether or not to change the current debug info for the split dwarf proposal support.
Definition: DwarfDebug.h:735
llvm::DwarfCompileUnit::getOrCreateSourceID
unsigned getOrCreateSourceID(const DIFile *File) override
Look up the source ID for the given file.
Definition: DwarfCompileUnit.cpp:116
llvm::DICompileUnit
Compile unit.
Definition: DebugInfoMetadata.h:1322
llvm::DIImportedEntity
An imported module (C++ using directive or similar).
Definition: DebugInfoMetadata.h:3293
llvm::DwarfCompileUnit::finishSubprogramDefinition
void finishSubprogramDefinition(const DISubprogram *SP)
Definition: DwarfCompileUnit.cpp:1303
llvm::DIELoc
DIELoc - Represents an expression location.
Definition: DIE.h:930
ArrayRef.h
llvm::DwarfUnit::Asm
AsmPrinter * Asm
Target of Dwarf emission.
Definition: DwarfUnit.h:44
llvm::DwarfCompileUnit::addGlobalType
void addGlobalType(const DIType *Ty, const DIE &Die, const DIScope *Context) override
Add a new global type to the compile unit.
Definition: DwarfCompileUnit.cpp:1418
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::DwarfCompileUnit::finishEntityDefinition
void finishEntityDefinition(const DbgEntity *Entity)
Definition: DwarfCompileUnit.cpp:1317
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::DwarfCompileUnit::constructImportedEntityDIE
DIE * constructImportedEntityDIE(const DIImportedEntity *Module)
Construct import_module DIE.
Definition: DwarfCompileUnit.cpp:1265
llvm::DwarfCompileUnit::BaseTypeRef::BitSize
unsigned BitSize
Definition: DwarfCompileUnit.h:142
llvm::DwarfCompileUnit::addComplexAddress
void addComplexAddress(const DbgVariable &DV, DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location)
Start with the address based on the location provided, and generate the DWARF information necessary t...
Definition: DwarfCompileUnit.cpp:1472
llvm::DICompositeType
Composite types.
Definition: DebugInfoMetadata.h:1042
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::DwarfCompileUnit::applyLabelAttributes
void applyLabelAttributes(const DbgLabel &Label, DIE &LabelDie)
Definition: DwarfCompileUnit.cpp:1527
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
Dwarf.h
llvm::DwarfFile::getAbstractEntities
DenseMap< const DINode *, std::unique_ptr< DbgEntity > > & getAbstractEntities()
Definition: DwarfFile.h:169
llvm::DINode
Tagged DWARF-like metadata node.
Definition: DebugInfoMetadata.h:129
llvm::DwarfCompileUnit::addRange
void addRange(RangeSpan Range)
addRange - Add an address range to the list of ranges for this unit.
Definition: DwarfCompileUnit.cpp:379
llvm::DwarfCompileUnit::addAddrTableBase
void addAddrTableBase()
Add the DW_AT_addr_base attribute to the unit DIE.
Definition: DwarfCompileUnit.cpp:1563
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::DwarfCompileUnit::getBaseAddress
const MCSymbol * getBaseAddress() const
Definition: DwarfCompileUnit.h:354
Node
Definition: ItaniumDemangle.h:155
llvm::DwarfCompileUnit::applyVariableAttributes
void applyVariableAttributes(const DbgVariable &Var, DIE &VariableDie)
Definition: DwarfCompileUnit.cpp:1508
llvm::AsmPrinter::getUnitLengthFieldByteSize
unsigned int getUnitLengthFieldByteSize() const
Returns 4 for DWARF32 and 12 for DWARF64.
Definition: AsmPrinter.cpp:3829
llvm::DwarfDebug::shareAcrossDWOCUs
bool shareAcrossDWOCUs() const
Definition: DwarfDebug.cpp:558
llvm::DwarfCompileUnit::BaseTypeRef::Encoding
dwarf::TypeKind Encoding
Definition: DwarfCompileUnit.h:143
llvm::dwarf::TypeKind
TypeKind
Definition: Dwarf.h:151
llvm::DwarfCompileUnit::setBaseAddress
void setBaseAddress(const MCSymbol *Base)
Definition: DwarfCompileUnit.h:353
llvm::DwarfUnit::DD
DwarfDebug * DD
Definition: DwarfUnit.h:50
llvm::DwarfCompileUnit::BaseTypeRef
Definition: DwarfCompileUnit.h:139
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
llvm::DwarfCompileUnit::createAbstractEntity
void createAbstractEntity(const DINode *Node, LexicalScope *Scope)
Definition: DwarfCompileUnit.cpp:1349
llvm::DIScope
Base class for scope-like contexts.
Definition: DebugInfoMetadata.h:471
llvm::DwarfCompileUnit::useGNUAnalogForDwarf5Feature
bool useGNUAnalogForDwarf5Feature() const
Whether to use the GNU analog for a DWARF5 tag, attribute, or location atom.
Definition: DwarfCompileUnit.cpp:1134
llvm::DwarfCompileUnit::getLength
unsigned getLength()
Definition: DwarfCompileUnit.h:285
Casting.h
llvm::DwarfCompileUnit::applyStmtList
void applyStmtList(DIE &D)
Apply the DW_AT_stmt_list from this compile unit to the specified DIE.
Definition: DwarfCompileUnit.cpp:423
llvm::DwarfCompileUnit::addGlobalTypeUnitType
void addGlobalTypeUnitType(const DIType *Ty, const DIScope *Context)
Add a new global type present in a type unit to this compile unit.
Definition: DwarfCompileUnit.cpp:1426
llvm::DwarfCompileUnit::addLocalLabelAddress
void addLocalLabelAddress(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label)
addLocalLabelAddress - Add a dwarf label attribute data and value using DW_FORM_addr only.
Definition: DwarfCompileUnit.cpp:107
DwarfUnit.h
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:81
llvm::UnitKind::Full
@ Full
llvm::DwarfFile
Definition: DwarfFile.h:49
llvm::DwarfCompileUnit::includeMinimalInlineScopes
bool includeMinimalInlineScopes() const
Definition: DwarfCompileUnit.cpp:1558
llvm::DwarfCompileUnit::getSkeleton
DwarfCompileUnit * getSkeleton() const
Definition: DwarfCompileUnit.h:119
llvm::DwarfCompileUnit::constructCallSiteParmEntryDIEs
void constructCallSiteParmEntryDIEs(DIE &CallSiteDIE, SmallVector< DbgCallSiteParam, 4 > &Params)
Construct call site parameter DIEs for the CallSiteDIE.
Definition: DwarfCompileUnit.cpp:1241
llvm::DwarfCompileUnit::addImportedEntity
void addImportedEntity(const DIImportedEntity *IE)
Definition: DwarfCompileUnit.h:174
SmallVector.h
llvm::DwarfCompileUnit::getHeaderSize
unsigned getHeaderSize() const override
Compute the size of a header for this unit, not including the initial length field.
Definition: DwarfCompileUnit.h:278
llvm::DwarfCompileUnit::getDwarf5OrGNUTag
dwarf::Tag getDwarf5OrGNUTag(dwarf::Tag Tag) const
This takes a DWARF 5 tag and returns it or a GNU analog.
Definition: DwarfCompileUnit.cpp:1138
llvm::UnitKind::Skeleton
@ Skeleton
llvm::DISubprogram
Subprogram description.
Definition: DebugInfoMetadata.h:1803
llvm::SmallVectorImpl< InsnRange >
llvm::DwarfDebug::getDwarfVersion
uint16_t getDwarfVersion() const
Returns the Dwarf Version.
Definition: DwarfDebug.cpp:3501
llvm::DwarfCompileUnit::GlobalExpr::Var
const GlobalVariable * Var
Definition: DwarfCompileUnit.h:135
llvm::DwarfUnit
This dwarf writer support class manages information associated with a source file.
Definition: DwarfUnit.h:35
llvm::DwarfCompileUnit::hasRangeLists
bool hasRangeLists() const
Definition: DwarfCompileUnit.h:116
llvm::DIEValueList
A list of DIE values.
Definition: DIE.h:662
llvm::DwarfCompileUnit::constructCallSiteEntryDIE
DIE & constructCallSiteEntryDIE(DIE &ScopeDIE, const DISubprogram *CalleeSP, bool IsTail, const MCSymbol *PCAddr, const MCSymbol *CallAddr, unsigned CallReg)
Construct a call site entry DIE describing a call within Scope to a callee described by CalleeSP.
Definition: DwarfCompileUnit.cpp:1185
llvm::DwarfCompileUnit::addAddress
void addAddress(DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location)
Add an address attribute to a die based on the location provided.
Definition: DwarfCompileUnit.cpp:1447
llvm::DwarfCompileUnit::getUniqueID
unsigned getUniqueID() const
Definition: DwarfCompileUnit.h:117
llvm::DwarfCompileUnit::getLabelBegin
MCSymbol * getLabelBegin() const
Definition: DwarfCompileUnit.h:295
llvm::DwarfCompileUnit::getRanges
const SmallVectorImpl< RangeSpan > & getRanges() const
getRanges - Get the list of ranges for this unit.
Definition: DwarfCompileUnit.h:350
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::DIEUnit::getUnitDie
DIE & getUnitDie()
Definition: DIE.h:919
llvm::DwarfUnit::getHeaderSize
virtual unsigned getHeaderSize() const
Compute the size of a header for this unit, not including the initial length field.
Definition: DwarfUnit.h:269
llvm::dwarf::LocationAtom
LocationAtom
Definition: Dwarf.h:138
llvm::ISD::MCSymbol
@ MCSymbol
Definition: ISDOpcodes.h:172
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58
llvm::DIFile
File.
Definition: DebugInfoMetadata.h:525
llvm::DwarfCompileUnit::InlinedEntity
DbgValueHistoryMap::InlinedEntity InlinedEntity
Find abstract variable associated with Var.
Definition: DwarfCompileUnit.h:271
llvm::DwarfCompileUnit::addExpr
void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr)
Add a Dwarf expression attribute data and value.
Definition: DwarfCompileUnit.cpp:1537