LLVM  14.0.0git
DIBuilder.cpp
Go to the documentation of this file.
1 //===--- DIBuilder.cpp - Debug Information Builder ------------------------===//
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 implements the DIBuilder.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm/IR/DIBuilder.h"
14 #include "LLVMContextImpl.h"
15 #include "llvm/ADT/Optional.h"
16 #include "llvm/ADT/STLExtras.h"
18 #include "llvm/IR/Constants.h"
19 #include "llvm/IR/DebugInfo.h"
20 #include "llvm/IR/IRBuilder.h"
21 #include "llvm/IR/IntrinsicInst.h"
22 #include "llvm/IR/Module.h"
24 #include "llvm/Support/Debug.h"
25 
26 using namespace llvm;
27 using namespace llvm::dwarf;
28 
29 static cl::opt<bool>
30  UseDbgAddr("use-dbg-addr",
31  llvm::cl::desc("Use llvm.dbg.addr for all local variables"),
32  cl::init(false), cl::Hidden);
33 
34 DIBuilder::DIBuilder(Module &m, bool AllowUnresolvedNodes, DICompileUnit *CU)
35  : M(m), VMContext(M.getContext()), CUNode(CU),
36  DeclareFn(nullptr), ValueFn(nullptr), LabelFn(nullptr),
37  AllowUnresolvedNodes(AllowUnresolvedNodes) {}
38 
39 void DIBuilder::trackIfUnresolved(MDNode *N) {
40  if (!N)
41  return;
42  if (N->isResolved())
43  return;
44 
45  assert(AllowUnresolvedNodes && "Cannot handle unresolved nodes");
46  UnresolvedNodes.emplace_back(N);
47 }
48 
50  MDTuple *Temp = SP->getRetainedNodes().get();
51  if (!Temp || !Temp->isTemporary())
52  return;
53 
54  SmallVector<Metadata *, 16> RetainedNodes;
55 
56  auto PV = PreservedVariables.find(SP);
57  if (PV != PreservedVariables.end())
58  RetainedNodes.append(PV->second.begin(), PV->second.end());
59 
60  auto PL = PreservedLabels.find(SP);
61  if (PL != PreservedLabels.end())
62  RetainedNodes.append(PL->second.begin(), PL->second.end());
63 
64  DINodeArray Node = getOrCreateArray(RetainedNodes);
65 
66  TempMDTuple(Temp)->replaceAllUsesWith(Node.get());
67 }
68 
70  if (!CUNode) {
71  assert(!AllowUnresolvedNodes &&
72  "creating type nodes without a CU is not supported");
73  return;
74  }
75 
76  CUNode->replaceEnumTypes(MDTuple::get(VMContext, AllEnumTypes));
77 
78  SmallVector<Metadata *, 16> RetainValues;
79  // Declarations and definitions of the same type may be retained. Some
80  // clients RAUW these pairs, leaving duplicates in the retained types
81  // list. Use a set to remove the duplicates while we transform the
82  // TrackingVHs back into Values.
84  for (unsigned I = 0, E = AllRetainTypes.size(); I < E; I++)
85  if (RetainSet.insert(AllRetainTypes[I]).second)
86  RetainValues.push_back(AllRetainTypes[I]);
87 
88  if (!RetainValues.empty())
89  CUNode->replaceRetainedTypes(MDTuple::get(VMContext, RetainValues));
90 
91  DISubprogramArray SPs = MDTuple::get(VMContext, AllSubprograms);
92  for (auto *SP : SPs)
94  for (auto *N : RetainValues)
95  if (auto *SP = dyn_cast<DISubprogram>(N))
97 
98  if (!AllGVs.empty())
99  CUNode->replaceGlobalVariables(MDTuple::get(VMContext, AllGVs));
100 
101  if (!AllImportedModules.empty())
103  VMContext, SmallVector<Metadata *, 16>(AllImportedModules.begin(),
104  AllImportedModules.end())));
105 
106  for (const auto &I : AllMacrosPerParent) {
107  // DIMacroNode's with nullptr parent are DICompileUnit direct children.
108  if (!I.first) {
109  CUNode->replaceMacros(MDTuple::get(VMContext, I.second.getArrayRef()));
110  continue;
111  }
112  // Otherwise, it must be a temporary DIMacroFile that need to be resolved.
113  auto *TMF = cast<DIMacroFile>(I.first);
114  auto *MF = DIMacroFile::get(VMContext, dwarf::DW_MACINFO_start_file,
115  TMF->getLine(), TMF->getFile(),
116  getOrCreateMacroArray(I.second.getArrayRef()));
117  replaceTemporary(llvm::TempDIMacroNode(TMF), MF);
118  }
119 
120  // Now that all temp nodes have been replaced or deleted, resolve remaining
121  // cycles.
122  for (const auto &N : UnresolvedNodes)
123  if (N && !N->isResolved())
124  N->resolveCycles();
125  UnresolvedNodes.clear();
126 
127  // Can't handle unresolved nodes anymore.
128  AllowUnresolvedNodes = false;
129 }
130 
131 /// If N is compile unit return NULL otherwise return N.
133  if (!N || isa<DICompileUnit>(N))
134  return nullptr;
135  return cast<DIScope>(N);
136 }
137 
139  unsigned Lang, DIFile *File, StringRef Producer, bool isOptimized,
140  StringRef Flags, unsigned RunTimeVer, StringRef SplitName,
141  DICompileUnit::DebugEmissionKind Kind, uint64_t DWOId,
142  bool SplitDebugInlining, bool DebugInfoForProfiling,
143  DICompileUnit::DebugNameTableKind NameTableKind, bool RangesBaseAddress,
144  StringRef SysRoot, StringRef SDK) {
145 
146  assert(((Lang <= dwarf::DW_LANG_Fortran08 && Lang >= dwarf::DW_LANG_C89) ||
147  (Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
148  "Invalid Language tag");
149 
150  assert(!CUNode && "Can only make one compile unit per DIBuilder instance");
152  VMContext, Lang, File, Producer, isOptimized, Flags, RunTimeVer,
153  SplitName, Kind, nullptr, nullptr, nullptr, nullptr, nullptr, DWOId,
154  SplitDebugInlining, DebugInfoForProfiling, NameTableKind,
155  RangesBaseAddress, SysRoot, SDK);
156 
157  // Create a named metadata so that it is easier to find cu in a module.
158  NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu");
159  NMD->addOperand(CUNode);
160  trackIfUnresolved(CUNode);
161  return CUNode;
162 }
163 
164 static DIImportedEntity *
166  Metadata *NS, DIFile *File, unsigned Line, StringRef Name,
167  SmallVectorImpl<TrackingMDNodeRef> &AllImportedModules) {
168  if (Line)
169  assert(File && "Source location has line number but no file");
170  unsigned EntitiesCount = C.pImpl->DIImportedEntitys.size();
171  auto *M = DIImportedEntity::get(C, Tag, Context, cast_or_null<DINode>(NS),
172  File, Line, Name);
173  if (EntitiesCount < C.pImpl->DIImportedEntitys.size())
174  // A new Imported Entity was just added to the context.
175  // Add it to the Imported Modules list.
176  AllImportedModules.emplace_back(M);
177  return M;
178 }
179 
181  DINamespace *NS, DIFile *File,
182  unsigned Line) {
183  return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
184  Context, NS, File, Line, StringRef(),
185  AllImportedModules);
186 }
187 
189  DIImportedEntity *NS,
190  DIFile *File, unsigned Line) {
191  return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
192  Context, NS, File, Line, StringRef(),
193  AllImportedModules);
194 }
195 
197  DIFile *File, unsigned Line) {
198  return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
199  Context, M, File, Line, StringRef(),
200  AllImportedModules);
201 }
202 
204  DINode *Decl,
205  DIFile *File,
206  unsigned Line,
207  StringRef Name) {
208  // Make sure to use the unique identifier based metadata reference for
209  // types that have one.
210  return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_declaration,
211  Context, Decl, File, Line, Name,
212  AllImportedModules);
213 }
214 
218  return DIFile::get(VMContext, Filename, Directory, CS, Source);
219 }
220 
221 DIMacro *DIBuilder::createMacro(DIMacroFile *Parent, unsigned LineNumber,
222  unsigned MacroType, StringRef Name,
223  StringRef Value) {
224  assert(!Name.empty() && "Unable to create macro without name");
225  assert((MacroType == dwarf::DW_MACINFO_undef ||
226  MacroType == dwarf::DW_MACINFO_define) &&
227  "Unexpected macro type");
228  auto *M = DIMacro::get(VMContext, MacroType, LineNumber, Name, Value);
229  AllMacrosPerParent[Parent].insert(M);
230  return M;
231 }
232 
234  unsigned LineNumber, DIFile *File) {
236  LineNumber, File, DIMacroNodeArray())
237  .release();
238  AllMacrosPerParent[Parent].insert(MF);
239  // Add the new temporary DIMacroFile to the macro per parent map as a parent.
240  // This is needed to assure DIMacroFile with no children to have an entry in
241  // the map. Otherwise, it will not be resolved in DIBuilder::finalize().
242  AllMacrosPerParent.insert({MF, {}});
243  return MF;
244 }
245 
247  bool IsUnsigned) {
248  assert(!Name.empty() && "Unable to create enumerator without name");
249  return DIEnumerator::get(VMContext, APInt(64, Val, !IsUnsigned), IsUnsigned,
250  Name);
251 }
252 
254  assert(!Name.empty() && "Unable to create enumerator without name");
255  return DIEnumerator::get(VMContext, APInt(Value), Value.isUnsigned(), Name);
256 }
257 
259  assert(!Name.empty() && "Unable to create type without name");
260  return DIBasicType::get(VMContext, dwarf::DW_TAG_unspecified_type, Name);
261 }
262 
264  return createUnspecifiedType("decltype(nullptr)");
265 }
266 
268  unsigned Encoding,
269  DINode::DIFlags Flags) {
270  assert(!Name.empty() && "Unable to create type without name");
271  return DIBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits,
272  0, Encoding, Flags);
273 }
274 
276  assert(!Name.empty() && "Unable to create type without name");
277  return DIStringType::get(VMContext, dwarf::DW_TAG_string_type, Name,
278  SizeInBits, 0);
279 }
280 
282  return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, FromTy, 0,
283  0, 0, None, DINode::FlagZero);
284 }
285 
287  DIType *PointeeTy,
288  uint64_t SizeInBits,
289  uint32_t AlignInBits,
290  Optional<unsigned> DWARFAddressSpace,
291  StringRef Name) {
292  // FIXME: Why is there a name here?
293  return DIDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name,
294  nullptr, 0, nullptr, PointeeTy, SizeInBits,
295  AlignInBits, 0, DWARFAddressSpace,
296  DINode::FlagZero);
297 }
298 
300  DIType *Base,
301  uint64_t SizeInBits,
302  uint32_t AlignInBits,
303  DINode::DIFlags Flags) {
304  return DIDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "",
305  nullptr, 0, nullptr, PointeeTy, SizeInBits,
306  AlignInBits, 0, None, Flags, Base);
307 }
308 
310  unsigned Tag, DIType *RTy,
311  uint64_t SizeInBits,
312  uint32_t AlignInBits,
313  Optional<unsigned> DWARFAddressSpace) {
314  assert(RTy && "Unable to create reference type");
315  return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, RTy,
316  SizeInBits, AlignInBits, 0, DWARFAddressSpace,
317  DINode::FlagZero);
318 }
319 
321  DIFile *File, unsigned LineNo,
322  DIScope *Context,
323  uint32_t AlignInBits) {
324  return DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File,
325  LineNo, getNonCompileUnitScope(Context), Ty, 0,
326  AlignInBits, 0, None, DINode::FlagZero);
327 }
328 
330  assert(Ty && "Invalid type!");
331  assert(FriendTy && "Invalid friend type!");
332  return DIDerivedType::get(VMContext, dwarf::DW_TAG_friend, "", nullptr, 0, Ty,
333  FriendTy, 0, 0, 0, None, DINode::FlagZero);
334 }
335 
337  uint64_t BaseOffset,
338  uint32_t VBPtrOffset,
339  DINode::DIFlags Flags) {
340  assert(Ty && "Unable to create inheritance");
341  Metadata *ExtraData = ConstantAsMetadata::get(
342  ConstantInt::get(IntegerType::get(VMContext, 32), VBPtrOffset));
343  return DIDerivedType::get(VMContext, dwarf::DW_TAG_inheritance, "", nullptr,
344  0, Ty, BaseTy, 0, 0, BaseOffset, None,
345  Flags, ExtraData);
346 }
347 
349  DIFile *File, unsigned LineNumber,
350  uint64_t SizeInBits,
351  uint32_t AlignInBits,
352  uint64_t OffsetInBits,
353  DINode::DIFlags Flags, DIType *Ty) {
354  return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
355  LineNumber, getNonCompileUnitScope(Scope), Ty,
356  SizeInBits, AlignInBits, OffsetInBits, None, Flags);
357 }
358 
360  if (C)
361  return ConstantAsMetadata::get(C);
362  return nullptr;
363 }
364 
366  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
367  uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
368  Constant *Discriminant, DINode::DIFlags Flags, DIType *Ty) {
369  return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
370  LineNumber, getNonCompileUnitScope(Scope), Ty,
371  SizeInBits, AlignInBits, OffsetInBits, None, Flags,
372  getConstantOrNull(Discriminant));
373 }
374 
376  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
377  uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits,
378  DINode::DIFlags Flags, DIType *Ty) {
379  Flags |= DINode::FlagBitField;
380  return DIDerivedType::get(
381  VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
382  getNonCompileUnitScope(Scope), Ty, SizeInBits, /* AlignInBits */ 0,
383  OffsetInBits, None, Flags,
385  StorageOffsetInBits)));
386 }
387 
390  unsigned LineNumber, DIType *Ty,
391  DINode::DIFlags Flags, llvm::Constant *Val,
392  uint32_t AlignInBits) {
393  Flags |= DINode::FlagStaticMember;
394  return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
395  LineNumber, getNonCompileUnitScope(Scope), Ty, 0,
396  AlignInBits, 0, None, Flags,
397  getConstantOrNull(Val));
398 }
399 
402  uint64_t SizeInBits, uint32_t AlignInBits,
403  uint64_t OffsetInBits, DINode::DIFlags Flags,
404  DIType *Ty, MDNode *PropertyNode) {
405  return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
406  LineNumber, getNonCompileUnitScope(File), Ty,
407  SizeInBits, AlignInBits, OffsetInBits, None, Flags,
408  PropertyNode);
409 }
410 
413  StringRef GetterName, StringRef SetterName,
414  unsigned PropertyAttributes, DIType *Ty) {
415  return DIObjCProperty::get(VMContext, Name, File, LineNumber, GetterName,
416  SetterName, PropertyAttributes, Ty);
417 }
418 
421  DIType *Ty, bool isDefault) {
422  assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
423  return DITemplateTypeParameter::get(VMContext, Name, Ty, isDefault);
424 }
425 
429  bool IsDefault, Metadata *MD) {
430  assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
431  return DITemplateValueParameter::get(VMContext, Tag, Name, Ty, IsDefault, MD);
432 }
433 
436  DIType *Ty, bool isDefault,
437  Constant *Val) {
439  VMContext, dwarf::DW_TAG_template_value_parameter, Context, Name, Ty,
440  isDefault, getConstantOrNull(Val));
441 }
442 
445  DIType *Ty, StringRef Val) {
447  VMContext, dwarf::DW_TAG_GNU_template_template_param, Context, Name, Ty,
448  false, MDString::get(VMContext, Val));
449 }
450 
453  DIType *Ty, DINodeArray Val) {
455  VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty,
456  false, Val.get());
457 }
458 
460  DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
461  uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
462  DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
463  DIType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) {
464  assert((!Context || isa<DIScope>(Context)) &&
465  "createClassType should be called with a valid Context");
466 
467  auto *R = DICompositeType::get(
468  VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
469  getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBits,
470  OffsetInBits, Flags, Elements, 0, VTableHolder,
471  cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier);
472  trackIfUnresolved(R);
473  return R;
474 }
475 
477  DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
478  uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
479  DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang,
480  DIType *VTableHolder, StringRef UniqueIdentifier) {
481  auto *R = DICompositeType::get(
482  VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
483  getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBits, 0,
484  Flags, Elements, RunTimeLang, VTableHolder, nullptr, UniqueIdentifier);
485  trackIfUnresolved(R);
486  return R;
487 }
488 
490  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
491  uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
492  DINodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) {
493  auto *R = DICompositeType::get(
494  VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
495  getNonCompileUnitScope(Scope), nullptr, SizeInBits, AlignInBits, 0, Flags,
496  Elements, RunTimeLang, nullptr, nullptr, UniqueIdentifier);
497  trackIfUnresolved(R);
498  return R;
499 }
500 
502  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
503  uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
504  DIDerivedType *Discriminator, DINodeArray Elements, StringRef UniqueIdentifier) {
505  auto *R = DICompositeType::get(
506  VMContext, dwarf::DW_TAG_variant_part, Name, File, LineNumber,
507  getNonCompileUnitScope(Scope), nullptr, SizeInBits, AlignInBits, 0, Flags,
508  Elements, 0, nullptr, nullptr, UniqueIdentifier, Discriminator);
509  trackIfUnresolved(R);
510  return R;
511 }
512 
514  DINode::DIFlags Flags,
515  unsigned CC) {
516  return DISubroutineType::get(VMContext, Flags, CC, ParameterTypes);
517 }
518 
520  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
521  uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements,
522  DIType *UnderlyingType, StringRef UniqueIdentifier, bool IsScoped) {
523  auto *CTy = DICompositeType::get(
524  VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
525  getNonCompileUnitScope(Scope), UnderlyingType, SizeInBits, AlignInBits, 0,
526  IsScoped ? DINode::FlagEnumClass : DINode::FlagZero, Elements, 0, nullptr,
527  nullptr, UniqueIdentifier);
528  AllEnumTypes.push_back(CTy);
529  trackIfUnresolved(CTy);
530  return CTy;
531 }
532 
534  DIFile *File, unsigned LineNo,
535  uint64_t SizeInBits,
536  uint32_t AlignInBits, DIType *Ty) {
537  auto *R =
538  DIDerivedType::get(VMContext, dwarf::DW_TAG_set_type, Name, File, LineNo,
539  getNonCompileUnitScope(Scope), Ty, SizeInBits,
540  AlignInBits, 0, None, DINode::FlagZero);
541  trackIfUnresolved(R);
542  return R;
543 }
544 
546  uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts,
551  auto *R = DICompositeType::get(
552  VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0,
553  nullptr, Ty, Size, AlignInBits, 0, DINode::FlagZero,
554  Subscripts, 0, nullptr, nullptr, "", nullptr,
555  DL.is<DIExpression *>() ? (Metadata *)DL.get<DIExpression *>()
556  : (Metadata *)DL.get<DIVariable *>(),
557  AS.is<DIExpression *>() ? (Metadata *)AS.get<DIExpression *>()
558  : (Metadata *)AS.get<DIVariable *>(),
559  AL.is<DIExpression *>() ? (Metadata *)AL.get<DIExpression *>()
560  : (Metadata *)AL.get<DIVariable *>(),
561  RK.is<DIExpression *>() ? (Metadata *)RK.get<DIExpression *>()
562  : (Metadata *)RK.get<DIVariable *>());
563  trackIfUnresolved(R);
564  return R;
565 }
566 
568  uint32_t AlignInBits, DIType *Ty,
569  DINodeArray Subscripts) {
570  auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "",
571  nullptr, 0, nullptr, Ty, Size, AlignInBits, 0,
572  DINode::FlagVector, Subscripts, 0, nullptr);
573  trackIfUnresolved(R);
574  return R;
575 }
576 
578  auto NewSP = SP->cloneWithFlags(SP->getFlags() | DINode::FlagArtificial);
579  return MDNode::replaceWithDistinct(std::move(NewSP));
580 }
581 
583  DINode::DIFlags FlagsToSet) {
584  auto NewTy = Ty->cloneWithFlags(Ty->getFlags() | FlagsToSet);
585  return MDNode::replaceWithUniqued(std::move(NewTy));
586 }
587 
589  // FIXME: Restrict this to the nodes where it's valid.
590  if (Ty->isArtificial())
591  return Ty;
592  return createTypeWithFlags(Ty, DINode::FlagArtificial);
593 }
594 
596  // FIXME: Restrict this to the nodes where it's valid.
597  if (Ty->isObjectPointer())
598  return Ty;
599  DINode::DIFlags Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
600  return createTypeWithFlags(Ty, Flags);
601 }
602 
604  assert(T && "Expected non-null type");
605  assert((isa<DIType>(T) || (isa<DISubprogram>(T) &&
606  cast<DISubprogram>(T)->isDefinition() == false)) &&
607  "Expected type or subprogram declaration");
608  AllRetainTypes.emplace_back(T);
609 }
610 
612 
615  DIFile *F, unsigned Line, unsigned RuntimeLang,
616  uint64_t SizeInBits, uint32_t AlignInBits,
617  StringRef UniqueIdentifier) {
618  // FIXME: Define in terms of createReplaceableForwardDecl() by calling
619  // replaceWithUniqued().
620  auto *RetTy = DICompositeType::get(
621  VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr,
622  SizeInBits, AlignInBits, 0, DINode::FlagFwdDecl, nullptr, RuntimeLang,
623  nullptr, nullptr, UniqueIdentifier);
624  trackIfUnresolved(RetTy);
625  return RetTy;
626 }
627 
629  unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
630  unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits,
631  DINode::DIFlags Flags, StringRef UniqueIdentifier) {
632  auto *RetTy =
634  VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr,
635  SizeInBits, AlignInBits, 0, Flags, nullptr, RuntimeLang, nullptr,
636  nullptr, UniqueIdentifier)
637  .release();
638  trackIfUnresolved(RetTy);
639  return RetTy;
640 }
641 
643  return MDTuple::get(VMContext, Elements);
644 }
645 
646 DIMacroNodeArray
648  return MDTuple::get(VMContext, Elements);
649 }
650 
653  for (unsigned i = 0, e = Elements.size(); i != e; ++i) {
654  if (Elements[i] && isa<MDNode>(Elements[i]))
655  Elts.push_back(cast<DIType>(Elements[i]));
656  else
657  Elts.push_back(Elements[i]);
658  }
659  return DITypeRefArray(MDNode::get(VMContext, Elts));
660 }
661 
662 DISubrange *DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
663  auto *LB = ConstantAsMetadata::get(
665  auto *CountNode = ConstantAsMetadata::get(
666  ConstantInt::getSigned(Type::getInt64Ty(VMContext), Count));
667  return DISubrange::get(VMContext, CountNode, LB, nullptr, nullptr);
668 }
669 
671  auto *LB = ConstantAsMetadata::get(
673  return DISubrange::get(VMContext, CountNode, LB, nullptr, nullptr);
674 }
675 
677  Metadata *UB, Metadata *Stride) {
678  return DISubrange::get(VMContext, CountNode, LB, UB, Stride);
679 }
680 
684  auto ConvToMetadata = [&](DIGenericSubrange::BoundType Bound) -> Metadata * {
685  return Bound.is<DIExpression *>() ? (Metadata *)Bound.get<DIExpression *>()
686  : (Metadata *)Bound.get<DIVariable *>();
687  };
688  return DIGenericSubrange::get(VMContext, ConvToMetadata(CountNode),
689  ConvToMetadata(LB), ConvToMetadata(UB),
690  ConvToMetadata(Stride));
691 }
692 
694 #ifndef NDEBUG
695  if (auto *CT =
696  dyn_cast_or_null<DICompositeType>(getNonCompileUnitScope(Context)))
697  assert(CT->getIdentifier().empty() &&
698  "Context of a global variable should not be a type with identifier");
699 #endif
700 }
701 
703  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
704  unsigned LineNumber, DIType *Ty, bool IsLocalToUnit,
705  bool isDefined, DIExpression *Expr,
706  MDNode *Decl, MDTuple *TemplateParams, uint32_t AlignInBits) {
708 
710  VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
711  LineNumber, Ty, IsLocalToUnit, isDefined, cast_or_null<DIDerivedType>(Decl),
712  TemplateParams, AlignInBits);
713  if (!Expr)
714  Expr = createExpression();
715  auto *N = DIGlobalVariableExpression::get(VMContext, GV, Expr);
716  AllGVs.push_back(N);
717  return N;
718 }
719 
721  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
722  unsigned LineNumber, DIType *Ty, bool IsLocalToUnit, MDNode *Decl,
723  MDTuple *TemplateParams, uint32_t AlignInBits) {
725 
727  VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
728  LineNumber, Ty, IsLocalToUnit, false,
729  cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits)
730  .release();
731 }
732 
734  LLVMContext &VMContext,
735  DenseMap<MDNode *, SmallVector<TrackingMDNodeRef, 1>> &PreservedVariables,
736  DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
737  unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags,
738  uint32_t AlignInBits) {
739  // FIXME: Why getNonCompileUnitScope()?
740  // FIXME: Why is "!Context" okay here?
741  // FIXME: Why doesn't this check for a subprogram or lexical block (AFAICT
742  // the only valid scopes)?
744 
745  auto *Node =
746  DILocalVariable::get(VMContext, cast_or_null<DILocalScope>(Context), Name,
747  File, LineNo, Ty, ArgNo, Flags, AlignInBits);
748  if (AlwaysPreserve) {
749  // The optimizer may remove local variables. If there is an interest
750  // to preserve variable info in such situation then stash it in a
751  // named mdnode.
753  assert(Fn && "Missing subprogram for local variable");
754  PreservedVariables[Fn].emplace_back(Node);
755  }
756  return Node;
757 }
758 
760  DIFile *File, unsigned LineNo,
761  DIType *Ty, bool AlwaysPreserve,
762  DINode::DIFlags Flags,
763  uint32_t AlignInBits) {
764  return createLocalVariable(VMContext, PreservedVariables, Scope, Name,
765  /* ArgNo */ 0, File, LineNo, Ty, AlwaysPreserve,
766  Flags, AlignInBits);
767 }
768 
770  DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
771  unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags) {
772  assert(ArgNo && "Expected non-zero argument number for parameter");
773  return createLocalVariable(VMContext, PreservedVariables, Scope, Name, ArgNo,
774  File, LineNo, Ty, AlwaysPreserve, Flags,
775  /* AlignInBits */0);
776 }
777 
780  unsigned LineNo, bool AlwaysPreserve) {
782 
783  auto *Node =
784  DILabel::get(VMContext, cast_or_null<DILocalScope>(Context), Name,
785  File, LineNo);
786 
787  if (AlwaysPreserve) {
788  /// The optimizer may remove labels. If there is an interest
789  /// to preserve label info in such situation then append it to
790  /// the list of retained nodes of the DISubprogram.
792  assert(Fn && "Missing subprogram for label");
793  PreservedLabels[Fn].emplace_back(Node);
794  }
795  return Node;
796 }
797 
799  return DIExpression::get(VMContext, Addr);
800 }
801 
803  // TODO: Remove the callers of this signed version and delete.
804  SmallVector<uint64_t, 8> Addr(Signed.begin(), Signed.end());
805  return createExpression(Addr);
806 }
807 
808 template <class... Ts>
809 static DISubprogram *getSubprogram(bool IsDistinct, Ts &&... Args) {
810  if (IsDistinct)
811  return DISubprogram::getDistinct(std::forward<Ts>(Args)...);
812  return DISubprogram::get(std::forward<Ts>(Args)...);
813 }
814 
816  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
817  unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
819  DITemplateParameterArray TParams, DISubprogram *Decl,
820  DITypeArray ThrownTypes) {
821  bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
822  auto *Node = getSubprogram(
823  /*IsDistinct=*/IsDefinition, VMContext, getNonCompileUnitScope(Context),
824  Name, LinkageName, File, LineNo, Ty, ScopeLine, nullptr, 0, 0, Flags,
825  SPFlags, IsDefinition ? CUNode : nullptr, TParams, Decl,
826  MDTuple::getTemporary(VMContext, None).release(), ThrownTypes);
827 
828  if (IsDefinition)
829  AllSubprograms.push_back(Node);
830  trackIfUnresolved(Node);
831  return Node;
832 }
833 
835  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
836  unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
838  DITemplateParameterArray TParams, DISubprogram *Decl,
839  DITypeArray ThrownTypes) {
840  bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
842  Name, LinkageName, File, LineNo, Ty,
843  ScopeLine, nullptr, 0, 0, Flags, SPFlags,
844  IsDefinition ? CUNode : nullptr, TParams,
845  Decl, nullptr, ThrownTypes)
846  .release();
847 }
848 
850  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
851  unsigned LineNo, DISubroutineType *Ty, unsigned VIndex, int ThisAdjustment,
852  DIType *VTableHolder, DINode::DIFlags Flags,
853  DISubprogram::DISPFlags SPFlags, DITemplateParameterArray TParams,
854  DITypeArray ThrownTypes) {
856  "Methods should have both a Context and a context that isn't "
857  "the compile unit.");
858  // FIXME: Do we want to use different scope/lines?
859  bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
860  auto *SP = getSubprogram(
861  /*IsDistinct=*/IsDefinition, VMContext, cast<DIScope>(Context), Name,
862  LinkageName, F, LineNo, Ty, LineNo, VTableHolder, VIndex, ThisAdjustment,
863  Flags, SPFlags, IsDefinition ? CUNode : nullptr, TParams, nullptr,
864  nullptr, ThrownTypes);
865 
866  if (IsDefinition)
867  AllSubprograms.push_back(SP);
868  trackIfUnresolved(SP);
869  return SP;
870 }
871 
874  unsigned LineNo) {
875  return DICommonBlock::get(
876  VMContext, Scope, Decl, Name, File, LineNo);
877 }
878 
880  bool ExportSymbols) {
881 
882  // It is okay to *not* make anonymous top-level namespaces distinct, because
883  // all nodes that have an anonymous namespace as their parent scope are
884  // guaranteed to be unique and/or are linked to their containing
885  // DICompileUnit. This decision is an explicit tradeoff of link time versus
886  // memory usage versus code simplicity and may get revisited in the future.
888  ExportSymbols);
889 }
890 
892  StringRef ConfigurationMacros,
893  StringRef IncludePath, StringRef APINotesFile,
894  DIFile *File, unsigned LineNo, bool IsDecl) {
895  return DIModule::get(VMContext, File, getNonCompileUnitScope(Scope), Name,
896  ConfigurationMacros, IncludePath, APINotesFile, LineNo,
897  IsDecl);
898 }
899 
901  DIFile *File,
902  unsigned Discriminator) {
903  return DILexicalBlockFile::get(VMContext, Scope, File, Discriminator);
904 }
905 
907  unsigned Line, unsigned Col) {
908  // Make these distinct, to avoid merging two lexical blocks on the same
909  // file/line/column.
911  File, Line, Col);
912 }
913 
914 Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
915  DIExpression *Expr, const DILocation *DL,
916  Instruction *InsertBefore) {
917  return insertDeclare(Storage, VarInfo, Expr, DL, InsertBefore->getParent(),
918  InsertBefore);
919 }
920 
921 Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
922  DIExpression *Expr, const DILocation *DL,
923  BasicBlock *InsertAtEnd) {
924  // If this block already has a terminator then insert this intrinsic before
925  // the terminator. Otherwise, put it at the end of the block.
926  Instruction *InsertBefore = InsertAtEnd->getTerminator();
927  return insertDeclare(Storage, VarInfo, Expr, DL, InsertAtEnd, InsertBefore);
928 }
929 
930 Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
931  Instruction *InsertBefore) {
932  return insertLabel(
933  LabelInfo, DL, InsertBefore ? InsertBefore->getParent() : nullptr,
934  InsertBefore);
935 }
936 
937 Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
938  BasicBlock *InsertAtEnd) {
939  return insertLabel(LabelInfo, DL, InsertAtEnd, nullptr);
940 }
941 
942 Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V,
943  DILocalVariable *VarInfo,
944  DIExpression *Expr,
945  const DILocation *DL,
946  Instruction *InsertBefore) {
947  return insertDbgValueIntrinsic(
948  V, VarInfo, Expr, DL, InsertBefore ? InsertBefore->getParent() : nullptr,
949  InsertBefore);
950 }
951 
952 Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V,
953  DILocalVariable *VarInfo,
954  DIExpression *Expr,
955  const DILocation *DL,
956  BasicBlock *InsertAtEnd) {
957  return insertDbgValueIntrinsic(V, VarInfo, Expr, DL, InsertAtEnd, nullptr);
958 }
959 
960 /// Initialize IRBuilder for inserting dbg.declare and dbg.value intrinsics.
961 /// This abstracts over the various ways to specify an insert position.
963  BasicBlock *InsertBB, Instruction *InsertBefore) {
964  if (InsertBefore)
965  Builder.SetInsertPoint(InsertBefore);
966  else if (InsertBB)
967  Builder.SetInsertPoint(InsertBB);
968  Builder.SetCurrentDebugLocation(DL);
969 }
970 
972  assert(V && "no value passed to dbg intrinsic");
973  return MetadataAsValue::get(VMContext, ValueAsMetadata::get(V));
974 }
975 
977  return Intrinsic::getDeclaration(&M, UseDbgAddr ? Intrinsic::dbg_addr
978  : Intrinsic::dbg_declare);
979 }
980 
981 Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
982  DIExpression *Expr, const DILocation *DL,
983  BasicBlock *InsertBB, Instruction *InsertBefore) {
984  assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.declare");
985  assert(DL && "Expected debug loc");
986  assert(DL->getScope()->getSubprogram() ==
987  VarInfo->getScope()->getSubprogram() &&
988  "Expected matching subprograms");
989  if (!DeclareFn)
990  DeclareFn = getDeclareIntrin(M);
991 
992  trackIfUnresolved(VarInfo);
993  trackIfUnresolved(Expr);
994  Value *Args[] = {getDbgIntrinsicValueImpl(VMContext, Storage),
995  MetadataAsValue::get(VMContext, VarInfo),
996  MetadataAsValue::get(VMContext, Expr)};
997 
998  IRBuilder<> B(DL->getContext());
999  initIRBuilder(B, DL, InsertBB, InsertBefore);
1000  return B.CreateCall(DeclareFn, Args);
1001 }
1002 
1003 Instruction *DIBuilder::insertDbgValueIntrinsic(
1004  Value *V, DILocalVariable *VarInfo, DIExpression *Expr,
1005  const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore) {
1006  assert(V && "no value passed to dbg.value");
1007  assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.value");
1008  assert(DL && "Expected debug loc");
1009  assert(DL->getScope()->getSubprogram() ==
1010  VarInfo->getScope()->getSubprogram() &&
1011  "Expected matching subprograms");
1012  if (!ValueFn)
1013  ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
1014 
1015  trackIfUnresolved(VarInfo);
1016  trackIfUnresolved(Expr);
1017  Value *Args[] = {getDbgIntrinsicValueImpl(VMContext, V),
1018  MetadataAsValue::get(VMContext, VarInfo),
1019  MetadataAsValue::get(VMContext, Expr)};
1020 
1021  IRBuilder<> B(DL->getContext());
1022  initIRBuilder(B, DL, InsertBB, InsertBefore);
1023  return B.CreateCall(ValueFn, Args);
1024 }
1025 
1026 Instruction *DIBuilder::insertLabel(
1027  DILabel *LabelInfo, const DILocation *DL,
1028  BasicBlock *InsertBB, Instruction *InsertBefore) {
1029  assert(LabelInfo && "empty or invalid DILabel* passed to dbg.label");
1030  assert(DL && "Expected debug loc");
1031  assert(DL->getScope()->getSubprogram() ==
1032  LabelInfo->getScope()->getSubprogram() &&
1033  "Expected matching subprograms");
1034  if (!LabelFn)
1035  LabelFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_label);
1036 
1037  trackIfUnresolved(LabelInfo);
1038  Value *Args[] = {MetadataAsValue::get(VMContext, LabelInfo)};
1039 
1040  IRBuilder<> B(DL->getContext());
1041  initIRBuilder(B, DL, InsertBB, InsertBefore);
1042  return B.CreateCall(LabelFn, Args);
1043 }
1044 
1046  DIType *VTableHolder) {
1047  {
1049  N->replaceVTableHolder(VTableHolder);
1050  T = N.get();
1051  }
1052 
1053  // If this didn't create a self-reference, just return.
1054  if (T != VTableHolder)
1055  return;
1056 
1057  // Look for unresolved operands. T will drop RAUW support, orphaning any
1058  // cycles underneath it.
1059  if (T->isResolved())
1060  for (const MDOperand &O : T->operands())
1061  if (auto *N = dyn_cast_or_null<MDNode>(O))
1062  trackIfUnresolved(N);
1063 }
1064 
1065 void DIBuilder::replaceArrays(DICompositeType *&T, DINodeArray Elements,
1066  DINodeArray TParams) {
1067  {
1069  if (Elements)
1070  N->replaceElements(Elements);
1071  if (TParams)
1072  N->replaceTemplateParams(DITemplateParameterArray(TParams));
1073  T = N.get();
1074  }
1075 
1076  // If T isn't resolved, there's no problem.
1077  if (!T->isResolved())
1078  return;
1079 
1080  // If T is resolved, it may be due to a self-reference cycle. Track the
1081  // arrays explicitly if they're unresolved, or else the cycles will be
1082  // orphaned.
1083  if (Elements)
1084  trackIfUnresolved(Elements.get());
1085  if (TParams)
1086  trackIfUnresolved(TParams.get());
1087 }
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:891
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
i
i
Definition: README.txt:29
Signed
@ Signed
Definition: NVPTXISelLowering.cpp:4630
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
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::DIType
Base class for types.
Definition: DebugInfoMetadata.h:662
llvm::DILocalScope::getSubprogram
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
Definition: DebugInfoMetadata.cpp:812
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:651
llvm::AArch64CC::AL
@ AL
Definition: AArch64BaseInfo.h:250
llvm::NamedMDNode
A tuple of MDNodes.
Definition: Metadata.h:1386
llvm::DIBuilder::finalize
void finalize()
Construct any deferred debug info descriptors.
Definition: DIBuilder.cpp:69
Optional.h
llvm::dwarf
Definition: Dwarf.h:35
llvm::DIBuilder::replaceVTableHolder
void replaceVTableHolder(DICompositeType *&T, DIType *VTableHolder)
Replace the vtable holder in the given type.
Definition: DIBuilder.cpp:1045
llvm::Intrinsic::getDeclaration
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
Definition: Function.cpp:1336
IntrinsicInst.h
llvm::DIGenericSubrange
Definition: DebugInfoMetadata.h:362
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
llvm::lltok::NameTableKind
@ NameTableKind
Definition: LLToken.h:481
llvm::DILexicalBlockFile
Definition: DebugInfoMetadata.h:2132
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
getDeclareIntrin
static Function * getDeclareIntrin(Module &M)
Definition: DIBuilder.cpp:976
llvm::MipsISD::Lo
@ Lo
Definition: MipsISelLowering.h:79
llvm::DICompileUnit::replaceRetainedTypes
void replaceRetainedTypes(DITypeArray N)
Definition: DebugInfoMetadata.h:1510
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:720
llvm::IRBuilder<>
llvm::DIType::cloneWithFlags
TempDIType cloneWithFlags(DIFlags NewFlags) const
Returns a new temporary DIType with updated Flags.
Definition: DebugInfoMetadata.h:715
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::DILocation
Debug location.
Definition: DebugInfoMetadata.h:1562
llvm::getDISubprogram
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
Definition: DebugInfo.cpp:129
llvm::AtomicOrderingCABI::release
@ release
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:834
Module.h
llvm::Optional
Definition: APInt.h:33
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::ConstantAsMetadata::get
static ConstantAsMetadata * get(Constant *C)
Definition: Metadata.h:419
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:449
llvm::DIBuilder::createEnumerator
DIEnumerator * createEnumerator(StringRef Name, APSInt Value)
Create a single enumerator value.
Definition: DIBuilder.cpp:253
llvm::ValueAsMetadata::get
static ValueAsMetadata * get(Value *V)
Definition: Metadata.cpp:368
STLExtras.h
llvm::DIBuilder::createSubroutineType
DISubroutineType * createSubroutineType(DITypeRefArray ParameterTypes, DINode::DIFlags Flags=DINode::FlagZero, unsigned CC=0)
Create subroutine type.
Definition: DIBuilder.cpp:513
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2557
llvm::DIBuilder::createQualifiedType
DIDerivedType * createQualifiedType(unsigned Tag, DIType *FromTy)
Create debugging information entry for a qualified type, e.g.
Definition: DIBuilder.cpp:281
llvm::dwarf::Tag
Tag
Definition: Dwarf.h:104
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:275
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:412
llvm::DICompileUnit::DebugEmissionKind
DebugEmissionKind
Definition: DebugInfoMetadata.h:1322
llvm::PointerUnion::get
T get() const
Returns the value of the specified pointer type.
Definition: PointerUnion.h:187
llvm::DINamespace
Definition: DebugInfoMetadata.h:2247
llvm::DILexicalBlock
Definition: DebugInfoMetadata.h:2081
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:452
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
llvm::PointerUnion::is
bool is() const
Test if the Union currently holds the type matching T.
Definition: PointerUnion.h:177
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:759
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:533
llvm::NamedMDNode::addOperand
void addOperand(MDNode *M)
Definition: Metadata.cpp:1130
CommandLine.h
llvm::DIBuilder::createArtificialType
static DIType * createArtificialType(DIType *Ty)
Create a uniqued clone of Ty with FlagArtificial set.
Definition: DIBuilder.cpp:588
llvm::DIObjCProperty
Definition: DebugInfoMetadata.h:3201
llvm::DIBuilder::replaceTemporary
NodeTy * replaceTemporary(TempMDNode &&N, NodeTy *Replacement)
Replace a temporary node.
Definition: DIBuilder.h:937
llvm::DIType::getFlags
DIFlags getFlags() const
Definition: DebugInfoMetadata.h:705
createTemplateValueParameterHelper
static DITemplateValueParameter * createTemplateValueParameterHelper(LLVMContext &VMContext, unsigned Tag, DIScope *Context, StringRef Name, DIType *Ty, bool IsDefault, Metadata *MD)
Definition: DIBuilder.cpp:427
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:389
Constants.h
llvm::DICompileUnit::replaceEnumTypes
void replaceEnumTypes(DICompositeTypeArray N)
Replace arrays.
Definition: DebugInfoMetadata.h:1507
llvm::DILocalVariable
Local variable.
Definition: DebugInfoMetadata.h:3053
getConstantOrNull
static ConstantAsMetadata * getConstantOrNull(Constant *C)
Definition: DIBuilder.cpp:359
llvm::DIMacro
Definition: DebugInfoMetadata.h:3433
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
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::SmallVectorImpl::append
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:648
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::DICompileUnit::replaceImportedEntities
void replaceImportedEntities(DIImportedEntityArray N)
Definition: DebugInfoMetadata.h:1516
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:872
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
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:603
llvm::DISubprogram::DISPFlags
DISPFlags
Debug info subprogram flags.
Definition: DebugInfoMetadata.h:1817
llvm::MDTuple
Tuple of metadata.
Definition: Metadata.h:1139
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:329
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:815
llvm::DITemplateTypeParameter
Definition: DebugInfoMetadata.h:2397
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
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:286
LLVMContextImpl.h
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:489
llvm::MDNode::getTemporary
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1210
initIRBuilder
static void initIRBuilder(IRBuilder<> &Builder, const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore)
Initialize IRBuilder for inserting dbg.declare and dbg.value intrinsics.
Definition: DIBuilder.cpp:962
llvm::ConstantInt::get
static Constant * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Definition: Constants.cpp:899
llvm::AArch64CC::PL
@ PL
Definition: AArch64BaseInfo.h:241
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:501
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:1065
createTypeWithFlags
static DIType * createTypeWithFlags(const DIType *Ty, DINode::DIFlags FlagsToSet)
Definition: DIBuilder.cpp:582
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:595
createLocalVariable
static DILocalVariable * createLocalVariable(LLVMContext &VMContext, DenseMap< MDNode *, SmallVector< TrackingMDNodeRef, 1 >> &PreservedVariables, DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags, uint32_t AlignInBits)
Definition: DIBuilder.cpp:733
llvm::DILocalVariable::getScope
DILocalScope * getScope() const
Get the local scope for this variable.
Definition: DebugInfoMetadata.h:3106
llvm::DICommonBlock
Definition: DebugInfoMetadata.h:2991
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:309
llvm::dwarf::DW_LANG_lo_user
@ DW_LANG_lo_user
Definition: Dwarf.h:204
llvm::cl::opt< bool >
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:179
getNonCompileUnitScope
static DIScope * getNonCompileUnitScope(DIScope *N)
If N is compile unit return NULL otherwise return N.
Definition: DIBuilder.cpp:132
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:849
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:769
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:614
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:545
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:519
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:459
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:798
llvm::DIGlobalVariable
Global variables.
Definition: DebugInfoMetadata.h:2911
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:444
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
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:628
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::DICompileUnit::replaceGlobalVariables
void replaceGlobalVariables(DIGlobalVariableExpressionArray N)
Definition: DebugInfoMetadata.h:1513
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:299
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:443
DIBuilder.h
llvm::DICompileUnit
Compile unit.
Definition: DebugInfoMetadata.h:1317
llvm::DIImportedEntity
An imported module (C++ using directive or similar).
Definition: DebugInfoMetadata.h:3284
llvm::MDString::get
static MDString * get(LLVMContext &Context, StringRef Str)
Definition: Metadata.cpp:473
llvm::DIMacroFile
Definition: DebugInfoMetadata.h:3482
llvm::DIBuilder::createArtificialSubprogram
static DISubprogram * createArtificialSubprogram(DISubprogram *SP)
Create a distinct clone of SP with FlagArtificial set.
Definition: DIBuilder.cpp:577
IRBuilder.h
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::MDTuple::get
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1165
checkGlobalVariableScope
static void checkGlobalVariableScope(DIScope *Context)
Definition: DIBuilder.cpp:693
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:778
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
Builder
assume Assume Builder
Definition: AssumeBundleBuilder.cpp:651
llvm::DIBasicType
Basic type, like 'int' or 'float'.
Definition: DebugInfoMetadata.h:769
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:70
llvm::DISubroutineType
Type array for a subprogram.
Definition: DebugInfoMetadata.h:1263
llvm::DICompositeType
Composite types.
Definition: DebugInfoMetadata.h:1051
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:900
llvm::DICompileUnit::DebugNameTableKind
DebugNameTableKind
Definition: DebugInfoMetadata.h:1330
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:365
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
Dwarf.h
llvm::DINode
Tagged DWARF-like metadata node.
Definition: DebugInfoMetadata.h:127
uint32_t
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::dwarf::DW_MACINFO_define
@ DW_MACINFO_define
Definition: Dwarf.h:381
llvm::MDTuple::getTemporary
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Return a temporary node.
Definition: Metadata.h:1185
llvm::DIVariable
Base class for variables.
Definition: DebugInfoMetadata.h:2489
llvm::MDNode::getDistinct
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1206
llvm::DIBuilder::getOrCreateGenericSubrange
DIGenericSubrange * getOrCreateGenericSubrange(DIGenericSubrange::BoundType Count, DIGenericSubrange::BoundType LowerBound, DIGenericSubrange::BoundType UpperBound, DIGenericSubrange::BoundType Stride)
Definition: DIBuilder.cpp:681
llvm::BasicBlock::getTerminator
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
Definition: BasicBlock.cpp:148
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:906
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:420
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:336
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::ConstantAsMetadata
Definition: Metadata.h:412
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:879
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:476
llvm::Type::getInt64Ty
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:204
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::DILabel::getScope
DILocalScope * getScope() const
Get the local scope for this label.
Definition: DebugInfoMetadata.h:3176
llvm::DIBuilder::createUnspecifiedType
DIBasicType * createUnspecifiedType(StringRef Name)
Create a DWARF unspecified type.
Definition: DIBuilder.cpp:258
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:401
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:320
llvm::MetadataAsValue::get
static MetadataAsValue * get(LLVMContext &Context, Metadata *MD)
Definition: Metadata.cpp:106
llvm::DIBuilder::createImportedModule
DIImportedEntity * createImportedModule(DIScope *Context, DINamespace *NS, DIFile *File, unsigned Line)
Create a descriptor for an imported module.
Definition: DIBuilder.cpp:180
llvm::ConstantInt::getSigned
static ConstantInt * getSigned(IntegerType *Ty, int64_t V)
Return a ConstantInt with the specified value for the specified type.
Definition: Constants.cpp:913
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:348
llvm::dwarf::DW_MACINFO_start_file
@ DW_MACINFO_start_file
Definition: Dwarf.h:383
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:567
llvm::DIBuilder::getOrCreateArray
DINodeArray getOrCreateArray(ArrayRef< Metadata * > Elements)
Get a DINodeArray, create one if required.
Definition: DIBuilder.cpp:642
llvm::Module::getOrInsertNamedMetadata
NamedMDNode * getOrInsertNamedMetadata(StringRef Name)
Return the named MDNode in the module with the specified name.
Definition: Module.cpp:263
llvm::dwarf::DW_MACINFO_undef
@ DW_MACINFO_undef
Definition: Dwarf.h:382
llvm::DIDerivedType
Derived types.
Definition: DebugInfoMetadata.h:917
llvm::DIGlobalVariableExpression
A pair of DIGlobalVariable and DIExpression.
Definition: DebugInfoMetadata.h:3343
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:435
llvm::MDNode::replaceWithDistinct
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithDistinct(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a distinct one.
Definition: Metadata.h:1027
llvm::DITemplateValueParameter
Definition: DebugInfoMetadata.h:2439
llvm::MDNode::isTemporary
bool isTemporary() const
Definition: Metadata.h:977
llvm::DIBuilder::createNullPtrType
DIBasicType * createNullPtrType()
Create C++11 nullptr type.
Definition: DIBuilder.cpp:263
llvm::TypedTrackingMDRef
Typed tracking ref.
Definition: TrackingMDRef.h:106
llvm::DIBuilder::getOrCreateSubrange
DISubrange * getOrCreateSubrange(int64_t Lo, int64_t Count)
Create a descriptor for a value range.
Definition: DIBuilder.cpp:662
llvm::DIBuilder::getOrCreateMacroArray
DIMacroNodeArray getOrCreateMacroArray(ArrayRef< Metadata * > Elements)
Get a DIMacroNodeArray, create one if required.
Definition: DIBuilder.cpp:647
llvm::DINode::DIFlags
DIFlags
Debug info flags.
Definition: DebugInfoMetadata.h:166
N
#define N
llvm::Instruction::getParent
const BasicBlock * getParent() const
Definition: Instruction.h:94
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:702
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:165
getSubprogram
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&... Args)
Definition: DIBuilder.cpp:809
llvm::DISubprogram
Subprogram description.
Definition: DebugInfoMetadata.h:1802
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::DIModule
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Definition: DebugInfoMetadata.h:2299
llvm::IntegerType::get
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:275
UseDbgAddr
static cl::opt< bool > UseDbgAddr("use-dbg-addr", llvm::cl::desc("Use llvm.dbg.addr for all local variables"), cl::init(false), cl::Hidden)
llvm::DILabel
Label.
Definition: DebugInfoMetadata.h:3133
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:267
createImportedModule
static DIImportedEntity * createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context, Metadata *NS, DIFile *File, unsigned Line, StringRef Name, SmallVectorImpl< TrackingMDNodeRef > &AllImportedModules)
Definition: DIBuilder.cpp:165
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:389
llvm::cl::desc
Definition: CommandLine.h:414
llvm::DIType::isArtificial
bool isArtificial() const
Definition: DebugInfoMetadata.h:733
getDbgIntrinsicValueImpl
static Value * getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V)
Definition: DIBuilder.cpp:971
llvm::DIType::isObjectPointer
bool isObjectPointer() const
Definition: DebugInfoMetadata.h:734
CU
Definition: AArch64AsmBackend.cpp:499
llvm::DICompileUnit::replaceMacros
void replaceMacros(DIMacroNodeArray N)
Definition: DebugInfoMetadata.h:1519
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
Debug.h
File
Instrumentation for Order File
Definition: InstrOrderFile.cpp:206
llvm::MDOperand
Tracking metadata reference owned by Metadata.
Definition: Metadata.h:744
llvm::DIBuilder::createUnspecifiedParameter
DIBasicType * createUnspecifiedParameter()
Create unspecified parameter type for a subroutine type.
Definition: DIBuilder.cpp:611
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:375
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58
llvm::DIFile
File.
Definition: DebugInfoMetadata.h:530
llvm::SmallVectorImpl::emplace_back
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:908
llvm::SmallPtrSetImpl::insert
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition: SmallPtrSet.h:364