LLVM 22.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"
22#include <optional>
23#include <string>
24
25namespace llvm {
26
27class ConstantFP;
28class ConstantInt;
31class MCSymbol;
32
33//===----------------------------------------------------------------------===//
34/// This dwarf writer support class manages information associated with a
35/// source file.
36class DwarfUnit : public DIEUnit {
37protected:
38 /// A numeric ID unique among all CUs in the module
39 unsigned UniqueID;
40 /// MDNode for the compile unit.
42
43 // All DIEValues are allocated through this allocator.
45
46 /// Target of Dwarf emission.
48
49 /// The start of the unit within its section.
50 MCSymbol *LabelBegin = nullptr;
51
52 /// Emitted at the end of the CU and used to compute the CU Length field.
53 MCSymbol *EndLabel = nullptr;
54
55 // Holders for some common dwarf information.
58
59 /// An anonymous type for index type. Owned by DIEUnit.
60 DIE *IndexTyDie = nullptr;
61
62 /// Tracks the mapping of unit level debug information variables to debug
63 /// information entries.
65
66 /// A list of all the DIEBlocks in use.
67 std::vector<DIEBlock *> DIEBlocks;
68
69 /// A list of all the DIELocs in use.
70 std::vector<DIELoc *> DIELocs;
71
72 /// This map is used to keep track of subprogram DIEs that need
73 /// DW_AT_containing_type attribute. This attribute points to a DIE that
74 /// corresponds to the MDNode mapped with the subprogram DIE.
76
78 DwarfDebug *DW, DwarfFile *DWU, unsigned UniqueID = 0);
79
80 bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal);
81
82 bool isShareableAcrossCUs(const DINode *D) const;
83
84 template <typename T>
86 dwarf::Form Form, T &&Value) {
87 // For strict DWARF mode, only generate attributes available to current
88 // DWARF version.
89 // Attribute 0 is used when emitting form-encoded values in blocks, which
90 // don't have attributes (only forms) so we cannot detect their DWARF
91 // version compatibility here and assume they are compatible.
92 if (Attribute != 0 && Asm->TM.Options.DebugStrictDwarf &&
93 DD->getDwarfVersion() < dwarf::AttributeVersion(Attribute))
94 return;
95
96 Die.addValue(DIEValueAllocator,
97 DIEValue(Attribute, Form, std::forward<T>(Value)));
98 }
99
100public:
101 /// Gets Unique ID for this unit.
102 unsigned getUniqueID() const { return UniqueID; }
103 // Accessors.
104 AsmPrinter* getAsmPrinter() const { return Asm; }
105 /// Get the the symbol for start of the section for this unit.
107 assert(LabelBegin && "LabelBegin is not initialized");
108 return LabelBegin;
109 }
110 MCSymbol *getEndLabel() const { return EndLabel; }
112 const DICompileUnit *getCUNode() const { return CUNode; }
113 DwarfDebug &getDwarfDebug() const { return *DD; }
114
115 /// Return true if this compile unit has something to write out.
116 bool hasContent() const { return getUnitDie().hasChildren(); }
117
118 /// Get string containing language specific context for a global name.
119 ///
120 /// Walks the metadata parent chain in a language specific manner (using the
121 /// compile unit language) and returns it as a string. This is done at the
122 /// metadata level because DIEs may not currently have been added to the
123 /// parent context and walking the DIEs looking for names is more expensive
124 /// than walking the metadata.
125 std::string getParentContextString(const DIScope *Context) const;
126
127 /// Add a new global name to the compile unit.
128 virtual void addGlobalName(StringRef Name, const DIE &Die,
129 const DIScope *Context) = 0;
130
131 /// Add a new global type to the compile unit.
132 virtual void addGlobalTypeImpl(const DIType *Ty, const DIE &Die,
133 const DIScope *Context) = 0;
134
135 void addGlobalType(const DIType *Ty, const DIE &Die, const DIScope *Context);
136
137 /// Returns the DIE map slot for the specified debug variable.
138 ///
139 /// We delegate the request to DwarfDebug when the MDNode can be part of the
140 /// type system, since DIEs for the type system can be shared across CUs and
141 /// the mappings are kept in DwarfDebug.
142 DIE *getDIE(const DINode *D) const;
143
144 /// Returns a fresh newly allocated DIELoc.
146
147 /// Insert DIE into the map.
148 ///
149 /// We delegate the request to DwarfDebug when the MDNode can be part of the
150 /// type system, since DIEs for the type system can be shared across CUs and
151 /// the mappings are kept in DwarfDebug.
152 void insertDIE(const DINode *Desc, DIE *D);
153
154 void insertDIE(DIE *D);
155
156 /// Add a flag that is true to the DIE.
158
159 /// Add an unsigned integer attribute data and value.
161 std::optional<dwarf::Form> Form, uint64_t Integer);
162
164
165 /// Add an signed integer attribute data and value.
167 std::optional<dwarf::Form> Form, int64_t Integer);
168
169 void addSInt(DIEValueList &Die, std::optional<dwarf::Form> Form,
170 int64_t Integer);
171
172 /// Add an integer attribute data and value; value may be any width.
174 bool Unsigned);
175
176 /// Add a string attribute data and value.
177 ///
178 /// We always emit a reference to the string pool instead of immediate
179 /// strings so that DIEs have more predictable sizes. In the case of split
180 /// dwarf we emit an index into another table which gets us the static offset
181 /// into the string table.
183
184 /// Add a Dwarf label attribute data and value.
186 const MCSymbol *Label);
187
188 void addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label);
189
190 /// Add an offset into a section attribute data and value.
192
193 /// Add a dwarf op address data and value using the form given and an
194 /// op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
195 void addOpAddress(DIELoc &Die, const MCSymbol *Sym);
196 void addPoolOpAddress(DIEValueList &Die, const MCSymbol *Label);
197
198 /// Add a label delta attribute data and value.
200 const MCSymbol *Hi, const MCSymbol *Lo);
201
202 /// Add a DIE attribute data and value.
203 void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry);
204
205 /// Add a DIE attribute data and value.
207
208 /// Add a type's DW_AT_signature and set the declaration flag.
209 void addDIETypeSignature(DIE &Die, uint64_t Signature);
210
211 /// Add block data.
213
214 /// Add block data.
217 DIEBlock *Block);
218
219 /// Add location information to specified debug information entry.
220 void addSourceLine(DIE &Die, unsigned Line, unsigned Column,
221 const DIFile *File);
222 void addSourceLine(DIE &Die, const DILocalVariable *V);
223 void addSourceLine(DIE &Die, const DIGlobalVariable *G);
224 void addSourceLine(DIE &Die, const DISubprogram *SP);
225 void addSourceLine(DIE &Die, const DILabel *L);
226 void addSourceLine(DIE &Die, const DIType *Ty);
227 void addSourceLine(DIE &Die, const DIObjCProperty *Ty);
228
229 /// Add constant value entry in variable DIE.
230 void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty);
231 void addConstantValue(DIE &Die, const APInt &Val, const DIType *Ty);
232 void addConstantValue(DIE &Die, const APInt &Val, bool Unsigned);
233 void addConstantValue(DIE &Die, uint64_t Val, const DIType *Ty);
234 void addConstantValue(DIE &Die, bool Unsigned, uint64_t Val);
235
236 /// Add constant value entry in variable DIE.
237 void addConstantFPValue(DIE &Die, const ConstantFP *CFP);
238
239 /// Add a linkage name, if it isn't empty.
241
242 /// Add template parameters in buffer.
243 void addTemplateParams(DIE &Buffer, DINodeArray TParams);
244
245 /// Add thrown types.
246 void addThrownTypes(DIE &Die, DINodeArray ThrownTypes);
247
248 /// Add the accessibility attribute.
249 void addAccess(DIE &Die, DINode::DIFlags Flags);
250
251 /// Add a new type attribute to the specified entity.
252 ///
253 /// This takes and attribute parameter because DW_AT_friend attributes are
254 /// also type references.
255 void addType(DIE &Entity, const DIType *Ty,
256 dwarf::Attribute Attribute = dwarf::DW_AT_type);
257
259 DIE *getOrCreateModule(const DIModule *M);
260 virtual DIE *getOrCreateSubprogramDIE(const DISubprogram *SP,
261 const Function *FnHint,
262 bool Minimal = false);
263
264 void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,
265 bool SkipSPAttributes = false);
266
267 /// Creates type DIE with specific context.
268 DIE *createTypeDIE(const DIScope *Context, DIE &ContextDIE, const DIType *Ty);
269
270 /// Find existing DIE or create new DIE for the given type.
271 virtual DIE *getOrCreateTypeDIE(const MDNode *TyNode);
272
273 /// Get context owner's DIE.
274 virtual DIE *getOrCreateContextDIE(const DIScope *Context);
275
276 /// Construct DIEs for types that contain vtables.
278
279 /// Construct function argument DIEs.
280 ///
281 /// \returns The index of the object parameter in \c Args if one exists.
282 /// Returns std::nullopt otherwise.
283 std::optional<unsigned> constructSubprogramArguments(DIE &Buffer,
284 DITypeRefArray Args);
285
286 /// Create a DIE with the given Tag, add the DIE to its parent, and
287 /// call insertDIE if MD is not null.
288 DIE &createAndAddDIE(dwarf::Tag Tag, DIE &Parent, const DINode *N = nullptr);
289
291 return DD->useSegmentedStringOffsetsTable();
292 }
293
294 /// Compute the size of a header for this unit, not including the initial
295 /// length field.
296 virtual unsigned getHeaderSize() const {
297 return sizeof(int16_t) + // DWARF version number
298 Asm->getDwarfOffsetByteSize() + // Offset Into Abbrev. Section
299 sizeof(int8_t) + // Pointer Size (in bytes)
300 (DD->getDwarfVersion() >= 5 ? sizeof(int8_t)
301 : 0); // DWARF v5 unit type
302 }
303
304 /// Emit the header for this unit, not including the initial length field.
305 virtual void emitHeader(bool UseOffsets) = 0;
306
307 /// Add the DW_AT_str_offsets_base attribute to the unit DIE.
309
310 /// Add the DW_AT_rnglists_base attribute to the unit DIE.
311 void addRnglistsBase();
312
313 virtual DwarfCompileUnit &getCU() = 0;
314
315 void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy);
316
317 /// addSectionDelta - Add a label delta attribute data and value.
319 const MCSymbol *Lo);
320
321 /// Add a Dwarf section label attribute data and value.
323 const MCSymbol *Label, const MCSymbol *Sec);
324
325 /// Add DW_TAG_LLVM_annotation.
326 void addAnnotation(DIE &Buffer, DINodeArray Annotations);
327
328 /// Get context owner's DIE.
330
331 /// If this is a named finished type then include it in the list of types for
332 /// the accelerator tables.
333 void updateAcceleratorTables(const DIScope *Context, const DIType *Ty,
334 const DIE &TyDIE);
335
336protected:
337 ~DwarfUnit();
338
339 /// Create new static data member DIE.
341
342 /// Look up the source ID for the given file. If none currently exists,
343 /// create a new ID and insert it in the line table.
344 virtual unsigned getOrCreateSourceID(const DIFile *File) = 0;
345
346 /// Emit the common part of the header for this unit.
347 void emitCommonHeader(bool UseOffsets, dwarf::UnitType UT);
348
349 bool shouldPlaceInUnitDIE(const DISubprogram *SP, bool Minimal) {
350 // Add subprogram declarations to the CU die directly.
351 return Minimal || SP->getDeclaration();
352 }
353
355 bool IgnoreScope) {
356 if (IgnoreScope)
357 return &getUnitDie();
358 return getOrCreateContextDIE(SP->getScope());
359 }
360
361private:
362 DISourceLanguageName getLanguage() const {
363 return CUNode->getSourceLanguage();
364 }
365
366 /// A helper to add a wide integer constant to a DIE using a block
367 /// form.
368 void addIntAsBlock(DIE &Die, dwarf::Attribute Attribute, const APInt &Val);
369
370 // Add discriminant constants to a DW_TAG_variant DIE.
371 void addDiscriminant(DIE &Variant, Constant *Discriminant, bool IsUnsigned);
372
373 void constructTypeDIE(DIE &Buffer, const DIBasicType *BTy);
374 void constructTypeDIE(DIE &Buffer, const DIFixedPointType *BTy);
375 void constructTypeDIE(DIE &Buffer, const DIStringType *BTy);
376 void constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy);
377 void constructTypeDIE(DIE &Buffer, const DISubroutineType *CTy);
378 void constructSubrangeDIE(DIE &Buffer, const DISubrangeType *SR,
379 bool ForArray = false);
380 void constructSubrangeDIE(DIE &Buffer, const DISubrange *SR);
381 void constructGenericSubrangeDIE(DIE &Buffer, const DIGenericSubrange *SR);
382 void constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy);
383 void constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy);
384 DIE &constructMemberDIE(DIE &Buffer, const DIDerivedType *DT);
385 void constructTemplateTypeParameterDIE(DIE &Buffer,
386 const DITemplateTypeParameter *TP);
387 void constructTemplateValueParameterDIE(DIE &Buffer,
388 const DITemplateValueParameter *TVP);
389
390 /// Return the default lower bound for an array.
391 ///
392 /// If the DWARF version doesn't handle the language, return -1.
393 int64_t getDefaultLowerBound() const;
394
395 /// Get an anonymous type for index type.
396 DIE *getIndexTyDie();
397
398 /// Set D as anonymous type for index which can be reused later.
399 void setIndexTyDie(DIE *D) { IndexTyDie = D; }
400
401 virtual void finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) = 0;
402
403 virtual bool isDwoUnit() const = 0;
404 const MCSymbol *getCrossSectionRelativeBaseAddress() const override;
405
406 /// Returns 'true' if the current DwarfVersion is compatible
407 /// with the specified \p Version.
408 bool isCompatibleWithVersion(uint16_t Version) const;
409};
410
411class DwarfTypeUnit final : public DwarfUnit {
412 uint64_t TypeSignature;
413 const DIE *Ty;
415 MCDwarfDwoLineTable *SplitLineTable;
416 bool UsedLineTable = false;
417
418 unsigned getOrCreateSourceID(const DIFile *File) override;
419 void finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) override;
420 bool isDwoUnit() const override;
421
422public:
424 DwarfFile *DWU, unsigned UniqueID,
425 MCDwarfDwoLineTable *SplitLineTable = nullptr);
426
427 void setTypeSignature(uint64_t Signature) { TypeSignature = Signature; }
428 /// Returns Type Signature.
429 uint64_t getTypeSignature() const { return TypeSignature; }
430 void setType(const DIE *Ty) { this->Ty = Ty; }
431
432 /// Emit the header for this unit, not including the initial length field.
433 void emitHeader(bool UseOffsets) override;
434 unsigned getHeaderSize() const override {
435 return DwarfUnit::getHeaderSize() + sizeof(uint64_t) + // Type Signature
436 Asm->getDwarfOffsetByteSize(); // Type DIE Offset
437 }
438 void addGlobalName(StringRef Name, const DIE &Die,
439 const DIScope *Context) override;
440 void addGlobalTypeImpl(const DIType *Ty, const DIE &Die,
441 const DIScope *Context) override;
442 DwarfCompileUnit &getCU() override { return CU; }
443};
444} // end llvm namespace
445#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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.
#define G(x, y, z)
Definition MD5.cpp:56
#define T
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:91
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Definition Attributes.h:69
ConstantFP - Floating Point Values [float, double].
Definition Constants.h:277
This is the shared class of boolean and integer constants.
Definition Constants.h:87
DISourceLanguageName getSourceLanguage() const
DIEBlock - Represents a block of values.
Definition DIE.h:1056
A pointer to another debug information entry.
Definition DIE.h:325
DIELoc - Represents an expression location.
Definition DIE.h:1020
virtual const MCSymbol * getCrossSectionRelativeBaseAddress() const
Definition DIE.h:999
LLVM_ABI DIEUnit(dwarf::Tag UnitTag)
Definition DIE.cpp:306
DIE & getUnitDie()
Definition DIE.h:1009
A list of DIE values.
Definition DIE.h:698
A structured debug information entry.
Definition DIE.h:828
bool hasChildren() const
Definition DIE.h:876
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.
Wrapper structure that holds a language name and its version.
Subprogram description. Uses SubclassData1.
Base class for types.
Collects and handles dwarf debug information.
Definition DwarfDebug.h:351
DwarfTypeUnit(DwarfCompileUnit &CU, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, unsigned UniqueID, MCDwarfDwoLineTable *SplitLineTable=nullptr)
Definition DwarfUnit.cpp:89
void addGlobalTypeImpl(const DIType *Ty, const DIE &Die, const DIScope *Context) override
Add a new global type to the compile unit.
unsigned getHeaderSize() const override
Compute the size of a header for this unit, not including the initial length field.
Definition DwarfUnit.h:434
DwarfCompileUnit & getCU() override
Definition DwarfUnit.h:442
uint64_t getTypeSignature() const
Returns Type Signature.
Definition DwarfUnit.h:429
void emitHeader(bool UseOffsets) override
Emit the header for this unit, not including the initial length field.
void addGlobalName(StringRef Name, const DIE &Die, const DIScope *Context) override
Add a new global name to the compile unit.
void setTypeSignature(uint64_t Signature)
Definition DwarfUnit.h:427
void setType(const DIE *Ty)
Definition DwarfUnit.h:430
virtual DIE * getOrCreateTypeDIE(const MDNode *TyNode)
Find existing DIE or create new DIE for the given type.
void addInt(DIE &Die, dwarf::Attribute Attribute, const APInt &Integer, bool Unsigned)
Add an integer attribute data and value; value may be any width.
DwarfDebug & getDwarfDebug() const
Definition DwarfUnit.h:113
void addThrownTypes(DIE &Die, DINodeArray ThrownTypes)
Add thrown types.
void addStringOffsetsStart()
Add the DW_AT_str_offsets_base attribute to the unit DIE.
void addAnnotation(DIE &Buffer, DINodeArray Annotations)
Add DW_TAG_LLVM_annotation.
std::vector< DIEBlock * > DIEBlocks
A list of all the DIEBlocks in use.
Definition DwarfUnit.h:67
std::vector< DIELoc * > DIELocs
A list of all the DIELocs in use.
Definition DwarfUnit.h:70
void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc)
Add block data.
void addTemplateParams(DIE &Buffer, DINodeArray TParams)
Add template parameters in buffer.
virtual DIE * getOrCreateContextDIE(const DIScope *Context)
Get context owner's DIE.
bool useSegmentedStringOffsetsTable() const
Definition DwarfUnit.h:290
bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal)
DIELoc * getDIELoc()
Returns a fresh newly allocated DIELoc.
Definition DwarfUnit.h:145
void updateAcceleratorTables(const DIScope *Context, const DIType *Ty, const DIE &TyDIE)
If this is a named finished type then include it in the list of types for the accelerator tables.
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:85
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...
void addUInt(DIEValueList &Die, dwarf::Attribute Attribute, std::optional< dwarf::Form > Form, uint64_t Integer)
Add an unsigned integer attribute data and value.
void addString(DIE &Die, dwarf::Attribute Attribute, StringRef Str)
Add a string attribute data and value.
void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty)
Add constant value entry in variable DIE.
DIE * getOrCreateNameSpace(const DINamespace *NS)
void insertDIE(const DINode *Desc, DIE *D)
Insert DIE into the map.
void addAccess(DIE &Die, DINode::DIFlags Flags)
Add the accessibility attribute.
void addSectionDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
addSectionDelta - Add a label delta attribute data and value.
void addGlobalType(const DIType *Ty, const DIE &Die, const DIScope *Context)
DIE * createTypeDIE(const DIScope *Context, DIE &ContextDIE, const DIType *Ty)
Creates type DIE with specific context.
bool shouldPlaceInUnitDIE(const DISubprogram *SP, bool Minimal)
Definition DwarfUnit.h:349
DwarfDebug * DD
Definition DwarfUnit.h:56
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:75
const DICompileUnit * CUNode
MDNode for the compile unit.
Definition DwarfUnit.h:41
virtual unsigned getOrCreateSourceID(const DIFile *File)=0
Look up the source ID for the given file.
virtual DIE * getOrCreateSubprogramDIE(const DISubprogram *SP, const Function *FnHint, bool Minimal=false)
DIE * getOrCreateSubprogramContextDIE(const DISubprogram *SP, bool IgnoreScope)
Definition DwarfUnit.h:354
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.
std::optional< unsigned > constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args)
Construct function argument DIEs.
virtual DwarfCompileUnit & getCU()=0
DIE * getDIE(const DINode *D) const
Returns the DIE map slot for the specified debug variable.
AsmPrinter * getAsmPrinter() const
Definition DwarfUnit.h:104
virtual unsigned getHeaderSize() const
Compute the size of a header for this unit, not including the initial length field.
Definition DwarfUnit.h:296
bool hasContent() const
Return true if this compile unit has something to write out.
Definition DwarfUnit.h:116
MCSymbol * LabelBegin
The start of the unit within its section.
Definition DwarfUnit.h:50
void addSInt(DIEValueList &Die, dwarf::Attribute Attribute, std::optional< dwarf::Form > Form, int64_t Integer)
Add an signed integer attribute data and value.
DwarfUnit(dwarf::Tag, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, unsigned UniqueID=0)
Definition DwarfUnit.cpp:83
void addLabelDelta(DIEValueList &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
Add a label delta attribute data and value.
void addLinkageName(DIE &Die, StringRef LinkageName)
Add a linkage name, if it isn't empty.
MCSymbol * getEndLabel() const
Definition DwarfUnit.h:110
std::string getParentContextString(const DIScope *Context) const
Get string containing language specific context for a global name.
void addSourceLine(DIE &Die, unsigned Line, unsigned Column, const DIFile *File)
Add location information to specified debug information entry.
void emitCommonHeader(bool UseOffsets, dwarf::UnitType UT)
Emit the common part of the header for this unit.
BumpPtrAllocator DIEValueAllocator
Definition DwarfUnit.h:44
DIE * IndexTyDie
An anonymous type for index type. Owned by DIEUnit.
Definition DwarfUnit.h:60
void addRnglistsBase()
Add the DW_AT_rnglists_base attribute to the unit DIE.
DIE * getOrCreateModule(const DIModule *M)
const DICompileUnit * getCUNode() const
Definition DwarfUnit.h:112
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.
DwarfFile * DU
Definition DwarfUnit.h:57
void addSectionOffset(DIE &Die, dwarf::Attribute Attribute, uint64_t Integer)
Add an offset into a section attribute data and value.
DIE * getOrCreateStaticMemberDIE(const DIDerivedType *DT)
Create new static data member DIE.
void addLabel(DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, const MCSymbol *Label)
Add a Dwarf label attribute data and value.
void addConstantFPValue(DIE &Die, const ConstantFP *CFP)
Add constant value entry in variable DIE.
void constructContainingTypeDIEs()
Construct DIEs for types that contain vtables.
unsigned UniqueID
A numeric ID unique among all CUs in the module.
Definition DwarfUnit.h:39
void addSectionLabel(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label, const MCSymbol *Sec)
Add a Dwarf section label attribute data and value.
bool isShareableAcrossCUs(const DINode *D) const
Check whether the DIE for this MDNode can be shared across CUs.
llvm::dwarf::SourceLanguage getSourceLanguage() const
void addPoolOpAddress(DIEValueList &Die, const MCSymbol *Label)
MCSymbol * getLabelBegin() const
Get the the symbol for start of the section for this unit.
Definition DwarfUnit.h:106
DenseMap< const MDNode *, DIE * > MDNodeToDieMap
Tracks the mapping of unit level debug information variables to debug information entries.
Definition DwarfUnit.h:64
void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy)
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:53
void addFlag(DIE &Die, dwarf::Attribute Attribute)
Add a flag that is true to the DIE.
AsmPrinter * Asm
Target of Dwarf emission.
Definition DwarfUnit.h:47
unsigned getUniqueID() const
Gets Unique ID for this unit.
Definition DwarfUnit.h:102
void addType(DIE &Entity, const DIType *Ty, dwarf::Attribute Attribute=dwarf::DW_AT_type)
Add a new type attribute to the specified entity.
void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool SkipSPAttributes=false)
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry)
Add a DIE attribute data and value.
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:1078
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
LLVM Value Representation.
Definition Value.h:75
LLVM_ABI unsigned AttributeVersion(Attribute A)
Definition Dwarf.cpp:83
Attribute
Attributes.
Definition Dwarf.h:125
UnitType
Constants for unit types in DWARF v5.
Definition Dwarf.h:896
This is an optimization pass for GlobalISel generic memory operations.
Op::Description Desc
FunctionAddr VTableAddr uintptr_t uintptr_t Version
Definition InstrProf.h:302
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383
#define N