LLVM: lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H
14#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H
15
28#include
29#include
30
31namespace llvm {
32
42
44
46 bool HasRangeLists = false;
47
48
49
51
52
54
55
57
58
60
61
63
64
66
67
68
69 const MCSymbol *BaseAddress = nullptr;
70
71 using MDNodeSetVector =
74
75
76
77 MDNodeSetVector DeferredLocalDecls;
78
79
81
82
85
86
87
89
91
92
94
95 const DIFile *LastFile = nullptr;
96 unsigned LastFileID;
97
98
99
100
101
102
103
104
105 void applyConcreteDbgVariableAttributes(const Loc::Single &Single,
107 DIE &VariableDie);
108
109 void applyConcreteDbgVariableAttributes(const Loc::Multi &Multi,
111 DIE &VariableDie);
112
113 void applyConcreteDbgVariableAttributes(const Loc::MMI &MMI,
115 DIE &VariableDie);
116
117 void applyConcreteDbgVariableAttributes(const Loc::EntryValue &EntryValue,
119 DIE &VariableDie);
120
121 void applyConcreteDbgVariableAttributes(const std::monostate &,
123 DIE &VariableDie);
124
125
126
127 bool isDwoUnit() const override;
128
130 if (isDwoUnit() && ->shareAcrossDWOCUs())
131 return AbstractLocalScopeDIEs;
132 return DU->getAbstractScopeDIEs();
133 }
134
136 if (isDwoUnit() && ->shareAcrossDWOCUs())
137 return AbstractEntities;
138 return DU->getAbstractEntities();
139 }
140
141 auto &getFinalizedAbstractSubprograms() {
142 if (isDwoUnit() && ->shareAcrossDWOCUs())
143 return FinalizedAbstractSubprograms;
144 return DU->getFinalizedAbstractSubprograms();
145 }
146
148
149
152
153
154
155
156 std::pair<DIE *, DwarfCompileUnit *>
157 getOrCreateAbstractSubprogramContextDIE(const DISubprogram *SP);
158
159
160 DIE &createAbstractSubprogramDIE(const DISubprogram *SP, DIE *ContextDIE,
162
163
164
168
169public:
173
175
177 return Skeleton;
178 }
179
181
183
185
186
188
189
191
192
197
205
207
208
212
215
218
219
220
223
224
225
228
230
232
233
235
237
238
239
240
241
244
246
247
248
250
252
255
256
257
259
260
261
263
264
265
266
268
269
271
272
273
275 DIE *&ObjectPointer);
276
277
279
281
282
283
285
287 bool Minimal = false) override;
288
289
292
294
295
296
299
300
301
303
304
306
307
309
310
312
313
314
315
316
317
318
319
320
322 const Function *CalleeF, bool IsTail,
326 DIType *AllocSiteTy);
327
328
329
330
333
334
337
341
342
346
347
349
351
352 unsigned DWOIdSize =
353 DD->getDwarfVersion() >= 5 && DD->useSplitDwarf() ? sizeof(uint64_t)
354 : 0;
356 }
358 return Asm->getUnitLengthFieldByteSize() +
360 }
361
362 void emitHeader(bool UseOffsets) override;
363
364
366
368 return MacroLabelBegin;
369 }
370
371
373 const DIScope *Context) override;
374
375
377
378
380 const DIScope *Context) override;
381
382
384
387
388
389
392
395
396
397
400
401
402
403
407
408
410
411
412
414 DIE &VariableDie);
415
416
418
420 DIE &SPDie);
421
423
424
427
430
433
435
437
439};
440
441}
442
443#endif
This file defines the StringMap class.
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.
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This class is intended to be used as a driving class for all asm writers.
Functions, function parameters, and return types can have attributes to indicate how they should be t...
DIELoc - Represents an expression location.
A structured debug information entry.
An imported module (C++ using directive or similar).
Tagged DWARF-like metadata node.
Base class for scope-like contexts.
Subprogram description. Uses SubclassData1.
This class is defined as the common parent of DbgVariable and DbgLabel such that it could levarage po...
This class is used to track label information.
std::pair< const DINode *, const DILocation * > InlinedEntity
This class is used to track local variable information.
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 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.
Definition DwarfCompileUnit.h:350
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()
Definition DwarfCompileUnit.h:426
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
Definition DwarfCompileUnit.h:367
std::vector< BaseTypeRef > ExprRefedBaseTypes
Definition DwarfCompileUnit.h:206
DIE * constructInlinedScopeDIE(LexicalScope *Scope, DIE &ParentScopeDIE)
This scope represents an inlined body of a function.
void createBaseTypeDIEs()
void addScopeRangeList(DIE &ScopeDIE, SmallVector< RangeSpan, 2 > Range)
A helper function to construct a RangeSpanList for a given lexical scope.
uint64_t getDWOId() const
Definition DwarfCompileUnit.h:431
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...
unsigned getLength()
Definition DwarfCompileUnit.h:357
DbgValueHistoryMap::InlinedEntity InlinedEntity
Find abstract variable associated with Var.
Definition DwarfCompileUnit.h:343
MDNodeSetVector & getDeferredLocalDecls()
Definition DwarfCompileUnit.h:438
DIE & constructSubprogramScopeDIE(const DISubprogram *Sub, const Function &F, LexicalScope *Scope, MCSymbol *LineTableSym)
Construct a DIE for this subprogram scope.
DIE * getLexicalBlockDIE(const DILexicalBlock *LB)
Get a DIE for the given DILexicalBlock.
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
Definition DwarfCompileUnit.h:176
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.
Definition DwarfCompileUnit.h:348
void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr)
Add a Dwarf expression attribute data and value.
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)
Definition DwarfCompileUnit.h:432
void addLocalLabelAddress(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label)
addLocalLabelAddress - Add a dwarf label attribute data and value using DW_FORM_addr only.
DIE * constructLexicalScopeDIE(LexicalScope *Scope)
Construct new DW_TAG_lexical_block for this scope and attach DW_AT_low_pc/DW_AT_high_pc labels.
void addGlobalTypeImpl(const DIType *Ty, const DIE &Die, const DIScope *Context) override
Add a new global type to the compile unit.
MCSymbol * getLineTableStartSym() const
Get line table start symbol for this unit.
Definition DwarfCompileUnit.h:190
const SmallVectorImpl< RangeSpan > & getRanges() const
getRanges - Get the list of ranges for this unit.
Definition DwarfCompileUnit.h:425
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
Definition DwarfCompileUnit.h:429
void attachLexicalScopesAbstractOrigins()
DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, UnitKind Kind=UnitKind::Full)
const StringMap< const DIE * > & getGlobalNames() const
Definition DwarfCompileUnit.h:385
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
Definition DwarfCompileUnit.h:386
bool hasDwarfPubSections() 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.
bool emitFuncLineTableOffsets() const
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
Definition DwarfCompileUnit.h:229
void attachRangesOrLowHighPC(DIE &D, SmallVector< RangeSpan, 2 > Ranges)
bool hasRangeLists() const
Definition DwarfCompileUnit.h:174
void setBaseAddress(const MCSymbol *Base)
Definition DwarfCompileUnit.h:428
void finishSubprogramDefinition(const DISubprogram *SP)
Collects and handles dwarf debug information.
virtual unsigned getHeaderSize() const
Compute the size of a header for this unit, not including the initial length field.
DwarfUnit(dwarf::Tag, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, unsigned UniqueID=0)
AsmPrinter * Asm
Target of Dwarf emission.
This class is used to track scope information.
Multi-value location description.
Single value location description.
Base class for the full range of assembler expressions which are needed for parsing.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
A vector that has set insertion semantics.
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",...
StringRef - Represent a constant reference to a string, i.e.
This is an optimization pass for GlobalISel generic memory operations.
@ Sub
Subtraction of integers.
UnitKind
Definition DwarfCompileUnit.h:43
@ Skeleton
Definition DwarfCompileUnit.h:43
@ Full
Definition DwarfCompileUnit.h:43
BaseTypeRef(unsigned BitSize, dwarf::TypeKind Encoding)
Definition DwarfCompileUnit.h:199
DIE * Die
Definition DwarfCompileUnit.h:203
dwarf::TypeKind Encoding
Definition DwarfCompileUnit.h:202
unsigned BitSize
Definition DwarfCompileUnit.h:201
A pair of GlobalVariable and DIExpression.
Definition DwarfCompileUnit.h:193
const DIExpression * Expr
Definition DwarfCompileUnit.h:195
const GlobalVariable * Var
Definition DwarfCompileUnit.h:194
Single location defined by (potentially multiple) EntryValueInfo.
Single location defined by (potentially multiple) MMI entries.