LLVM 20.0.0git
DwarfUnit.h
Go to the documentation of this file.
1//===-- llvm/CodeGen/DwarfUnit.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_DWARFUNIT_H
14#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFUNIT_H
15
16#include "DwarfDebug.h"
17#include "llvm/ADT/DenseMap.h"
19#include "llvm/CodeGen/DIE.h"
21#include <optional>
22#include <string>
23
24namespace llvm {
25
26class ConstantFP;
27class ConstantInt;
28class DwarfCompileUnit;
29class MCDwarfDwoLineTable;
30class MCSymbol;
31
32//===----------------------------------------------------------------------===//
33/// This dwarf writer support class manages information associated with a
34/// source file.
35class DwarfUnit : public DIEUnit {
36protected:
37 /// A numeric ID unique among all CUs in the module
38 unsigned UniqueID;
39 /// MDNode for the compile unit.
41
42 // All DIEValues are allocated through this allocator.
44
45 /// Target of Dwarf emission.
47
48 /// The start of the unit within its section.
49 MCSymbol *LabelBegin = nullptr;
50
51 /// Emitted at the end of the CU and used to compute the CU Length field.
52 MCSymbol *EndLabel = nullptr;
53
54 // Holders for some common dwarf information.
57
58 /// An anonymous type for index type. Owned by DIEUnit.
59 DIE *IndexTyDie = nullptr;
60
61 /// Tracks the mapping of unit level debug information variables to debug
62 /// information entries.
64
65 /// A list of all the DIEBlocks in use.
66 std::vector<DIEBlock *> DIEBlocks;
67
68 /// A list of all the DIELocs in use.
69 std::vector<DIELoc *> DIELocs;
70
71 /// This map is used to keep track of subprogram DIEs that need
72 /// DW_AT_containing_type attribute. This attribute points to a DIE that
73 /// corresponds to the MDNode mapped with the subprogram DIE.
75
77 DwarfDebug *DW, DwarfFile *DWU, unsigned UniqueID = 0);
78
79 bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal);
80
81 bool isShareableAcrossCUs(const DINode *D) const;
82
83 template <typename T>
85 dwarf::Form Form, T &&Value) {
86 // For strict DWARF mode, only generate attributes available to current
87 // DWARF version.
88 // Attribute 0 is used when emitting form-encoded values in blocks, which
89 // don't have attributes (only forms) so we cannot detect their DWARF
90 // version compatibility here and assume they are compatible.
93 return;
94
96 DIEValue(Attribute, Form, std::forward<T>(Value)));
97 }
98
99public:
100 /// Gets Unique ID for this unit.
101 unsigned getUniqueID() const { return UniqueID; }
102 // Accessors.
103 AsmPrinter* getAsmPrinter() const { return Asm; }
104 /// Get the the symbol for start of the section for this unit.
106 assert(LabelBegin && "LabelBegin is not initialized");
107 return LabelBegin;
108 }
109 MCSymbol *getEndLabel() const { return EndLabel; }
111 const DICompileUnit *getCUNode() const { return CUNode; }
112 DwarfDebug &getDwarfDebug() const { return *DD; }
113
114 /// Return true if this compile unit has something to write out.
115 bool hasContent() const { return getUnitDie().hasChildren(); }
116
117 /// Get string containing language specific context for a global name.
118 ///
119 /// Walks the metadata parent chain in a language specific manner (using the
120 /// compile unit language) and returns it as a string. This is done at the
121 /// metadata level because DIEs may not currently have been added to the
122 /// parent context and walking the DIEs looking for names is more expensive
123 /// than walking the metadata.
124 std::string getParentContextString(const DIScope *Context) const;
125
126 /// Add a new global name to the compile unit.
127 virtual void addGlobalName(StringRef Name, const DIE &Die,
128 const DIScope *Context) = 0;
129
130 /// Add a new global type to the compile unit.
131 virtual void addGlobalTypeImpl(const DIType *Ty, const DIE &Die,
132 const DIScope *Context) = 0;
133
134 void addGlobalType(const DIType *Ty, const DIE &Die, const DIScope *Context);
135
136 /// Returns the DIE map slot for the specified debug variable.
137 ///
138 /// We delegate the request to DwarfDebug when the MDNode can be part of the
139 /// type system, since DIEs for the type system can be shared across CUs and
140 /// the mappings are kept in DwarfDebug.
141 DIE *getDIE(const DINode *D) const;
142
143 /// Returns a fresh newly allocated DIELoc.
145
146 /// Insert DIE into the map.
147 ///
148 /// We delegate the request to DwarfDebug when the MDNode can be part of the
149 /// type system, since DIEs for the type system can be shared across CUs and
150 /// the mappings are kept in DwarfDebug.
151 void insertDIE(const DINode *Desc, DIE *D);
152
153 void insertDIE(DIE *D);
154
155 /// Add a flag that is true to the DIE.
157
158 /// Add an unsigned integer attribute data and value.
160 std::optional<dwarf::Form> Form, uint64_t Integer);
161
163
164 /// Add an signed integer attribute data and value.
166 std::optional<dwarf::Form> Form, int64_t Integer);
167
168 void addSInt(DIELoc &Die, std::optional<dwarf::Form> Form, int64_t Integer);
169
170 /// Add a string attribute data and value.
171 ///
172 /// We always emit a reference to the string pool instead of immediate
173 /// strings so that DIEs have more predictable sizes. In the case of split
174 /// dwarf we emit an index into another table which gets us the static offset
175 /// into the string table.
177
178 /// Add a Dwarf label attribute data and value.
180 const MCSymbol *Label);
181
182 void addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label);
183
184 /// Add an offset into a section attribute data and value.
186
187 /// Add a dwarf op address data and value using the form given and an
188 /// op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
189 void addOpAddress(DIELoc &Die, const MCSymbol *Sym);
190 void addPoolOpAddress(DIEValueList &Die, const MCSymbol *Label);
191
192 /// Add a label delta attribute data and value.
194 const MCSymbol *Hi, const MCSymbol *Lo);
195
196 /// Add a DIE attribute data and value.
197 void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry);
198
199 /// Add a DIE attribute data and value.
201
202 /// Add a type's DW_AT_signature and set the declaration flag.
203 void addDIETypeSignature(DIE &Die, uint64_t Signature);
204
205 /// Add block data.
206 void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc);
207
208 /// Add block data.
211 DIEBlock *Block);
212
213 /// Add location information to specified debug information entry.
214 void addSourceLine(DIE &Die, unsigned Line, const DIFile *File);
215 void addSourceLine(DIE &Die, const DILocalVariable *V);
216 void addSourceLine(DIE &Die, const DIGlobalVariable *G);
217 void addSourceLine(DIE &Die, const DISubprogram *SP);
218 void addSourceLine(DIE &Die, const DILabel *L);
219 void addSourceLine(DIE &Die, const DIType *Ty);
220 void addSourceLine(DIE &Die, const DIObjCProperty *Ty);
221
222 /// Add constant value entry in variable DIE.
223 void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty);
224 void addConstantValue(DIE &Die, const APInt &Val, const DIType *Ty);
225 void addConstantValue(DIE &Die, const APInt &Val, bool Unsigned);
226 void addConstantValue(DIE &Die, uint64_t Val, const DIType *Ty);
227 void addConstantValue(DIE &Die, bool Unsigned, uint64_t Val);
228
229 /// Add constant value entry in variable DIE.
230 void addConstantFPValue(DIE &Die, const ConstantFP *CFP);
231
232 /// Add a linkage name, if it isn't empty.
234
235 /// Add template parameters in buffer.
236 void addTemplateParams(DIE &Buffer, DINodeArray TParams);
237
238 /// Add thrown types.
239 void addThrownTypes(DIE &Die, DINodeArray ThrownTypes);
240
241 /// Add the accessibility attribute.
242 void addAccess(DIE &Die, DINode::DIFlags Flags);
243
244 /// Add a new type attribute to the specified entity.
245 ///
246 /// This takes and attribute parameter because DW_AT_friend attributes are
247 /// also type references.
248 void addType(DIE &Entity, const DIType *Ty,
249 dwarf::Attribute Attribute = dwarf::DW_AT_type);
250
252 DIE *getOrCreateModule(const DIModule *M);
253 DIE *getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal = false);
254
255 void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,
256 bool SkipSPAttributes = false);
257
258 /// Creates type DIE with specific context.
259 DIE *createTypeDIE(const DIScope *Context, DIE &ContextDIE, const DIType *Ty);
260
261 /// Find existing DIE or create new DIE for the given type.
262 virtual DIE *getOrCreateTypeDIE(const MDNode *TyNode);
263
264 /// Get context owner's DIE.
265 virtual DIE *getOrCreateContextDIE(const DIScope *Context);
266
267 /// Construct DIEs for types that contain vtables.
269
270 /// Construct function argument DIEs.
272
273 /// Create a DIE with the given Tag, add the DIE to its parent, and
274 /// call insertDIE if MD is not null.
275 DIE &createAndAddDIE(dwarf::Tag Tag, DIE &Parent, const DINode *N = nullptr);
276
279 }
280
281 /// Compute the size of a header for this unit, not including the initial
282 /// length field.
283 virtual unsigned getHeaderSize() const {
284 return sizeof(int16_t) + // DWARF version number
285 Asm->getDwarfOffsetByteSize() + // Offset Into Abbrev. Section
286 sizeof(int8_t) + // Pointer Size (in bytes)
287 (DD->getDwarfVersion() >= 5 ? sizeof(int8_t)
288 : 0); // DWARF v5 unit type
289 }
290
291 /// Emit the header for this unit, not including the initial length field.
292 virtual void emitHeader(bool UseOffsets) = 0;
293
294 /// Add the DW_AT_str_offsets_base attribute to the unit DIE.
296
297 /// Add the DW_AT_rnglists_base attribute to the unit DIE.
298 void addRnglistsBase();
299
300 virtual DwarfCompileUnit &getCU() = 0;
301
302 void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy);
303
304 /// addSectionDelta - Add a label delta attribute data and value.
306 const MCSymbol *Lo);
307
308 /// Add a Dwarf section label attribute data and value.
310 const MCSymbol *Label, const MCSymbol *Sec);
311
312 /// Add DW_TAG_LLVM_annotation.
313 void addAnnotation(DIE &Buffer, DINodeArray Annotations);
314
315 /// Get context owner's DIE.
317
318protected:
319 ~DwarfUnit();
320
321 /// Create new static data member DIE.
323
324 /// Look up the source ID for the given file. If none currently exists,
325 /// create a new ID and insert it in the line table.
326 virtual unsigned getOrCreateSourceID(const DIFile *File) = 0;
327
328 /// Emit the common part of the header for this unit.
329 void emitCommonHeader(bool UseOffsets, dwarf::UnitType UT);
330
331private:
332 void constructTypeDIE(DIE &Buffer, const DIBasicType *BTy);
333 void constructTypeDIE(DIE &Buffer, const DIStringType *BTy);
334 void constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy);
335 void constructTypeDIE(DIE &Buffer, const DISubroutineType *CTy);
336 void constructSubrangeDIE(DIE &Buffer, const DISubrange *SR, DIE *IndexTy);
337 void constructGenericSubrangeDIE(DIE &Buffer, const DIGenericSubrange *SR,
338 DIE *IndexTy);
339 void constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy);
340 void constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy);
341 DIE &constructMemberDIE(DIE &Buffer, const DIDerivedType *DT);
342 void constructTemplateTypeParameterDIE(DIE &Buffer,
343 const DITemplateTypeParameter *TP);
344 void constructTemplateValueParameterDIE(DIE &Buffer,
345 const DITemplateValueParameter *TVP);
346
347 /// Return the default lower bound for an array.
348 ///
349 /// If the DWARF version doesn't handle the language, return -1.
350 int64_t getDefaultLowerBound() const;
351
352 /// Get an anonymous type for index type.
353 DIE *getIndexTyDie();
354
355 /// Set D as anonymous type for index which can be reused later.
356 void setIndexTyDie(DIE *D) { IndexTyDie = D; }
357
358 virtual void finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) = 0;
359
360 /// If this is a named finished type then include it in the list of types for
361 /// the accelerator tables.
362 void updateAcceleratorTables(const DIScope *Context, const DIType *Ty,
363 const DIE &TyDIE);
364
365 virtual bool isDwoUnit() const = 0;
366 const MCSymbol *getCrossSectionRelativeBaseAddress() const override;
367
368 /// Returns 'true' if the current DwarfVersion is compatible
369 /// with the specified \p Version.
370 bool isCompatibleWithVersion(uint16_t Version) const;
371};
372
373class DwarfTypeUnit final : public DwarfUnit {
374 uint64_t TypeSignature;
375 const DIE *Ty;
377 MCDwarfDwoLineTable *SplitLineTable;
378 bool UsedLineTable = false;
379
380 unsigned getOrCreateSourceID(const DIFile *File) override;
381 void finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) override;
382 bool isDwoUnit() const override;
383
384public:
386 DwarfFile *DWU, unsigned UniqueID,
387 MCDwarfDwoLineTable *SplitLineTable = nullptr);
388
389 void setTypeSignature(uint64_t Signature) { TypeSignature = Signature; }
390 /// Returns Type Signature.
391 uint64_t getTypeSignature() const { return TypeSignature; }
392 void setType(const DIE *Ty) { this->Ty = Ty; }
393
394 /// Emit the header for this unit, not including the initial length field.
395 void emitHeader(bool UseOffsets) override;
396 unsigned getHeaderSize() const override {
397 return DwarfUnit::getHeaderSize() + sizeof(uint64_t) + // Type Signature
398 Asm->getDwarfOffsetByteSize(); // Type DIE Offset
399 }
400 void addGlobalName(StringRef Name, const DIE &Die,
401 const DIScope *Context) override;
402 void addGlobalTypeImpl(const DIType *Ty, const DIE &Die,
403 const DIScope *Context) override;
404 DwarfCompileUnit &getCU() override { return CU; }
405};
406} // end llvm namespace
407#endif
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.
std::string Name
Symbol * Sym
Definition: ELF_riscv.cpp:479
#define G(x, y, z)
Definition: MD5.cpp:56
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Class for arbitrary precision integers.
Definition: APInt.h:78
Annotations lets you mark points and ranges inside source code, for tests:
Definition: Annotations.h:53
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:86
TargetMachine & TM
Target machine description.
Definition: AsmPrinter.h:89
unsigned int getDwarfOffsetByteSize() const
Returns 4 for DWARF32 and 8 for DWARF64.
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:66
ConstantFP - Floating Point Values [float, double].
Definition: Constants.h:271
This is the shared class of boolean and integer constants.
Definition: Constants.h:83
Basic type, like 'int' or 'float'.
unsigned getSourceLanguage() const
DIEBlock - Represents a block of values.
Definition: DIE.h:1046
A pointer to another debug information entry.
Definition: DIE.h:319
DIELoc - Represents an expression location.
Definition: DIE.h:1010
Represents a compile or type unit.
Definition: DIE.h:960
DIE & getUnitDie()
Definition: DIE.h:999
A list of DIE values.
Definition: DIE.h:689
value_iterator addValue(BumpPtrAllocator &Alloc, const DIEValue &V)
Definition: DIE.h:740
A structured debug information entry.
Definition: DIE.h:819
bool hasChildren() const
Definition: DIE.h:867
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Debug lexical block.
Tagged DWARF-like metadata node.
DIFlags
Debug info flags.
Base class for scope-like contexts.
String type, Fortran CHARACTER(n)
Subprogram description.
Array subrange.
Type array for a subprogram.
Base class for types.
Collects and handles dwarf debug information.
Definition: DwarfDebug.h:351
bool useSegmentedStringOffsetsTable() const
Returns whether to generate a string offsets table with (possibly shared) contributions from each CU ...
Definition: DwarfDebug.h:823
uint16_t getDwarfVersion() const
Returns the Dwarf Version.
void addGlobalTypeImpl(const DIType *Ty, const DIE &Die, const DIScope *Context) override
Add a new global type to the compile unit.
Definition: DwarfUnit.cpp:1890
unsigned getHeaderSize() const override
Compute the size of a header for this unit, not including the initial length field.
Definition: DwarfUnit.h:396
DwarfCompileUnit & getCU() override
Definition: DwarfUnit.h:404
uint64_t getTypeSignature() const
Returns Type Signature.
Definition: DwarfUnit.h:391
void emitHeader(bool UseOffsets) override
Emit the header for this unit, not including the initial length field.
Definition: DwarfUnit.cpp:1850
void addGlobalName(StringRef Name, const DIE &Die, const DIScope *Context) override
Add a new global name to the compile unit.
Definition: DwarfUnit.cpp:1885
void setTypeSignature(uint64_t Signature)
Definition: DwarfUnit.h:389
void setType(const DIE *Ty)
Definition: DwarfUnit.h:392
This dwarf writer support class manages information associated with a source file.
Definition: DwarfUnit.h:35
virtual DIE * getOrCreateTypeDIE(const MDNode *TyNode)
Find existing DIE or create new DIE for the given type.
Definition: DwarfUnit.cpp:612
DwarfDebug & getDwarfDebug() const
Definition: DwarfUnit.h:112
void addThrownTypes(DIE &Die, DINodeArray ThrownTypes)
Add thrown types.
Definition: DwarfUnit.cpp:527
void addStringOffsetsStart()
Add the DW_AT_str_offsets_base attribute to the unit DIE.
Definition: DwarfUnit.cpp:1903
void addAnnotation(DIE &Buffer, DINodeArray Annotations)
Add DW_TAG_LLVM_annotation.
Definition: DwarfUnit.cpp:897
std::vector< DIEBlock * > DIEBlocks
A list of all the DIEBlocks in use.
Definition: DwarfUnit.h:66
std::vector< DIELoc * > DIELocs
A list of all the DIELocs in use.
Definition: DwarfUnit.h:69
uint16_t getLanguage() const
Definition: DwarfUnit.h:110
void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc)
Add block data.
Definition: DwarfUnit.cpp:391
void addTemplateParams(DIE &Buffer, DINodeArray TParams)
Add template parameters in buffer.
Definition: DwarfUnit.cpp:516
virtual DIE * getOrCreateContextDIE(const DIScope *Context)
Get context owner's DIE.
Definition: DwarfUnit.cpp:546
bool useSegmentedStringOffsetsTable() const
Definition: DwarfUnit.h:277
bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal)
Definition: DwarfUnit.cpp:1243
DIELoc * getDIELoc()
Returns a fresh newly allocated DIELoc.
Definition: DwarfUnit.h:144
virtual void emitHeader(bool UseOffsets)=0
Emit the header for this unit, not including the initial length field.
void addAttribute(DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, T &&Value)
Definition: DwarfUnit.h:84
void addOpAddress(DIELoc &Die, const MCSymbol *Sym)
Add a dwarf op address data and value using the form given and an op of either DW_FORM_addr or DW_FOR...
Definition: DwarfUnit.cpp:332
void addUInt(DIEValueList &Die, dwarf::Attribute Attribute, std::optional< dwarf::Form > Form, uint64_t Integer)
Add an unsigned integer attribute data and value.
Definition: DwarfUnit.cpp:221
void addString(DIE &Die, dwarf::Attribute Attribute, StringRef Str)
Add a string attribute data and value.
Definition: DwarfUnit.cpp:247
void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty)
Add constant value entry in variable DIE.
Definition: DwarfUnit.cpp:459
DIE * getOrCreateNameSpace(const DINamespace *NS)
Definition: DwarfUnit.cpp:1159
void insertDIE(const DINode *Desc, DIE *D)
Insert DIE into the map.
Definition: DwarfUnit.cpp:202
void addAccess(DIE &Die, DINode::DIFlags Flags)
Add the accessibility attribute.
Definition: DwarfUnit.cpp:534
void addSectionDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
addSectionDelta - Add a label delta attribute data and value.
Definition: DwarfUnit.cpp:1865
void addGlobalType(const DIType *Ty, const DIE &Die, const DIScope *Context)
Definition: DwarfUnit.cpp:668
DIE * createTypeDIE(const DIScope *Context, DIE &ContextDIE, const DIType *Ty)
Creates type DIE with specific context.
Definition: DwarfUnit.cpp:576
DwarfDebug * DD
Definition: DwarfUnit.h:55
DenseMap< DIE *, const DINode * > ContainingTypeMap
This map is used to keep track of subprogram DIEs that need DW_AT_containing_type attribute.
Definition: DwarfUnit.h:74
const DICompileUnit * CUNode
MDNode for the compile unit.
Definition: DwarfUnit.h:40
virtual unsigned getOrCreateSourceID(const DIFile *File)=0
Look up the source ID for the given file.
virtual void addGlobalTypeImpl(const DIType *Ty, const DIE &Die, const DIScope *Context)=0
Add a new global type to the compile unit.
void addDIETypeSignature(DIE &Die, uint64_t Signature)
Add a type's DW_AT_signature and set the declaration flag.
Definition: DwarfUnit.cpp:357
virtual DwarfCompileUnit & getCU()=0
DIE * getDIE(const DINode *D) const
Returns the DIE map slot for the specified debug variable.
Definition: DwarfUnit.cpp:196
AsmPrinter * getAsmPrinter() const
Definition: DwarfUnit.h:103
virtual unsigned getHeaderSize() const
Compute the size of a header for this unit, not including the initial length field.
Definition: DwarfUnit.h:283
bool hasContent() const
Return true if this compile unit has something to write out.
Definition: DwarfUnit.h:115
void constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args)
Construct function argument DIEs.
Definition: DwarfUnit.cpp:852
MCSymbol * LabelBegin
The start of the unit within its section.
Definition: DwarfUnit.h:49
void addSInt(DIEValueList &Die, dwarf::Attribute Attribute, std::optional< dwarf::Form > Form, int64_t Integer)
Add an signed integer attribute data and value.
Definition: DwarfUnit.cpp:235
void addLabelDelta(DIEValueList &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
Add a label delta attribute data and value.
Definition: DwarfUnit.cpp:347
void addLinkageName(DIE &Die, StringRef LinkageName)
Add a linkage name, if it isn't empty.
Definition: DwarfUnit.cpp:508
MCSymbol * getEndLabel() const
Definition: DwarfUnit.h:109
std::string getParentContextString(const DIScope *Context) const
Get string containing language specific context for a global name.
Definition: DwarfUnit.cpp:681
void addSourceLine(DIE &Die, unsigned Line, const DIFile *File)
Add location information to specified debug information entry.
Definition: DwarfUnit.cpp:409
void emitCommonHeader(bool UseOffsets, dwarf::UnitType UT)
Emit the common part of the header for this unit.
Definition: DwarfUnit.cpp:1812
BumpPtrAllocator DIEValueAllocator
Definition: DwarfUnit.h:43
DIE * IndexTyDie
An anonymous type for index type. Owned by DIEUnit.
Definition: DwarfUnit.h:59
void addRnglistsBase()
Add the DW_AT_rnglists_base attribute to the unit DIE.
Definition: DwarfUnit.cpp:1910
DIE * getOrCreateModule(const DIModule *M)
Definition: DwarfUnit.cpp:1180
const DICompileUnit * getCUNode() const
Definition: DwarfUnit.h:111
DIE & createAndAddDIE(dwarf::Tag Tag, DIE &Parent, const DINode *N=nullptr)
Create a DIE with the given Tag, add the DIE to its parent, and call insertDIE if MD is not null.
Definition: DwarfUnit.cpp:384
DwarfFile * DU
Definition: DwarfUnit.h:56
void addSectionOffset(DIE &Die, dwarf::Attribute Attribute, uint64_t Integer)
Add an offset into a section attribute data and value.
Definition: DwarfUnit.cpp:289
DIE * getOrCreateStaticMemberDIE(const DIDerivedType *DT)
Create new static data member DIE.
Definition: DwarfUnit.cpp:1769
void addLabel(DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, const MCSymbol *Label)
Add a Dwarf label attribute data and value.
Definition: DwarfUnit.cpp:280
void addConstantFPValue(DIE &Die, const ConstantFP *CFP)
Add constant value entry in variable DIE.
Definition: DwarfUnit.cpp:454
void constructContainingTypeDIEs()
Construct DIEs for types that contain vtables.
Definition: DwarfUnit.cpp:1637
unsigned UniqueID
A numeric ID unique among all CUs in the module.
Definition: DwarfUnit.h:38
DIE * getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal=false)
Definition: DwarfUnit.cpp:1211
void addSectionLabel(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label, const MCSymbol *Sec)
Add a Dwarf section label attribute data and value.
Definition: DwarfUnit.cpp:1871
bool isShareableAcrossCUs(const DINode *D) const
Check whether the DIE for this MDNode can be shared across CUs.
Definition: DwarfUnit.cpp:181
void addPoolOpAddress(DIEValueList &Die, const MCSymbol *Label)
Definition: DwarfUnit.cpp:307
MCSymbol * getLabelBegin() const
Get the the symbol for start of the section for this unit.
Definition: DwarfUnit.h:105
DenseMap< const MDNode *, DIE * > MDNodeToDieMap
Tracks the mapping of unit level debug information variables to debug information entries.
Definition: DwarfUnit.h:63
void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy)
Definition: DwarfUnit.cpp:918
virtual void addGlobalName(StringRef Name, const DIE &Die, const DIScope *Context)=0
Add a new global name to the compile unit.
MCSymbol * EndLabel
Emitted at the end of the CU and used to compute the CU Length field.
Definition: DwarfUnit.h:52
void addFlag(DIE &Die, dwarf::Attribute Attribute)
Add a flag that is true to the DIE.
Definition: DwarfUnit.cpp:214
AsmPrinter * Asm
Target of Dwarf emission.
Definition: DwarfUnit.h:46
unsigned getUniqueID() const
Gets Unique ID for this unit.
Definition: DwarfUnit.h:101
void addType(DIE &Entity, const DIType *Ty, dwarf::Attribute Attribute=dwarf::DW_AT_type)
Add a new type attribute to the specified entity.
Definition: DwarfUnit.cpp:675
void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool SkipSPAttributes=false)
Definition: DwarfUnit.cpp:1296
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry)
Add a DIE attribute data and value.
Definition: DwarfUnit.cpp:353
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
Metadata node.
Definition: Metadata.h:1069
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
TargetOptions Options
unsigned DebugStrictDwarf
When set to true, don't use DWARF extensions in later DWARF versions.
LLVM Value Representation.
Definition: Value.h:74
unsigned AttributeVersion(Attribute A)
Definition: Dwarf.cpp:83
@ ConstantFP
Definition: ISDOpcodes.h:77
Attribute
Attributes.
Definition: Dwarf.h:123
UnitType
Constants for unit types in DWARF v5.
Definition: Dwarf.h:875
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
#define N
Description of the encoding of one expression Op.