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