LLVM  14.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 DbgVariable;
29 class DwarfCompileUnit;
30 class MachineOperand;
31 class MCDwarfDwoLineTable;
32 class MCSymbol;
33 
34 //===----------------------------------------------------------------------===//
35 /// This dwarf writer support class manages information associated with a
36 /// source file.
37 class DwarfUnit : public DIEUnit {
38 protected:
39  /// MDNode for the compile unit.
41 
42  // All DIEValues are allocated through this allocator.
44 
45  /// Target of Dwarf emission.
47 
48  /// Emitted at the end of the CU and used to compute the CU Length field.
49  MCSymbol *EndLabel = nullptr;
50 
51  // Holders for some common dwarf information.
54 
55  /// An anonymous type for index type. Owned by DIEUnit.
57 
58  /// Tracks the mapping of unit level debug information variables to debug
59  /// information entries.
61 
62  /// A list of all the DIEBlocks in use.
63  std::vector<DIEBlock *> DIEBlocks;
64 
65  /// A list of all the DIELocs in use.
66  std::vector<DIELoc *> DIELocs;
67 
68  /// This map is used to keep track of subprogram DIEs that need
69  /// DW_AT_containing_type attribute. This attribute points to a DIE that
70  /// corresponds to the MDNode mapped with the subprogram DIE.
72 
74  DwarfFile *DWU);
75 
76  bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal);
77 
78  bool isShareableAcrossCUs(const DINode *D) const;
79 
80  template <typename T>
82  dwarf::Form Form, T &&Value) {
83  // For strict DWARF mode, only generate attributes available to current
84  // DWARF version.
85  // Attribute 0 is used when emitting form-encoded values in blocks, which
86  // don't have attributes (only forms) so we cannot detect their DWARF
87  // version compatibility here and assume they are compatible.
88  if (Attribute != 0 && Asm->TM.Options.DebugStrictDwarf &&
90  return;
91 
93  DIEValue(Attribute, Form, std::forward<T>(Value)));
94  }
95 
96 public:
97  // Accessors.
98  AsmPrinter* getAsmPrinter() const { return Asm; }
99  MCSymbol *getEndLabel() const { return EndLabel; }
101  const DICompileUnit *getCUNode() const { return CUNode; }
102  DwarfDebug &getDwarfDebug() const { return *DD; }
103 
104  /// Return true if this compile unit has something to write out.
105  bool hasContent() const { return getUnitDie().hasChildren(); }
106 
107  /// Get string containing language specific context for a global name.
108  ///
109  /// Walks the metadata parent chain in a language specific manner (using the
110  /// compile unit language) and returns it as a string. This is done at the
111  /// metadata level because DIEs may not currently have been added to the
112  /// parent context and walking the DIEs looking for names is more expensive
113  /// than walking the metadata.
114  std::string getParentContextString(const DIScope *Context) const;
115 
116  /// Add a new global name to the compile unit.
117  virtual void addGlobalName(StringRef Name, const DIE &Die,
118  const DIScope *Context) = 0;
119 
120  /// Add a new global type to the compile unit.
121  virtual void addGlobalType(const DIType *Ty, const DIE &Die,
122  const DIScope *Context) = 0;
123 
124  /// Returns the DIE map slot for the specified debug variable.
125  ///
126  /// We delegate the request to DwarfDebug when the MDNode can be part of the
127  /// type system, since DIEs for the type system can be shared across CUs and
128  /// the mappings are kept in DwarfDebug.
129  DIE *getDIE(const DINode *D) const;
130 
131  /// Returns a fresh newly allocated DIELoc.
133 
134  /// Insert DIE into the map.
135  ///
136  /// We delegate the request to DwarfDebug when the MDNode can be part of the
137  /// type system, since DIEs for the type system can be shared across CUs and
138  /// the mappings are kept in DwarfDebug.
139  void insertDIE(const DINode *Desc, DIE *D);
140 
141  void insertDIE(DIE *D);
142 
143  /// Add a flag that is true to the DIE.
145 
146  /// Add an unsigned integer attribute data and value.
149 
150  void addUInt(DIEValueList &Block, dwarf::Form Form, uint64_t Integer);
151 
152  /// Add an signed integer attribute data and value.
154  Optional<dwarf::Form> Form, int64_t Integer);
155 
156  void addSInt(DIELoc &Die, Optional<dwarf::Form> Form, int64_t Integer);
157 
158  /// Add a string attribute data and value.
159  ///
160  /// We always emit a reference to the string pool instead of immediate
161  /// strings so that DIEs have more predictable sizes. In the case of split
162  /// dwarf we emit an index into another table which gets us the static offset
163  /// into the string table.
165 
166  /// Add a Dwarf label attribute data and value.
168  const MCSymbol *Label);
169 
170  void addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label);
171 
172  /// Add an offset into a section attribute data and value.
174 
175  /// Add a dwarf op address data and value using the form given and an
176  /// op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
177  void addOpAddress(DIELoc &Die, const MCSymbol *Sym);
178  void addPoolOpAddress(DIEValueList &Die, const MCSymbol *Label);
179 
180  /// Add a label delta attribute data and value.
182  const MCSymbol *Hi, const MCSymbol *Lo);
183 
184  /// Add a DIE attribute data and value.
185  void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry);
186 
187  /// Add a DIE attribute data and value.
189 
190  /// Add a type's DW_AT_signature and set the declaration flag.
191  void addDIETypeSignature(DIE &Die, uint64_t Signature);
192 
193  /// Add block data.
194  void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc);
195 
196  /// Add block data.
197  void addBlock(DIE &Die, dwarf::Attribute Attribute, DIEBlock *Block);
199  DIEBlock *Block);
200 
201  /// Add location information to specified debug information entry.
202  void addSourceLine(DIE &Die, unsigned Line, const DIFile *File);
203  void addSourceLine(DIE &Die, const DILocalVariable *V);
204  void addSourceLine(DIE &Die, const DIGlobalVariable *G);
205  void addSourceLine(DIE &Die, const DISubprogram *SP);
206  void addSourceLine(DIE &Die, const DILabel *L);
207  void addSourceLine(DIE &Die, const DIType *Ty);
208  void addSourceLine(DIE &Die, const DIObjCProperty *Ty);
209 
210  /// Add constant value entry in variable DIE.
211  void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty);
212  void addConstantValue(DIE &Die, const APInt &Val, const DIType *Ty);
213  void addConstantValue(DIE &Die, const APInt &Val, bool Unsigned);
214  void addConstantValue(DIE &Die, uint64_t Val, const DIType *Ty);
215  void addConstantValue(DIE &Die, bool Unsigned, uint64_t Val);
216 
217  /// Add constant value entry in variable DIE.
218  void addConstantFPValue(DIE &Die, const ConstantFP *CFP);
219 
220  /// Add a linkage name, if it isn't empty.
221  void addLinkageName(DIE &Die, StringRef LinkageName);
222 
223  /// Add template parameters in buffer.
224  void addTemplateParams(DIE &Buffer, DINodeArray TParams);
225 
226  /// Add thrown types.
227  void addThrownTypes(DIE &Die, DINodeArray ThrownTypes);
228 
229  /// Add a new type attribute to the specified entity.
230  ///
231  /// This takes and attribute parameter because DW_AT_friend attributes are
232  /// also type references.
233  void addType(DIE &Entity, const DIType *Ty,
234  dwarf::Attribute Attribute = dwarf::DW_AT_type);
235 
237  DIE *getOrCreateModule(const DIModule *M);
238  DIE *getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal = false);
239 
240  void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,
241  bool SkipSPAttributes = false);
242 
243  /// Creates type DIE with specific context.
244  DIE *createTypeDIE(const DIScope *Context, DIE &ContextDIE, const DIType *Ty);
245 
246  /// Find existing DIE or create new DIE for the given type.
247  DIE *getOrCreateTypeDIE(const MDNode *TyNode);
248 
249  /// Get context owner's DIE.
251 
252  /// Construct DIEs for types that contain vtables.
254 
255  /// Construct function argument DIEs.
257 
258  /// Create a DIE with the given Tag, add the DIE to its parent, and
259  /// call insertDIE if MD is not null.
260  DIE &createAndAddDIE(dwarf::Tag Tag, DIE &Parent, const DINode *N = nullptr);
261 
264  }
265 
266  /// Compute the size of a header for this unit, not including the initial
267  /// length field.
268  virtual unsigned getHeaderSize() const {
269  return sizeof(int16_t) + // DWARF version number
270  Asm->getDwarfOffsetByteSize() + // Offset Into Abbrev. Section
271  sizeof(int8_t) + // Pointer Size (in bytes)
272  (DD->getDwarfVersion() >= 5 ? sizeof(int8_t)
273  : 0); // DWARF v5 unit type
274  }
275 
276  /// Emit the header for this unit, not including the initial length field.
277  virtual void emitHeader(bool UseOffsets) = 0;
278 
279  /// Add the DW_AT_str_offsets_base attribute to the unit DIE.
280  void addStringOffsetsStart();
281 
282  /// Add the DW_AT_rnglists_base attribute to the unit DIE.
283  void addRnglistsBase();
284 
285  virtual DwarfCompileUnit &getCU() = 0;
286 
287  void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy);
288 
289  /// addSectionDelta - Add a label delta attribute data and value.
291  const MCSymbol *Lo);
292 
293  /// Add a Dwarf section label attribute data and value.
295  const MCSymbol *Label, const MCSymbol *Sec);
296 
297  /// Add DW_TAG_LLVM_annotation.
298  void addAnnotation(DIE &Buffer, DINodeArray Annotations);
299 
300  /// Get context owner's DIE.
301  DIE *createTypeDIE(const DICompositeType *Ty);
302 
303 protected:
304  ~DwarfUnit();
305 
306  /// Create new static data member DIE.
308 
309  /// Look up the source ID for the given file. If none currently exists,
310  /// create a new ID and insert it in the line table.
311  virtual unsigned getOrCreateSourceID(const DIFile *File) = 0;
312 
313  /// Emit the common part of the header for this unit.
314  void emitCommonHeader(bool UseOffsets, dwarf::UnitType UT);
315 
316 private:
317  void constructTypeDIE(DIE &Buffer, const DIBasicType *BTy);
318  void constructTypeDIE(DIE &Buffer, const DIStringType *BTy);
319  void constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy);
320  void constructTypeDIE(DIE &Buffer, const DISubroutineType *CTy);
321  void constructSubrangeDIE(DIE &Buffer, const DISubrange *SR, DIE *IndexTy);
322  void constructGenericSubrangeDIE(DIE &Buffer, const DIGenericSubrange *SR,
323  DIE *IndexTy);
324  void constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy);
325  void constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy);
326  DIE &constructMemberDIE(DIE &Buffer, const DIDerivedType *DT);
327  void constructTemplateTypeParameterDIE(DIE &Buffer,
328  const DITemplateTypeParameter *TP);
329  void constructTemplateValueParameterDIE(DIE &Buffer,
330  const DITemplateValueParameter *TVP);
331 
332  /// Return the default lower bound for an array.
333  ///
334  /// If the DWARF version doesn't handle the language, return -1.
335  int64_t getDefaultLowerBound() const;
336 
337  /// Get an anonymous type for index type.
338  DIE *getIndexTyDie();
339 
340  /// Set D as anonymous type for index which can be reused later.
341  void setIndexTyDie(DIE *D) { IndexTyDie = D; }
342 
343  virtual void finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) = 0;
344 
345  /// If this is a named finished type then include it in the list of types for
346  /// the accelerator tables.
347  void updateAcceleratorTables(const DIScope *Context, const DIType *Ty,
348  const DIE &TyDIE);
349 
350  virtual bool isDwoUnit() const = 0;
351  const MCSymbol *getCrossSectionRelativeBaseAddress() const override;
352 };
353 
354 class DwarfTypeUnit final : public DwarfUnit {
355  uint64_t TypeSignature;
356  const DIE *Ty;
358  MCDwarfDwoLineTable *SplitLineTable;
359  bool UsedLineTable = false;
360 
361  unsigned getOrCreateSourceID(const DIFile *File) override;
362  void finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) override;
363  bool isDwoUnit() const override;
364 
365 public:
367  DwarfFile *DWU, MCDwarfDwoLineTable *SplitLineTable = nullptr);
368 
369  void setTypeSignature(uint64_t Signature) { TypeSignature = Signature; }
370  void setType(const DIE *Ty) { this->Ty = Ty; }
371 
372  /// Emit the header for this unit, not including the initial length field.
373  void emitHeader(bool UseOffsets) override;
374  unsigned getHeaderSize() const override {
375  return DwarfUnit::getHeaderSize() + sizeof(uint64_t) + // Type Signature
376  Asm->getDwarfOffsetByteSize(); // Type DIE Offset
377  }
378  void addGlobalName(StringRef Name, const DIE &Die,
379  const DIScope *Context) override;
380  void addGlobalType(const DIType *Ty, const DIE &Die,
381  const DIScope *Context) override;
382  DwarfCompileUnit &getCU() override { return CU; }
383 };
384 } // end llvm namespace
385 #endif
llvm::DwarfUnit::getOrCreateStaticMemberDIE
DIE * getOrCreateStaticMemberDIE(const DIDerivedType *DT)
Create new static data member DIE.
Definition: DwarfUnit.cpp:1685
llvm::DwarfUnit::addSourceLine
void addSourceLine(DIE &Die, unsigned Line, const DIFile *File)
Add location information to specified debug information entry.
Definition: DwarfUnit.cpp:414
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:188
llvm::DwarfUnit::useSegmentedStringOffsetsTable
bool useSegmentedStringOffsetsTable() const
Definition: DwarfUnit.h:262
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:1826
llvm::DwarfUnit::addThrownTypes
void addThrownTypes(DIE &Die, DINodeArray ThrownTypes)
Add thrown types.
Definition: DwarfUnit.cpp:532
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::DIType
Base class for types.
Definition: DebugInfoMetadata.h:662
llvm::DwarfTypeUnit::setType
void setType(const DIE *Ty)
Definition: DwarfUnit.h:370
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:221
llvm::DIGenericSubrange
Definition: DebugInfoMetadata.h:362
llvm::ISD::ConstantFP
@ ConstantFP
Definition: ISDOpcodes.h:77
llvm::Attribute
Definition: Attributes.h:52
llvm::DwarfUnit::getOrCreateContextDIE
DIE * getOrCreateContextDIE(const DIScope *Context)
Get context owner's DIE.
Definition: DwarfUnit.cpp:539
llvm::DwarfUnit::emitCommonHeader
void emitCommonHeader(bool UseOffsets, dwarf::UnitType UT)
Emit the common part of the header for this unit.
Definition: DwarfUnit.cpp:1732
llvm::DwarfCompileUnit
Definition: DwarfCompileUnit.h:47
llvm::DwarfUnit::DU
DwarfFile * DU
Definition: DwarfUnit.h:53
llvm::DIEValue
Definition: DIE.h:369
llvm::DIEUnit
Represents a compile or type unit.
Definition: DIE.h:872
llvm::DIStringType
String type, Fortran CHARACTER(n)
Definition: DebugInfoMetadata.h:837
llvm::dwarf::Form
Form
Definition: Dwarf.h:131
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:354
llvm::MipsISD::Lo
@ Lo
Definition: MipsISelLowering.h:79
llvm::DwarfUnit::getEndLabel
MCSymbol * getEndLabel() const
Definition: DwarfUnit.h:99
llvm::DwarfUnit::insertDIE
void insertDIE(const DINode *Desc, DIE *D)
Insert DIE into the map.
Definition: DwarfUnit.cpp:209
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:339
llvm::DwarfUnit::getDIE
DIE * getDIE(const DINode *D) const
Returns the DIE map slot for the specified debug variable.
Definition: DwarfUnit.cpp:203
llvm::DwarfUnit::getOrCreateSubprogramDIE
DIE * getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal=false)
Definition: DwarfUnit.cpp:1120
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:647
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:254
llvm::AsmPrinter::getDwarfOffsetByteSize
unsigned int getDwarfOffsetByteSize() const
Returns 4 for DWARF32 and 8 for DWARF64.
Definition: AsmPrinter.cpp:3613
llvm::DwarfTypeUnit
Definition: DwarfUnit.h:354
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:364
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:242
llvm::dwarf::Tag
Tag
Definition: Dwarf.h:104
llvm::DwarfUnit::constructTypeDIE
void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy)
Definition: DwarfUnit.cpp:853
llvm::DwarfUnit::hasContent
bool hasContent() const
Return true if this compile unit has something to write out.
Definition: DwarfUnit.h:105
llvm::DINamespace
Definition: DebugInfoMetadata.h:2276
llvm::dwarf::Attribute
Attribute
Attributes.
Definition: Dwarf.h:124
llvm::Annotations
Annotations lets you mark points and ranges inside source code, for tests:
Definition: Annotations.h:46
llvm::MipsISD::Hi
@ Hi
Definition: MipsISelLowering.h:75
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::DITypeRefArray
Definition: DebugInfoMetadata.h:67
llvm::ConstantInt
This is the shared class of boolean and integer constants.
Definition: Constants.h:79
llvm::DIObjCProperty
Definition: DebugInfoMetadata.h:3253
TargetMachine.h
llvm::DwarfUnit::getAsmPrinter
AsmPrinter * getAsmPrinter() const
Definition: DwarfUnit.h:98
llvm::DILocalVariable
Local variable.
Definition: DebugInfoMetadata.h:3097
llvm::DwarfUnit::constructContainingTypeDIEs
void constructContainingTypeDIEs()
Construct DIEs for types that contain vtables.
Definition: DwarfUnit.cpp:1552
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:296
llvm::DwarfUnit::addConstantValue
void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty)
Add constant value entry in variable DIE.
Definition: DwarfUnit.cpp:464
llvm::DwarfUnit::addAnnotation
void addAnnotation(DIE &Buffer, DINodeArray Annotations)
Add DW_TAG_LLVM_annotation.
Definition: DwarfUnit.cpp:836
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:1787
llvm::DwarfUnit::DIEBlocks
std::vector< DIEBlock * > DIEBlocks
A list of all the DIEBlocks in use.
Definition: DwarfUnit.h:63
llvm::DwarfUnit::getParentContextString
std::string getParentContextString(const DIScope *Context) const
Get string containing language specific context for a global name.
Definition: DwarfUnit.cpp:653
llvm::DwarfUnit::CUNode
const DICompileUnit * CUNode
MDNode for the compile unit.
Definition: DwarfUnit.h:40
llvm::DwarfUnit::applySubprogramAttributes
void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool SkipSPAttributes=false)
Definition: DwarfUnit.cpp:1205
llvm::DISubrange
Array subrange.
Definition: DebugInfoMetadata.h:296
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:1781
llvm::DwarfUnit::addTemplateParams
void addTemplateParams(DIE &Buffer, DINodeArray TParams)
Add template parameters in buffer.
Definition: DwarfUnit.cpp:521
llvm::DITemplateTypeParameter
Definition: DebugInfoMetadata.h:2426
llvm::DwarfUnit::getCUNode
const DICompileUnit * getCUNode() const
Definition: DwarfUnit.h:101
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:513
DwarfDebug.h
llvm::DIEBlock
DIEBlock - Represents a block of values.
Definition: DIE.h:959
llvm::DwarfUnit::DIEValueAllocator
BumpPtrAllocator DIEValueAllocator
Definition: DwarfUnit.h:43
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:374
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:132
llvm::DwarfUnit::addPoolOpAddress
void addPoolOpAddress(DIEValueList &Die, const MCSymbol *Label)
Definition: DwarfUnit.cpp:314
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:202
llvm::DwarfUnit::getOrCreateModule
DIE * getOrCreateModule(const DIModule *M)
Definition: DwarfUnit.cpp:1089
llvm::DICompileUnit::getSourceLanguage
unsigned getSourceLanguage() const
Definition: DebugInfoMetadata.h:1465
llvm::DwarfDebug
Collects and handles dwarf debug information.
Definition: DwarfDebug.h:295
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:67
llvm::DIGlobalVariable
Global variables.
Definition: DebugInfoMetadata.h:2946
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:1819
llvm::DICompileUnit
Compile unit.
Definition: DebugInfoMetadata.h:1335
llvm::DIELoc
DIELoc - Represents an expression location.
Definition: DIE.h:922
llvm::dwarf::UnitType
UnitType
Constants for unit types in DWARF v5.
Definition: Dwarf.h:460
llvm::DwarfUnit::Asm
AsmPrinter * Asm
Target of Dwarf emission.
Definition: DwarfUnit.h:46
llvm::TargetMachine::Options
TargetOptions Options
Definition: TargetMachine.h:120
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:60
llvm::DwarfTypeUnit::getCU
DwarfCompileUnit & getCU() override
Definition: DwarfUnit.h:382
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:66
llvm::MDNode
Metadata node.
Definition: Metadata.h:901
llvm::DwarfTypeUnit::emitHeader
void emitHeader(bool UseOffsets) override
Emit the header for this unit, not including the initial length field.
Definition: DwarfUnit.cpp:1770
llvm::DwarfUnit::constructSubprogramArguments
void constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args)
Construct function argument DIEs.
Definition: DwarfUnit.cpp:788
llvm::DwarfUnit::IndexTyDie
DIE * IndexTyDie
An anonymous type for index type. Owned by DIEUnit.
Definition: DwarfUnit.h:56
llvm::DIBasicType
Basic type, like 'int' or 'float'.
Definition: DebugInfoMetadata.h:769
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
llvm::DISubroutineType
Type array for a subprogram.
Definition: DebugInfoMetadata.h:1281
llvm::DICompositeType
Composite types.
Definition: DebugInfoMetadata.h:1060
llvm::DwarfUnit::getOrCreateTypeDIE
DIE * getOrCreateTypeDIE(const MDNode *TyNode)
Find existing DIE or create new DIE for the given type.
Definition: DwarfUnit.cpp:602
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:389
llvm::MCDwarfDwoLineTable
Definition: MCDwarf.h:283
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::DINode
Tagged DWARF-like metadata node.
Definition: DebugInfoMetadata.h:127
Unsigned
@ Unsigned
Definition: NVPTXISelLowering.cpp:4637
Node
Definition: ItaniumDemangle.h:234
llvm::TargetOptions::DebugStrictDwarf
unsigned DebugStrictDwarf
When set to true, don't use DWARF extensions in later DWARF versions.
Definition: TargetOptions.h:340
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:49
llvm::DwarfUnit::getOrCreateNameSpace
DIE * getOrCreateNameSpace(const DINamespace *NS)
Definition: DwarfUnit.cpp:1068
llvm::DwarfUnit::DD
DwarfDebug * DD
Definition: DwarfUnit.h:52
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::DwarfUnit::addAttribute
void addAttribute(DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, T &&Value)
Definition: DwarfUnit.h:81
llvm::DIScope
Base class for scope-like contexts.
Definition: DebugInfoMetadata.h:476
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:228
llvm::DwarfDebug::useSegmentedStringOffsetsTable
bool useSegmentedStringOffsetsTable() const
Returns whether to generate a string offsets table with (possibly shared) contributions from each CU ...
Definition: DwarfDebug.h:757
llvm::DwarfUnit::~DwarfUnit
~DwarfUnit()
Definition: DwarfUnit.cpp:102
llvm::DwarfUnit::addBlock
void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc)
Add block data.
Definition: DwarfUnit.cpp:396
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:82
llvm::DwarfTypeUnit::setTypeSignature
void setTypeSignature(uint64_t Signature)
Definition: DwarfUnit.h:369
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:569
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:1806
llvm::DIDerivedType
Derived types.
Definition: DebugInfoMetadata.h:917
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:95
llvm::DITemplateValueParameter
Definition: DebugInfoMetadata.h:2468
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:287
llvm::AsmPrinter::TM
TargetMachine & TM
Target machine description.
Definition: AsmPrinter.h:85
N
#define N
llvm::DIE::hasChildren
bool hasChildren() const
Definition: DIE.h:779
llvm::DwarfUnit::applySubprogramDefinitionAttributes
bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal)
Definition: DwarfUnit.cpp:1152
llvm::DISubprogram
Subprogram description.
Definition: DebugInfoMetadata.h:1820
llvm::DIModule
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Definition: DebugInfoMetadata.h:2328
llvm::DwarfUnit::getDwarfDebug
DwarfDebug & getDwarfDebug() const
Definition: DwarfUnit.h:102
llvm::DwarfDebug::getDwarfVersion
uint16_t getDwarfVersion() const
Returns the Dwarf Version.
Definition: DwarfDebug.cpp:3503
llvm::DILabel
Label.
Definition: DebugInfoMetadata.h:3185
llvm::DwarfUnit
This dwarf writer support class manages information associated with a source file.
Definition: DwarfUnit.h:37
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:389
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:71
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:1801
llvm::DwarfUnit::addConstantFPValue
void addConstantFPValue(DIE &Die, const ConstantFP *CFP)
Add constant value entry in variable DIE.
Definition: DwarfUnit.cpp:459
CU
Definition: AArch64AsmBackend.cpp:501
llvm::DwarfUnit::getLanguage
uint16_t getLanguage() const
Definition: DwarfUnit.h:100
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
File
Instrumentation for Order File
Definition: InstrOrderFile.cpp:205
llvm::DIEUnit::getUnitDie
DIE & getUnitDie()
Definition: DIE.h:911
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:268
llvm::ISD::MCSymbol
@ MCSymbol
Definition: ISDOpcodes.h:172
llvm::DIFile
File.
Definition: DebugInfoMetadata.h:530
llvm::DwarfUnit::DwarfUnit
DwarfUnit(dwarf::Tag, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU)
Definition: DwarfUnit.cpp:90
llvm::DwarfUnit::addDIEEntry
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry)
Add a DIE attribute data and value.
Definition: DwarfUnit.cpp:360