LLVM  3.7.0
DwarfUnit.h
Go to the documentation of this file.
1 //===-- llvm/CodeGen/DwarfUnit.h - Dwarf Compile Unit ---*- C++ -*--===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains support for writing dwarf compile unit.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFUNIT_H
15 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFUNIT_H
16 
17 #include "DwarfDebug.h"
18 #include "llvm/ADT/DenseMap.h"
19 #include "llvm/ADT/Optional.h"
20 #include "llvm/ADT/StringMap.h"
22 #include "llvm/CodeGen/DIE.h"
23 #include "llvm/IR/DIBuilder.h"
24 #include "llvm/IR/DebugInfo.h"
25 #include "llvm/MC/MCDwarf.h"
26 #include "llvm/MC/MCExpr.h"
27 #include "llvm/MC/MCSection.h"
28 
29 namespace llvm {
30 
31 class MachineLocation;
32 class MachineOperand;
33 class ConstantInt;
34 class ConstantFP;
35 class DbgVariable;
36 class DwarfCompileUnit;
37 
38 // Data structure to hold a range for range lists.
39 class RangeSpan {
40 public:
41  RangeSpan(MCSymbol *S, MCSymbol *E) : Start(S), End(E) {}
42  const MCSymbol *getStart() const { return Start; }
43  const MCSymbol *getEnd() const { return End; }
44  void setEnd(const MCSymbol *E) { End = E; }
45 
46 private:
47  const MCSymbol *Start, *End;
48 };
49 
51 private:
52  // Index for locating within the debug_range section this particular span.
53  MCSymbol *RangeSym;
54  // List of ranges.
56 
57 public:
59  : RangeSym(Sym), Ranges(std::move(Ranges)) {}
60  MCSymbol *getSym() const { return RangeSym; }
61  const SmallVectorImpl<RangeSpan> &getRanges() const { return Ranges; }
62  void addRange(RangeSpan Range) { Ranges.push_back(Range); }
63 };
64 
65 //===----------------------------------------------------------------------===//
66 /// This dwarf writer support class manages information associated with a
67 /// source file.
68 class DwarfUnit {
69 protected:
70  /// A numeric ID unique among all CUs in the module
71  unsigned UniqueID;
72 
73  /// MDNode for the compile unit.
75 
76  // All DIEValues are allocated through this allocator.
78 
79  /// Unit debug information entry.
81 
82  /// Offset of the UnitDie from beginning of debug info section.
83  unsigned DebugInfoOffset;
84 
85  /// Target of Dwarf emission.
87 
88  // Holders for some common dwarf information.
91 
92  /// An anonymous type for index type. Owned by UnitDie.
94 
95  /// Tracks the mapping of unit level debug information variables to debug
96  /// information entries.
98 
99  /// A list of all the DIEBlocks in use.
100  std::vector<DIEBlock *> DIEBlocks;
101 
102  /// A list of all the DIELocs in use.
103  std::vector<DIELoc *> DIELocs;
104 
105  /// This map is used to keep track of subprogram DIEs that need
106  /// DW_AT_containing_type attribute. This attribute points to a DIE that
107  /// corresponds to the MDNode mapped with the subprogram DIE.
109 
110  /// The section this unit will be emitted in.
112 
113  DwarfUnit(unsigned UID, dwarf::Tag, const DICompileUnit *CU, AsmPrinter *A,
114  DwarfDebug *DW, DwarfFile *DWU);
115 
116  /// Add a string attribute data and value.
117  ///
118  /// This is guaranteed to be in the local string pool instead of indirected.
120 
122 
124 
125 public:
126  virtual ~DwarfUnit();
127 
129 
131  assert(Section);
132  return Section;
133  }
134 
135  // Accessors.
136  AsmPrinter* getAsmPrinter() const { return Asm; }
137  unsigned getUniqueID() const { return UniqueID; }
138  uint16_t getLanguage() const { return CUNode->getSourceLanguage(); }
139  const DICompileUnit *getCUNode() const { return CUNode; }
140  DIE &getUnitDie() { return UnitDie; }
141 
142  unsigned getDebugInfoOffset() const { return DebugInfoOffset; }
143  void setDebugInfoOffset(unsigned DbgInfoOff) { DebugInfoOffset = DbgInfoOff; }
144 
145  /// Return true if this compile unit has something to write out.
146  bool hasContent() const { return UnitDie.hasChildren(); }
147 
148  /// Get string containing language specific context for a global name.
149  ///
150  /// Walks the metadata parent chain in a language specific manner (using the
151  /// compile unit language) and returns it as a string. This is done at the
152  /// metadata level because DIEs may not currently have been added to the
153  /// parent context and walking the DIEs looking for names is more expensive
154  /// than walking the metadata.
155  std::string getParentContextString(const DIScope *Context) const;
156 
157  /// Add a new global name to the compile unit.
158  virtual void addGlobalName(StringRef Name, DIE &Die, const DIScope *Context) {
159  }
160 
161  /// Add a new global type to the compile unit.
162  virtual void addGlobalType(const DIType *Ty, const DIE &Die,
163  const DIScope *Context) {}
164 
165  /// Add a new name to the namespace accelerator table.
166  void addAccelNamespace(StringRef Name, const DIE &Die);
167 
168  /// Returns the DIE map slot for the specified debug variable.
169  ///
170  /// We delegate the request to DwarfDebug when the MDNode can be part of the
171  /// type system, since DIEs for the type system can be shared across CUs and
172  /// the mappings are kept in DwarfDebug.
173  DIE *getDIE(const DINode *D) const;
174 
175  /// Returns a fresh newly allocated DIELoc.
177 
178  /// Insert DIE into the map.
179  ///
180  /// We delegate the request to DwarfDebug when the MDNode can be part of the
181  /// type system, since DIEs for the type system can be shared across CUs and
182  /// the mappings are kept in DwarfDebug.
183  void insertDIE(const DINode *Desc, DIE *D);
184 
185  /// Add a flag that is true to the DIE.
187 
188  /// Add an unsigned integer attribute data and value.
190  uint64_t Integer);
191 
192  void addUInt(DIE &Block, dwarf::Form Form, uint64_t Integer);
193 
194  /// Add an signed integer attribute data and value.
196  int64_t Integer);
197 
198  void addSInt(DIELoc &Die, Optional<dwarf::Form> Form, int64_t Integer);
199 
200  /// Add a string attribute data and value.
201  ///
202  /// We always emit a reference to the string pool instead of immediate
203  /// strings so that DIEs have more predictable sizes. In the case of split
204  /// dwarf we emit an index into another table which gets us the static offset
205  /// into the string table.
207 
208  /// Add a Dwarf label attribute data and value.
210  dwarf::Form Form, const MCSymbol *Label);
211 
212  void addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label);
213 
214  /// Add an offset into a section attribute data and value.
215  void addSectionOffset(DIE &Die, dwarf::Attribute Attribute, uint64_t Integer);
216 
217  /// Add a dwarf op address data and value using the form given and an
218  /// op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
219  void addOpAddress(DIELoc &Die, const MCSymbol *Label);
220 
221  /// Add a label delta attribute data and value.
223  const MCSymbol *Lo);
224 
225  /// Add a DIE attribute data and value.
226  void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry);
227 
228  /// Add a DIE attribute data and value.
230 
231  void addDIETypeSignature(DIE &Die, const DwarfTypeUnit &Type);
232 
233  /// Add block data.
235 
236  /// Add block data.
238 
239  /// Add location information to specified debug information entry.
240  void addSourceLine(DIE &Die, unsigned Line, StringRef File,
241  StringRef Directory);
242  void addSourceLine(DIE &Die, const DILocalVariable *V);
243  void addSourceLine(DIE &Die, const DIGlobalVariable *G);
244  void addSourceLine(DIE &Die, const DISubprogram *SP);
245  void addSourceLine(DIE &Die, const DIType *Ty);
246  void addSourceLine(DIE &Die, const DINamespace *NS);
247  void addSourceLine(DIE &Die, const DIObjCProperty *Ty);
248 
249  /// Add constant value entry in variable DIE.
250  void addConstantValue(DIE &Die, const MachineOperand &MO, const DIType *Ty);
251  void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty);
252  void addConstantValue(DIE &Die, const APInt &Val, const DIType *Ty);
253  void addConstantValue(DIE &Die, const APInt &Val, bool Unsigned);
254  void addConstantValue(DIE &Die, bool Unsigned, uint64_t Val);
255 
256  /// Add constant value entry in variable DIE.
257  void addConstantFPValue(DIE &Die, const MachineOperand &MO);
258  void addConstantFPValue(DIE &Die, const ConstantFP *CFP);
259 
260  /// Add a linkage name, if it isn't empty.
262 
263  /// Add template parameters in buffer.
264  void addTemplateParams(DIE &Buffer, DINodeArray TParams);
265 
266  /// Add register operand.
267  /// \returns false if the register does not exist, e.g., because it was never
268  /// materialized.
269  bool addRegisterOpPiece(DIELoc &TheDie, unsigned Reg,
270  unsigned SizeInBits = 0, unsigned OffsetInBits = 0);
271 
272  /// Add register offset.
273  /// \returns false if the register does not exist, e.g., because it was never
274  /// materialized.
275  bool addRegisterOffset(DIELoc &TheDie, unsigned Reg, int64_t Offset);
276 
277  // FIXME: Should be reformulated in terms of addComplexAddress.
278  /// Start with the address based on the location provided, and generate the
279  /// DWARF information necessary to find the actual Block variable (navigating
280  /// the Block struct) based on the starting location. Add the DWARF
281  /// information to the die. Obsolete, please use addComplexAddress instead.
282  void addBlockByrefAddress(const DbgVariable &DV, DIE &Die,
284  const MachineLocation &Location);
285 
286  /// Add a new type attribute to the specified entity.
287  ///
288  /// This takes and attribute parameter because DW_AT_friend attributes are
289  /// also type references.
290  void addType(DIE &Entity, const DIType *Ty,
292 
294  DIE *getOrCreateModule(const DIModule *M);
295  DIE *getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal = false);
296 
297  void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,
298  bool Minimal = false);
299 
300  /// Find existing DIE or create new DIE for the given type.
301  DIE *getOrCreateTypeDIE(const MDNode *N);
302 
303  /// Get context owner's DIE.
304  DIE *createTypeDIE(const DICompositeType *Ty);
305 
306  /// Get context owner's DIE.
307  DIE *getOrCreateContextDIE(const DIScope *Context);
308 
309  /// Construct DIEs for types that contain vtables.
311 
312  /// Construct function argument DIEs.
313  void constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args);
314 
315  /// Create a DIE with the given Tag, add the DIE to its parent, and
316  /// call insertDIE if MD is not null.
317  DIE &createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N = nullptr);
318 
319  /// Compute the size of a header for this unit, not including the initial
320  /// length field.
321  virtual unsigned getHeaderSize() const {
322  return sizeof(int16_t) + // DWARF version number
323  sizeof(int32_t) + // Offset Into Abbrev. Section
324  sizeof(int8_t); // Pointer Size (in bytes)
325  }
326 
327  /// Emit the header for this unit, not including the initial length field.
328  virtual void emitHeader(bool UseOffsets);
329 
330  virtual DwarfCompileUnit &getCU() = 0;
331 
332  void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy);
333 
334 protected:
335  /// Create new static data member DIE.
337 
338  /// Look up the source ID with the given directory and source file names. If
339  /// none currently exists, create a new ID and insert it in the line table.
340  virtual unsigned getOrCreateSourceID(StringRef File, StringRef Directory) = 0;
341 
342  /// Look in the DwarfDebug map for the MDNode that corresponds to the
343  /// reference.
344  template <typename T> T *resolve(TypedDINodeRef<T> Ref) const {
345  return DD->resolve(Ref);
346  }
347 
348 private:
349  void constructTypeDIE(DIE &Buffer, const DIBasicType *BTy);
350  void constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy);
351  void constructTypeDIE(DIE &Buffer, const DISubroutineType *DTy);
352  void constructSubrangeDIE(DIE &Buffer, const DISubrange *SR, DIE *IndexTy);
353  void constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy);
354  void constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy);
355  void constructMemberDIE(DIE &Buffer, const DIDerivedType *DT);
356  void constructTemplateTypeParameterDIE(DIE &Buffer,
357  const DITemplateTypeParameter *TP);
358  void constructTemplateValueParameterDIE(DIE &Buffer,
359  const DITemplateValueParameter *TVP);
360 
361  /// Return the default lower bound for an array.
362  ///
363  /// If the DWARF version doesn't handle the language, return -1.
364  int64_t getDefaultLowerBound() const;
365 
366  /// Get an anonymous type for index type.
367  DIE *getIndexTyDie();
368 
369  /// Set D as anonymous type for index which can be reused later.
370  void setIndexTyDie(DIE *D) { IndexTyDie = D; }
371 
372  /// If this is a named finished type then include it in the list of types for
373  /// the accelerator tables.
374  void updateAcceleratorTables(const DIScope *Context, const DIType *Ty,
375  const DIE &TyDIE);
376 
377  virtual bool isDwoUnit() const = 0;
378 };
379 
380 class DwarfTypeUnit : public DwarfUnit {
381  uint64_t TypeSignature;
382  const DIE *Ty;
383  DwarfCompileUnit &CU;
384  MCDwarfDwoLineTable *SplitLineTable;
385 
386  unsigned getOrCreateSourceID(StringRef File, StringRef Directory) override;
387  bool isDwoUnit() const override;
388 
389 public:
390  DwarfTypeUnit(unsigned UID, DwarfCompileUnit &CU, AsmPrinter *A,
391  DwarfDebug *DW, DwarfFile *DWU,
392  MCDwarfDwoLineTable *SplitLineTable = nullptr);
393 
394  void setTypeSignature(uint64_t Signature) { TypeSignature = Signature; }
395  uint64_t getTypeSignature() const { return TypeSignature; }
396  void setType(const DIE *Ty) { this->Ty = Ty; }
397 
398  /// Emit the header for this unit, not including the initial length field.
399  void emitHeader(bool UseOffsets) override;
400  unsigned getHeaderSize() const override {
401  return DwarfUnit::getHeaderSize() + sizeof(uint64_t) + // Type Signature
402  sizeof(uint32_t); // Type DIE Offset
403  }
404  DwarfCompileUnit &getCU() override { return CU; }
405 };
406 } // end llvm namespace
407 #endif
const MCSymbol * getStart() const
Definition: DwarfUnit.h:42
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:48
void addFlag(DIE &Die, dwarf::Attribute Attribute)
Add a flag that is true to the DIE.
Definition: DwarfUnit.cpp:186
unsigned getUniqueID() const
Definition: DwarfUnit.h:137
MCSection * Section
The section this unit will be emitted in.
Definition: DwarfUnit.h:111
void addLabelDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
Add a label delta attribute data and value.
Definition: DwarfUnit.cpp:259
const DICompileUnit * getCUNode() const
Definition: DwarfUnit.h:139
std::vector< DIELoc * > DIELocs
A list of all the DIELocs in use.
Definition: DwarfUnit.h:103
DIELoc - Represents an expression location.
Definition: DIE.h:748
DIE * getOrCreateStaticMemberDIE(const DIDerivedType *DT)
Create new static data member DIE.
Definition: DwarfUnit.cpp:1445
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:39
virtual void addGlobalType(const DIType *Ty, const DIE &Die, const DIScope *Context)
Add a new global type to the compile unit.
Definition: DwarfUnit.h:162
void insertDIE(const DINode *Desc, DIE *D)
Insert DIE into the map.
Definition: DwarfUnit.cpp:178
Collects and handles dwarf debug information.
Definition: DwarfDebug.h:207
virtual ~DwarfUnit()
Definition: DwarfUnit.cpp:85
DIE & getUnitDie()
Definition: DwarfUnit.h:140
Metadata node.
Definition: Metadata.h:740
void initSection(MCSection *Section)
Definition: DwarfUnit.cpp:1508
void addIndexedString(DIE &Die, dwarf::Attribute Attribute, StringRef Str)
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:770
virtual DwarfCompileUnit & getCU()=0
AsmPrinter * Asm
Target of Dwarf emission.
Definition: DwarfUnit.h:86
Tagged DWARF-like metadata node.
DIE * getOrCreateTypeDIE(const MDNode *N)
Find existing DIE or create new DIE for the given type.
Definition: DwarfUnit.cpp:707
void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy)
Definition: DwarfUnit.cpp:901
virtual void addGlobalName(StringRef Name, DIE &Die, const DIScope *Context)
Add a new global name to the compile unit.
Definition: DwarfUnit.h:158
void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Block)
Add block data.
Definition: DwarfUnit.cpp:303
virtual void emitHeader(bool UseOffsets)
Emit the header for this unit, not including the initial length field.
Definition: DwarfUnit.cpp:1488
Array subrange.
void addSInt(DIE &Die, dwarf::Attribute Attribute, Optional< dwarf::Form > Form, int64_t Integer)
Add an signed integer attribute data and value.
Definition: DwarfUnit.cpp:206
virtual unsigned getOrCreateSourceID(StringRef File, StringRef Directory)=0
Look up the source ID with the given directory and source file names.
T * resolve(TypedDINodeRef< T > Ref) const
Look in the DwarfDebug map for the MDNode that corresponds to the reference.
Definition: DwarfUnit.h:344
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APInt.h:33
void addConstantFPValue(DIE &Die, const MachineOperand &MO)
Add constant value entry in variable DIE.
Definition: DwarfUnit.cpp:582
Reg
All possible values of the reg field in the ModR/M byte.
bool addRegisterOffset(DIELoc &TheDie, unsigned Reg, int64_t Offset)
Add register offset.
Definition: DwarfUnit.cpp:370
void constructContainingTypeDIEs()
Construct DIEs for types that contain vtables.
Definition: DwarfUnit.cpp:1323
Pointer union between a subclass of DINode and MDString.
#define G(x, y, z)
Definition: MD5.cpp:52
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:108
void addString(DIE &Die, dwarf::Attribute Attribute, StringRef Str)
Add a string attribute data and value.
Definition: DwarfUnit.cpp:218
Subprogram description.
MCSection * getSection() const
Definition: DwarfUnit.h:130
This class is used to track local variable information.
Definition: DwarfDebug.h:81
DwarfCompileUnit & getCU() override
Definition: DwarfUnit.h:404
virtual unsigned getHeaderSize() const
Compute the size of a header for this unit, not including the initial length field.
Definition: DwarfUnit.h:321
DIE * getOrCreateNameSpace(const DINamespace *NS)
Definition: DwarfUnit.cpp:1052
bool addRegisterOpPiece(DIELoc &TheDie, unsigned Reg, unsigned SizeInBits=0, unsigned OffsetInBits=0)
Add register operand.
Definition: DwarfUnit.cpp:363
void addConstantValue(DIE &Die, const MachineOperand &MO, const DIType *Ty)
Add constant value entry in variable DIE.
Definition: DwarfUnit.cpp:614
This dwarf writer support class manages information associated with a source file.
Definition: DwarfUnit.h:68
bool hasChildren() const
Definition: DIE.h:666
bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie)
Definition: DwarfUnit.cpp:1127
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
void addLocalString(DIE &Die, dwarf::Attribute Attribute, StringRef Str)
Add a string attribute data and value.
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:135
void addSourceLine(DIE &Die, unsigned Line, StringRef File, StringRef Directory)
Add location information to specified debug information entry.
Definition: DwarfUnit.cpp:317
DIE - A structured debug information entry.
Definition: DIE.h:623
DIELoc * getDIELoc()
Returns a fresh newly allocated DIELoc.
Definition: DwarfUnit.h:176
ConstantFP - Floating Point Values [float, double].
Definition: Constants.h:233
unsigned getSourceLanguage() const
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:66
void setEnd(const MCSymbol *E)
Definition: DwarfUnit.h:44
DenseMap< const MDNode *, DIE * > MDNodeToDieMap
Tracks the mapping of unit level debug information variables to debug information entries...
Definition: DwarfUnit.h:97
T * resolve(TypedDINodeRef< T > Ref) const
Find the MDNode for the given reference.
Definition: DwarfDebug.h:594
DIE * getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal=false)
Definition: DwarfUnit.cpp:1096
DIE * IndexTyDie
An anonymous type for index type. Owned by UnitDie.
Definition: DwarfUnit.h:93
DIE * getDIE(const DINode *D) const
Returns the DIE map slot for the specified debug variable.
Definition: DwarfUnit.cpp:172
Base class for scope-like contexts.
unsigned getHeaderSize() const override
Compute the size of a header for this unit, not including the initial length field.
Definition: DwarfUnit.h:400
Base class for types.
void addAccelNamespace(StringRef Name, const DIE &Die)
Add a new name to the namespace accelerator table.
This is the shared class of boolean and integer constants.
Definition: Constants.h:47
uint16_t getLanguage() const
Definition: DwarfUnit.h:138
unsigned getDebugInfoOffset() const
Definition: DwarfUnit.h:142
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:861
void addLinkageName(DIE &Die, StringRef LinkageName)
Add a linkage name, if it isn't empty.
Definition: DwarfUnit.cpp:661
void setDebugInfoOffset(unsigned DbgInfoOff)
Definition: DwarfUnit.h:143
void setTypeSignature(uint64_t Signature)
Definition: DwarfUnit.h:394
void addTemplateParams(DIE &Buffer, DINodeArray TParams)
Add template parameters in buffer.
Definition: DwarfUnit.cpp:669
DwarfDebug * DD
Definition: DwarfUnit.h:89
Class for arbitrary precision integers.
Definition: APInt.h:73
A (clang) module that has been imported by the compile unit.
void setType(const DIE *Ty)
Definition: DwarfUnit.h:396
const SmallVectorImpl< RangeSpan > & getRanges() const
Definition: DwarfUnit.h:61
std::string getParentContextString(const DIScope *Context) const
Get string containing language specific context for a global name.
Definition: DwarfUnit.cpp:776
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry)
Add a DIE attribute data and value.
Definition: DwarfUnit.cpp:265
DIE::value_iterator addLabel(DIE &Die, dwarf::Attribute Attribute, dwarf::Form Form, const MCSymbol *Label)
Add a Dwarf label attribute data and value.
Definition: DwarfUnit.cpp:225
unsigned UniqueID
A numeric ID unique among all CUs in the module.
Definition: DwarfUnit.h:71
DIE * getOrCreateContextDIE(const DIScope *Context)
Get context owner's DIE.
Definition: DwarfUnit.cpp:679
Type array for a subprogram.
DwarfTypeUnit(unsigned UID, DwarfCompileUnit &CU, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, MCDwarfDwoLineTable *SplitLineTable=nullptr)
Definition: DwarfUnit.cpp:76
DIE & createAndAddDIE(unsigned 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:294
RangeSpan(MCSymbol *S, MCSymbol *E)
Definition: DwarfUnit.h:41
unsigned DebugInfoOffset
Offset of the UnitDie from beginning of debug info section.
Definition: DwarfUnit.h:83
#define N
DwarfUnit(unsigned UID, dwarf::Tag, const DICompileUnit *CU, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU)
Definition: DwarfUnit.cpp:66
void emitHeader(bool UseOffsets) override
Emit the header for this unit, not including the initial length field.
Definition: DwarfUnit.cpp:1513
DIE * getOrCreateModule(const DIModule *M)
Definition: DwarfUnit.cpp:1072
void addBlockByrefAddress(const DbgVariable &DV, DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location)
Start with the address based on the location provided, and generate the DWARF information necessary t...
Definition: DwarfUnit.cpp:430
void addRange(RangeSpan Range)
Definition: DwarfUnit.h:62
DIE * createTypeDIE(const DICompositeType *Ty)
Get context owner's DIE.
Definition: DwarfUnit.cpp:691
const DICompileUnit * CUNode
MDNode for the compile unit.
Definition: DwarfUnit.h:74
AsmPrinter * getAsmPrinter() const
Definition: DwarfUnit.h:136
void addSectionOffset(DIE &Die, dwarf::Attribute Attribute, uint64_t Integer)
Add an offset into a section attribute data and value.
Definition: DwarfUnit.cpp:235
bool hasContent() const
Return true if this compile unit has something to write out.
Definition: DwarfUnit.h:146
BumpPtrAllocator DIEValueAllocator
Definition: DwarfUnit.h:77
void addDIETypeSignature(DIE &Die, const DwarfTypeUnit &Type)
Definition: DwarfUnit.cpp:269
DIE & UnitDie
Unit debug information entry.
Definition: DwarfUnit.h:80
RangeSpanList(MCSymbol *Sym, SmallVector< RangeSpan, 2 > Ranges)
Definition: DwarfUnit.h:58
std::vector< DIEBlock * > DIEBlocks
A list of all the DIEBlocks in use.
Definition: DwarfUnit.h:100
void addOpAddress(DIELoc &Die, const MCSymbol *Label)
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:248
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40
uint64_t getTypeSignature() const
Definition: DwarfUnit.h:395
DIEBlock - Represents a block of values.
Definition: DIE.h:784
DwarfFile * DU
Definition: DwarfUnit.h:90
void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal=false)
Definition: DwarfUnit.cpp:1159
void constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args)
Construct function argument DIEs.
Definition: DwarfUnit.cpp:858
void addUInt(DIE &Die, dwarf::Attribute Attribute, Optional< dwarf::Form > Form, uint64_t Integer)
Add an unsigned integer attribute data and value.
Definition: DwarfUnit.cpp:195
MCSymbol * getSym() const
Definition: DwarfUnit.h:60
const MCSymbol * getEnd() const
Definition: DwarfUnit.h:43
Basic type, like 'int' or 'float'.