LLVM  13.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.
184  DIEnumerator *createEnumerator(StringRef Name, int64_t Val, bool IsUnsigned = false);
185 
186  /// Create a DWARF unspecified type.
188 
189  /// Create C++11 nullptr type.
191 
192  /// Create debugging information entry for a basic
193  /// type.
194  /// \param Name Type name.
195  /// \param SizeInBits Size of the type.
196  /// \param Encoding DWARF encoding code, e.g., dwarf::DW_ATE_float.
197  /// \param Flags Optional DWARF attributes, e.g., DW_AT_endianity.
198  DIBasicType *createBasicType(StringRef Name, uint64_t SizeInBits,
199  unsigned Encoding,
200  DINode::DIFlags Flags = DINode::FlagZero);
201 
202  /// Create debugging information entry for a string
203  /// type.
204  /// \param Name Type name.
205  /// \param SizeInBits Size of the type.
206  DIStringType *createStringType(StringRef Name, uint64_t SizeInBits);
207 
208  /// Create debugging information entry for a qualified
209  /// type, e.g. 'const int'.
210  /// \param Tag Tag identifing type, e.g. dwarf::TAG_volatile_type
211  /// \param FromTy Base Type.
212  DIDerivedType *createQualifiedType(unsigned Tag, DIType *FromTy);
213 
214  /// Create debugging information entry for a pointer.
215  /// \param PointeeTy Type pointed by this pointer.
216  /// \param SizeInBits Size.
217  /// \param AlignInBits Alignment. (optional)
218  /// \param DWARFAddressSpace DWARF address space. (optional)
219  /// \param Name Pointer type name. (optional)
220  DIDerivedType *createPointerType(DIType *PointeeTy, uint64_t SizeInBits,
221  uint32_t AlignInBits = 0,
222  Optional<unsigned> DWARFAddressSpace =
223  None,
224  StringRef Name = "");
225 
226  /// Create debugging information entry for a pointer to member.
227  /// \param PointeeTy Type pointed to by this pointer.
228  /// \param SizeInBits Size.
229  /// \param AlignInBits Alignment. (optional)
230  /// \param Class Type for which this pointer points to members of.
231  DIDerivedType *
232  createMemberPointerType(DIType *PointeeTy, DIType *Class,
233  uint64_t SizeInBits, uint32_t AlignInBits = 0,
234  DINode::DIFlags Flags = DINode::FlagZero);
235 
236  /// Create debugging information entry for a c++
237  /// style reference or rvalue reference type.
238  DIDerivedType *createReferenceType(unsigned Tag, DIType *RTy,
239  uint64_t SizeInBits = 0,
240  uint32_t AlignInBits = 0,
241  Optional<unsigned> DWARFAddressSpace =
242  None);
243 
244  /// Create debugging information entry for a typedef.
245  /// \param Ty Original type.
246  /// \param Name Typedef name.
247  /// \param File File where this type is defined.
248  /// \param LineNo Line number.
249  /// \param Context The surrounding context for the typedef.
250  /// \param AlignInBits Alignment. (optional)
252  unsigned LineNo, DIScope *Context,
253  uint32_t AlignInBits = 0);
254 
255  /// Create debugging information entry for a 'friend'.
256  DIDerivedType *createFriend(DIType *Ty, DIType *FriendTy);
257 
258  /// Create debugging information entry to establish
259  /// inheritance relationship between two types.
260  /// \param Ty Original type.
261  /// \param BaseTy Base type. Ty is inherits from base.
262  /// \param BaseOffset Base offset.
263  /// \param VBPtrOffset Virtual base pointer offset.
264  /// \param Flags Flags to describe inheritance attribute,
265  /// e.g. private
267  uint64_t BaseOffset, uint32_t VBPtrOffset,
268  DINode::DIFlags Flags);
269 
270  /// Create debugging information entry for a member.
271  /// \param Scope Member scope.
272  /// \param Name Member name.
273  /// \param File File where this member is defined.
274  /// \param LineNo Line number.
275  /// \param SizeInBits Member size.
276  /// \param AlignInBits Member alignment.
277  /// \param OffsetInBits Member offset.
278  /// \param Flags Flags to encode member attribute, e.g. private
279  /// \param Ty Parent type.
281  DIFile *File, unsigned LineNo,
282  uint64_t SizeInBits,
283  uint32_t AlignInBits,
284  uint64_t OffsetInBits,
285  DINode::DIFlags Flags, DIType *Ty);
286 
287  /// Create debugging information entry for a variant. A variant
288  /// normally should be a member of a variant part.
289  /// \param Scope Member scope.
290  /// \param Name Member name.
291  /// \param File File where this member is defined.
292  /// \param LineNo Line number.
293  /// \param SizeInBits Member size.
294  /// \param AlignInBits Member alignment.
295  /// \param OffsetInBits Member offset.
296  /// \param Flags Flags to encode member attribute, e.g. private
297  /// \param Discriminant The discriminant for this branch; null for
298  /// the default branch
299  /// \param Ty Parent type.
301  DIFile *File, unsigned LineNo,
302  uint64_t SizeInBits,
303  uint32_t AlignInBits,
304  uint64_t OffsetInBits,
305  Constant *Discriminant,
306  DINode::DIFlags Flags, DIType *Ty);
307 
308  /// Create debugging information entry for a bit field member.
309  /// \param Scope Member scope.
310  /// \param Name Member name.
311  /// \param File File where this member is defined.
312  /// \param LineNo Line number.
313  /// \param SizeInBits Member size.
314  /// \param OffsetInBits Member offset.
315  /// \param StorageOffsetInBits Member storage offset.
316  /// \param Flags Flags to encode member attribute.
317  /// \param Ty Parent type.
319  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
320  uint64_t SizeInBits, uint64_t OffsetInBits,
321  uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty);
322 
323  /// Create debugging information entry for a
324  /// C++ static data member.
325  /// \param Scope Member scope.
326  /// \param Name Member name.
327  /// \param File File where this member is declared.
328  /// \param LineNo Line number.
329  /// \param Ty Type of the static member.
330  /// \param Flags Flags to encode member attribute, e.g. private.
331  /// \param Val Const initializer of the member.
332  /// \param AlignInBits Member alignment.
334  DIFile *File, unsigned LineNo,
335  DIType *Ty, DINode::DIFlags Flags,
336  Constant *Val,
337  uint32_t AlignInBits = 0);
338 
339  /// Create debugging information entry for Objective-C
340  /// instance variable.
341  /// \param Name Member name.
342  /// \param File File where this member is defined.
343  /// \param LineNo Line number.
344  /// \param SizeInBits Member size.
345  /// \param AlignInBits Member alignment.
346  /// \param OffsetInBits Member offset.
347  /// \param Flags Flags to encode member attribute, e.g. private
348  /// \param Ty Parent type.
349  /// \param PropertyNode Property associated with this ivar.
351  uint64_t SizeInBits, uint32_t AlignInBits,
352  uint64_t OffsetInBits, DINode::DIFlags Flags,
353  DIType *Ty, MDNode *PropertyNode);
354 
355  /// Create debugging information entry for Objective-C
356  /// property.
357  /// \param Name Property name.
358  /// \param File File where this property is defined.
359  /// \param LineNumber Line number.
360  /// \param GetterName Name of the Objective C property getter selector.
361  /// \param SetterName Name of the Objective C property setter selector.
362  /// \param PropertyAttributes Objective C property attributes.
363  /// \param Ty Type.
365  unsigned LineNumber,
366  StringRef GetterName,
367  StringRef SetterName,
368  unsigned PropertyAttributes, DIType *Ty);
369 
370  /// Create debugging information entry for a class.
371  /// \param Scope Scope in which this class is defined.
372  /// \param Name class name.
373  /// \param File File where this member is defined.
374  /// \param LineNumber Line number.
375  /// \param SizeInBits Member size.
376  /// \param AlignInBits Member alignment.
377  /// \param OffsetInBits Member offset.
378  /// \param Flags Flags to encode member attribute, e.g. private
379  /// \param Elements class members.
380  /// \param VTableHolder Debug info of the base class that contains vtable
381  /// for this type. This is used in
382  /// DW_AT_containing_type. See DWARF documentation
383  /// for more info.
384  /// \param TemplateParms Template type parameters.
385  /// \param UniqueIdentifier A unique identifier for the class.
387  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
388  uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
389  DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
390  DIType *VTableHolder = nullptr, MDNode *TemplateParms = nullptr,
391  StringRef UniqueIdentifier = "");
392 
393  /// Create debugging information entry for a struct.
394  /// \param Scope Scope in which this struct is defined.
395  /// \param Name Struct name.
396  /// \param File File where this member is defined.
397  /// \param LineNumber Line number.
398  /// \param SizeInBits Member size.
399  /// \param AlignInBits Member alignment.
400  /// \param Flags Flags to encode member attribute, e.g. private
401  /// \param Elements Struct elements.
402  /// \param RunTimeLang Optional parameter, Objective-C runtime version.
403  /// \param UniqueIdentifier A unique identifier for the struct.
405  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
406  uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
407  DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
408  DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "");
409 
410  /// Create debugging information entry for an union.
411  /// \param Scope Scope in which this union is defined.
412  /// \param Name Union name.
413  /// \param File File where this member is defined.
414  /// \param LineNumber Line number.
415  /// \param SizeInBits Member size.
416  /// \param AlignInBits Member alignment.
417  /// \param Flags Flags to encode member attribute, e.g. private
418  /// \param Elements Union elements.
419  /// \param RunTimeLang Optional parameter, Objective-C runtime version.
420  /// \param UniqueIdentifier A unique identifier for the union.
422  DIFile *File, unsigned LineNumber,
423  uint64_t SizeInBits, uint32_t AlignInBits,
424  DINode::DIFlags Flags,
425  DINodeArray Elements,
426  unsigned RunTimeLang = 0,
427  StringRef UniqueIdentifier = "");
428 
429  /// Create debugging information entry for a variant part. A
430  /// variant part normally has a discriminator (though this is not
431  /// required) and a number of variant children.
432  /// \param Scope Scope in which this union is defined.
433  /// \param Name Union name.
434  /// \param File File where this member is defined.
435  /// \param LineNumber Line number.
436  /// \param SizeInBits Member size.
437  /// \param AlignInBits Member alignment.
438  /// \param Flags Flags to encode member attribute, e.g. private
439  /// \param Discriminator Discriminant member
440  /// \param Elements Variant elements.
441  /// \param UniqueIdentifier A unique identifier for the union.
443  DIFile *File, unsigned LineNumber,
444  uint64_t SizeInBits, uint32_t AlignInBits,
445  DINode::DIFlags Flags,
446  DIDerivedType *Discriminator,
447  DINodeArray Elements,
448  StringRef UniqueIdentifier = "");
449 
450  /// Create debugging information for template
451  /// type parameter.
452  /// \param Scope Scope in which this type is defined.
453  /// \param Name Type parameter name.
454  /// \param Ty Parameter type.
455  /// \param IsDefault Parameter is default or not
457  StringRef Name,
458  DIType *Ty,
459  bool IsDefault);
460 
461  /// Create debugging information for template
462  /// value parameter.
463  /// \param Scope Scope in which this type is defined.
464  /// \param Name Value parameter name.
465  /// \param Ty Parameter type.
466  /// \param IsDefault Parameter is default or not
467  /// \param Val Constant parameter value.
470  bool IsDefault, Constant *Val);
471 
472  /// Create debugging information for a template template parameter.
473  /// \param Scope Scope in which this type is defined.
474  /// \param Name Value parameter name.
475  /// \param Ty Parameter type.
476  /// \param Val The fully qualified name of the template.
478  StringRef Name,
479  DIType *Ty,
480  StringRef Val);
481 
482  /// Create debugging information for a template parameter pack.
483  /// \param Scope Scope in which this type is defined.
484  /// \param Name Value parameter name.
485  /// \param Ty Parameter type.
486  /// \param Val An array of types in the pack.
488  StringRef Name,
489  DIType *Ty,
490  DINodeArray Val);
491 
492  /// Create debugging information entry for an array.
493  /// \param Size Array size.
494  /// \param AlignInBits Alignment.
495  /// \param Ty Element type.
496  /// \param Subscripts Subscripts.
497  /// \param DataLocation The location of the raw data of a descriptor-based
498  /// Fortran array, either a DIExpression* or
499  /// a DIVariable*.
500  /// \param Associated The associated attribute of a descriptor-based
501  /// Fortran array, either a DIExpression* or
502  /// a DIVariable*.
503  /// \param Allocated The allocated attribute of a descriptor-based
504  /// Fortran array, either a DIExpression* or
505  /// a DIVariable*.
506  /// \param Rank The rank attribute of a descriptor-based
507  /// Fortran array, either a DIExpression* or
508  /// a DIVariable*.
510  uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts,
511  PointerUnion<DIExpression *, DIVariable *> DataLocation = nullptr,
512  PointerUnion<DIExpression *, DIVariable *> Associated = nullptr,
513  PointerUnion<DIExpression *, DIVariable *> Allocated = nullptr,
515 
516  /// Create debugging information entry for a vector type.
517  /// \param Size Array size.
518  /// \param AlignInBits Alignment.
519  /// \param Ty Element type.
520  /// \param Subscripts Subscripts.
521  DICompositeType *createVectorType(uint64_t Size, uint32_t AlignInBits,
522  DIType *Ty, DINodeArray Subscripts);
523 
524  /// Create debugging information entry for an
525  /// enumeration.
526  /// \param Scope Scope in which this enumeration is defined.
527  /// \param Name Union name.
528  /// \param File File where this member is defined.
529  /// \param LineNumber Line number.
530  /// \param SizeInBits Member size.
531  /// \param AlignInBits Member alignment.
532  /// \param Elements Enumeration elements.
533  /// \param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
534  /// \param UniqueIdentifier A unique identifier for the enum.
535  /// \param IsScoped Boolean flag indicate if this is C++11/ObjC 'enum class'.
537  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
538  uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements,
539  DIType *UnderlyingType, StringRef UniqueIdentifier = "", bool IsScoped = false);
540 
541  /// Create debugging information entry for a set.
542  /// \param Scope Scope in which this set is defined.
543  /// \param Name Set name.
544  /// \param File File where this set is defined.
545  /// \param LineNo Line number.
546  /// \param SizeInBits Set size.
547  /// \param AlignInBits Set alignment.
548  /// \param Ty Base type of the set.
550  unsigned LineNo, uint64_t SizeInBits,
551  uint32_t AlignInBits, DIType *Ty);
552 
553  /// Create subroutine type.
554  /// \param ParameterTypes An array of subroutine parameter types. This
555  /// includes return type at 0th index.
556  /// \param Flags E.g.: LValueReference.
557  /// These flags are used to emit dwarf attributes.
558  /// \param CC Calling convention, e.g. dwarf::DW_CC_normal
560  createSubroutineType(DITypeRefArray ParameterTypes,
561  DINode::DIFlags Flags = DINode::FlagZero,
562  unsigned CC = 0);
563 
564  /// Create a distinct clone of \p SP with FlagArtificial set.
566 
567  /// Create a uniqued clone of \p Ty with FlagArtificial set.
568  static DIType *createArtificialType(DIType *Ty);
569 
570  /// Create a uniqued clone of \p Ty with FlagObjectPointer and
571  /// FlagArtificial set.
573 
574  /// Create a permanent forward-declared type.
576  DIScope *Scope, DIFile *F, unsigned Line,
577  unsigned RuntimeLang = 0,
578  uint64_t SizeInBits = 0,
579  uint32_t AlignInBits = 0,
580  StringRef UniqueIdentifier = "");
581 
582  /// Create a temporary forward-declared type.
584  unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
585  unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
586  uint32_t AlignInBits = 0, DINode::DIFlags Flags = DINode::FlagFwdDecl,
587  StringRef UniqueIdentifier = "");
588 
589  /// Retain DIScope* in a module even if it is not referenced
590  /// through debug info anchors.
591  void retainType(DIScope *T);
592 
593  /// Create unspecified parameter type
594  /// for a subroutine type.
596 
597  /// Get a DINodeArray, create one if required.
598  DINodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
599 
600  /// Get a DIMacroNodeArray, create one if required.
601  DIMacroNodeArray getOrCreateMacroArray(ArrayRef<Metadata *> Elements);
602 
603  /// Get a DITypeRefArray, create one if required.
605 
606  /// Create a descriptor for a value range. This
607  /// implicitly uniques the values returned.
608  DISubrange *getOrCreateSubrange(int64_t Lo, int64_t Count);
609  DISubrange *getOrCreateSubrange(int64_t Lo, Metadata *CountNode);
610  DISubrange *getOrCreateSubrange(Metadata *Count, Metadata *LowerBound,
611  Metadata *UpperBound, Metadata *Stride);
612 
615  DIGenericSubrange::BoundType LowerBound,
616  DIGenericSubrange::BoundType UpperBound,
618 
619  /// Create a new descriptor for the specified variable.
620  /// \param Context Variable scope.
621  /// \param Name Name of the variable.
622  /// \param LinkageName Mangled name of the variable.
623  /// \param File File where this variable is defined.
624  /// \param LineNo Line number.
625  /// \param Ty Variable Type.
626  /// \param IsLocalToUnit Boolean flag indicate whether this variable is
627  /// externally visible or not.
628  /// \param Expr The location of the global relative to the attached
629  /// GlobalVariable.
630  /// \param Decl Reference to the corresponding declaration.
631  /// \param AlignInBits Variable alignment(or 0 if no alignment attr was
632  /// specified)
635  unsigned LineNo, DIType *Ty, bool IsLocalToUnit, bool isDefined = true,
636  DIExpression *Expr = nullptr, MDNode *Decl = nullptr,
637  MDTuple *TemplateParams = nullptr, uint32_t AlignInBits = 0);
638 
639  /// Identical to createGlobalVariable
640  /// except that the resulting DbgNode is temporary and meant to be RAUWed.
643  unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl = nullptr,
644  MDTuple *TemplateParams= nullptr, uint32_t AlignInBits = 0);
645 
646  /// Create a new descriptor for an auto variable. This is a local variable
647  /// that is not a subprogram parameter.
648  ///
649  /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
650  /// leads to a \a DISubprogram.
651  ///
652  /// If \c AlwaysPreserve, this variable will be referenced from its
653  /// containing subprogram, and will survive some optimizations.
656  unsigned LineNo, DIType *Ty, bool AlwaysPreserve = false,
657  DINode::DIFlags Flags = DINode::FlagZero,
658  uint32_t AlignInBits = 0);
659 
660  /// Create a new descriptor for an label.
661  ///
662  /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
663  /// leads to a \a DISubprogram.
664  DILabel *
665  createLabel(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
666  bool AlwaysPreserve = false);
667 
668  /// Create a new descriptor for a parameter variable.
669  ///
670  /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
671  /// leads to a \a DISubprogram.
672  ///
673  /// \c ArgNo is the index (starting from \c 1) of this variable in the
674  /// subprogram parameters. \c ArgNo should not conflict with other
675  /// parameters of the same subprogram.
676  ///
677  /// If \c AlwaysPreserve, this variable will be referenced from its
678  /// containing subprogram, and will survive some optimizations.
681  DIFile *File, unsigned LineNo, DIType *Ty,
682  bool AlwaysPreserve = false,
683  DINode::DIFlags Flags = DINode::FlagZero);
684 
685  /// Create a new descriptor for the specified
686  /// variable which has a complex address expression for its address.
687  /// \param Addr An array of complex address operations.
690 
691  /// Create an expression for a variable that does not have an address, but
692  /// does have a constant value.
694  return DIExpression::get(
695  VMContext, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_stack_value});
696  }
697 
698  /// Create a new descriptor for the specified subprogram.
699  /// See comments in DISubprogram* for descriptions of these fields.
700  /// \param Scope Function scope.
701  /// \param Name Function name.
702  /// \param LinkageName Mangled function name.
703  /// \param File File where this variable is defined.
704  /// \param LineNo Line number.
705  /// \param Ty Function type.
706  /// \param ScopeLine Set to the beginning of the scope this starts
707  /// \param Flags e.g. is this function prototyped or not.
708  /// These flags are used to emit dwarf attributes.
709  /// \param SPFlags Additional flags specific to subprograms.
710  /// \param TParams Function template parameters.
711  /// \param ThrownTypes Exception types this function may throw.
712  DISubprogram *
714  DIFile *File, unsigned LineNo, DISubroutineType *Ty,
715  unsigned ScopeLine, DINode::DIFlags Flags = DINode::FlagZero,
716  DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
717  DITemplateParameterArray TParams = nullptr,
718  DISubprogram *Decl = nullptr,
719  DITypeArray ThrownTypes = nullptr);
720 
721  /// Identical to createFunction,
722  /// except that the resulting DbgNode is meant to be RAUWed.
724  DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
725  unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
726  DINode::DIFlags Flags = DINode::FlagZero,
727  DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
728  DITemplateParameterArray TParams = nullptr,
729  DISubprogram *Decl = nullptr, DITypeArray ThrownTypes = nullptr);
730 
731  /// Create a new descriptor for the specified C++ method.
732  /// See comments in \a DISubprogram* for descriptions of these fields.
733  /// \param Scope Function scope.
734  /// \param Name Function name.
735  /// \param LinkageName Mangled function name.
736  /// \param File File where this variable is defined.
737  /// \param LineNo Line number.
738  /// \param Ty Function type.
739  /// \param VTableIndex Index no of this method in virtual table, or -1u if
740  /// unrepresentable.
741  /// \param ThisAdjustment
742  /// MS ABI-specific adjustment of 'this' that occurs
743  /// in the prologue.
744  /// \param VTableHolder Type that holds vtable.
745  /// \param Flags e.g. is this function prototyped or not.
746  /// This flags are used to emit dwarf attributes.
747  /// \param SPFlags Additional flags specific to subprograms.
748  /// \param TParams Function template parameters.
749  /// \param ThrownTypes Exception types this function may throw.
750  DISubprogram *
752  DIFile *File, unsigned LineNo, DISubroutineType *Ty,
753  unsigned VTableIndex = 0, int ThisAdjustment = 0,
754  DIType *VTableHolder = nullptr,
755  DINode::DIFlags Flags = DINode::FlagZero,
756  DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
757  DITemplateParameterArray TParams = nullptr,
758  DITypeArray ThrownTypes = nullptr);
759 
760  /// Create common block entry for a Fortran common block.
761  /// \param Scope Scope of this common block.
762  /// \param decl Global variable declaration.
763  /// \param Name The name of this common block.
764  /// \param File The file this common block is defined.
765  /// \param LineNo Line number.
768  unsigned LineNo);
769 
770  /// This creates new descriptor for a namespace with the specified
771  /// parent scope.
772  /// \param Scope Namespace scope
773  /// \param Name Name of this namespace
774  /// \param ExportSymbols True for C++ inline namespaces.
776  bool ExportSymbols);
777 
778  /// This creates new descriptor for a module with the specified
779  /// parent scope.
780  /// \param Scope Parent scope
781  /// \param Name Name of this module
782  /// \param ConfigurationMacros
783  /// A space-separated shell-quoted list of -D macro
784  /// definitions as they would appear on a command line.
785  /// \param IncludePath The path to the module map file.
786  /// \param APINotesFile The path to an API notes file for this module.
787  /// \param File Source file of the module.
788  /// Used for Fortran modules.
789  /// \param LineNo Source line number of the module.
790  /// Used for Fortran modules.
791  /// \param IsDecl This is a module declaration; default to false;
792  /// when set to true, only Scope and Name are required
793  /// as this entry is just a hint for the debugger to find
794  /// the corresponding definition in the global scope.
796  StringRef ConfigurationMacros, StringRef IncludePath,
797  StringRef APINotesFile = {}, DIFile *File = nullptr,
798  unsigned LineNo = 0, bool IsDecl = false);
799 
800  /// This creates a descriptor for a lexical block with a new file
801  /// attached. This merely extends the existing
802  /// lexical block as it crosses a file.
803  /// \param Scope Lexical block.
804  /// \param File Source file.
805  /// \param Discriminator DWARF path discriminator value.
806  DILexicalBlockFile *createLexicalBlockFile(DIScope *Scope, DIFile *File,
807  unsigned Discriminator = 0);
808 
809  /// This creates a descriptor for a lexical block with the
810  /// specified parent context.
811  /// \param Scope Parent lexical scope.
812  /// \param File Source file.
813  /// \param Line Line number.
814  /// \param Col Column number.
815  DILexicalBlock *createLexicalBlock(DIScope *Scope, DIFile *File,
816  unsigned Line, unsigned Col);
817 
818  /// Create a descriptor for an imported module.
819  /// \param Context The scope this module is imported into
820  /// \param NS The namespace being imported here.
821  /// \param File File where the declaration is located.
822  /// \param Line Line number of the declaration.
823  DIImportedEntity *createImportedModule(DIScope *Context, DINamespace *NS,
824  DIFile *File, unsigned Line);
825 
826  /// Create a descriptor for an imported module.
827  /// \param Context The scope this module is imported into.
828  /// \param NS An aliased namespace.
829  /// \param File File where the declaration is located.
830  /// \param Line Line number of the declaration.
831  DIImportedEntity *createImportedModule(DIScope *Context,
832  DIImportedEntity *NS, DIFile *File,
833  unsigned Line);
834 
835  /// Create a descriptor for an imported module.
836  /// \param Context The scope this module is imported into.
837  /// \param M The module being imported here
838  /// \param File File where the declaration is located.
839  /// \param Line Line number of the declaration.
840  DIImportedEntity *createImportedModule(DIScope *Context, DIModule *M,
841  DIFile *File, unsigned Line);
842 
843  /// Create a descriptor for an imported function.
844  /// \param Context The scope this module is imported into.
845  /// \param Decl The declaration (or definition) of a function, type, or
846  /// variable.
847  /// \param File File where the declaration is located.
848  /// \param Line Line number of the declaration.
849  DIImportedEntity *createImportedDeclaration(DIScope *Context, DINode *Decl,
850  DIFile *File, unsigned Line,
851  StringRef Name = "");
852 
853  /// Insert a new llvm.dbg.declare intrinsic call.
854  /// \param Storage llvm::Value of the variable
855  /// \param VarInfo Variable's debug info descriptor.
856  /// \param Expr A complex location expression.
857  /// \param DL Debug info location.
858  /// \param InsertAtEnd Location for the new intrinsic.
859  Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
860  DIExpression *Expr, const DILocation *DL,
861  BasicBlock *InsertAtEnd);
862 
863  /// Insert a new llvm.dbg.declare intrinsic call.
864  /// \param Storage llvm::Value of the variable
865  /// \param VarInfo Variable's debug info descriptor.
866  /// \param Expr A complex location expression.
867  /// \param DL Debug info location.
868  /// \param InsertBefore Location for the new intrinsic.
869  Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
870  DIExpression *Expr, const DILocation *DL,
871  Instruction *InsertBefore);
872 
873  /// Insert a new llvm.dbg.label intrinsic call.
874  /// \param LabelInfo Label's debug info descriptor.
875  /// \param DL Debug info location.
876  /// \param InsertBefore Location for the new intrinsic.
877  Instruction *insertLabel(DILabel *LabelInfo, const DILocation *DL,
878  Instruction *InsertBefore);
879 
880  /// Insert a new llvm.dbg.label intrinsic call.
881  /// \param LabelInfo Label's debug info descriptor.
882  /// \param DL Debug info location.
883  /// \param InsertAtEnd Location for the new intrinsic.
884  Instruction *insertLabel(DILabel *LabelInfo, const DILocation *DL,
885  BasicBlock *InsertAtEnd);
886 
887  /// Insert a new llvm.dbg.value intrinsic call.
888  /// \param Val llvm::Value of the variable
889  /// \param VarInfo Variable's debug info descriptor.
890  /// \param Expr A complex location expression.
891  /// \param DL Debug info location.
892  /// \param InsertAtEnd Location for the new intrinsic.
893  Instruction *insertDbgValueIntrinsic(llvm::Value *Val,
894  DILocalVariable *VarInfo,
895  DIExpression *Expr,
896  const DILocation *DL,
897  BasicBlock *InsertAtEnd);
898 
899  /// Insert a new llvm.dbg.value intrinsic call.
900  /// \param Val llvm::Value of the variable
901  /// \param VarInfo Variable's debug info descriptor.
902  /// \param Expr A complex location expression.
903  /// \param DL Debug info location.
904  /// \param InsertBefore Location for the new intrinsic.
905  Instruction *insertDbgValueIntrinsic(llvm::Value *Val,
906  DILocalVariable *VarInfo,
907  DIExpression *Expr,
908  const DILocation *DL,
909  Instruction *InsertBefore);
910 
911  /// Replace the vtable holder in the given type.
912  ///
913  /// If this creates a self reference, it may orphan some unresolved cycles
914  /// in the operands of \c T, so \a DIBuilder needs to track that.
915  void replaceVTableHolder(DICompositeType *&T,
916  DIType *VTableHolder);
917 
918  /// Replace arrays on a composite type.
919  ///
920  /// If \c T is resolved, but the arrays aren't -- which can happen if \c T
921  /// has a self-reference -- \a DIBuilder needs to track the array to
922  /// resolve cycles.
923  void replaceArrays(DICompositeType *&T, DINodeArray Elements,
924  DINodeArray TParams = DINodeArray());
925 
926  /// Replace a temporary node.
927  ///
928  /// Call \a MDNode::replaceAllUsesWith() on \c N, replacing it with \c
929  /// Replacement.
930  ///
931  /// If \c Replacement is the same as \c N.get(), instead call \a
932  /// MDNode::replaceWithUniqued(). In this case, the uniqued node could
933  /// have a different address, so we return the final address.
934  template <class NodeTy>
935  NodeTy *replaceTemporary(TempMDNode &&N, NodeTy *Replacement) {
936  if (N.get() == Replacement)
937  return cast<NodeTy>(MDNode::replaceWithUniqued(std::move(N)));
938 
939  N->replaceAllUsesWith(Replacement);
940  return Replacement;
941  }
942  };
943 
944  // Create wrappers for C Binding types (see CBindingWrapping.h).
946 
947 } // end namespace llvm
948 
949 #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:886
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::DIBuilder::createImportedDeclaration
DIImportedEntity * createImportedDeclaration(DIScope *Context, DINode *Decl, DIFile *File, unsigned Line, StringRef Name="")
Create a descriptor for an imported function.
Definition: DIBuilder.cpp:203
llvm
Definition: AllocatorList.h:23
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:646
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:1040
llvm::DIBuilder
Definition: DIBuilder.h:41
DebugInfoMetadata.h
llvm::DIGenericSubrange
Definition: DebugInfoMetadata.h:358
llvm::Function
Definition: Function.h:61
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::lltok::NameTableKind
@ NameTableKind
Definition: LLToken.h:479
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:833
llvm::DIFile::ChecksumInfo
A single checksum, represented by a Kind and a Value (a string).
Definition: DebugInfoMetadata.h:548
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:715
MapVector.h
llvm::DIBuilder::createEnumerator
DIEnumerator * createEnumerator(StringRef Name, int64_t Val, bool IsUnsigned=false)
Create a single enumerator value.
Definition: DIBuilder.cpp:246
llvm::DILocation
Debug location.
Definition: DebugInfoMetadata.h:1558
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:829
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::createSubroutineType
DISubroutineType * createSubroutineType(DITypeRefArray ParameterTypes, DINode::DIFlags Flags=DINode::FlagZero, unsigned CC=0)
Create subroutine type.
Definition: DIBuilder.cpp:508
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2559
llvm::DIBuilder::createQualifiedType
DIDerivedType * createQualifiedType(unsigned Tag, DIType *FromTy)
Create debugging information entry for a qualified type, e.g.
Definition: DIBuilder.cpp:276
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:270
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:407
llvm::DICompileUnit::DebugEmissionKind
DebugEmissionKind
Definition: DebugInfoMetadata.h:1318
llvm::DINamespace
Definition: DebugInfoMetadata.h:2249
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:215
llvm::MDNode::get
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1198
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:447
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
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:754
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::DITypeRefArray
Definition: DebugInfoMetadata.h:63
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:528
llvm::DIBuilder::createArtificialType
static DIType * createArtificialType(DIType *Ty)
Create a uniqued clone of Ty with FlagArtificial set.
Definition: DIBuilder.cpp:583
llvm::DIObjCProperty
Definition: DebugInfoMetadata.h:3189
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:935
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:384
llvm::ISD::Constant
@ Constant
Definition: ISDOpcodes.h:69
llvm::DILocalVariable
Local variable.
Definition: DebugInfoMetadata.h:3041
llvm::DIMacro
Definition: DebugInfoMetadata.h:3421
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:221
llvm::DIBuilder::createTempMacroFile
DIMacroFile * createTempMacroFile(DIMacroFile *Parent, unsigned Line, DIFile *File)
Create debugging information temporary entry for a macro file.
Definition: DIBuilder.cpp:233
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:867
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:598
llvm::DISubprogram::DISPFlags
DISPFlags
Debug info subprogram flags.
Definition: DebugInfoMetadata.h:1830
llvm::MDTuple
Tuple of metadata.
Definition: Metadata.h:1139
llvm::DISubrange
Array subrange.
Definition: DebugInfoMetadata.h:292
llvm::DIBuilder::createFriend
DIDerivedType * createFriend(DIType *Ty, DIType *FriendTy)
Create debugging information entry for a 'friend'.
Definition: DIBuilder.cpp:324
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)
Create a new descriptor for the specified subprogram.
Definition: DIBuilder.cpp:810
llvm::DITemplateTypeParameter
Definition: DebugInfoMetadata.h:2399
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:281
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:484
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:496
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:1060
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:590
llvm::DICommonBlock
Definition: DebugInfoMetadata.h:2979
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:304
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::DIEnumerator
Enumeration value.
Definition: DebugInfoMetadata.h:408
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:844
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)
Create a new descriptor for a parameter variable.
Definition: DIBuilder.cpp:764
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:609
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:540
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:514
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:454
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:793
llvm::DIGlobalVariable
Global variables.
Definition: DebugInfoMetadata.h:2899
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:1017
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:439
llvm::DenseMap
Definition: DenseMap.h:714
DebugInfo.h
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="")
Create a temporary forward-declared type.
Definition: DIBuilder.cpp:623
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:294
llvm::DICompileUnit
Compile unit.
Definition: DebugInfoMetadata.h:1313
ArrayRef.h
llvm::DIMacroFile
Definition: DebugInfoMetadata.h:3470
llvm::DIBuilder::createArtificialSubprogram
static DISubprogram * createArtificialSubprogram(DISubprogram *SP)
Create a distinct clone of SP with FlagArtificial set.
Definition: DIBuilder.cpp:572
llvm::ISD::BasicBlock
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:64
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:773
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:897
llvm::DIBasicType
Basic type, like 'int' or 'float'.
Definition: DebugInfoMetadata.h:765
llvm::DISubroutineType
Type array for a subprogram.
Definition: DebugInfoMetadata.h:1259
llvm::DICompositeType
Composite types.
Definition: DebugInfoMetadata.h:1047
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:895
llvm::DICompileUnit::DebugNameTableKind
DebugNameTableKind
Definition: DebugInfoMetadata.h:1326
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:360
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
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:676
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:901
llvm::PointerUnion
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
Definition: PointerUnion.h:149
llvm::DIBuilder::createTemplateTypeParameter
DITemplateTypeParameter * createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault)
Create debugging information for template type parameter.
Definition: DIBuilder.cpp:415
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:331
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:138
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:874
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:471
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::DIBuilder::createUnspecifiedType
DIBasicType * createUnspecifiedType(StringRef Name)
Create a DWARF unspecified type.
Definition: DIBuilder.cpp:253
llvm::DIScope
Base class for scope-like contexts.
Definition: DebugInfoMetadata.h:472
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:396
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:315
llvm::DIBuilder::createImportedModule
DIImportedEntity * createImportedModule(DIScope *Context, DINamespace *NS, DIFile *File, unsigned Line)
Create a descriptor for an imported module.
Definition: DIBuilder.cpp:180
Casting.h
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)
Create debugging information entry for a member.
Definition: DIBuilder.cpp:343
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:562
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:637
llvm::DICompileUnit::DebugNameTableKind::Default
@ Default
llvm::DIDerivedType
Derived types.
Definition: DebugInfoMetadata.h:913
llvm::DIGlobalVariableExpression
A pair of DIGlobalVariable and DIExpression.
Definition: DebugInfoMetadata.h:3331
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:430
llvm::DITemplateValueParameter
Definition: DebugInfoMetadata.h:2441
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:258
llvm::DIBuilder::getOrCreateSubrange
DISubrange * getOrCreateSubrange(int64_t Lo, int64_t Count)
Create a descriptor for a value range.
Definition: DIBuilder.cpp:657
llvm::DIBuilder::getOrCreateMacroArray
DIMacroNodeArray getOrCreateMacroArray(ArrayRef< Metadata * > Elements)
Get a DIMacroNodeArray, create one if required.
Definition: DIBuilder.cpp:642
SmallVector.h
llvm::DINode::DIFlags
DIFlags
Debug info flags.
Definition: DebugInfoMetadata.h:162
N
#define N
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)
Create a new descriptor for the specified variable.
Definition: DIBuilder.cpp:697
llvm::DISubprogram
Subprogram description.
Definition: DebugInfoMetadata.h:1815
llvm::DIModule
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Definition: DebugInfoMetadata.h:2301
llvm::DILabel
Label.
Definition: DebugInfoMetadata.h:3121
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:262
CU
Definition: AArch64AsmBackend.cpp:506
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
File
Instrumentation for Order File
Definition: InstrOrderFile.cpp:206
llvm::DIBuilder::createUnspecifiedParameter
DIBasicType * createUnspecifiedParameter()
Create unspecified parameter type for a subroutine type.
Definition: DIBuilder.cpp:606
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:693
SetVector.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)
Create debugging information entry for a bit field member.
Definition: DIBuilder.cpp:370
llvm::DIFile
File.
Definition: DebugInfoMetadata.h:526