LLVM  15.0.0git
DIBuilder.h
Go to the documentation of this file.
1 //===- DIBuilder.h - Debug Information Builder ------------------*- 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 defines a DIBuilder that is useful for creating debugging
10 // information entries in LLVM IR form.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_IR_DIBUILDER_H
15 #define LLVM_IR_DIBUILDER_H
16 
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/DenseMap.h"
19 #include "llvm/ADT/MapVector.h"
20 #include "llvm/ADT/Optional.h"
21 #include "llvm/ADT/SetVector.h"
22 #include "llvm/ADT/SmallVector.h"
23 #include "llvm/ADT/StringRef.h"
26 #include "llvm/IR/TrackingMDRef.h"
27 #include "llvm/Support/Casting.h"
28 #include <algorithm>
29 #include <cstdint>
30 
31 namespace llvm {
32 
33  class BasicBlock;
34  class Constant;
35  class Function;
36  class Instruction;
37  class LLVMContext;
38  class Module;
39  class Value;
40 
41  class DIBuilder {
42  Module &M;
43  LLVMContext &VMContext;
44 
45  DICompileUnit *CUNode; ///< The one compile unit created by this DIBuiler.
46  Function *DeclareFn; ///< llvm.dbg.declare
47  Function *ValueFn; ///< llvm.dbg.value
48  Function *LabelFn; ///< llvm.dbg.label
49  Function *AddrFn; ///< llvm.dbg.addr
50 
51  SmallVector<Metadata *, 4> AllEnumTypes;
52  /// Track the RetainTypes, since they can be updated later on.
53  SmallVector<TrackingMDNodeRef, 4> AllRetainTypes;
54  SmallVector<Metadata *, 4> AllSubprograms;
56  SmallVector<TrackingMDNodeRef, 4> AllImportedModules;
57  /// Map Macro parent (which can be DIMacroFile or nullptr) to a list of
58  /// Metadata all of type DIMacroNode.
59  /// DIMacroNode's with nullptr parent are DICompileUnit direct children.
61 
62  /// Track nodes that may be unresolved.
63  SmallVector<TrackingMDNodeRef, 4> UnresolvedNodes;
64  bool AllowUnresolvedNodes;
65 
66  /// Each subprogram's preserved local variables.
67  ///
68  /// Do not use a std::vector. Some versions of libc++ apparently copy
69  /// instead of move on grow operations, and TrackingMDRef is expensive to
70  /// copy.
72 
73  /// Each subprogram's preserved labels.
75 
76  /// Create a temporary.
77  ///
78  /// Create an \a temporary node and track it in \a UnresolvedNodes.
79  void trackIfUnresolved(MDNode *N);
80 
81  /// Internal helper for insertDeclare.
82  Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
83  DIExpression *Expr, const DILocation *DL,
84  BasicBlock *InsertBB, Instruction *InsertBefore);
85 
86  /// Internal helper for insertLabel.
87  Instruction *insertLabel(DILabel *LabelInfo, const DILocation *DL,
88  BasicBlock *InsertBB, Instruction *InsertBefore);
89 
90  /// Internal helper with common code used by insertDbg{Value,Addr}Intrinsic.
91  Instruction *insertDbgIntrinsic(llvm::Function *Intrinsic, llvm::Value *Val,
92  DILocalVariable *VarInfo,
93  DIExpression *Expr, const DILocation *DL,
94  BasicBlock *InsertBB,
95  Instruction *InsertBefore);
96 
97  /// Internal helper for insertDbgValueIntrinsic.
98  Instruction *
99  insertDbgValueIntrinsic(llvm::Value *Val, DILocalVariable *VarInfo,
100  DIExpression *Expr, const DILocation *DL,
101  BasicBlock *InsertBB, Instruction *InsertBefore);
102 
103  /// Internal helper for insertDbgAddrIntrinsic.
104  Instruction *
105  insertDbgAddrIntrinsic(llvm::Value *Val, DILocalVariable *VarInfo,
106  DIExpression *Expr, const DILocation *DL,
107  BasicBlock *InsertBB, Instruction *InsertBefore);
108 
109  public:
110  /// Construct a builder for a module.
111  ///
112  /// If \c AllowUnresolved, collect unresolved nodes attached to the module
113  /// in order to resolve cycles during \a finalize().
114  ///
115  /// If \p CU is given a value other than nullptr, then set \p CUNode to CU.
116  explicit DIBuilder(Module &M, bool AllowUnresolved = true,
117  DICompileUnit *CU = nullptr);
118  DIBuilder(const DIBuilder &) = delete;
119  DIBuilder &operator=(const DIBuilder &) = delete;
120 
121  /// Construct any deferred debug info descriptors.
122  void finalize();
123 
124  /// Finalize a specific subprogram - no new variables may be added to this
125  /// subprogram afterwards.
127 
128  /// A CompileUnit provides an anchor for all debugging
129  /// information generated during this instance of compilation.
130  /// \param Lang Source programming language, eg. dwarf::DW_LANG_C99
131  /// \param File File info.
132  /// \param Producer Identify the producer of debugging information
133  /// and code. Usually this is a compiler
134  /// version string.
135  /// \param isOptimized A boolean flag which indicates whether optimization
136  /// is enabled or not.
137  /// \param Flags This string lists command line options. This
138  /// string is directly embedded in debug info
139  /// output which may be used by a tool
140  /// analyzing generated debugging information.
141  /// \param RV This indicates runtime version for languages like
142  /// Objective-C.
143  /// \param SplitName The name of the file that we'll split debug info
144  /// out into.
145  /// \param Kind The kind of debug information to generate.
146  /// \param DWOId The DWOId if this is a split skeleton compile unit.
147  /// \param SplitDebugInlining Whether to emit inline debug info.
148  /// \param DebugInfoForProfiling Whether to emit extra debug info for
149  /// profile collection.
150  /// \param NameTableKind Whether to emit .debug_gnu_pubnames,
151  /// .debug_pubnames, or no pubnames at all.
152  /// \param SysRoot The clang system root (value of -isysroot).
153  /// \param SDK The SDK name. On Darwin, this is the last component
154  /// of the sysroot.
155  DICompileUnit *
156  createCompileUnit(unsigned Lang, DIFile *File, StringRef Producer,
157  bool isOptimized, StringRef Flags, unsigned RV,
158  StringRef SplitName = StringRef(),
160  DICompileUnit::DebugEmissionKind::FullDebug,
161  uint64_t DWOId = 0, bool SplitDebugInlining = true,
162  bool DebugInfoForProfiling = false,
165  bool RangesBaseAddress = false, StringRef SysRoot = {},
166  StringRef SDK = {});
167 
168  /// Create a file descriptor to hold debugging information for a file.
169  /// \param Filename File name.
170  /// \param Directory Directory.
171  /// \param Checksum Optional checksum kind (e.g. CSK_MD5, CSK_SHA1, etc.)
172  /// and value.
173  /// \param Source Optional source text.
174  DIFile *
175  createFile(StringRef Filename, StringRef Directory,
178 
179  /// Create debugging information entry for a macro.
180  /// \param Parent Macro parent (could be nullptr).
181  /// \param Line Source line number where the macro is defined.
182  /// \param MacroType DW_MACINFO_define or DW_MACINFO_undef.
183  /// \param Name Macro name.
184  /// \param Value Macro value.
185  DIMacro *createMacro(DIMacroFile *Parent, unsigned Line, unsigned MacroType,
187 
188  /// Create debugging information temporary entry for a macro file.
189  /// List of macro node direct children will be calculated by DIBuilder,
190  /// using the \p Parent relationship.
191  /// \param Parent Macro file parent (could be nullptr).
192  /// \param Line Source line number where the macro file is included.
193  /// \param File File descriptor containing the name of the macro file.
194  DIMacroFile *createTempMacroFile(DIMacroFile *Parent, unsigned Line,
195  DIFile *File);
196 
197  /// Create a single enumerator value.
200  bool IsUnsigned = false);
201 
202  /// Create a DWARF unspecified type.
204 
205  /// Create C++11 nullptr type.
207 
208  /// Create debugging information entry for a basic
209  /// type.
210  /// \param Name Type name.
211  /// \param SizeInBits Size of the type.
212  /// \param Encoding DWARF encoding code, e.g., dwarf::DW_ATE_float.
213  /// \param Flags Optional DWARF attributes, e.g., DW_AT_endianity.
215  unsigned Encoding,
216  DINode::DIFlags Flags = DINode::FlagZero);
217 
218  /// Create debugging information entry for a string
219  /// type.
220  /// \param Name Type name.
221  /// \param SizeInBits Size of the type.
223 
224  /// Create debugging information entry for Fortran
225  /// assumed length string type.
226  /// \param Name Type name.
227  /// \param StringLength String length expressed as DIVariable *.
228  /// \param StrLocationExp Optional memory location of the string.
230  DIExpression *StrLocationExp = nullptr);
231 
232  /// Create debugging information entry for Fortran
233  /// assumed length string type.
234  /// \param Name Type name.
235  /// \param StringLengthExp String length expressed in DIExpression form.
236  /// \param StrLocationExp Optional memory location of the string.
238  DIExpression *StringLengthExp,
239  DIExpression *StrLocationExp = nullptr);
240 
241  /// Create debugging information entry for a qualified
242  /// type, e.g. 'const int'.
243  /// \param Tag Tag identifing type, e.g. dwarf::TAG_volatile_type
244  /// \param FromTy Base Type.
245  DIDerivedType *createQualifiedType(unsigned Tag, DIType *FromTy);
246 
247  /// Create debugging information entry for a pointer.
248  /// \param PointeeTy Type pointed by this pointer.
249  /// \param SizeInBits Size.
250  /// \param AlignInBits Alignment. (optional)
251  /// \param DWARFAddressSpace DWARF address space. (optional)
252  /// \param Name Pointer type name. (optional)
253  /// \param Annotations Member annotations.
254  DIDerivedType *
255  createPointerType(DIType *PointeeTy, uint64_t SizeInBits,
256  uint32_t AlignInBits = 0,
257  Optional<unsigned> DWARFAddressSpace = None,
258  StringRef Name = "", DINodeArray Annotations = nullptr);
259 
260  /// Create debugging information entry for a pointer to member.
261  /// \param PointeeTy Type pointed to by this pointer.
262  /// \param SizeInBits Size.
263  /// \param AlignInBits Alignment. (optional)
264  /// \param Class Type for which this pointer points to members of.
265  DIDerivedType *
266  createMemberPointerType(DIType *PointeeTy, DIType *Class,
267  uint64_t SizeInBits, uint32_t AlignInBits = 0,
268  DINode::DIFlags Flags = DINode::FlagZero);
269 
270  /// Create debugging information entry for a c++
271  /// style reference or rvalue reference type.
272  DIDerivedType *createReferenceType(unsigned Tag, DIType *RTy,
273  uint64_t SizeInBits = 0,
274  uint32_t AlignInBits = 0,
275  Optional<unsigned> DWARFAddressSpace =
276  None);
277 
278  /// Create debugging information entry for a typedef.
279  /// \param Ty Original type.
280  /// \param Name Typedef name.
281  /// \param File File where this type is defined.
282  /// \param LineNo Line number.
283  /// \param Context The surrounding context for the typedef.
284  /// \param AlignInBits Alignment. (optional)
285  /// \param Annotations Annotations. (optional)
287  unsigned LineNo, DIScope *Context,
288  uint32_t AlignInBits = 0,
289  DINodeArray Annotations = nullptr);
290 
291  /// Create debugging information entry for a 'friend'.
292  DIDerivedType *createFriend(DIType *Ty, DIType *FriendTy);
293 
294  /// Create debugging information entry to establish
295  /// inheritance relationship between two types.
296  /// \param Ty Original type.
297  /// \param BaseTy Base type. Ty is inherits from base.
298  /// \param BaseOffset Base offset.
299  /// \param VBPtrOffset Virtual base pointer offset.
300  /// \param Flags Flags to describe inheritance attribute,
301  /// e.g. private
303  uint64_t BaseOffset, uint32_t VBPtrOffset,
304  DINode::DIFlags Flags);
305 
306  /// Create debugging information entry for a member.
307  /// \param Scope Member scope.
308  /// \param Name Member name.
309  /// \param File File where this member is defined.
310  /// \param LineNo Line number.
311  /// \param SizeInBits Member size.
312  /// \param AlignInBits Member alignment.
313  /// \param OffsetInBits Member offset.
314  /// \param Flags Flags to encode member attribute, e.g. private
315  /// \param Ty Parent type.
316  /// \param Annotations Member annotations.
318  DIFile *File, unsigned LineNo,
319  uint64_t SizeInBits, uint32_t AlignInBits,
320  uint64_t OffsetInBits,
321  DINode::DIFlags Flags, DIType *Ty,
322  DINodeArray Annotations = nullptr);
323 
324  /// Create debugging information entry for a variant. A variant
325  /// normally should be a member of a variant part.
326  /// \param Scope Member scope.
327  /// \param Name Member name.
328  /// \param File File where this member is defined.
329  /// \param LineNo Line number.
330  /// \param SizeInBits Member size.
331  /// \param AlignInBits Member alignment.
332  /// \param OffsetInBits Member offset.
333  /// \param Flags Flags to encode member attribute, e.g. private
334  /// \param Discriminant The discriminant for this branch; null for
335  /// the default branch
336  /// \param Ty Parent type.
338  DIFile *File, unsigned LineNo,
339  uint64_t SizeInBits,
340  uint32_t AlignInBits,
341  uint64_t OffsetInBits,
342  Constant *Discriminant,
343  DINode::DIFlags Flags, DIType *Ty);
344 
345  /// Create debugging information entry for a bit field member.
346  /// \param Scope Member scope.
347  /// \param Name Member name.
348  /// \param File File where this member is defined.
349  /// \param LineNo Line number.
350  /// \param SizeInBits Member size.
351  /// \param OffsetInBits Member offset.
352  /// \param StorageOffsetInBits Member storage offset.
353  /// \param Flags Flags to encode member attribute.
354  /// \param Ty Parent type.
355  /// \param Annotations Member annotations.
357  DIFile *File, unsigned LineNo,
358  uint64_t SizeInBits,
359  uint64_t OffsetInBits,
360  uint64_t StorageOffsetInBits,
361  DINode::DIFlags Flags, DIType *Ty,
362  DINodeArray Annotations = nullptr);
363 
364  /// Create debugging information entry for a
365  /// C++ static data member.
366  /// \param Scope Member scope.
367  /// \param Name Member name.
368  /// \param File File where this member is declared.
369  /// \param LineNo Line number.
370  /// \param Ty Type of the static member.
371  /// \param Flags Flags to encode member attribute, e.g. private.
372  /// \param Val Const initializer of the member.
373  /// \param AlignInBits Member alignment.
375  DIFile *File, unsigned LineNo,
376  DIType *Ty, DINode::DIFlags Flags,
377  Constant *Val,
378  uint32_t AlignInBits = 0);
379 
380  /// Create debugging information entry for Objective-C
381  /// instance variable.
382  /// \param Name Member name.
383  /// \param File File where this member is defined.
384  /// \param LineNo Line number.
385  /// \param SizeInBits Member size.
386  /// \param AlignInBits Member alignment.
387  /// \param OffsetInBits Member offset.
388  /// \param Flags Flags to encode member attribute, e.g. private
389  /// \param Ty Parent type.
390  /// \param PropertyNode Property associated with this ivar.
391  DIDerivedType *createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo,
392  uint64_t SizeInBits, uint32_t AlignInBits,
393  uint64_t OffsetInBits, DINode::DIFlags Flags,
394  DIType *Ty, MDNode *PropertyNode);
395 
396  /// Create debugging information entry for Objective-C
397  /// property.
398  /// \param Name Property name.
399  /// \param File File where this property is defined.
400  /// \param LineNumber Line number.
401  /// \param GetterName Name of the Objective C property getter selector.
402  /// \param SetterName Name of the Objective C property setter selector.
403  /// \param PropertyAttributes Objective C property attributes.
404  /// \param Ty Type.
406  unsigned LineNumber,
407  StringRef GetterName,
408  StringRef SetterName,
409  unsigned PropertyAttributes, DIType *Ty);
410 
411  /// Create debugging information entry for a class.
412  /// \param Scope Scope in which this class is defined.
413  /// \param Name class name.
414  /// \param File File where this member is defined.
415  /// \param LineNumber Line number.
416  /// \param SizeInBits Member size.
417  /// \param AlignInBits Member alignment.
418  /// \param OffsetInBits Member offset.
419  /// \param Flags Flags to encode member attribute, e.g. private
420  /// \param Elements class members.
421  /// \param VTableHolder Debug info of the base class that contains vtable
422  /// for this type. This is used in
423  /// DW_AT_containing_type. See DWARF documentation
424  /// for more info.
425  /// \param TemplateParms Template type parameters.
426  /// \param UniqueIdentifier A unique identifier for the class.
428  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
429  uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
430  DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
431  DIType *VTableHolder = nullptr, MDNode *TemplateParms = nullptr,
432  StringRef UniqueIdentifier = "");
433 
434  /// Create debugging information entry for a struct.
435  /// \param Scope Scope in which this struct is defined.
436  /// \param Name Struct name.
437  /// \param File File where this member is defined.
438  /// \param LineNumber Line number.
439  /// \param SizeInBits Member size.
440  /// \param AlignInBits Member alignment.
441  /// \param Flags Flags to encode member attribute, e.g. private
442  /// \param Elements Struct elements.
443  /// \param RunTimeLang Optional parameter, Objective-C runtime version.
444  /// \param UniqueIdentifier A unique identifier for the struct.
446  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
447  uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
448  DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
449  DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "");
450 
451  /// Create debugging information entry for an union.
452  /// \param Scope Scope in which this union is defined.
453  /// \param Name Union name.
454  /// \param File File where this member is defined.
455  /// \param LineNumber Line number.
456  /// \param SizeInBits Member size.
457  /// \param AlignInBits Member alignment.
458  /// \param Flags Flags to encode member attribute, e.g. private
459  /// \param Elements Union elements.
460  /// \param RunTimeLang Optional parameter, Objective-C runtime version.
461  /// \param UniqueIdentifier A unique identifier for the union.
463  DIFile *File, unsigned LineNumber,
464  uint64_t SizeInBits, uint32_t AlignInBits,
465  DINode::DIFlags Flags,
466  DINodeArray Elements,
467  unsigned RunTimeLang = 0,
468  StringRef UniqueIdentifier = "");
469 
470  /// Create debugging information entry for a variant part. A
471  /// variant part normally has a discriminator (though this is not
472  /// required) and a number of variant children.
473  /// \param Scope Scope in which this union is defined.
474  /// \param Name Union name.
475  /// \param File File where this member is defined.
476  /// \param LineNumber Line number.
477  /// \param SizeInBits Member size.
478  /// \param AlignInBits Member alignment.
479  /// \param Flags Flags to encode member attribute, e.g. private
480  /// \param Discriminator Discriminant member
481  /// \param Elements Variant elements.
482  /// \param UniqueIdentifier A unique identifier for the union.
484  DIFile *File, unsigned LineNumber,
485  uint64_t SizeInBits, uint32_t AlignInBits,
486  DINode::DIFlags Flags,
487  DIDerivedType *Discriminator,
488  DINodeArray Elements,
489  StringRef UniqueIdentifier = "");
490 
491  /// Create debugging information for template
492  /// type parameter.
493  /// \param Scope Scope in which this type is defined.
494  /// \param Name Type parameter name.
495  /// \param Ty Parameter type.
496  /// \param IsDefault Parameter is default or not
498  StringRef Name,
499  DIType *Ty,
500  bool IsDefault);
501 
502  /// Create debugging information for template
503  /// value parameter.
504  /// \param Scope Scope in which this type is defined.
505  /// \param Name Value parameter name.
506  /// \param Ty Parameter type.
507  /// \param IsDefault Parameter is default or not
508  /// \param Val Constant parameter value.
511  bool IsDefault, Constant *Val);
512 
513  /// Create debugging information for a template template parameter.
514  /// \param Scope Scope in which this type is defined.
515  /// \param Name Value parameter name.
516  /// \param Ty Parameter type.
517  /// \param Val The fully qualified name of the template.
519  StringRef Name,
520  DIType *Ty,
521  StringRef Val);
522 
523  /// Create debugging information for a template parameter pack.
524  /// \param Scope Scope in which this type is defined.
525  /// \param Name Value parameter name.
526  /// \param Ty Parameter type.
527  /// \param Val An array of types in the pack.
529  StringRef Name,
530  DIType *Ty,
531  DINodeArray Val);
532 
533  /// Create debugging information entry for an array.
534  /// \param Size Array size.
535  /// \param AlignInBits Alignment.
536  /// \param Ty Element type.
537  /// \param Subscripts Subscripts.
538  /// \param DataLocation The location of the raw data of a descriptor-based
539  /// Fortran array, either a DIExpression* or
540  /// a DIVariable*.
541  /// \param Associated The associated attribute of a descriptor-based
542  /// Fortran array, either a DIExpression* or
543  /// a DIVariable*.
544  /// \param Allocated The allocated attribute of a descriptor-based
545  /// Fortran array, either a DIExpression* or
546  /// a DIVariable*.
547  /// \param Rank The rank attribute of a descriptor-based
548  /// Fortran array, either a DIExpression* or
549  /// a DIVariable*.
551  uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts,
552  PointerUnion<DIExpression *, DIVariable *> DataLocation = nullptr,
553  PointerUnion<DIExpression *, DIVariable *> Associated = nullptr,
554  PointerUnion<DIExpression *, DIVariable *> Allocated = nullptr,
556 
557  /// Create debugging information entry for a vector type.
558  /// \param Size Array size.
559  /// \param AlignInBits Alignment.
560  /// \param Ty Element type.
561  /// \param Subscripts Subscripts.
563  DIType *Ty, DINodeArray Subscripts);
564 
565  /// Create debugging information entry for an
566  /// enumeration.
567  /// \param Scope Scope in which this enumeration is defined.
568  /// \param Name Union name.
569  /// \param File File where this member is defined.
570  /// \param LineNumber Line number.
571  /// \param SizeInBits Member size.
572  /// \param AlignInBits Member alignment.
573  /// \param Elements Enumeration elements.
574  /// \param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
575  /// \param UniqueIdentifier A unique identifier for the enum.
576  /// \param IsScoped Boolean flag indicate if this is C++11/ObjC 'enum class'.
578  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
579  uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements,
580  DIType *UnderlyingType, StringRef UniqueIdentifier = "", bool IsScoped = false);
581 
582  /// Create debugging information entry for a set.
583  /// \param Scope Scope in which this set is defined.
584  /// \param Name Set name.
585  /// \param File File where this set is defined.
586  /// \param LineNo Line number.
587  /// \param SizeInBits Set size.
588  /// \param AlignInBits Set alignment.
589  /// \param Ty Base type of the set.
591  unsigned LineNo, uint64_t SizeInBits,
592  uint32_t AlignInBits, DIType *Ty);
593 
594  /// Create subroutine type.
595  /// \param ParameterTypes An array of subroutine parameter types. This
596  /// includes return type at 0th index.
597  /// \param Flags E.g.: LValueReference.
598  /// These flags are used to emit dwarf attributes.
599  /// \param CC Calling convention, e.g. dwarf::DW_CC_normal
601  createSubroutineType(DITypeRefArray ParameterTypes,
602  DINode::DIFlags Flags = DINode::FlagZero,
603  unsigned CC = 0);
604 
605  /// Create a distinct clone of \p SP with FlagArtificial set.
607 
608  /// Create a uniqued clone of \p Ty with FlagArtificial set.
609  static DIType *createArtificialType(DIType *Ty);
610 
611  /// Create a uniqued clone of \p Ty with FlagObjectPointer and
612  /// FlagArtificial set.
614 
615  /// Create a permanent forward-declared type.
617  DIScope *Scope, DIFile *F, unsigned Line,
618  unsigned RuntimeLang = 0,
619  uint64_t SizeInBits = 0,
620  uint32_t AlignInBits = 0,
621  StringRef UniqueIdentifier = "");
622 
623  /// Create a temporary forward-declared type.
625  unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
626  unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
627  uint32_t AlignInBits = 0, DINode::DIFlags Flags = DINode::FlagFwdDecl,
628  StringRef UniqueIdentifier = "", DINodeArray Annotations = nullptr);
629 
630  /// Retain DIScope* in a module even if it is not referenced
631  /// through debug info anchors.
632  void retainType(DIScope *T);
633 
634  /// Create unspecified parameter type
635  /// for a subroutine type.
637 
638  /// Get a DINodeArray, create one if required.
639  DINodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
640 
641  /// Get a DIMacroNodeArray, create one if required.
642  DIMacroNodeArray getOrCreateMacroArray(ArrayRef<Metadata *> Elements);
643 
644  /// Get a DITypeRefArray, create one if required.
646 
647  /// Create a descriptor for a value range. This
648  /// implicitly uniques the values returned.
649  DISubrange *getOrCreateSubrange(int64_t Lo, int64_t Count);
650  DISubrange *getOrCreateSubrange(int64_t Lo, Metadata *CountNode);
651  DISubrange *getOrCreateSubrange(Metadata *Count, Metadata *LowerBound,
652  Metadata *UpperBound, Metadata *Stride);
653 
656  DIGenericSubrange::BoundType LowerBound,
657  DIGenericSubrange::BoundType UpperBound,
659 
660  /// Create a new descriptor for the specified variable.
661  /// \param Context Variable scope.
662  /// \param Name Name of the variable.
663  /// \param LinkageName Mangled name of the variable.
664  /// \param File File where this variable is defined.
665  /// \param LineNo Line number.
666  /// \param Ty Variable Type.
667  /// \param IsLocalToUnit Boolean flag indicate whether this variable is
668  /// externally visible or not.
669  /// \param Expr The location of the global relative to the attached
670  /// GlobalVariable.
671  /// \param Decl Reference to the corresponding declaration.
672  /// \param AlignInBits Variable alignment(or 0 if no alignment attr was
673  /// specified)
676  unsigned LineNo, DIType *Ty, bool IsLocalToUnit, bool isDefined = true,
677  DIExpression *Expr = nullptr, MDNode *Decl = nullptr,
678  MDTuple *TemplateParams = nullptr, uint32_t AlignInBits = 0,
679  DINodeArray Annotations = nullptr);
680 
681  /// Identical to createGlobalVariable
682  /// except that the resulting DbgNode is temporary and meant to be RAUWed.
685  unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl = nullptr,
686  MDTuple *TemplateParams= nullptr, uint32_t AlignInBits = 0);
687 
688  /// Create a new descriptor for an auto variable. This is a local variable
689  /// that is not a subprogram parameter.
690  ///
691  /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
692  /// leads to a \a DISubprogram.
693  ///
694  /// If \c AlwaysPreserve, this variable will be referenced from its
695  /// containing subprogram, and will survive some optimizations.
698  unsigned LineNo, DIType *Ty, bool AlwaysPreserve = false,
699  DINode::DIFlags Flags = DINode::FlagZero,
700  uint32_t AlignInBits = 0);
701 
702  /// Create a new descriptor for an label.
703  ///
704  /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
705  /// leads to a \a DISubprogram.
706  DILabel *
707  createLabel(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
708  bool AlwaysPreserve = false);
709 
710  /// Create a new descriptor for a parameter variable.
711  ///
712  /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
713  /// leads to a \a DISubprogram.
714  ///
715  /// \c ArgNo is the index (starting from \c 1) of this variable in the
716  /// subprogram parameters. \c ArgNo should not conflict with other
717  /// parameters of the same subprogram.
718  ///
719  /// If \c AlwaysPreserve, this variable will be referenced from its
720  /// containing subprogram, and will survive some optimizations.
723  DIFile *File, unsigned LineNo, DIType *Ty,
724  bool AlwaysPreserve = false,
725  DINode::DIFlags Flags = DINode::FlagZero,
726  DINodeArray Annotations = nullptr);
727 
728  /// Create a new descriptor for the specified
729  /// variable which has a complex address expression for its address.
730  /// \param Addr An array of complex address operations.
732 
733  /// Create an expression for a variable that does not have an address, but
734  /// does have a constant value.
736  return DIExpression::get(
737  VMContext, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_stack_value});
738  }
739 
740  /// Create a new descriptor for the specified subprogram.
741  /// See comments in DISubprogram* for descriptions of these fields.
742  /// \param Scope Function scope.
743  /// \param Name Function name.
744  /// \param LinkageName Mangled function name.
745  /// \param File File where this variable is defined.
746  /// \param LineNo Line number.
747  /// \param Ty Function type.
748  /// \param ScopeLine Set to the beginning of the scope this starts
749  /// \param Flags e.g. is this function prototyped or not.
750  /// These flags are used to emit dwarf attributes.
751  /// \param SPFlags Additional flags specific to subprograms.
752  /// \param TParams Function template parameters.
753  /// \param ThrownTypes Exception types this function may throw.
754  /// \param Annotations Attribute Annotations.
755  /// \param TargetFuncName The name of the target function if this is
756  /// a trampoline.
757  DISubprogram *
759  DIFile *File, unsigned LineNo, DISubroutineType *Ty,
760  unsigned ScopeLine, DINode::DIFlags Flags = DINode::FlagZero,
761  DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
762  DITemplateParameterArray TParams = nullptr,
763  DISubprogram *Decl = nullptr,
764  DITypeArray ThrownTypes = nullptr,
765  DINodeArray Annotations = nullptr,
766  StringRef TargetFuncName = "");
767 
768  /// Identical to createFunction,
769  /// except that the resulting DbgNode is meant to be RAUWed.
771  DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
772  unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
773  DINode::DIFlags Flags = DINode::FlagZero,
774  DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
775  DITemplateParameterArray TParams = nullptr,
776  DISubprogram *Decl = nullptr, DITypeArray ThrownTypes = nullptr);
777 
778  /// Create a new descriptor for the specified C++ method.
779  /// See comments in \a DISubprogram* for descriptions of these fields.
780  /// \param Scope Function scope.
781  /// \param Name Function name.
782  /// \param LinkageName Mangled function name.
783  /// \param File File where this variable is defined.
784  /// \param LineNo Line number.
785  /// \param Ty Function type.
786  /// \param VTableIndex Index no of this method in virtual table, or -1u if
787  /// unrepresentable.
788  /// \param ThisAdjustment
789  /// MS ABI-specific adjustment of 'this' that occurs
790  /// in the prologue.
791  /// \param VTableHolder Type that holds vtable.
792  /// \param Flags e.g. is this function prototyped or not.
793  /// This flags are used to emit dwarf attributes.
794  /// \param SPFlags Additional flags specific to subprograms.
795  /// \param TParams Function template parameters.
796  /// \param ThrownTypes Exception types this function may throw.
797  DISubprogram *
799  DIFile *File, unsigned LineNo, DISubroutineType *Ty,
800  unsigned VTableIndex = 0, int ThisAdjustment = 0,
801  DIType *VTableHolder = nullptr,
802  DINode::DIFlags Flags = DINode::FlagZero,
803  DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
804  DITemplateParameterArray TParams = nullptr,
805  DITypeArray ThrownTypes = nullptr);
806 
807  /// Create common block entry for a Fortran common block.
808  /// \param Scope Scope of this common block.
809  /// \param decl Global variable declaration.
810  /// \param Name The name of this common block.
811  /// \param File The file this common block is defined.
812  /// \param LineNo Line number.
814  StringRef Name, DIFile *File,
815  unsigned LineNo);
816 
817  /// This creates new descriptor for a namespace with the specified
818  /// parent scope.
819  /// \param Scope Namespace scope
820  /// \param Name Name of this namespace
821  /// \param ExportSymbols True for C++ inline namespaces.
823  bool ExportSymbols);
824 
825  /// This creates new descriptor for a module with the specified
826  /// parent scope.
827  /// \param Scope Parent scope
828  /// \param Name Name of this module
829  /// \param ConfigurationMacros
830  /// A space-separated shell-quoted list of -D macro
831  /// definitions as they would appear on a command line.
832  /// \param IncludePath The path to the module map file.
833  /// \param APINotesFile The path to an API notes file for this module.
834  /// \param File Source file of the module.
835  /// Used for Fortran modules.
836  /// \param LineNo Source line number of the module.
837  /// Used for Fortran modules.
838  /// \param IsDecl This is a module declaration; default to false;
839  /// when set to true, only Scope and Name are required
840  /// as this entry is just a hint for the debugger to find
841  /// the corresponding definition in the global scope.
843  StringRef ConfigurationMacros, StringRef IncludePath,
844  StringRef APINotesFile = {}, DIFile *File = nullptr,
845  unsigned LineNo = 0, bool IsDecl = false);
846 
847  /// This creates a descriptor for a lexical block with a new file
848  /// attached. This merely extends the existing
849  /// lexical block as it crosses a file.
850  /// \param Scope Lexical block.
851  /// \param File Source file.
852  /// \param Discriminator DWARF path discriminator value.
853  DILexicalBlockFile *createLexicalBlockFile(DIScope *Scope, DIFile *File,
854  unsigned Discriminator = 0);
855 
856  /// This creates a descriptor for a lexical block with the
857  /// specified parent context.
858  /// \param Scope Parent lexical scope.
859  /// \param File Source file.
860  /// \param Line Line number.
861  /// \param Col Column number.
862  DILexicalBlock *createLexicalBlock(DIScope *Scope, DIFile *File,
863  unsigned Line, unsigned Col);
864 
865  /// Create a descriptor for an imported module.
866  /// \param Context The scope this module is imported into
867  /// \param NS The namespace being imported here.
868  /// \param File File where the declaration is located.
869  /// \param Line Line number of the declaration.
870  /// \param Elements Renamed elements.
871  DIImportedEntity *createImportedModule(DIScope *Context, DINamespace *NS,
872  DIFile *File, unsigned Line,
873  DINodeArray Elements = nullptr);
874 
875  /// Create a descriptor for an imported module.
876  /// \param Context The scope this module is imported into.
877  /// \param NS An aliased namespace.
878  /// \param File File where the declaration is located.
879  /// \param Line Line number of the declaration.
880  /// \param Elements Renamed elements.
881  DIImportedEntity *createImportedModule(DIScope *Context,
882  DIImportedEntity *NS, DIFile *File,
883  unsigned Line,
884  DINodeArray Elements = nullptr);
885 
886  /// Create a descriptor for an imported module.
887  /// \param Context The scope this module is imported into.
888  /// \param M The module being imported here
889  /// \param File File where the declaration is located.
890  /// \param Line Line number of the declaration.
891  /// \param Elements Renamed elements.
892  DIImportedEntity *createImportedModule(DIScope *Context, DIModule *M,
893  DIFile *File, unsigned Line,
894  DINodeArray Elements = nullptr);
895 
896  /// Create a descriptor for an imported function.
897  /// \param Context The scope this module is imported into.
898  /// \param Decl The declaration (or definition) of a function, type, or
899  /// variable.
900  /// \param File File where the declaration is located.
901  /// \param Line Line number of the declaration.
902  /// \param Elements Renamed elements.
903  DIImportedEntity *createImportedDeclaration(DIScope *Context, DINode *Decl,
904  DIFile *File, unsigned Line,
905  StringRef Name = "",
906  DINodeArray Elements = nullptr);
907 
908  /// Insert a new llvm.dbg.declare intrinsic call.
909  /// \param Storage llvm::Value of the variable
910  /// \param VarInfo Variable's debug info descriptor.
911  /// \param Expr A complex location expression.
912  /// \param DL Debug info location.
913  /// \param InsertAtEnd Location for the new intrinsic.
914  Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
915  DIExpression *Expr, const DILocation *DL,
916  BasicBlock *InsertAtEnd);
917 
918  /// Insert a new llvm.dbg.declare intrinsic call.
919  /// \param Storage llvm::Value of the variable
920  /// \param VarInfo Variable's debug info descriptor.
921  /// \param Expr A complex location expression.
922  /// \param DL Debug info location.
923  /// \param InsertBefore Location for the new intrinsic.
924  Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
925  DIExpression *Expr, const DILocation *DL,
926  Instruction *InsertBefore);
927 
928  /// Insert a new llvm.dbg.label intrinsic call.
929  /// \param LabelInfo Label's debug info descriptor.
930  /// \param DL Debug info location.
931  /// \param InsertBefore Location for the new intrinsic.
932  Instruction *insertLabel(DILabel *LabelInfo, const DILocation *DL,
933  Instruction *InsertBefore);
934 
935  /// Insert a new llvm.dbg.label intrinsic call.
936  /// \param LabelInfo Label's debug info descriptor.
937  /// \param DL Debug info location.
938  /// \param InsertAtEnd Location for the new intrinsic.
939  Instruction *insertLabel(DILabel *LabelInfo, const DILocation *DL,
940  BasicBlock *InsertAtEnd);
941 
942  /// Insert a new llvm.dbg.value intrinsic call.
943  /// \param Val llvm::Value of the variable
944  /// \param VarInfo Variable's debug info descriptor.
945  /// \param Expr A complex location expression.
946  /// \param DL Debug info location.
947  /// \param InsertAtEnd Location for the new intrinsic.
948  Instruction *insertDbgValueIntrinsic(llvm::Value *Val,
949  DILocalVariable *VarInfo,
950  DIExpression *Expr,
951  const DILocation *DL,
952  BasicBlock *InsertAtEnd);
953 
954  /// Insert a new llvm.dbg.value intrinsic call.
955  /// \param Val llvm::Value of the variable
956  /// \param VarInfo Variable's debug info descriptor.
957  /// \param Expr A complex location expression.
958  /// \param DL Debug info location.
959  /// \param InsertBefore Location for the new intrinsic.
960  Instruction *insertDbgValueIntrinsic(llvm::Value *Val,
961  DILocalVariable *VarInfo,
962  DIExpression *Expr,
963  const DILocation *DL,
964  Instruction *InsertBefore);
965 
966  /// Insert a new llvm.dbg.addr intrinsic call.
967  /// \param Addr llvm::Value of the address
968  /// \param VarInfo Variable's debug info descriptor.
969  /// \param Expr A complex location expression.
970  /// \param DL Debug info location.
971  /// \param InsertAtEnd Location for the new intrinsic.
972  Instruction *insertDbgAddrIntrinsic(llvm::Value *Addr,
973  DILocalVariable *VarInfo,
974  DIExpression *Expr,
975  const DILocation *DL,
976  BasicBlock *InsertAtEnd);
977 
978  /// Insert a new llvm.dbg.addr intrinsic call.
979  /// \param Addr llvm::Value of the address.
980  /// \param VarInfo Variable's debug info descriptor.
981  /// \param Expr A complex location expression.
982  /// \param DL Debug info location.
983  /// \param InsertBefore Location for the new intrinsic.
984  Instruction *insertDbgAddrIntrinsic(llvm::Value *Addr,
985  DILocalVariable *VarInfo,
986  DIExpression *Expr,
987  const DILocation *DL,
988  Instruction *InsertBefore);
989 
990  /// Replace the vtable holder in the given type.
991  ///
992  /// If this creates a self reference, it may orphan some unresolved cycles
993  /// in the operands of \c T, so \a DIBuilder needs to track that.
994  void replaceVTableHolder(DICompositeType *&T,
995  DIType *VTableHolder);
996 
997  /// Replace arrays on a composite type.
998  ///
999  /// If \c T is resolved, but the arrays aren't -- which can happen if \c T
1000  /// has a self-reference -- \a DIBuilder needs to track the array to
1001  /// resolve cycles.
1002  void replaceArrays(DICompositeType *&T, DINodeArray Elements,
1003  DINodeArray TParams = DINodeArray());
1004 
1005  /// Replace a temporary node.
1006  ///
1007  /// Call \a MDNode::replaceAllUsesWith() on \c N, replacing it with \c
1008  /// Replacement.
1009  ///
1010  /// If \c Replacement is the same as \c N.get(), instead call \a
1011  /// MDNode::replaceWithUniqued(). In this case, the uniqued node could
1012  /// have a different address, so we return the final address.
1013  template <class NodeTy>
1014  NodeTy *replaceTemporary(TempMDNode &&N, NodeTy *Replacement) {
1015  if (N.get() == Replacement)
1016  return cast<NodeTy>(MDNode::replaceWithUniqued(std::move(N)));
1017 
1018  N->replaceAllUsesWith(Replacement);
1019  return Replacement;
1020  }
1021  };
1022 
1023  // Create wrappers for C Binding types (see CBindingWrapping.h).
1025 
1026 } // end namespace llvm
1027 
1028 #endif // LLVM_IR_DIBUILDER_H
llvm::DIBuilder::createModule
DIModule * createModule(DIScope *Scope, StringRef Name, StringRef ConfigurationMacros, StringRef IncludePath, StringRef APINotesFile={}, DIFile *File=nullptr, unsigned LineNo=0, bool IsDecl=false)
This creates new descriptor for a module with the specified parent scope.
Definition: DIBuilder.cpp:922
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::DIType
Base class for types.
Definition: DebugInfoMetadata.h:658
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::DIBuilder::getOrCreateTypeArray
DITypeRefArray getOrCreateTypeArray(ArrayRef< Metadata * > Elements)
Get a DITypeRefArray, create one if required.
Definition: DIBuilder.cpp:685
llvm::DIBuilder::finalize
void finalize()
Construct any deferred debug info descriptors.
Definition: DIBuilder.cpp:79
Optional.h
llvm::DIBuilder::replaceVTableHolder
void replaceVTableHolder(DICompositeType *&T, DIType *VTableHolder)
Replace the vtable holder in the given type.
Definition: DIBuilder.cpp:1116
llvm::DIBuilder
Definition: DIBuilder.h:41
DebugInfoMetadata.h
llvm::DIGenericSubrange
Definition: DebugInfoMetadata.h:363
llvm::Function
Definition: Function.h:60
llvm::DIBuilder::finalizeSubprogram
void finalizeSubprogram(DISubprogram *SP)
Finalize a specific subprogram - no new variables may be added to this subprogram afterwards.
Definition: DIBuilder.cpp:59
StringRef.h
llvm::DIBuilder::createBitFieldMemberType
DIDerivedType * createBitFieldMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations=nullptr)
Create debugging information entry for a bit field member.
Definition: DIBuilder.cpp:403
llvm::lltok::NameTableKind
@ NameTableKind
Definition: LLToken.h:415
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1185
llvm::DIBuilder::createPointerType
DIDerivedType * createPointerType(DIType *PointeeTy, uint64_t SizeInBits, uint32_t AlignInBits=0, Optional< unsigned > DWARFAddressSpace=None, StringRef Name="", DINodeArray Annotations=nullptr)
Create debugging information entry for a pointer.
Definition: DIBuilder.cpp:317
llvm::DIStringType
String type, Fortran CHARACTER(n)
Definition: DebugInfoMetadata.h:832
llvm::DIFile::ChecksumInfo
A single checksum, represented by a Kind and a Value (a string).
Definition: DebugInfoMetadata.h:546
llvm::DIBuilder::createTempGlobalVariableFwdDecl
DIGlobalVariable * createTempGlobalVariableFwdDecl(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl=nullptr, MDTuple *TemplateParams=nullptr, uint32_t AlignInBits=0)
Identical to createGlobalVariable except that the resulting DbgNode is temporary and meant to be RAUW...
Definition: DIBuilder.cpp:755
MapVector.h
llvm::DILocation
Debug location.
Definition: DebugInfoMetadata.h:1551
DenseMap.h
llvm::DIBuilder::createTempFunctionFwdDecl
DISubprogram * createTempFunctionFwdDecl(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine, DINode::DIFlags Flags=DINode::FlagZero, DISubprogram::DISPFlags SPFlags=DISubprogram::SPFlagZero, DITemplateParameterArray TParams=nullptr, DISubprogram *Decl=nullptr, DITypeArray ThrownTypes=nullptr)
Identical to createFunction, except that the resulting DbgNode is meant to be RAUWed.
Definition: DIBuilder.cpp:865
llvm::Optional
Definition: APInt.h:33
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::MapVector
This class implements a map that also provides access to all stored values in a deterministic order.
Definition: MapVector.h:37
llvm::DIBuilder::createMemberType
DIDerivedType * createMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations=nullptr)
Create debugging information entry for a member.
Definition: DIBuilder.cpp:377
llvm::DIBuilder::createSubroutineType
DISubroutineType * createSubroutineType(DITypeRefArray ParameterTypes, DINode::DIFlags Flags=DINode::FlagZero, unsigned CC=0)
Create subroutine type.
Definition: DIBuilder.cpp:544
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2548
llvm::DIBuilder::createQualifiedType
DIDerivedType * createQualifiedType(unsigned Tag, DIType *FromTy)
Create debugging information entry for a qualified type, e.g.
Definition: DIBuilder.cpp:311
llvm::DIBuilder::DIBuilder
DIBuilder(Module &M, bool AllowUnresolved=true, DICompileUnit *CU=nullptr)
Construct a builder for a module.
Definition: DIBuilder.cpp:31
llvm::DINameKind::LinkageName
@ LinkageName
llvm::DIBuilder::createStringType
DIStringType * createStringType(StringRef Name, uint64_t SizeInBits)
Create debugging information entry for a string type.
Definition: DIBuilder.cpp:289
llvm::DIBuilder::createObjCProperty
DIObjCProperty * createObjCProperty(StringRef Name, DIFile *File, unsigned LineNumber, StringRef GetterName, StringRef SetterName, unsigned PropertyAttributes, DIType *Ty)
Create debugging information entry for Objective-C property.
Definition: DIBuilder.cpp:441
llvm::DICompileUnit::DebugEmissionKind
DebugEmissionKind
Definition: DebugInfoMetadata.h:1321
llvm::DIBuilder::createReplaceableCompositeType
DICompositeType * createReplaceableCompositeType(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang=0, uint64_t SizeInBits=0, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagFwdDecl, StringRef UniqueIdentifier="", DINodeArray Annotations=nullptr)
Create a temporary forward-declared type.
Definition: DIBuilder.cpp:660
llvm::DINamespace
Definition: DebugInfoMetadata.h:2248
llvm::DIBuilder::createFile
DIFile * createFile(StringRef Filename, StringRef Directory, Optional< DIFile::ChecksumInfo< StringRef >> Checksum=None, Optional< StringRef > Source=None)
Create a file descriptor to hold debugging information for a file.
Definition: DIBuilder.cpp:229
llvm::MDNode::get
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1289
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::DIBuilder::createTemplateParameterPack
DITemplateValueParameter * createTemplateParameterPack(DIScope *Scope, StringRef Name, DIType *Ty, DINodeArray Val)
Create debugging information for a template parameter pack.
Definition: DIBuilder.cpp:481
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:55
llvm::Annotations
Annotations lets you mark points and ranges inside source code, for tests:
Definition: Annotations.h:48
llvm::DIBuilder::createAutoVariable
DILocalVariable * createAutoVariable(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve=false, DINode::DIFlags Flags=DINode::FlagZero, uint32_t AlignInBits=0)
Create a new descriptor for an auto variable.
Definition: DIBuilder.cpp:795
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::DITypeRefArray
Definition: DebugInfoMetadata.h:69
llvm::DIBuilder::createSetType
DIDerivedType * createSetType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, DIType *Ty)
Create debugging information entry for a set.
Definition: DIBuilder.cpp:564
llvm::DIBuilder::createArtificialType
static DIType * createArtificialType(DIType *Ty)
Create a uniqued clone of Ty with FlagArtificial set.
Definition: DIBuilder.cpp:620
llvm::DIObjCProperty
Definition: DebugInfoMetadata.h:3203
DEFINE_ISA_CONVERSION_FUNCTIONS
#define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref)
Definition: CBindingWrapping.h:28
llvm::DIBuilder::replaceTemporary
NodeTy * replaceTemporary(TempMDNode &&N, NodeTy *Replacement)
Replace a temporary node.
Definition: DIBuilder.h:1014
llvm::DIBuilder::createStaticMemberType
DIDerivedType * createStaticMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, DIType *Ty, DINode::DIFlags Flags, Constant *Val, uint32_t AlignInBits=0)
Create debugging information entry for a C++ static data member.
Definition: DIBuilder.cpp:418
llvm::ISD::Constant
@ Constant
Definition: ISDOpcodes.h:76
llvm::DILocalVariable
Local variable.
Definition: DebugInfoMetadata.h:3048
llvm::DIMacro
Definition: DebugInfoMetadata.h:3438
llvm::DIBuilder::createMacro
DIMacro * createMacro(DIMacroFile *Parent, unsigned Line, unsigned MacroType, StringRef Name, StringRef Value=StringRef())
Create debugging information entry for a macro.
Definition: DIBuilder.cpp:235
llvm::DIBuilder::createTempMacroFile
DIMacroFile * createTempMacroFile(DIMacroFile *Parent, unsigned Line, DIFile *File)
Create debugging information temporary entry for a macro file.
Definition: DIBuilder.cpp:247
llvm::DIBuilder::createCommonBlock
DICommonBlock * createCommonBlock(DIScope *Scope, DIGlobalVariable *decl, StringRef Name, DIFile *File, unsigned LineNo)
Create common block entry for a Fortran common block.
Definition: DIBuilder.cpp:903
llvm::DIBuilder::retainType
void retainType(DIScope *T)
Retain DIScope* in a module even if it is not referenced through debug info anchors.
Definition: DIBuilder.cpp:635
llvm::DISubprogram::DISPFlags
DISPFlags
Debug info subprogram flags.
Definition: DebugInfoMetadata.h:1812
llvm::MDTuple
Tuple of metadata.
Definition: Metadata.h:1230
llvm::DIBuilder::createEnumerator
DIEnumerator * createEnumerator(StringRef Name, const APSInt &Value)
Create a single enumerator value.
Definition: DIBuilder.cpp:267
llvm::DISubrange
Array subrange.
Definition: DebugInfoMetadata.h:300
llvm::DIBuilder::createFriend
DIDerivedType * createFriend(DIType *Ty, DIType *FriendTy)
Create debugging information entry for a 'friend'.
Definition: DIBuilder.cpp:358
llvm::DITemplateTypeParameter
Definition: DebugInfoMetadata.h:2393
llvm::Instruction
Definition: Instruction.h:42
llvm::APSInt
An arbitrary precision integer that knows its signedness.
Definition: APSInt.h:23
llvm::DIBuilder::createUnionType
DICompositeType * createUnionType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DINodeArray Elements, unsigned RunTimeLang=0, StringRef UniqueIdentifier="")
Create debugging information entry for an union.
Definition: DIBuilder.cpp:518
llvm::DIBuilder::createTypedef
DIDerivedType * createTypedef(DIType *Ty, StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context, uint32_t AlignInBits=0, DINodeArray Annotations=nullptr)
Create debugging information entry for a typedef.
Definition: DIBuilder.cpp:348
llvm::DIBuilder::createVariantPart
DICompositeType * createVariantPart(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DIDerivedType *Discriminator, DINodeArray Elements, StringRef UniqueIdentifier="")
Create debugging information entry for a variant part.
Definition: DIBuilder.cpp:531
llvm::Metadata
Root of the metadata hierarchy.
Definition: Metadata.h:62
llvm::DIBuilder::replaceArrays
void replaceArrays(DICompositeType *&T, DINodeArray Elements, DINodeArray TParams=DINodeArray())
Replace arrays on a composite type.
Definition: DIBuilder.cpp:1135
llvm::None
const NoneType None
Definition: None.h:24
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::DIBuilder::createObjectPointerType
static DIType * createObjectPointerType(DIType *Ty)
Create a uniqued clone of Ty with FlagObjectPointer and FlagArtificial set.
Definition: DIBuilder.cpp:627
llvm::DICommonBlock
Definition: DebugInfoMetadata.h:2989
llvm::DIBuilder::createReferenceType
DIDerivedType * createReferenceType(unsigned Tag, DIType *RTy, uint64_t SizeInBits=0, uint32_t AlignInBits=0, Optional< unsigned > DWARFAddressSpace=None)
Create debugging information entry for a c++ style reference or rvalue reference type.
Definition: DIBuilder.cpp:339
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::DIEnumerator
Enumeration value.
Definition: DebugInfoMetadata.h:411
llvm::DIBuilder::createMethod
DISubprogram * createMethod(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, unsigned VTableIndex=0, int ThisAdjustment=0, DIType *VTableHolder=nullptr, DINode::DIFlags Flags=DINode::FlagZero, DISubprogram::DISPFlags SPFlags=DISubprogram::SPFlagZero, DITemplateParameterArray TParams=nullptr, DITypeArray ThrownTypes=nullptr)
Create a new descriptor for the specified C++ method.
Definition: DIBuilder.cpp:880
uint64_t
llvm::DIBuilder::createForwardDecl
DICompositeType * createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang=0, uint64_t SizeInBits=0, uint32_t AlignInBits=0, StringRef UniqueIdentifier="")
Create a permanent forward-declared type.
Definition: DIBuilder.cpp:646
llvm::DIBuilder::createArrayType
DICompositeType * createArrayType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts, PointerUnion< DIExpression *, DIVariable * > DataLocation=nullptr, PointerUnion< DIExpression *, DIVariable * > Associated=nullptr, PointerUnion< DIExpression *, DIVariable * > Allocated=nullptr, PointerUnion< DIExpression *, DIVariable * > Rank=nullptr)
Create debugging information entry for an array.
Definition: DIBuilder.cpp:577
Addr
uint64_t Addr
Definition: ELFObjHandler.cpp:78
llvm::DIBuilder::createEnumerationType
DICompositeType * createEnumerationType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements, DIType *UnderlyingType, StringRef UniqueIdentifier="", bool IsScoped=false)
Create debugging information entry for an enumeration.
Definition: DIBuilder.cpp:550
llvm::DIBuilder::createClassType
DICompositeType * createClassType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, DIType *VTableHolder=nullptr, MDNode *TemplateParms=nullptr, StringRef UniqueIdentifier="")
Create debugging information entry for a class.
Definition: DIBuilder.cpp:488
llvm::DIBuilder::createExpression
DIExpression * createExpression(ArrayRef< uint64_t > Addr=None)
Create a new descriptor for the specified variable which has a complex address expression for its add...
Definition: DIBuilder.cpp:833
llvm::DIGlobalVariable
Global variables.
Definition: DebugInfoMetadata.h:2904
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::MDNode::replaceWithUniqued
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithUniqued(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a uniqued one.
Definition: Metadata.h:1080
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
llvm::DIBuilder::createTemplateTemplateParameter
DITemplateValueParameter * createTemplateTemplateParameter(DIScope *Scope, StringRef Name, DIType *Ty, StringRef Val)
Create debugging information for a template template parameter.
Definition: DIBuilder.cpp:473
llvm::DenseMap
Definition: DenseMap.h:716
llvm::DIBuilder::createMemberPointerType
DIDerivedType * createMemberPointerType(DIType *PointeeTy, DIType *Class, uint64_t SizeInBits, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagZero)
Create debugging information entry for a pointer to member.
Definition: DIBuilder.cpp:328
llvm::DICompileUnit
Compile unit.
Definition: DebugInfoMetadata.h:1316
ArrayRef.h
llvm::DIMacroFile
Definition: DebugInfoMetadata.h:3489
llvm::DIBuilder::createArtificialSubprogram
static DISubprogram * createArtificialSubprogram(DISubprogram *SP)
Create a distinct clone of SP with FlagArtificial set.
Definition: DIBuilder.cpp:609
llvm::ISD::BasicBlock
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:71
llvm::DIBuilder::createLabel
DILabel * createLabel(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, bool AlwaysPreserve=false)
Create a new descriptor for an label.
Definition: DIBuilder.cpp:815
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::MDNode
Metadata node.
Definition: Metadata.h:926
llvm::DIBuilder::createImportedDeclaration
DIImportedEntity * createImportedDeclaration(DIScope *Context, DINode *Decl, DIFile *File, unsigned Line, StringRef Name="", DINodeArray Elements=nullptr)
Create a descriptor for an imported function.
Definition: DIBuilder.cpp:219
llvm::DIBasicType
Basic type, like 'int' or 'float'.
Definition: DebugInfoMetadata.h:764
llvm::DISubroutineType
Type array for a subprogram.
Definition: DebugInfoMetadata.h:1265
llvm::DICompositeType
Composite types.
Definition: DebugInfoMetadata.h:1042
llvm::DIBuilder::createImportedModule
DIImportedEntity * createImportedModule(DIScope *Context, DINamespace *NS, DIFile *File, unsigned Line, DINodeArray Elements=nullptr)
Create a descriptor for an imported module.
Definition: DIBuilder.cpp:192
llvm::Sched::Source
@ Source
Definition: TargetLowering.h:99
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::DIBuilder::createLexicalBlockFile
DILexicalBlockFile * createLexicalBlockFile(DIScope *Scope, DIFile *File, unsigned Discriminator=0)
This creates a descriptor for a lexical block with a new file attached.
Definition: DIBuilder.cpp:931
llvm::DICompileUnit::DebugNameTableKind
DebugNameTableKind
Definition: DebugInfoMetadata.h:1329
llvm::DIBuilder::createVariantMemberType
DIDerivedType * createVariantMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, Constant *Discriminant, DINode::DIFlags Flags, DIType *Ty)
Create debugging information entry for a variant.
Definition: DIBuilder.cpp:393
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
Dwarf.h
uint32_t
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::DIVariable
Base class for variables.
Definition: DebugInfoMetadata.h:2482
llvm::DIBuilder::operator=
DIBuilder & operator=(const DIBuilder &)=delete
llvm::DIBuilder::getOrCreateGenericSubrange
DIGenericSubrange * getOrCreateGenericSubrange(DIGenericSubrange::BoundType Count, DIGenericSubrange::BoundType LowerBound, DIGenericSubrange::BoundType UpperBound, DIGenericSubrange::BoundType Stride)
Definition: DIBuilder.cpp:715
llvm::DIBuilder::createLexicalBlock
DILexicalBlock * createLexicalBlock(DIScope *Scope, DIFile *File, unsigned Line, unsigned Col)
This creates a descriptor for a lexical block with the specified parent context.
Definition: DIBuilder.cpp:937
llvm::PointerUnion
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
Definition: PointerUnion.h:112
llvm::DIBuilder::createTemplateTypeParameter
DITemplateTypeParameter * createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault)
Create debugging information for template type parameter.
Definition: DIBuilder.cpp:449
llvm::DIBuilder::createInheritance
DIDerivedType * createInheritance(DIType *Ty, DIType *BaseTy, uint64_t BaseOffset, uint32_t VBPtrOffset, DINode::DIFlags Flags)
Create debugging information entry to establish inheritance relationship between two types.
Definition: DIBuilder.cpp:365
llvm::DIBuilder::createCompileUnit
DICompileUnit * createCompileUnit(unsigned Lang, DIFile *File, StringRef Producer, bool isOptimized, StringRef Flags, unsigned RV, StringRef SplitName=StringRef(), DICompileUnit::DebugEmissionKind Kind=DICompileUnit::DebugEmissionKind::FullDebug, uint64_t DWOId=0, bool SplitDebugInlining=true, bool DebugInfoForProfiling=false, DICompileUnit::DebugNameTableKind NameTableKind=DICompileUnit::DebugNameTableKind::Default, bool RangesBaseAddress=false, StringRef SysRoot={}, StringRef SDK={})
A CompileUnit provides an anchor for all debugging information generated during this instance of comp...
Definition: DIBuilder.cpp:149
llvm::DIBuilder::createNameSpace
DINamespace * createNameSpace(DIScope *Scope, StringRef Name, bool ExportSymbols)
This creates new descriptor for a namespace with the specified parent scope.
Definition: DIBuilder.cpp:910
llvm::DIBuilder::createStructType
DICompositeType * createStructType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang=0, DIType *VTableHolder=nullptr, StringRef UniqueIdentifier="")
Create debugging information entry for a struct.
Definition: DIBuilder.cpp:505
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
llvm::DIBuilder::createUnspecifiedType
DIBasicType * createUnspecifiedType(StringRef Name)
Create a DWARF unspecified type.
Definition: DIBuilder.cpp:272
llvm::DIScope
Base class for scope-like contexts.
Definition: DebugInfoMetadata.h:471
llvm::DIBuilder::createObjCIVar
DIDerivedType * createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty, MDNode *PropertyNode)
Create debugging information entry for Objective-C instance variable.
Definition: DIBuilder.cpp:430
Casting.h
TrackingMDRef.h
llvm::DIBuilder::createVectorType
DICompositeType * createVectorType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts)
Create debugging information entry for a vector type.
Definition: DIBuilder.cpp:599
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::DIBuilder::getOrCreateArray
DINodeArray getOrCreateArray(ArrayRef< Metadata * > Elements)
Get a DINodeArray, create one if required.
Definition: DIBuilder.cpp:676
llvm::DIBuilder::createParameterVariable
DILocalVariable * createParameterVariable(DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve=false, DINode::DIFlags Flags=DINode::FlagZero, DINodeArray Annotations=nullptr)
Create a new descriptor for a parameter variable.
Definition: DIBuilder.cpp:805
llvm::DICompileUnit::DebugNameTableKind::Default
@ Default
llvm::DIBuilder::createGlobalVariableExpression
DIGlobalVariableExpression * createGlobalVariableExpression(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool IsLocalToUnit, bool isDefined=true, DIExpression *Expr=nullptr, MDNode *Decl=nullptr, MDTuple *TemplateParams=nullptr, uint32_t AlignInBits=0, DINodeArray Annotations=nullptr)
Create a new descriptor for the specified variable.
Definition: DIBuilder.cpp:736
llvm::DIDerivedType
Derived types.
Definition: DebugInfoMetadata.h:924
llvm::DIGlobalVariableExpression
A pair of DIGlobalVariable and DIExpression.
Definition: DebugInfoMetadata.h:3348
llvm::DIBuilder::createTemplateValueParameter
DITemplateValueParameter * createTemplateValueParameter(DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault, Constant *Val)
Create debugging information for template value parameter.
Definition: DIBuilder.cpp:464
llvm::DITemplateValueParameter
Definition: DebugInfoMetadata.h:2432
llvm::DIBuilder::createFunction
DISubprogram * createFunction(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine, DINode::DIFlags Flags=DINode::FlagZero, DISubprogram::DISPFlags SPFlags=DISubprogram::SPFlagZero, DITemplateParameterArray TParams=nullptr, DISubprogram *Decl=nullptr, DITypeArray ThrownTypes=nullptr, DINodeArray Annotations=nullptr, StringRef TargetFuncName="")
Create a new descriptor for the specified subprogram.
Definition: DIBuilder.cpp:844
LLVMDIBuilderRef
struct LLVMOpaqueDIBuilder * LLVMDIBuilderRef
Represents an LLVM debug info builder.
Definition: Types.h:117
llvm::DIBuilder::createNullPtrType
DIBasicType * createNullPtrType()
Create C++11 nullptr type.
Definition: DIBuilder.cpp:277
llvm::DIBuilder::getOrCreateSubrange
DISubrange * getOrCreateSubrange(int64_t Lo, int64_t Count)
Create a descriptor for a value range.
Definition: DIBuilder.cpp:696
llvm::DIBuilder::getOrCreateMacroArray
DIMacroNodeArray getOrCreateMacroArray(ArrayRef< Metadata * > Elements)
Get a DIMacroNodeArray, create one if required.
Definition: DIBuilder.cpp:681
SmallVector.h
llvm::DINode::DIFlags
DIFlags
Debug info flags.
Definition: DebugInfoMetadata.h:168
N
#define N
llvm::DISubprogram
Subprogram description.
Definition: DebugInfoMetadata.h:1797
llvm::DIModule
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Definition: DebugInfoMetadata.h:2297
llvm::DILabel
Label.
Definition: DebugInfoMetadata.h:3138
llvm::DIBuilder::createBasicType
DIBasicType * createBasicType(StringRef Name, uint64_t SizeInBits, unsigned Encoding, DINode::DIFlags Flags=DINode::FlagZero)
Create debugging information entry for a basic type.
Definition: DIBuilder.cpp:281
CU
Definition: AArch64AsmBackend.cpp:505
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::DIBuilder::createUnspecifiedParameter
DIBasicType * createUnspecifiedParameter()
Create unspecified parameter type for a subroutine type.
Definition: DIBuilder.cpp:643
llvm::codeview::PublicSymFlags::Function
@ Function
llvm::DIBuilder::createConstantValueExpression
DIExpression * createConstantValueExpression(uint64_t Val)
Create an expression for a variable that does not have an address, but does have a constant value.
Definition: DIBuilder.h:735
SetVector.h
llvm::DIFile
File.
Definition: DebugInfoMetadata.h:525