LLVM  14.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"
24 #include "llvm/IR/DebugInfo.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 
50  SmallVector<Metadata *, 4> AllEnumTypes;
51  /// Track the RetainTypes, since they can be updated later on.
52  SmallVector<TrackingMDNodeRef, 4> AllRetainTypes;
53  SmallVector<Metadata *, 4> AllSubprograms;
55  SmallVector<TrackingMDNodeRef, 4> AllImportedModules;
56  /// Map Macro parent (which can be DIMacroFile or nullptr) to a list of
57  /// Metadata all of type DIMacroNode.
58  /// DIMacroNode's with nullptr parent are DICompileUnit direct children.
60 
61  /// Track nodes that may be unresolved.
62  SmallVector<TrackingMDNodeRef, 4> UnresolvedNodes;
63  bool AllowUnresolvedNodes;
64 
65  /// Each subprogram's preserved local variables.
66  ///
67  /// Do not use a std::vector. Some versions of libc++ apparently copy
68  /// instead of move on grow operations, and TrackingMDRef is expensive to
69  /// copy.
71 
72  /// Each subprogram's preserved labels.
74 
75  /// Create a temporary.
76  ///
77  /// Create an \a temporary node and track it in \a UnresolvedNodes.
78  void trackIfUnresolved(MDNode *N);
79 
80  /// Internal helper for insertDeclare.
81  Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
82  DIExpression *Expr, const DILocation *DL,
83  BasicBlock *InsertBB, Instruction *InsertBefore);
84 
85  /// Internal helper for insertLabel.
86  Instruction *insertLabel(DILabel *LabelInfo, const DILocation *DL,
87  BasicBlock *InsertBB, Instruction *InsertBefore);
88 
89  /// Internal helper for insertDbgValueIntrinsic.
90  Instruction *
91  insertDbgValueIntrinsic(llvm::Value *Val, DILocalVariable *VarInfo,
92  DIExpression *Expr, const DILocation *DL,
93  BasicBlock *InsertBB, Instruction *InsertBefore);
94 
95  public:
96  /// Construct a builder for a module.
97  ///
98  /// If \c AllowUnresolved, collect unresolved nodes attached to the module
99  /// in order to resolve cycles during \a finalize().
100  ///
101  /// If \p CU is given a value other than nullptr, then set \p CUNode to CU.
102  explicit DIBuilder(Module &M, bool AllowUnresolved = true,
103  DICompileUnit *CU = nullptr);
104  DIBuilder(const DIBuilder &) = delete;
105  DIBuilder &operator=(const DIBuilder &) = delete;
106 
107  /// Construct any deferred debug info descriptors.
108  void finalize();
109 
110  /// Finalize a specific subprogram - no new variables may be added to this
111  /// subprogram afterwards.
113 
114  /// A CompileUnit provides an anchor for all debugging
115  /// information generated during this instance of compilation.
116  /// \param Lang Source programming language, eg. dwarf::DW_LANG_C99
117  /// \param File File info.
118  /// \param Producer Identify the producer of debugging information
119  /// and code. Usually this is a compiler
120  /// version string.
121  /// \param isOptimized A boolean flag which indicates whether optimization
122  /// is enabled or not.
123  /// \param Flags This string lists command line options. This
124  /// string is directly embedded in debug info
125  /// output which may be used by a tool
126  /// analyzing generated debugging information.
127  /// \param RV This indicates runtime version for languages like
128  /// Objective-C.
129  /// \param SplitName The name of the file that we'll split debug info
130  /// out into.
131  /// \param Kind The kind of debug information to generate.
132  /// \param DWOId The DWOId if this is a split skeleton compile unit.
133  /// \param SplitDebugInlining Whether to emit inline debug info.
134  /// \param DebugInfoForProfiling Whether to emit extra debug info for
135  /// profile collection.
136  /// \param NameTableKind Whether to emit .debug_gnu_pubnames,
137  /// .debug_pubnames, or no pubnames at all.
138  /// \param SysRoot The clang system root (value of -isysroot).
139  /// \param SDK The SDK name. On Darwin, this is the last component
140  /// of the sysroot.
141  DICompileUnit *
142  createCompileUnit(unsigned Lang, DIFile *File, StringRef Producer,
143  bool isOptimized, StringRef Flags, unsigned RV,
144  StringRef SplitName = StringRef(),
146  DICompileUnit::DebugEmissionKind::FullDebug,
147  uint64_t DWOId = 0, bool SplitDebugInlining = true,
148  bool DebugInfoForProfiling = false,
151  bool RangesBaseAddress = false, StringRef SysRoot = {},
152  StringRef SDK = {});
153 
154  /// Create a file descriptor to hold debugging information for a file.
155  /// \param Filename File name.
156  /// \param Directory Directory.
157  /// \param Checksum Optional checksum kind (e.g. CSK_MD5, CSK_SHA1, etc.)
158  /// and value.
159  /// \param Source Optional source text.
160  DIFile *
161  createFile(StringRef Filename, StringRef Directory,
164 
165  /// Create debugging information entry for a macro.
166  /// \param Parent Macro parent (could be nullptr).
167  /// \param Line Source line number where the macro is defined.
168  /// \param MacroType DW_MACINFO_define or DW_MACINFO_undef.
169  /// \param Name Macro name.
170  /// \param Value Macro value.
171  DIMacro *createMacro(DIMacroFile *Parent, unsigned Line, unsigned MacroType,
173 
174  /// Create debugging information temporary entry for a macro file.
175  /// List of macro node direct children will be calculated by DIBuilder,
176  /// using the \p Parent relationship.
177  /// \param Parent Macro file parent (could be nullptr).
178  /// \param Line Source line number where the macro file is included.
179  /// \param File File descriptor containing the name of the macro file.
180  DIMacroFile *createTempMacroFile(DIMacroFile *Parent, unsigned Line,
181  DIFile *File);
182 
183  /// Create a single enumerator value.
186  bool IsUnsigned = false);
187 
188  /// Create a DWARF unspecified type.
190 
191  /// Create C++11 nullptr type.
193 
194  /// Create debugging information entry for a basic
195  /// type.
196  /// \param Name Type name.
197  /// \param SizeInBits Size of the type.
198  /// \param Encoding DWARF encoding code, e.g., dwarf::DW_ATE_float.
199  /// \param Flags Optional DWARF attributes, e.g., DW_AT_endianity.
201  unsigned Encoding,
202  DINode::DIFlags Flags = DINode::FlagZero);
203 
204  /// Create debugging information entry for a string
205  /// type.
206  /// \param Name Type name.
207  /// \param SizeInBits Size of the type.
209 
210  /// Create debugging information entry for a qualified
211  /// type, e.g. 'const int'.
212  /// \param Tag Tag identifing type, e.g. dwarf::TAG_volatile_type
213  /// \param FromTy Base Type.
214  DIDerivedType *createQualifiedType(unsigned Tag, DIType *FromTy);
215 
216  /// Create debugging information entry for a pointer.
217  /// \param PointeeTy Type pointed by this pointer.
218  /// \param SizeInBits Size.
219  /// \param AlignInBits Alignment. (optional)
220  /// \param DWARFAddressSpace DWARF address space. (optional)
221  /// \param Name Pointer type name. (optional)
222  DIDerivedType *createPointerType(DIType *PointeeTy, uint64_t SizeInBits,
223  uint32_t AlignInBits = 0,
224  Optional<unsigned> DWARFAddressSpace =
225  None,
226  StringRef Name = "");
227 
228  /// Create debugging information entry for a pointer to member.
229  /// \param PointeeTy Type pointed to by this pointer.
230  /// \param SizeInBits Size.
231  /// \param AlignInBits Alignment. (optional)
232  /// \param Class Type for which this pointer points to members of.
233  DIDerivedType *
234  createMemberPointerType(DIType *PointeeTy, DIType *Class,
235  uint64_t SizeInBits, uint32_t AlignInBits = 0,
236  DINode::DIFlags Flags = DINode::FlagZero);
237 
238  /// Create debugging information entry for a c++
239  /// style reference or rvalue reference type.
240  DIDerivedType *createReferenceType(unsigned Tag, DIType *RTy,
241  uint64_t SizeInBits = 0,
242  uint32_t AlignInBits = 0,
243  Optional<unsigned> DWARFAddressSpace =
244  None);
245 
246  /// Create debugging information entry for a typedef.
247  /// \param Ty Original type.
248  /// \param Name Typedef name.
249  /// \param File File where this type is defined.
250  /// \param LineNo Line number.
251  /// \param Context The surrounding context for the typedef.
252  /// \param AlignInBits Alignment. (optional)
254  unsigned LineNo, DIScope *Context,
255  uint32_t AlignInBits = 0);
256 
257  /// Create debugging information entry for a 'friend'.
258  DIDerivedType *createFriend(DIType *Ty, DIType *FriendTy);
259 
260  /// Create debugging information entry to establish
261  /// inheritance relationship between two types.
262  /// \param Ty Original type.
263  /// \param BaseTy Base type. Ty is inherits from base.
264  /// \param BaseOffset Base offset.
265  /// \param VBPtrOffset Virtual base pointer offset.
266  /// \param Flags Flags to describe inheritance attribute,
267  /// e.g. private
269  uint64_t BaseOffset, uint32_t VBPtrOffset,
270  DINode::DIFlags Flags);
271 
272  /// Create debugging information entry for a member.
273  /// \param Scope Member scope.
274  /// \param Name Member name.
275  /// \param File File where this member is defined.
276  /// \param LineNo Line number.
277  /// \param SizeInBits Member size.
278  /// \param AlignInBits Member alignment.
279  /// \param OffsetInBits Member offset.
280  /// \param Flags Flags to encode member attribute, e.g. private
281  /// \param Ty Parent type.
282  /// \param Annotations Member annotations.
284  DIFile *File, unsigned LineNo,
285  uint64_t SizeInBits, uint32_t AlignInBits,
286  uint64_t OffsetInBits,
287  DINode::DIFlags Flags, DIType *Ty,
288  DINodeArray Annotations = nullptr);
289 
290  /// Create debugging information entry for a variant. A variant
291  /// normally should be a member of a variant part.
292  /// \param Scope Member scope.
293  /// \param Name Member name.
294  /// \param File File where this member is defined.
295  /// \param LineNo Line number.
296  /// \param SizeInBits Member size.
297  /// \param AlignInBits Member alignment.
298  /// \param OffsetInBits Member offset.
299  /// \param Flags Flags to encode member attribute, e.g. private
300  /// \param Discriminant The discriminant for this branch; null for
301  /// the default branch
302  /// \param Ty Parent type.
304  DIFile *File, unsigned LineNo,
305  uint64_t SizeInBits,
306  uint32_t AlignInBits,
307  uint64_t OffsetInBits,
308  Constant *Discriminant,
309  DINode::DIFlags Flags, DIType *Ty);
310 
311  /// Create debugging information entry for a bit field member.
312  /// \param Scope Member scope.
313  /// \param Name Member name.
314  /// \param File File where this member is defined.
315  /// \param LineNo Line number.
316  /// \param SizeInBits Member size.
317  /// \param OffsetInBits Member offset.
318  /// \param StorageOffsetInBits Member storage offset.
319  /// \param Flags Flags to encode member attribute.
320  /// \param Ty Parent type.
321  /// \param Annotations Member annotations.
323  DIFile *File, unsigned LineNo,
324  uint64_t SizeInBits,
325  uint64_t OffsetInBits,
326  uint64_t StorageOffsetInBits,
327  DINode::DIFlags Flags, DIType *Ty,
328  DINodeArray Annotations = nullptr);
329 
330  /// Create debugging information entry for a
331  /// C++ static data member.
332  /// \param Scope Member scope.
333  /// \param Name Member name.
334  /// \param File File where this member is declared.
335  /// \param LineNo Line number.
336  /// \param Ty Type of the static member.
337  /// \param Flags Flags to encode member attribute, e.g. private.
338  /// \param Val Const initializer of the member.
339  /// \param AlignInBits Member alignment.
341  DIFile *File, unsigned LineNo,
342  DIType *Ty, DINode::DIFlags Flags,
343  Constant *Val,
344  uint32_t AlignInBits = 0);
345 
346  /// Create debugging information entry for Objective-C
347  /// instance variable.
348  /// \param Name Member name.
349  /// \param File File where this member is defined.
350  /// \param LineNo Line number.
351  /// \param SizeInBits Member size.
352  /// \param AlignInBits Member alignment.
353  /// \param OffsetInBits Member offset.
354  /// \param Flags Flags to encode member attribute, e.g. private
355  /// \param Ty Parent type.
356  /// \param PropertyNode Property associated with this ivar.
358  uint64_t SizeInBits, uint32_t AlignInBits,
359  uint64_t OffsetInBits, DINode::DIFlags Flags,
360  DIType *Ty, MDNode *PropertyNode);
361 
362  /// Create debugging information entry for Objective-C
363  /// property.
364  /// \param Name Property name.
365  /// \param File File where this property is defined.
366  /// \param LineNumber Line number.
367  /// \param GetterName Name of the Objective C property getter selector.
368  /// \param SetterName Name of the Objective C property setter selector.
369  /// \param PropertyAttributes Objective C property attributes.
370  /// \param Ty Type.
372  unsigned LineNumber,
373  StringRef GetterName,
374  StringRef SetterName,
375  unsigned PropertyAttributes, DIType *Ty);
376 
377  /// Create debugging information entry for a class.
378  /// \param Scope Scope in which this class is defined.
379  /// \param Name class name.
380  /// \param File File where this member is defined.
381  /// \param LineNumber Line number.
382  /// \param SizeInBits Member size.
383  /// \param AlignInBits Member alignment.
384  /// \param OffsetInBits Member offset.
385  /// \param Flags Flags to encode member attribute, e.g. private
386  /// \param Elements class members.
387  /// \param VTableHolder Debug info of the base class that contains vtable
388  /// for this type. This is used in
389  /// DW_AT_containing_type. See DWARF documentation
390  /// for more info.
391  /// \param TemplateParms Template type parameters.
392  /// \param UniqueIdentifier A unique identifier for the class.
394  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
395  uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
396  DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
397  DIType *VTableHolder = nullptr, MDNode *TemplateParms = nullptr,
398  StringRef UniqueIdentifier = "");
399 
400  /// Create debugging information entry for a struct.
401  /// \param Scope Scope in which this struct is defined.
402  /// \param Name Struct name.
403  /// \param File File where this member is defined.
404  /// \param LineNumber Line number.
405  /// \param SizeInBits Member size.
406  /// \param AlignInBits Member alignment.
407  /// \param Flags Flags to encode member attribute, e.g. private
408  /// \param Elements Struct elements.
409  /// \param RunTimeLang Optional parameter, Objective-C runtime version.
410  /// \param UniqueIdentifier A unique identifier for the struct.
412  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
413  uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
414  DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
415  DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "");
416 
417  /// Create debugging information entry for an union.
418  /// \param Scope Scope in which this union is defined.
419  /// \param Name Union name.
420  /// \param File File where this member is defined.
421  /// \param LineNumber Line number.
422  /// \param SizeInBits Member size.
423  /// \param AlignInBits Member alignment.
424  /// \param Flags Flags to encode member attribute, e.g. private
425  /// \param Elements Union elements.
426  /// \param RunTimeLang Optional parameter, Objective-C runtime version.
427  /// \param UniqueIdentifier A unique identifier for the union.
429  DIFile *File, unsigned LineNumber,
430  uint64_t SizeInBits, uint32_t AlignInBits,
431  DINode::DIFlags Flags,
432  DINodeArray Elements,
433  unsigned RunTimeLang = 0,
434  StringRef UniqueIdentifier = "");
435 
436  /// Create debugging information entry for a variant part. A
437  /// variant part normally has a discriminator (though this is not
438  /// required) and a number of variant children.
439  /// \param Scope Scope in which this union is defined.
440  /// \param Name Union name.
441  /// \param File File where this member is defined.
442  /// \param LineNumber Line number.
443  /// \param SizeInBits Member size.
444  /// \param AlignInBits Member alignment.
445  /// \param Flags Flags to encode member attribute, e.g. private
446  /// \param Discriminator Discriminant member
447  /// \param Elements Variant elements.
448  /// \param UniqueIdentifier A unique identifier for the union.
450  DIFile *File, unsigned LineNumber,
451  uint64_t SizeInBits, uint32_t AlignInBits,
452  DINode::DIFlags Flags,
453  DIDerivedType *Discriminator,
454  DINodeArray Elements,
455  StringRef UniqueIdentifier = "");
456 
457  /// Create debugging information for template
458  /// type parameter.
459  /// \param Scope Scope in which this type is defined.
460  /// \param Name Type parameter name.
461  /// \param Ty Parameter type.
462  /// \param IsDefault Parameter is default or not
464  StringRef Name,
465  DIType *Ty,
466  bool IsDefault);
467 
468  /// Create debugging information for template
469  /// value parameter.
470  /// \param Scope Scope in which this type is defined.
471  /// \param Name Value parameter name.
472  /// \param Ty Parameter type.
473  /// \param IsDefault Parameter is default or not
474  /// \param Val Constant parameter value.
477  bool IsDefault, Constant *Val);
478 
479  /// Create debugging information for a template template parameter.
480  /// \param Scope Scope in which this type is defined.
481  /// \param Name Value parameter name.
482  /// \param Ty Parameter type.
483  /// \param Val The fully qualified name of the template.
485  StringRef Name,
486  DIType *Ty,
487  StringRef Val);
488 
489  /// Create debugging information for a template parameter pack.
490  /// \param Scope Scope in which this type is defined.
491  /// \param Name Value parameter name.
492  /// \param Ty Parameter type.
493  /// \param Val An array of types in the pack.
495  StringRef Name,
496  DIType *Ty,
497  DINodeArray Val);
498 
499  /// Create debugging information entry for an array.
500  /// \param Size Array size.
501  /// \param AlignInBits Alignment.
502  /// \param Ty Element type.
503  /// \param Subscripts Subscripts.
504  /// \param DataLocation The location of the raw data of a descriptor-based
505  /// Fortran array, either a DIExpression* or
506  /// a DIVariable*.
507  /// \param Associated The associated attribute of a descriptor-based
508  /// Fortran array, either a DIExpression* or
509  /// a DIVariable*.
510  /// \param Allocated The allocated attribute of a descriptor-based
511  /// Fortran array, either a DIExpression* or
512  /// a DIVariable*.
513  /// \param Rank The rank attribute of a descriptor-based
514  /// Fortran array, either a DIExpression* or
515  /// a DIVariable*.
517  uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts,
518  PointerUnion<DIExpression *, DIVariable *> DataLocation = nullptr,
519  PointerUnion<DIExpression *, DIVariable *> Associated = nullptr,
520  PointerUnion<DIExpression *, DIVariable *> Allocated = nullptr,
522 
523  /// Create debugging information entry for a vector type.
524  /// \param Size Array size.
525  /// \param AlignInBits Alignment.
526  /// \param Ty Element type.
527  /// \param Subscripts Subscripts.
529  DIType *Ty, DINodeArray Subscripts);
530 
531  /// Create debugging information entry for an
532  /// enumeration.
533  /// \param Scope Scope in which this enumeration is defined.
534  /// \param Name Union name.
535  /// \param File File where this member is defined.
536  /// \param LineNumber Line number.
537  /// \param SizeInBits Member size.
538  /// \param AlignInBits Member alignment.
539  /// \param Elements Enumeration elements.
540  /// \param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
541  /// \param UniqueIdentifier A unique identifier for the enum.
542  /// \param IsScoped Boolean flag indicate if this is C++11/ObjC 'enum class'.
544  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
545  uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements,
546  DIType *UnderlyingType, StringRef UniqueIdentifier = "", bool IsScoped = false);
547 
548  /// Create debugging information entry for a set.
549  /// \param Scope Scope in which this set is defined.
550  /// \param Name Set name.
551  /// \param File File where this set is defined.
552  /// \param LineNo Line number.
553  /// \param SizeInBits Set size.
554  /// \param AlignInBits Set alignment.
555  /// \param Ty Base type of the set.
557  unsigned LineNo, uint64_t SizeInBits,
558  uint32_t AlignInBits, DIType *Ty);
559 
560  /// Create subroutine type.
561  /// \param ParameterTypes An array of subroutine parameter types. This
562  /// includes return type at 0th index.
563  /// \param Flags E.g.: LValueReference.
564  /// These flags are used to emit dwarf attributes.
565  /// \param CC Calling convention, e.g. dwarf::DW_CC_normal
567  createSubroutineType(DITypeRefArray ParameterTypes,
568  DINode::DIFlags Flags = DINode::FlagZero,
569  unsigned CC = 0);
570 
571  /// Create a distinct clone of \p SP with FlagArtificial set.
573 
574  /// Create a uniqued clone of \p Ty with FlagArtificial set.
575  static DIType *createArtificialType(DIType *Ty);
576 
577  /// Create a uniqued clone of \p Ty with FlagObjectPointer and
578  /// FlagArtificial set.
580 
581  /// Create a permanent forward-declared type.
583  DIScope *Scope, DIFile *F, unsigned Line,
584  unsigned RuntimeLang = 0,
585  uint64_t SizeInBits = 0,
586  uint32_t AlignInBits = 0,
587  StringRef UniqueIdentifier = "");
588 
589  /// Create a temporary forward-declared type.
591  unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
592  unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
593  uint32_t AlignInBits = 0, DINode::DIFlags Flags = DINode::FlagFwdDecl,
594  StringRef UniqueIdentifier = "", DINodeArray Annotations = nullptr);
595 
596  /// Retain DIScope* in a module even if it is not referenced
597  /// through debug info anchors.
598  void retainType(DIScope *T);
599 
600  /// Create unspecified parameter type
601  /// for a subroutine type.
603 
604  /// Get a DINodeArray, create one if required.
605  DINodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
606 
607  /// Get a DIMacroNodeArray, create one if required.
608  DIMacroNodeArray getOrCreateMacroArray(ArrayRef<Metadata *> Elements);
609 
610  /// Get a DITypeRefArray, create one if required.
612 
613  /// Create a descriptor for a value range. This
614  /// implicitly uniques the values returned.
615  DISubrange *getOrCreateSubrange(int64_t Lo, int64_t Count);
616  DISubrange *getOrCreateSubrange(int64_t Lo, Metadata *CountNode);
617  DISubrange *getOrCreateSubrange(Metadata *Count, Metadata *LowerBound,
618  Metadata *UpperBound, Metadata *Stride);
619 
622  DIGenericSubrange::BoundType LowerBound,
623  DIGenericSubrange::BoundType UpperBound,
625 
626  /// Create a new descriptor for the specified variable.
627  /// \param Context Variable scope.
628  /// \param Name Name of the variable.
629  /// \param LinkageName Mangled name of the variable.
630  /// \param File File where this variable is defined.
631  /// \param LineNo Line number.
632  /// \param Ty Variable Type.
633  /// \param IsLocalToUnit Boolean flag indicate whether this variable is
634  /// externally visible or not.
635  /// \param Expr The location of the global relative to the attached
636  /// GlobalVariable.
637  /// \param Decl Reference to the corresponding declaration.
638  /// \param AlignInBits Variable alignment(or 0 if no alignment attr was
639  /// specified)
642  unsigned LineNo, DIType *Ty, bool IsLocalToUnit, bool isDefined = true,
643  DIExpression *Expr = nullptr, MDNode *Decl = nullptr,
644  MDTuple *TemplateParams = nullptr, uint32_t AlignInBits = 0,
645  DINodeArray Annotations = nullptr);
646 
647  /// Identical to createGlobalVariable
648  /// except that the resulting DbgNode is temporary and meant to be RAUWed.
651  unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl = nullptr,
652  MDTuple *TemplateParams= nullptr, uint32_t AlignInBits = 0);
653 
654  /// Create a new descriptor for an auto variable. This is a local variable
655  /// that is not a subprogram parameter.
656  ///
657  /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
658  /// leads to a \a DISubprogram.
659  ///
660  /// If \c AlwaysPreserve, this variable will be referenced from its
661  /// containing subprogram, and will survive some optimizations.
664  unsigned LineNo, DIType *Ty, bool AlwaysPreserve = false,
665  DINode::DIFlags Flags = DINode::FlagZero,
666  uint32_t AlignInBits = 0);
667 
668  /// Create a new descriptor for an label.
669  ///
670  /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
671  /// leads to a \a DISubprogram.
672  DILabel *
673  createLabel(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
674  bool AlwaysPreserve = false);
675 
676  /// Create a new descriptor for a parameter variable.
677  ///
678  /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
679  /// leads to a \a DISubprogram.
680  ///
681  /// \c ArgNo is the index (starting from \c 1) of this variable in the
682  /// subprogram parameters. \c ArgNo should not conflict with other
683  /// parameters of the same subprogram.
684  ///
685  /// If \c AlwaysPreserve, this variable will be referenced from its
686  /// containing subprogram, and will survive some optimizations.
689  DIFile *File, unsigned LineNo, DIType *Ty,
690  bool AlwaysPreserve = false,
691  DINode::DIFlags Flags = DINode::FlagZero,
692  DINodeArray Annotations = nullptr);
693 
694  /// Create a new descriptor for the specified
695  /// variable which has a complex address expression for its address.
696  /// \param Addr An array of complex address operations.
699 
700  /// Create an expression for a variable that does not have an address, but
701  /// does have a constant value.
703  return DIExpression::get(
704  VMContext, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_stack_value});
705  }
706 
707  /// Create a new descriptor for the specified subprogram.
708  /// See comments in DISubprogram* for descriptions of these fields.
709  /// \param Scope Function scope.
710  /// \param Name Function name.
711  /// \param LinkageName Mangled function name.
712  /// \param File File where this variable is defined.
713  /// \param LineNo Line number.
714  /// \param Ty Function type.
715  /// \param ScopeLine Set to the beginning of the scope this starts
716  /// \param Flags e.g. is this function prototyped or not.
717  /// These flags are used to emit dwarf attributes.
718  /// \param SPFlags Additional flags specific to subprograms.
719  /// \param TParams Function template parameters.
720  /// \param ThrownTypes Exception types this function may throw.
721  /// \param Annotations Attribute Annotations.
722  DISubprogram *
724  DIFile *File, unsigned LineNo, DISubroutineType *Ty,
725  unsigned ScopeLine, DINode::DIFlags Flags = DINode::FlagZero,
726  DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
727  DITemplateParameterArray TParams = nullptr,
728  DISubprogram *Decl = nullptr,
729  DITypeArray ThrownTypes = nullptr,
730  DINodeArray Annotations = nullptr);
731 
732  /// Identical to createFunction,
733  /// except that the resulting DbgNode is meant to be RAUWed.
735  DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
736  unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
737  DINode::DIFlags Flags = DINode::FlagZero,
738  DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
739  DITemplateParameterArray TParams = nullptr,
740  DISubprogram *Decl = nullptr, DITypeArray ThrownTypes = nullptr);
741 
742  /// Create a new descriptor for the specified C++ method.
743  /// See comments in \a DISubprogram* for descriptions of these fields.
744  /// \param Scope Function scope.
745  /// \param Name Function name.
746  /// \param LinkageName Mangled function name.
747  /// \param File File where this variable is defined.
748  /// \param LineNo Line number.
749  /// \param Ty Function type.
750  /// \param VTableIndex Index no of this method in virtual table, or -1u if
751  /// unrepresentable.
752  /// \param ThisAdjustment
753  /// MS ABI-specific adjustment of 'this' that occurs
754  /// in the prologue.
755  /// \param VTableHolder Type that holds vtable.
756  /// \param Flags e.g. is this function prototyped or not.
757  /// This flags are used to emit dwarf attributes.
758  /// \param SPFlags Additional flags specific to subprograms.
759  /// \param TParams Function template parameters.
760  /// \param ThrownTypes Exception types this function may throw.
761  DISubprogram *
763  DIFile *File, unsigned LineNo, DISubroutineType *Ty,
764  unsigned VTableIndex = 0, int ThisAdjustment = 0,
765  DIType *VTableHolder = nullptr,
766  DINode::DIFlags Flags = DINode::FlagZero,
767  DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
768  DITemplateParameterArray TParams = nullptr,
769  DITypeArray ThrownTypes = nullptr);
770 
771  /// Create common block entry for a Fortran common block.
772  /// \param Scope Scope of this common block.
773  /// \param decl Global variable declaration.
774  /// \param Name The name of this common block.
775  /// \param File The file this common block is defined.
776  /// \param LineNo Line number.
779  unsigned LineNo);
780 
781  /// This creates new descriptor for a namespace with the specified
782  /// parent scope.
783  /// \param Scope Namespace scope
784  /// \param Name Name of this namespace
785  /// \param ExportSymbols True for C++ inline namespaces.
787  bool ExportSymbols);
788 
789  /// This creates new descriptor for a module with the specified
790  /// parent scope.
791  /// \param Scope Parent scope
792  /// \param Name Name of this module
793  /// \param ConfigurationMacros
794  /// A space-separated shell-quoted list of -D macro
795  /// definitions as they would appear on a command line.
796  /// \param IncludePath The path to the module map file.
797  /// \param APINotesFile The path to an API notes file for this module.
798  /// \param File Source file of the module.
799  /// Used for Fortran modules.
800  /// \param LineNo Source line number of the module.
801  /// Used for Fortran modules.
802  /// \param IsDecl This is a module declaration; default to false;
803  /// when set to true, only Scope and Name are required
804  /// as this entry is just a hint for the debugger to find
805  /// the corresponding definition in the global scope.
807  StringRef ConfigurationMacros, StringRef IncludePath,
808  StringRef APINotesFile = {}, DIFile *File = nullptr,
809  unsigned LineNo = 0, bool IsDecl = false);
810 
811  /// This creates a descriptor for a lexical block with a new file
812  /// attached. This merely extends the existing
813  /// lexical block as it crosses a file.
814  /// \param Scope Lexical block.
815  /// \param File Source file.
816  /// \param Discriminator DWARF path discriminator value.
817  DILexicalBlockFile *createLexicalBlockFile(DIScope *Scope, DIFile *File,
818  unsigned Discriminator = 0);
819 
820  /// This creates a descriptor for a lexical block with the
821  /// specified parent context.
822  /// \param Scope Parent lexical scope.
823  /// \param File Source file.
824  /// \param Line Line number.
825  /// \param Col Column number.
826  DILexicalBlock *createLexicalBlock(DIScope *Scope, DIFile *File,
827  unsigned Line, unsigned Col);
828 
829  /// Create a descriptor for an imported module.
830  /// \param Context The scope this module is imported into
831  /// \param NS The namespace being imported here.
832  /// \param File File where the declaration is located.
833  /// \param Line Line number of the declaration.
834  /// \param Elements Renamed elements.
835  DIImportedEntity *createImportedModule(DIScope *Context, DINamespace *NS,
836  DIFile *File, unsigned Line,
837  DINodeArray Elements = nullptr);
838 
839  /// Create a descriptor for an imported module.
840  /// \param Context The scope this module is imported into.
841  /// \param NS An aliased namespace.
842  /// \param File File where the declaration is located.
843  /// \param Line Line number of the declaration.
844  /// \param Elements Renamed elements.
845  DIImportedEntity *createImportedModule(DIScope *Context,
846  DIImportedEntity *NS, DIFile *File,
847  unsigned Line,
848  DINodeArray Elements = nullptr);
849 
850  /// Create a descriptor for an imported module.
851  /// \param Context The scope this module is imported into.
852  /// \param M The module being imported here
853  /// \param File File where the declaration is located.
854  /// \param Line Line number of the declaration.
855  /// \param Elements Renamed elements.
856  DIImportedEntity *createImportedModule(DIScope *Context, DIModule *M,
857  DIFile *File, unsigned Line,
858  DINodeArray Elements = nullptr);
859 
860  /// Create a descriptor for an imported function.
861  /// \param Context The scope this module is imported into.
862  /// \param Decl The declaration (or definition) of a function, type, or
863  /// variable.
864  /// \param File File where the declaration is located.
865  /// \param Line Line number of the declaration.
866  /// \param Elements Renamed elements.
867  DIImportedEntity *createImportedDeclaration(DIScope *Context, DINode *Decl,
868  DIFile *File, unsigned Line,
869  StringRef Name = "",
870  DINodeArray Elements = nullptr);
871 
872  /// Insert a new llvm.dbg.declare intrinsic call.
873  /// \param Storage llvm::Value of the variable
874  /// \param VarInfo Variable's debug info descriptor.
875  /// \param Expr A complex location expression.
876  /// \param DL Debug info location.
877  /// \param InsertAtEnd Location for the new intrinsic.
878  Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
879  DIExpression *Expr, const DILocation *DL,
880  BasicBlock *InsertAtEnd);
881 
882  /// Insert a new llvm.dbg.declare intrinsic call.
883  /// \param Storage llvm::Value of the variable
884  /// \param VarInfo Variable's debug info descriptor.
885  /// \param Expr A complex location expression.
886  /// \param DL Debug info location.
887  /// \param InsertBefore Location for the new intrinsic.
888  Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
889  DIExpression *Expr, const DILocation *DL,
890  Instruction *InsertBefore);
891 
892  /// Insert a new llvm.dbg.label intrinsic call.
893  /// \param LabelInfo Label's debug info descriptor.
894  /// \param DL Debug info location.
895  /// \param InsertBefore Location for the new intrinsic.
896  Instruction *insertLabel(DILabel *LabelInfo, const DILocation *DL,
897  Instruction *InsertBefore);
898 
899  /// Insert a new llvm.dbg.label intrinsic call.
900  /// \param LabelInfo Label's debug info descriptor.
901  /// \param DL Debug info location.
902  /// \param InsertAtEnd Location for the new intrinsic.
903  Instruction *insertLabel(DILabel *LabelInfo, const DILocation *DL,
904  BasicBlock *InsertAtEnd);
905 
906  /// Insert a new llvm.dbg.value intrinsic call.
907  /// \param Val llvm::Value of the variable
908  /// \param VarInfo Variable's debug info descriptor.
909  /// \param Expr A complex location expression.
910  /// \param DL Debug info location.
911  /// \param InsertAtEnd Location for the new intrinsic.
912  Instruction *insertDbgValueIntrinsic(llvm::Value *Val,
913  DILocalVariable *VarInfo,
914  DIExpression *Expr,
915  const DILocation *DL,
916  BasicBlock *InsertAtEnd);
917 
918  /// Insert a new llvm.dbg.value intrinsic call.
919  /// \param Val 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 *insertDbgValueIntrinsic(llvm::Value *Val,
925  DILocalVariable *VarInfo,
926  DIExpression *Expr,
927  const DILocation *DL,
928  Instruction *InsertBefore);
929 
930  /// Replace the vtable holder in the given type.
931  ///
932  /// If this creates a self reference, it may orphan some unresolved cycles
933  /// in the operands of \c T, so \a DIBuilder needs to track that.
934  void replaceVTableHolder(DICompositeType *&T,
935  DIType *VTableHolder);
936 
937  /// Replace arrays on a composite type.
938  ///
939  /// If \c T is resolved, but the arrays aren't -- which can happen if \c T
940  /// has a self-reference -- \a DIBuilder needs to track the array to
941  /// resolve cycles.
942  void replaceArrays(DICompositeType *&T, DINodeArray Elements,
943  DINodeArray TParams = DINodeArray());
944 
945  /// Replace a temporary node.
946  ///
947  /// Call \a MDNode::replaceAllUsesWith() on \c N, replacing it with \c
948  /// Replacement.
949  ///
950  /// If \c Replacement is the same as \c N.get(), instead call \a
951  /// MDNode::replaceWithUniqued(). In this case, the uniqued node could
952  /// have a different address, so we return the final address.
953  template <class NodeTy>
954  NodeTy *replaceTemporary(TempMDNode &&N, NodeTy *Replacement) {
955  if (N.get() == Replacement)
956  return cast<NodeTy>(MDNode::replaceWithUniqued(std::move(N)));
957 
958  N->replaceAllUsesWith(Replacement);
959  return Replacement;
960  }
961  };
962 
963  // Create wrappers for C Binding types (see CBindingWrapping.h).
965 
966 } // end namespace llvm
967 
968 #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:902
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::DIType
Base class for types.
Definition: DebugInfoMetadata.h:662
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:657
llvm::DIBuilder::finalize
void finalize()
Construct any deferred debug info descriptors.
Definition: DIBuilder.cpp:69
Optional.h
llvm::DIBuilder::replaceVTableHolder
void replaceVTableHolder(DICompositeType *&T, DIType *VTableHolder)
Replace the vtable holder in the given type.
Definition: DIBuilder.cpp:1056
llvm::DIBuilder
Definition: DIBuilder.h:41
DebugInfoMetadata.h
llvm::DIGenericSubrange
Definition: DebugInfoMetadata.h:362
llvm::Function
Definition: Function.h:62
llvm::DIBuilder::finalizeSubprogram
void finalizeSubprogram(DISubprogram *SP)
Finalize a specific subprogram - no new variables may be added to this subprogram afterwards.
Definition: DIBuilder.cpp:49
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:378
llvm::lltok::NameTableKind
@ NameTableKind
Definition: LLToken.h:485
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::DIStringType
String type, Fortran CHARACTER(n)
Definition: DebugInfoMetadata.h:837
llvm::DIFile::ChecksumInfo
A single checksum, represented by a Kind and a Value (a string).
Definition: DebugInfoMetadata.h:552
llvm::MipsISD::Lo
@ Lo
Definition: MipsISelLowering.h:79
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:727
MapVector.h
llvm::DILocation
Debug location.
Definition: DebugInfoMetadata.h:1580
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:845
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:352
llvm::DIBuilder::createSubroutineType
DISubroutineType * createSubroutineType(DITypeRefArray ParameterTypes, DINode::DIFlags Flags=DINode::FlagZero, unsigned CC=0)
Create subroutine type.
Definition: DIBuilder.cpp:517
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2586
llvm::DIBuilder::createQualifiedType
DIDerivedType * createQualifiedType(unsigned Tag, DIType *FromTy)
Create debugging information entry for a qualified type, e.g.
Definition: DIBuilder.cpp:285
llvm::DIBuilder::DIBuilder
DIBuilder(Module &M, bool AllowUnresolved=true, DICompileUnit *CU=nullptr)
Construct a builder for a module.
Definition: DIBuilder.cpp:34
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:279
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:416
llvm::DICompileUnit::DebugEmissionKind
DebugEmissionKind
Definition: DebugInfoMetadata.h:1340
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:632
llvm::DINamespace
Definition: DebugInfoMetadata.h:2276
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:219
llvm::MDNode::get
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1233
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::DIBuilder::createTemplateParameterPack
DITemplateValueParameter * createTemplateParameterPack(DIScope *Scope, StringRef Name, DIType *Ty, DINodeArray Val)
Create debugging information for a template parameter pack.
Definition: DIBuilder.cpp:456
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
llvm::Annotations
Annotations lets you mark points and ranges inside source code, for tests:
Definition: Annotations.h:46
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:768
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::DITypeRefArray
Definition: DebugInfoMetadata.h:67
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:537
llvm::DIBuilder::createArtificialType
static DIType * createArtificialType(DIType *Ty)
Create a uniqued clone of Ty with FlagArtificial set.
Definition: DIBuilder.cpp:592
llvm::DIObjCProperty
Definition: DebugInfoMetadata.h:3253
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:954
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:393
llvm::ISD::Constant
@ Constant
Definition: ISDOpcodes.h:76
llvm::DILocalVariable
Local variable.
Definition: DebugInfoMetadata.h:3097
llvm::DIMacro
Definition: DebugInfoMetadata.h:3491
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:225
llvm::DIBuilder::createTempMacroFile
DIMacroFile * createTempMacroFile(DIMacroFile *Parent, unsigned Line, DIFile *File)
Create debugging information temporary entry for a macro file.
Definition: DIBuilder.cpp:237
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:883
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:607
llvm::DISubprogram::DISPFlags
DISPFlags
Debug info subprogram flags.
Definition: DebugInfoMetadata.h:1835
llvm::MDTuple
Tuple of metadata.
Definition: Metadata.h:1174
llvm::DIBuilder::createEnumerator
DIEnumerator * createEnumerator(StringRef Name, const APSInt &Value)
Create a single enumerator value.
Definition: DIBuilder.cpp:257
llvm::DISubrange
Array subrange.
Definition: DebugInfoMetadata.h:296
llvm::DIBuilder::createFriend
DIDerivedType * createFriend(DIType *Ty, DIType *FriendTy)
Create debugging information entry for a 'friend'.
Definition: DIBuilder.cpp:333
llvm::DITemplateTypeParameter
Definition: DebugInfoMetadata.h:2426
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)
Create a new descriptor for the specified subprogram.
Definition: DIBuilder.cpp:825
llvm::Instruction
Definition: Instruction.h:45
llvm::DIBuilder::createPointerType
DIDerivedType * createPointerType(DIType *PointeeTy, uint64_t SizeInBits, uint32_t AlignInBits=0, Optional< unsigned > DWARFAddressSpace=None, StringRef Name="")
Create debugging information entry for a pointer.
Definition: DIBuilder.cpp:290
llvm::APSInt
An arbitrary precision integer that knows its signedness.
Definition: APSInt.h:22
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:493
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:505
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:1076
llvm::None
const NoneType None
Definition: None.h:23
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:599
llvm::DICommonBlock
Definition: DebugInfoMetadata.h:3035
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:313
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::DIEnumerator
Enumeration value.
Definition: DebugInfoMetadata.h:412
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:860
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:618
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:549
Addr
uint64_t Addr
Definition: ELFObjHandler.cpp:80
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:523
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:463
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:808
llvm::DIGlobalVariable
Global variables.
Definition: DebugInfoMetadata.h:2946
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:1027
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:448
llvm::DenseMap
Definition: DenseMap.h:714
DebugInfo.h
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:303
llvm::DICompileUnit
Compile unit.
Definition: DebugInfoMetadata.h:1335
ArrayRef.h
llvm::DIMacroFile
Definition: DebugInfoMetadata.h:3540
llvm::DIBuilder::createArtificialSubprogram
static DISubprogram * createArtificialSubprogram(DISubprogram *SP)
Create a distinct clone of SP with FlagArtificial set.
Definition: DIBuilder.cpp:581
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:788
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::MDNode
Metadata node.
Definition: Metadata.h:906
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:209
llvm::DIBasicType
Basic type, like 'int' or 'float'.
Definition: DebugInfoMetadata.h:769
llvm::DISubroutineType
Type array for a subprogram.
Definition: DebugInfoMetadata.h:1281
llvm::DICompositeType
Composite types.
Definition: DebugInfoMetadata.h:1060
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:182
llvm::ReplayInlineScope::Function
@ Function
llvm::Sched::Source
@ Source
Definition: TargetLowering.h:100
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:911
llvm::DICompileUnit::DebugNameTableKind
DebugNameTableKind
Definition: DebugInfoMetadata.h:1348
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:368
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
uint32_t
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
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:687
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:917
llvm::PointerUnion
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
Definition: PointerUnion.h:120
llvm::DIBuilder::createTemplateTypeParameter
DITemplateTypeParameter * createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault)
Create debugging information for template type parameter.
Definition: DIBuilder.cpp:424
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:340
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:139
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:890
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:480
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::DIBuilder::createUnspecifiedType
DIBasicType * createUnspecifiedType(StringRef Name)
Create a DWARF unspecified type.
Definition: DIBuilder.cpp:262
llvm::DIScope
Base class for scope-like contexts.
Definition: DebugInfoMetadata.h:476
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:405
llvm::DIBuilder::createTypedef
DIDerivedType * createTypedef(DIType *Ty, StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context, uint32_t AlignInBits=0)
Create debugging information entry for a typedef.
Definition: DIBuilder.cpp:324
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:571
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:648
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:778
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:708
llvm::DIDerivedType
Derived types.
Definition: DebugInfoMetadata.h:917
llvm::DIGlobalVariableExpression
A pair of DIGlobalVariable and DIExpression.
Definition: DebugInfoMetadata.h:3401
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:439
llvm::DITemplateValueParameter
Definition: DebugInfoMetadata.h:2468
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:267
llvm::DIBuilder::getOrCreateSubrange
DISubrange * getOrCreateSubrange(int64_t Lo, int64_t Count)
Create a descriptor for a value range.
Definition: DIBuilder.cpp:668
llvm::DIBuilder::getOrCreateMacroArray
DIMacroNodeArray getOrCreateMacroArray(ArrayRef< Metadata * > Elements)
Get a DIMacroNodeArray, create one if required.
Definition: DIBuilder.cpp:653
SmallVector.h
llvm::DINode::DIFlags
DIFlags
Debug info flags.
Definition: DebugInfoMetadata.h:166
N
#define N
llvm::DISubprogram
Subprogram description.
Definition: DebugInfoMetadata.h:1820
llvm::DIModule
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Definition: DebugInfoMetadata.h:2328
llvm::DILabel
Label.
Definition: DebugInfoMetadata.h:3185
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:271
CU
Definition: AArch64AsmBackend.cpp:501
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
File
Instrumentation for Order File
Definition: InstrOrderFile.cpp:205
llvm::DIBuilder::createUnspecifiedParameter
DIBasicType * createUnspecifiedParameter()
Create unspecified parameter type for a subroutine type.
Definition: DIBuilder.cpp:615
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:702
SetVector.h
llvm::DIFile
File.
Definition: DebugInfoMetadata.h:530