LLVM 24.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/MapVector.h"
22#include "llvm/ADT/StringMap.h"
23#include "llvm/ADT/StringRef.h"
29#include <cstdint>
30#include <memory>
31
32namespace llvm {
33
34class AsmPrinter;
35class DIE;
36class DIELoc;
37class DIEValueList;
38class DwarfFile;
39class GlobalVariable;
40class MCExpr;
41class MCSymbol;
42class MDNode;
43
44enum class UnitKind { Skeleton, Full };
45
46class DwarfCompileUnit final : public DwarfUnit {
47 bool HasRangeLists = false;
48
49 /// The start of the unit line section, this is also
50 /// reused in appyStmtList.
51 MCSymbol *LineTableStartSym;
52
53 /// Skeleton unit associated with this unit.
54 DwarfCompileUnit *Skeleton = nullptr;
55
56 /// The start of the unit macro info within macro section.
57 MCSymbol *MacroLabelBegin;
58
59 /// GlobalNames - A map of globally visible named entities for this unit.
60 StringMap<const DIE *> GlobalNames;
61
62 /// GlobalTypes - A map of globally visible types for this unit.
63 StringMap<const DIE *> GlobalTypes;
64
65 // List of ranges for a given compile unit.
67
68 // The base address of this unit, if any. Used for relative references in
69 // ranges/locs.
70 const MCSymbol *BaseAddress = nullptr;
71
72 using MDNodeSetVector =
75
76 // List of entities (either static locals, types or imports) that
77 // belong to subprograms within this CU.
78 MDNodeSetVector DeferredLocalDecls;
79
80 // List of concrete lexical block scopes belong to subprograms within this CU.
82
83 // List of abstract local scopes (either DISubprogram or DILexicalBlock).
84 DenseMap<const DILocalScope *, DIE *> AbstractLocalScopeDIEs;
85 SmallPtrSet<const DISubprogram *, 8> FinalizedAbstractSubprograms;
86
87 // Local scopes (either DISubprogram or DILexicalBlock) used as a context of
88 // DIEs before it was known whether their subprograms have abstract DIEs,
89 // mapped to the pending DIEs holding those DIEs until
90 // resolvePendingLocalScopeDIEs() moves them to the final scope DIEs.
91 MapVector<const DILocalScope *, DIE *> PendingLocalScopeDIEs;
92
93 // Parent of the pending DIEs. It is the first child of the unit DIE until
94 // resolvePendingLocalScopeDIEs() removes it.
95 DIE *PendingLocalScopesDIE = nullptr;
96
97 // List of inlined lexical block scopes that belong to subprograms within this
98 // CU.
100
102
103 /// Cache of artificial DIEs created for DW_OP_LLVM_implicit_pointer
104 /// lowering, keyed by (pointee type, constant value). Enables reuse when
105 /// multiple pointer variables reference the same constant.
106 DenseMap<std::pair<const DIType *, int64_t>, DIE *> ImplicitPointerDIEs;
107
108 /// DWO ID for correlating skeleton and split units.
109 uint64_t DWOId = 0;
110
111 const DIFile *LastFile = nullptr;
112 unsigned LastFileID;
113
114 /// \anchor applyConcreteDbgVariableAttribute
115 /// \name applyConcreteDbgVariableAttribute
116 /// Overload set which applies attributes to \c VariableDie based on
117 /// the active variant of \c DV, which is passed as the first argument.
118 ///@{
119
120 /// See \ref applyConcreteDbgVariableAttribute
121 void applyConcreteDbgVariableAttributes(const Loc::Single &Single,
122 const DbgVariable &DV,
123 DIE &VariableDie);
124 /// See \ref applyConcreteDbgVariableAttribute
125 void applyConcreteDbgVariableAttributes(const Loc::Multi &Multi,
126 const DbgVariable &DV,
127 DIE &VariableDie);
128 /// See \ref applyConcreteDbgVariableAttribute
129 void applyConcreteDbgVariableAttributes(const Loc::MMI &MMI,
130 const DbgVariable &DV,
131 DIE &VariableDie);
132 /// See \ref applyConcreteDbgVariableAttribute
133 void applyConcreteDbgVariableAttributes(const Loc::EntryValue &EntryValue,
134 const DbgVariable &DV,
135 DIE &VariableDie);
136 /// See \ref applyConcreteDbgVariableAttribute
137 void applyConcreteDbgVariableAttributes(const std::monostate &,
138 const DbgVariable &DV,
139 DIE &VariableDie);
140
141 ///@}
142
143 /// Lower DW_OP_LLVM_implicit_pointer by creating an artificial variable DIE
144 /// for the dereferenced value and emitting DW_OP_implicit_pointer (DWARF 5)
145 /// or DW_OP_GNU_implicit_pointer (DWARF 4) for the pointer's location.
146 ///
147 /// \returns true if the implicit pointer was handled successfully.
148 bool emitImplicitPointerLocation(const Loc::Single &Single,
149 const DbgVariable &DV, DIE &VariableDie);
150
151 bool isDwoUnit() const override;
152
153 DenseMap<const DILocalScope *, DIE *> &getAbstractScopeDIEs() {
154 if (isDwoUnit() && !DD->shareAcrossDWOCUs())
155 return AbstractLocalScopeDIEs;
156 return DU->getAbstractScopeDIEs();
157 }
158
160 if (isDwoUnit() && !DD->shareAcrossDWOCUs())
161 return AbstractEntities;
162 return DU->getAbstractEntities();
163 }
164
165 auto &getFinalizedAbstractSubprograms() {
166 if (isDwoUnit() && !DD->shareAcrossDWOCUs())
167 return FinalizedAbstractSubprograms;
168 return DU->getFinalizedAbstractSubprograms();
169 }
170
171 void finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) override;
172
173 /// Add info for Wasm-global-based relocation.
174 void addWasmRelocBaseGlobal(DIELoc *Loc, StringRef GlobalName,
175 uint64_t GlobalIndex);
176
177 /// Create context DIE for abstract subprogram.
178 /// \returns The context DIE and the compile unit where abstract
179 /// DIE should be constructed.
180 std::pair<DIE *, DwarfCompileUnit *>
181 getOrCreateAbstractSubprogramContextDIE(const DISubprogram *SP);
182
183 /// Create new DIE for abstract subprogram.
184 DIE &createAbstractSubprogramDIE(const DISubprogram *SP, DIE *ContextDIE,
185 DwarfCompileUnit *ContextCU);
186
187 /// Get the DIE to be used as a parent of DIEs of entities local to \p Scope,
188 /// which must not be a DILexicalBlockFile.
189 ///
190 /// The DIE belongs to the abstract tree if the subprogram of \p Scope has an
191 /// abstract DIE, and to the concrete tree otherwise. Until all functions are
192 /// processed, this may be a pending DIE, see
193 /// resolvePendingLocalScopeDIEs(). If there is no DIE for \p Scope in the
194 /// tree, the DIE of the closest enclosing scope is returned.
195 DIE *getOrCreateLocalScopeDIE(const DILocalScope *Scope);
196
197 /// Get or create the pending DIE of \p Scope.
198 DIE &getOrCreatePendingLocalScopeDIE(const DILocalScope *Scope);
199
200 /// Add a location exprloc to \p DIE with attribute \p Attribute at
201 /// for \p Location modified by raw DIExpression \p Expr.
202 void addLocationWithExpr(DIE &Die, dwarf::Attribute Attribute,
203 const MachineLocation &Location,
204 ArrayRef<uint64_t> Expr);
205
206public:
207 DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A,
208 DwarfDebug *DW, DwarfFile *DWU,
209 UnitKind Kind = UnitKind::Full);
210
211 bool hasRangeLists() const { return HasRangeLists; }
212
214 return Skeleton;
215 }
216
217 bool includeMinimalInlineScopes() const;
218
219 bool emitFuncLineTableOffsets() const;
220
221 void initStmtList();
222
223 /// Apply the DW_AT_stmt_list from this compile unit to the specified DIE.
224 void applyStmtList(DIE &D);
225
226 /// Get line table start symbol for this unit.
227 MCSymbol *getLineTableStartSym() const { return LineTableStartSym; }
228
229 /// A pair of GlobalVariable and DIExpression.
230 struct GlobalExpr {
233 };
234
242
243 std::vector<BaseTypeRef> ExprRefedBaseTypes;
244
245 /// Get or create global variable DIE.
246 DIE *
248 ArrayRef<GlobalExpr> GlobalExprs);
249
251 ArrayRef<GlobalExpr> GlobalExprs);
252
253 void addLocationAttribute(DIE *ToDIE, const DIGlobalVariable *GV,
254 ArrayRef<GlobalExpr> GlobalExprs);
255
256 /// addLabelAddress - Add a dwarf label attribute data and value using
257 /// either DW_FORM_addr or DW_FORM_GNU_addr_index.
259 const MCSymbol *Label);
260
261 /// addLocalLabelAddress - Add a dwarf label attribute data and value using
262 /// DW_FORM_addr only.
264 const MCSymbol *Label);
265
266 DwarfCompileUnit &getCU() override { return *this; }
267
268 unsigned getOrCreateSourceID(const DIFile *File) override;
269
270 /// addRange - Add an address range to the list of ranges for this unit.
272
273 void attachLowHighPC(DIE &D, const MCSymbol *Begin, const MCSymbol *End);
274
275 /// Find DIE for the given subprogram and attach appropriate
276 /// DW_AT_low_pc, DW_AT_high_pc and DW_AT_LLVM_stmt_sequence attributes.
277 /// If there are global variables in this scope then create and insert DIEs
278 /// for these variables.
280 MCSymbol *LineTableSym);
281
282 void constructScopeDIE(LexicalScope *Scope, DIE &ParentScopeDIE);
283
284 /// A helper function to construct a RangeSpanList for a given
285 /// lexical scope.
287
289
291 const SmallVectorImpl<InsnRange> &Ranges);
292
293 /// This scope represents an inlined body of a function. Construct a
294 /// DIE to represent this concrete inlined copy of the function.
295 DIE *constructInlinedScopeDIE(LexicalScope *Scope, DIE &ParentScopeDIE);
296
297 /// Get if available or create a new DW_TAG_lexical_block for the given
298 /// LexicalScope and attach DW_AT_low_pc/DW_AT_high_pc labels.
299 DIE *getOrCreateLexicalBlockDIE(LexicalScope *Scope, DIE &ParentDIE);
300
301 /// Construct a DIE for the given DbgVariable.
302 DIE *constructVariableDIE(DbgVariable &DV, bool Abstract = false);
303
304 /// Convenience overload which writes the DIE pointer into an out variable
305 /// ObjectPointer in addition to returning it.
307 DIE *&ObjectPointer);
308
309 /// Construct a DIE for the given DbgLabel.
311
312 void createBaseTypeDIEs();
313
314 /// Construct a DIE for a given scope.
315 /// This instance of 'getOrCreateContextDIE()' can handle DILocalScope.
316 DIE *getOrCreateContextDIE(const DIScope *Ty) override;
317
318 /// Move DIEs of function-local entities from pending DIEs to the DIEs of
319 /// their scopes in abstract or concrete trees. Must be called after all
320 /// functions are processed, when it is known which subprograms have
321 /// abstract DIEs.
323
325 bool Minimal = false) override;
326
327 /// Construct a DIE for this subprogram scope.
329 LexicalScope *Scope, MCSymbol *LineTableSym);
330
331 DIE *createAndAddScopeChildren(LexicalScope *Scope, DIE &ScopeDIE);
332
333 /// Create an abstract subprogram DIE, that should later be populated
334 /// by \ref constructAbstractSubprogramScopeDIE.
337
338 /// Whether to use the GNU analog for a DWARF5 tag, attribute, or location
339 /// atom. Only applicable when emitting otherwise DWARF4-compliant debug info.
340 bool useGNUAnalogForDwarf5Feature() const;
341
342 /// This takes a DWARF 5 tag and returns it or a GNU analog.
344
345 /// This takes a DWARF 5 attribute and returns it or a GNU analog.
347
348 /// This takes a DWARF 5 location atom and either returns it or a GNU analog.
350
351 /// Construct a call site entry DIE describing a call within \p Scope to a
352 /// callee described by \p CalleeSP and \p CalleeF.
353 /// \p IsTail specifies whether the call is a tail call.
354 /// \p PCAddr points to the PC value after the call instruction.
355 /// \p CallAddr points to the PC value at the call instruction (or is null).
356 /// \p CallTarget a location holding the target address for an indirect call.
357 /// For direct calls \p CallTarget register is set to 0.
358 /// \p Offset from \p CallTarget register value if the location is indirect.
359 DIE &constructCallSiteEntryDIE(DIE &ScopeDIE, const DISubprogram *CalleeSP,
360 const Function *CalleeF, bool IsTail,
361 const MCSymbol *PCAddr,
362 const MCSymbol *CallAddr,
363 MachineLocation CallTarget, int64_t Offset,
364 DIType *AllocSiteTy);
365 /// Construct call site parameter DIEs for the \p CallSiteDIE. The \p Params
366 /// were collected by the \ref collectCallSiteParameters.
367 /// Note: The order of parameters does not matter, since debuggers recognize
368 /// call site parameters by the DW_AT_location attribute.
369 void constructCallSiteParmEntryDIEs(DIE &CallSiteDIE,
371
372 /// Get or create a DIE for an imported entity.
375
377 void finishEntityDefinition(const DbgEntity *Entity);
379
380 /// Find abstract variable associated with Var.
383 void createAbstractEntity(const DINode *Node, LexicalScope *Scope);
384
385 /// Set the skeleton unit associated with this unit.
386 void setSkeleton(DwarfCompileUnit &Skel) { Skeleton = &Skel; }
387
388 unsigned getHeaderSize() const override {
389 // DWARF v5 added the DWO ID to the header for split/skeleton units.
390 unsigned DWOIdSize =
391 DD->getDwarfVersion() >= 5 && DD->useSplitDwarf() ? sizeof(uint64_t)
392 : 0;
393 return DwarfUnit::getHeaderSize() + DWOIdSize;
394 }
395 unsigned getLength() {
396 return Asm->getUnitLengthFieldByteSize() + // Length field
398 }
399
400 void emitHeader(bool UseOffsets) override;
401
402 /// Add the DW_AT_addr_base attribute to the unit DIE.
403 void addAddrTableBase();
404
406 return MacroLabelBegin;
407 }
408
409 /// Add a new global name to the compile unit.
410 void addGlobalName(StringRef Name, const DIE &Die,
411 const DIScope *Context) override;
412
413 /// Add a new global name present in a type unit to this compile unit.
414 void addGlobalNameForTypeUnit(StringRef Name, const DIScope *Context);
415
416 /// Add a new global type to the compile unit.
417 void addGlobalTypeImpl(const DIType *Ty, const DIE &Die,
418 const DIScope *Context) override;
419
420 /// Add a new global type present in a type unit to this compile unit.
421 void addGlobalTypeUnitType(const DIType *Ty, const DIScope *Context);
422
423 const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; }
424 const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; }
425
426 /// Add DW_AT_location attribute for a DbgVariable based on provided
427 /// MachineLocation.
428 void addVariableAddress(const DbgVariable &DV, DIE &Die,
429 MachineLocation Location);
430 /// Add an address attribute to a die based on the location provided.
432 const MachineLocation &Location);
433
434 /// Add a memory location exprloc to \p DIE with attribute \p Attribute
435 /// at \p Location + \p Offset.
437 const MachineLocation &Location, int64_t Offset);
438 /// Start with the address based on the location provided, and generate the
439 /// DWARF information necessary to find the actual variable (navigating the
440 /// extra location information encoded in the type) based on the starting
441 /// location. Add the DWARF information to the die.
442 void addComplexAddress(const DIExpression *DIExpr, DIE &Die,
444 const MachineLocation &Location);
445
446 /// Add a Dwarf loclistptr attribute data and value.
447 void addLocationList(DIE &Die, dwarf::Attribute Attribute, unsigned Index);
448
449 /// Add attributes to \p Var which reflect the common attributes of \p
450 /// VariableDie, namely those which are not dependant on the active variant.
452 DIE &VariableDie);
453
454 /// Add a Dwarf expression attribute data and value.
455 void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr);
456
458 DIE &SPDie);
459
460 void applyLabelAttributes(const DbgLabel &Label, DIE &LabelDie);
461
462 /// getRanges - Get the list of ranges for this unit.
463 const SmallVectorImpl<RangeSpan> &getRanges() const { return CURanges; }
464 SmallVector<RangeSpan, 2> takeRanges() { return std::move(CURanges); }
465
466 void setBaseAddress(const MCSymbol *Base) { BaseAddress = Base; }
467 const MCSymbol *getBaseAddress() const { return BaseAddress; }
468
469 uint64_t getDWOId() const { return DWOId; }
470 void setDWOId(uint64_t DwoId) { DWOId = DwoId; }
471
472 bool hasDwarfPubSections() const;
473
474 void addBaseTypeRef(DIEValueList &Die, int64_t Idx);
475
476 MDNodeSetVector &getDeferredLocalDecls() { return DeferredLocalDecls; }
477
479 const DISubprogram &CalleeSP,
480 DIE &CalleeDIE);
481};
482
483} // end namespace llvm
484
485#endif // LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H
This file defines the StringMap class.
uint64_t uint64_t
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
This file defines the DenseMap class.
This file contains constants used for implementing Dwarf debug support.
#define F(x, y, z)
Definition MD5.cpp:54
This file implements a map that provides insertion order iteration.
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
This file defines the SmallVector class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
This class is intended to be used as a driving class for all asm writers.
Definition AsmPrinter.h:95
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Definition Attributes.h:107
Debug common block.
DIELoc - Represents an expression location.
Definition DIE.h:1045
DIE & getUnitDie()
Definition DIE.h:1034
A list of DIE values.
Definition DIE.h:705
A structured debug information entry.
Definition DIE.h:835
unsigned getSize() const
Definition DIE.h:887
DWARF expression.
An imported module (C++ using directive or similar).
A scope for locals.
Tagged DWARF-like metadata node.
Base class for scope-like contexts.
Subprogram description. Uses SubclassData1.
Base class for types.
This class is defined as the common parent of DbgVariable and DbgLabel such that it could levarage po...
Definition DwarfDebug.h:66
This class is used to track label information.
Definition DwarfDebug.h:290
std::pair< const DINode *, const DILocation * > InlinedEntity
This class is used to track local variable information.
Definition DwarfDebug.h:215
bool useGNUAnalogForDwarf5Feature() const
Whether to use the GNU analog for a DWARF5 tag, attribute, or location atom.
void constructCallSiteParmEntryDIEs(DIE &CallSiteDIE, SmallVector< DbgCallSiteParam, 4 > &Params)
Construct call site parameter DIEs for the CallSiteDIE.
void addLinkageNamesToDeclarations(const DwarfDebug &DD, const DISubprogram &CalleeSP, DIE &CalleeDIE)
void attachLowHighPC(DIE &D, const MCSymbol *Begin, const MCSymbol *End)
void emitHeader(bool UseOffsets) override
Emit the header for this unit, not including the initial length field.
unsigned getHeaderSize() const override
Compute the size of a header for this unit, not including the initial length field.
dwarf::Tag getDwarf5OrGNUTag(dwarf::Tag Tag) const
This takes a DWARF 5 tag and returns it or a GNU analog.
void constructAbstractSubprogramScopeDIE(LexicalScope *Scope)
bool includeMinimalInlineScopes() const
DIE * getOrCreateImportedEntityDIE(const DIImportedEntity *IE)
Get or create a DIE for an imported entity.
SmallVector< RangeSpan, 2 > takeRanges()
void addBaseTypeRef(DIEValueList &Die, int64_t Idx)
void addGlobalNameForTypeUnit(StringRef Name, const DIScope *Context)
Add a new global name present in a type unit to this compile unit.
void finishEntityDefinition(const DbgEntity *Entity)
void addMemoryLocation(DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location, int64_t Offset)
Add a memory location exprloc to DIE with attribute Attribute at Location + Offset.
void addRange(RangeSpan Range)
addRange - Add an address range to the list of ranges for this unit.
void addAddrTableBase()
Add the DW_AT_addr_base attribute to the unit DIE.
MCSymbol * getMacroLabelBegin() const
std::vector< BaseTypeRef > ExprRefedBaseTypes
DIE * constructInlinedScopeDIE(LexicalScope *Scope, DIE &ParentScopeDIE)
This scope represents an inlined body of a function.
void addScopeRangeList(DIE &ScopeDIE, SmallVector< RangeSpan, 2 > Range)
A helper function to construct a RangeSpanList for a given lexical scope.
uint64_t getDWOId() const
DIE * getOrCreateCommonBlock(const DICommonBlock *CB, ArrayRef< GlobalExpr > GlobalExprs)
void addVariableAddress(const DbgVariable &DV, DIE &Die, MachineLocation Location)
Add DW_AT_location attribute for a DbgVariable based on provided MachineLocation.
DIE & constructCallSiteEntryDIE(DIE &ScopeDIE, const DISubprogram *CalleeSP, const Function *CalleeF, bool IsTail, const MCSymbol *PCAddr, const MCSymbol *CallAddr, MachineLocation CallTarget, int64_t Offset, DIType *AllocSiteTy)
Construct a call site entry DIE describing a call within Scope to a callee described by CalleeSP and ...
DIE & getOrCreateAbstractSubprogramDIE(const DISubprogram *SP)
Create an abstract subprogram DIE, that should later be populated by constructAbstractSubprogramScope...
DbgValueHistoryMap::InlinedEntity InlinedEntity
Find abstract variable associated with Var.
MDNodeSetVector & getDeferredLocalDecls()
DIE & constructSubprogramScopeDIE(const DISubprogram *Sub, const Function &F, LexicalScope *Scope, MCSymbol *LineTableSym)
Construct a DIE for this subprogram scope.
void addGlobalName(StringRef Name, const DIE &Die, const DIScope *Context) override
Add a new global name to the compile unit.
DIE & updateSubprogramScopeDIE(const DISubprogram *SP, const Function &F, MCSymbol *LineTableSym)
Find DIE for the given subprogram and attach appropriate DW_AT_low_pc, DW_AT_high_pc and DW_AT_LLVM_s...
void createAbstractEntity(const DINode *Node, LexicalScope *Scope)
void applyStmtList(DIE &D)
Apply the DW_AT_stmt_list from this compile unit to the specified DIE.
DIE * getOrCreateSubprogramDIE(const DISubprogram *SP, const Function *F, bool Minimal=false) override
DIE * getOrCreateContextDIE(const DIScope *Ty) override
Construct a DIE for a given scope.
void applyCommonDbgVariableAttributes(const DbgVariable &Var, DIE &VariableDie)
Add attributes to Var which reflect the common attributes of VariableDie, namely those which are not ...
DIE * constructVariableDIE(DbgVariable &DV, bool Abstract=false)
Construct a DIE for the given DbgVariable.
dwarf::LocationAtom getDwarf5OrGNULocationAtom(dwarf::LocationAtom Loc) const
This takes a DWARF 5 location atom and either returns it or a GNU analog.
DIE * getOrCreateGlobalVariableDIE(const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)
Get or create global variable DIE.
void addLocationAttribute(DIE *ToDIE, const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)
DwarfCompileUnit * getSkeleton() const
void applySubprogramAttributesToDefinition(const DISubprogram *SP, DIE &SPDie)
DIE * createAndAddScopeChildren(LexicalScope *Scope, DIE &ScopeDIE)
void setSkeleton(DwarfCompileUnit &Skel)
Set the skeleton unit associated with this unit.
void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr)
Add a Dwarf expression attribute data and value.
DIE * getOrCreateLexicalBlockDIE(LexicalScope *Scope, DIE &ParentDIE)
Get if available or create a new DW_TAG_lexical_block for the given LexicalScope and attach DW_AT_low...
dwarf::Attribute getDwarf5OrGNUAttr(dwarf::Attribute Attr) const
This takes a DWARF 5 attribute and returns it or a GNU analog.
void addAddress(DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location)
Add an address attribute to a die based on the location provided.
void applyLabelAttributes(const DbgLabel &Label, DIE &LabelDie)
void setDWOId(uint64_t DwoId)
void addLocalLabelAddress(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label)
addLocalLabelAddress - Add a dwarf label attribute data and value using DW_FORM_addr only.
void addGlobalTypeImpl(const DIType *Ty, const DIE &Die, const DIScope *Context) override
Add a new global type to the compile unit.
void resolvePendingLocalScopeDIEs()
Move DIEs of function-local entities from pending DIEs to the DIEs of their scopes in abstract or con...
MCSymbol * getLineTableStartSym() const
Get line table start symbol for this unit.
const SmallVectorImpl< RangeSpan > & getRanges() const
getRanges - Get the list of ranges for this unit.
unsigned getOrCreateSourceID(const DIFile *File) override
Look up the source ID for the given file.
void constructScopeDIE(LexicalScope *Scope, DIE &ParentScopeDIE)
const MCSymbol * getBaseAddress() const
DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, UnitKind Kind=UnitKind::Full)
const StringMap< const DIE * > & getGlobalNames() const
DIE * constructLabelDIE(DbgLabel &DL, const LexicalScope &Scope)
Construct a DIE for the given DbgLabel.
void addGlobalTypeUnitType(const DIType *Ty, const DIScope *Context)
Add a new global type present in a type unit to this compile unit.
DbgEntity * getExistingAbstractEntity(const DINode *Node)
const StringMap< const DIE * > & getGlobalTypes() const
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...
void addLocationList(DIE &Die, dwarf::Attribute Attribute, unsigned Index)
Add a Dwarf loclistptr attribute data and value.
void addComplexAddress(const DIExpression *DIExpr, DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location)
Start with the address based on the location provided, and generate the DWARF information necessary t...
DIE * constructImportedEntityDIE(const DIImportedEntity *IE)
DwarfCompileUnit & getCU() override
void attachRangesOrLowHighPC(DIE &D, SmallVector< RangeSpan, 2 > Ranges)
void setBaseAddress(const MCSymbol *Base)
void finishSubprogramDefinition(const DISubprogram *SP)
Collects and handles dwarf debug information.
Definition DwarfDebug.h:352
DwarfDebug * DD
Definition DwarfUnit.h:56
virtual unsigned getHeaderSize() const
Compute the size of a header for this unit, not including the initial length field.
Definition DwarfUnit.h:300
DwarfUnit(dwarf::Tag, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, unsigned UniqueID=0)
Definition DwarfUnit.cpp:87
DwarfFile * DU
Definition DwarfUnit.h:57
AsmPrinter * Asm
Target of Dwarf emission.
Definition DwarfUnit.h:47
This class is used to track scope information.
Multi-value location description.
Definition DwarfDebug.h:143
Single value location description.
Definition DwarfDebug.h:132
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
Metadata node.
Definition Metadata.h:1081
This class implements a map that also provides access to all stored values in a deterministic order.
Definition MapVector.h:39
A vector that has set insertion semantics.
Definition SetVector.h:57
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition StringMap.h:129
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Attribute
Attributes.
Definition Dwarf.h:125
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
@ Sub
Subtraction of integers.
@ End
Run the machine verifier once, at the end of the pipeline.
Definition CodeGen.h:320
BaseTypeRef(unsigned BitSize, dwarf::TypeKind Encoding)
A pair of GlobalVariable and DIExpression.
Single location defined by (potentially multiple) EntryValueInfo.
Definition DwarfDebug.h:173
Single location defined by (potentially multiple) MMI entries.
Definition DwarfDebug.h:160