LLVM  13.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 type without name");
255  return DIBasicType::get(VMContext, dwarf::DW_TAG_unspecified_type, Name);
256 }
257 
259  return createUnspecifiedType("decltype(nullptr)");
260 }
261 
263  unsigned Encoding,
264  DINode::DIFlags Flags) {
265  assert(!Name.empty() && "Unable to create type without name");
266  return DIBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits,
267  0, Encoding, Flags);
268 }
269 
271  assert(!Name.empty() && "Unable to create type without name");
272  return DIStringType::get(VMContext, dwarf::DW_TAG_string_type, Name,
273  SizeInBits, 0);
274 }
275 
277  return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, FromTy, 0,
278  0, 0, None, DINode::FlagZero);
279 }
280 
282  DIType *PointeeTy,
283  uint64_t SizeInBits,
284  uint32_t AlignInBits,
285  Optional<unsigned> DWARFAddressSpace,
286  StringRef Name) {
287  // FIXME: Why is there a name here?
288  return DIDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name,
289  nullptr, 0, nullptr, PointeeTy, SizeInBits,
290  AlignInBits, 0, DWARFAddressSpace,
291  DINode::FlagZero);
292 }
293 
295  DIType *Base,
296  uint64_t SizeInBits,
297  uint32_t AlignInBits,
298  DINode::DIFlags Flags) {
299  return DIDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "",
300  nullptr, 0, nullptr, PointeeTy, SizeInBits,
301  AlignInBits, 0, None, Flags, Base);
302 }
303 
305  unsigned Tag, DIType *RTy,
306  uint64_t SizeInBits,
307  uint32_t AlignInBits,
308  Optional<unsigned> DWARFAddressSpace) {
309  assert(RTy && "Unable to create reference type");
310  return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, RTy,
311  SizeInBits, AlignInBits, 0, DWARFAddressSpace,
312  DINode::FlagZero);
313 }
314 
316  DIFile *File, unsigned LineNo,
317  DIScope *Context,
318  uint32_t AlignInBits) {
319  return DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File,
320  LineNo, getNonCompileUnitScope(Context), Ty, 0,
321  AlignInBits, 0, None, DINode::FlagZero);
322 }
323 
325  assert(Ty && "Invalid type!");
326  assert(FriendTy && "Invalid friend type!");
327  return DIDerivedType::get(VMContext, dwarf::DW_TAG_friend, "", nullptr, 0, Ty,
328  FriendTy, 0, 0, 0, None, DINode::FlagZero);
329 }
330 
332  uint64_t BaseOffset,
333  uint32_t VBPtrOffset,
334  DINode::DIFlags Flags) {
335  assert(Ty && "Unable to create inheritance");
336  Metadata *ExtraData = ConstantAsMetadata::get(
337  ConstantInt::get(IntegerType::get(VMContext, 32), VBPtrOffset));
338  return DIDerivedType::get(VMContext, dwarf::DW_TAG_inheritance, "", nullptr,
339  0, Ty, BaseTy, 0, 0, BaseOffset, None,
340  Flags, ExtraData);
341 }
342 
344  DIFile *File, unsigned LineNumber,
345  uint64_t SizeInBits,
346  uint32_t AlignInBits,
347  uint64_t OffsetInBits,
348  DINode::DIFlags Flags, DIType *Ty) {
349  return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
350  LineNumber, getNonCompileUnitScope(Scope), Ty,
351  SizeInBits, AlignInBits, OffsetInBits, None, Flags);
352 }
353 
355  if (C)
356  return ConstantAsMetadata::get(C);
357  return nullptr;
358 }
359 
361  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
362  uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
363  Constant *Discriminant, DINode::DIFlags Flags, DIType *Ty) {
364  return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
365  LineNumber, getNonCompileUnitScope(Scope), Ty,
366  SizeInBits, AlignInBits, OffsetInBits, None, Flags,
367  getConstantOrNull(Discriminant));
368 }
369 
371  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
372  uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits,
373  DINode::DIFlags Flags, DIType *Ty) {
374  Flags |= DINode::FlagBitField;
375  return DIDerivedType::get(
376  VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
377  getNonCompileUnitScope(Scope), Ty, SizeInBits, /* AlignInBits */ 0,
378  OffsetInBits, None, Flags,
380  StorageOffsetInBits)));
381 }
382 
385  unsigned LineNumber, DIType *Ty,
386  DINode::DIFlags Flags, llvm::Constant *Val,
387  uint32_t AlignInBits) {
388  Flags |= DINode::FlagStaticMember;
389  return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
390  LineNumber, getNonCompileUnitScope(Scope), Ty, 0,
391  AlignInBits, 0, None, Flags,
392  getConstantOrNull(Val));
393 }
394 
397  uint64_t SizeInBits, uint32_t AlignInBits,
398  uint64_t OffsetInBits, DINode::DIFlags Flags,
399  DIType *Ty, MDNode *PropertyNode) {
400  return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
401  LineNumber, getNonCompileUnitScope(File), Ty,
402  SizeInBits, AlignInBits, OffsetInBits, None, Flags,
403  PropertyNode);
404 }
405 
408  StringRef GetterName, StringRef SetterName,
409  unsigned PropertyAttributes, DIType *Ty) {
410  return DIObjCProperty::get(VMContext, Name, File, LineNumber, GetterName,
411  SetterName, PropertyAttributes, Ty);
412 }
413 
416  DIType *Ty, bool isDefault) {
417  assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
418  return DITemplateTypeParameter::get(VMContext, Name, Ty, isDefault);
419 }
420 
424  bool IsDefault, Metadata *MD) {
425  assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
426  return DITemplateValueParameter::get(VMContext, Tag, Name, Ty, IsDefault, MD);
427 }
428 
431  DIType *Ty, bool isDefault,
432  Constant *Val) {
434  VMContext, dwarf::DW_TAG_template_value_parameter, Context, Name, Ty,
435  isDefault, getConstantOrNull(Val));
436 }
437 
440  DIType *Ty, StringRef Val) {
442  VMContext, dwarf::DW_TAG_GNU_template_template_param, Context, Name, Ty,
443  false, MDString::get(VMContext, Val));
444 }
445 
448  DIType *Ty, DINodeArray Val) {
450  VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty,
451  false, Val.get());
452 }
453 
455  DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
456  uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
457  DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
458  DIType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) {
459  assert((!Context || isa<DIScope>(Context)) &&
460  "createClassType should be called with a valid Context");
461 
462  auto *R = DICompositeType::get(
463  VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
464  getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBits,
465  OffsetInBits, Flags, Elements, 0, VTableHolder,
466  cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier);
467  trackIfUnresolved(R);
468  return R;
469 }
470 
472  DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
473  uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
474  DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang,
475  DIType *VTableHolder, StringRef UniqueIdentifier) {
476  auto *R = DICompositeType::get(
477  VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
478  getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBits, 0,
479  Flags, Elements, RunTimeLang, VTableHolder, nullptr, UniqueIdentifier);
480  trackIfUnresolved(R);
481  return R;
482 }
483 
485  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
486  uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
487  DINodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) {
488  auto *R = DICompositeType::get(
489  VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
490  getNonCompileUnitScope(Scope), nullptr, SizeInBits, AlignInBits, 0, Flags,
491  Elements, RunTimeLang, nullptr, nullptr, UniqueIdentifier);
492  trackIfUnresolved(R);
493  return R;
494 }
495 
497  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
498  uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
499  DIDerivedType *Discriminator, DINodeArray Elements, StringRef UniqueIdentifier) {
500  auto *R = DICompositeType::get(
501  VMContext, dwarf::DW_TAG_variant_part, Name, File, LineNumber,
502  getNonCompileUnitScope(Scope), nullptr, SizeInBits, AlignInBits, 0, Flags,
503  Elements, 0, nullptr, nullptr, UniqueIdentifier, Discriminator);
504  trackIfUnresolved(R);
505  return R;
506 }
507 
509  DINode::DIFlags Flags,
510  unsigned CC) {
511  return DISubroutineType::get(VMContext, Flags, CC, ParameterTypes);
512 }
513 
515  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
516  uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements,
517  DIType *UnderlyingType, StringRef UniqueIdentifier, bool IsScoped) {
518  auto *CTy = DICompositeType::get(
519  VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
520  getNonCompileUnitScope(Scope), UnderlyingType, SizeInBits, AlignInBits, 0,
521  IsScoped ? DINode::FlagEnumClass : DINode::FlagZero, Elements, 0, nullptr,
522  nullptr, UniqueIdentifier);
523  AllEnumTypes.push_back(CTy);
524  trackIfUnresolved(CTy);
525  return CTy;
526 }
527 
529  DIFile *File, unsigned LineNo,
530  uint64_t SizeInBits,
531  uint32_t AlignInBits, DIType *Ty) {
532  auto *R =
533  DIDerivedType::get(VMContext, dwarf::DW_TAG_set_type, Name, File, LineNo,
534  getNonCompileUnitScope(Scope), Ty, SizeInBits,
535  AlignInBits, 0, None, DINode::FlagZero);
536  trackIfUnresolved(R);
537  return R;
538 }
539 
541  uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts,
546  auto *R = DICompositeType::get(
547  VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0,
548  nullptr, Ty, Size, AlignInBits, 0, DINode::FlagZero,
549  Subscripts, 0, nullptr, nullptr, "", nullptr,
550  DL.is<DIExpression *>() ? (Metadata *)DL.get<DIExpression *>()
551  : (Metadata *)DL.get<DIVariable *>(),
552  AS.is<DIExpression *>() ? (Metadata *)AS.get<DIExpression *>()
553  : (Metadata *)AS.get<DIVariable *>(),
554  AL.is<DIExpression *>() ? (Metadata *)AL.get<DIExpression *>()
555  : (Metadata *)AL.get<DIVariable *>(),
556  RK.is<DIExpression *>() ? (Metadata *)RK.get<DIExpression *>()
557  : (Metadata *)RK.get<DIVariable *>());
558  trackIfUnresolved(R);
559  return R;
560 }
561 
563  uint32_t AlignInBits, DIType *Ty,
564  DINodeArray Subscripts) {
565  auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "",
566  nullptr, 0, nullptr, Ty, Size, AlignInBits, 0,
567  DINode::FlagVector, Subscripts, 0, nullptr);
568  trackIfUnresolved(R);
569  return R;
570 }
571 
573  auto NewSP = SP->cloneWithFlags(SP->getFlags() | DINode::FlagArtificial);
574  return MDNode::replaceWithDistinct(std::move(NewSP));
575 }
576 
578  DINode::DIFlags FlagsToSet) {
579  auto NewTy = Ty->cloneWithFlags(Ty->getFlags() | FlagsToSet);
580  return MDNode::replaceWithUniqued(std::move(NewTy));
581 }
582 
584  // FIXME: Restrict this to the nodes where it's valid.
585  if (Ty->isArtificial())
586  return Ty;
587  return createTypeWithFlags(Ty, DINode::FlagArtificial);
588 }
589 
591  // FIXME: Restrict this to the nodes where it's valid.
592  if (Ty->isObjectPointer())
593  return Ty;
594  DINode::DIFlags Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
595  return createTypeWithFlags(Ty, Flags);
596 }
597 
599  assert(T && "Expected non-null type");
600  assert((isa<DIType>(T) || (isa<DISubprogram>(T) &&
601  cast<DISubprogram>(T)->isDefinition() == false)) &&
602  "Expected type or subprogram declaration");
603  AllRetainTypes.emplace_back(T);
604 }
605 
607 
610  DIFile *F, unsigned Line, unsigned RuntimeLang,
611  uint64_t SizeInBits, uint32_t AlignInBits,
612  StringRef UniqueIdentifier) {
613  // FIXME: Define in terms of createReplaceableForwardDecl() by calling
614  // replaceWithUniqued().
615  auto *RetTy = DICompositeType::get(
616  VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr,
617  SizeInBits, AlignInBits, 0, DINode::FlagFwdDecl, nullptr, RuntimeLang,
618  nullptr, nullptr, UniqueIdentifier);
619  trackIfUnresolved(RetTy);
620  return RetTy;
621 }
622 
624  unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
625  unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits,
626  DINode::DIFlags Flags, StringRef UniqueIdentifier) {
627  auto *RetTy =
629  VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr,
630  SizeInBits, AlignInBits, 0, Flags, nullptr, RuntimeLang, nullptr,
631  nullptr, UniqueIdentifier)
632  .release();
633  trackIfUnresolved(RetTy);
634  return RetTy;
635 }
636 
638  return MDTuple::get(VMContext, Elements);
639 }
640 
641 DIMacroNodeArray
643  return MDTuple::get(VMContext, Elements);
644 }
645 
648  for (unsigned i = 0, e = Elements.size(); i != e; ++i) {
649  if (Elements[i] && isa<MDNode>(Elements[i]))
650  Elts.push_back(cast<DIType>(Elements[i]));
651  else
652  Elts.push_back(Elements[i]);
653  }
654  return DITypeRefArray(MDNode::get(VMContext, Elts));
655 }
656 
657 DISubrange *DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
658  auto *LB = ConstantAsMetadata::get(
660  auto *CountNode = ConstantAsMetadata::get(
661  ConstantInt::getSigned(Type::getInt64Ty(VMContext), Count));
662  return DISubrange::get(VMContext, CountNode, LB, nullptr, nullptr);
663 }
664 
666  auto *LB = ConstantAsMetadata::get(
668  return DISubrange::get(VMContext, CountNode, LB, nullptr, nullptr);
669 }
670 
672  Metadata *UB, Metadata *Stride) {
673  return DISubrange::get(VMContext, CountNode, LB, UB, Stride);
674 }
675 
679  auto ConvToMetadata = [&](DIGenericSubrange::BoundType Bound) -> Metadata * {
680  return Bound.is<DIExpression *>() ? (Metadata *)Bound.get<DIExpression *>()
681  : (Metadata *)Bound.get<DIVariable *>();
682  };
683  return DIGenericSubrange::get(VMContext, ConvToMetadata(CountNode),
684  ConvToMetadata(LB), ConvToMetadata(UB),
685  ConvToMetadata(Stride));
686 }
687 
689 #ifndef NDEBUG
690  if (auto *CT =
691  dyn_cast_or_null<DICompositeType>(getNonCompileUnitScope(Context)))
692  assert(CT->getIdentifier().empty() &&
693  "Context of a global variable should not be a type with identifier");
694 #endif
695 }
696 
698  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
699  unsigned LineNumber, DIType *Ty, bool IsLocalToUnit,
700  bool isDefined, DIExpression *Expr,
701  MDNode *Decl, MDTuple *TemplateParams, uint32_t AlignInBits) {
703 
705  VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
706  LineNumber, Ty, IsLocalToUnit, isDefined, cast_or_null<DIDerivedType>(Decl),
707  TemplateParams, AlignInBits);
708  if (!Expr)
709  Expr = createExpression();
710  auto *N = DIGlobalVariableExpression::get(VMContext, GV, Expr);
711  AllGVs.push_back(N);
712  return N;
713 }
714 
716  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
717  unsigned LineNumber, DIType *Ty, bool IsLocalToUnit, MDNode *Decl,
718  MDTuple *TemplateParams, uint32_t AlignInBits) {
720 
722  VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
723  LineNumber, Ty, IsLocalToUnit, false,
724  cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits)
725  .release();
726 }
727 
729  LLVMContext &VMContext,
730  DenseMap<MDNode *, SmallVector<TrackingMDNodeRef, 1>> &PreservedVariables,
731  DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
732  unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags,
733  uint32_t AlignInBits) {
734  // FIXME: Why getNonCompileUnitScope()?
735  // FIXME: Why is "!Context" okay here?
736  // FIXME: Why doesn't this check for a subprogram or lexical block (AFAICT
737  // the only valid scopes)?
739 
740  auto *Node =
741  DILocalVariable::get(VMContext, cast_or_null<DILocalScope>(Context), Name,
742  File, LineNo, Ty, ArgNo, Flags, AlignInBits);
743  if (AlwaysPreserve) {
744  // The optimizer may remove local variables. If there is an interest
745  // to preserve variable info in such situation then stash it in a
746  // named mdnode.
748  assert(Fn && "Missing subprogram for local variable");
749  PreservedVariables[Fn].emplace_back(Node);
750  }
751  return Node;
752 }
753 
755  DIFile *File, unsigned LineNo,
756  DIType *Ty, bool AlwaysPreserve,
757  DINode::DIFlags Flags,
758  uint32_t AlignInBits) {
759  return createLocalVariable(VMContext, PreservedVariables, Scope, Name,
760  /* ArgNo */ 0, File, LineNo, Ty, AlwaysPreserve,
761  Flags, AlignInBits);
762 }
763 
765  DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
766  unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags) {
767  assert(ArgNo && "Expected non-zero argument number for parameter");
768  return createLocalVariable(VMContext, PreservedVariables, Scope, Name, ArgNo,
769  File, LineNo, Ty, AlwaysPreserve, Flags,
770  /* AlignInBits */0);
771 }
772 
775  unsigned LineNo, bool AlwaysPreserve) {
777 
778  auto *Node =
779  DILabel::get(VMContext, cast_or_null<DILocalScope>(Context), Name,
780  File, LineNo);
781 
782  if (AlwaysPreserve) {
783  /// The optimizer may remove labels. If there is an interest
784  /// to preserve label info in such situation then append it to
785  /// the list of retained nodes of the DISubprogram.
787  assert(Fn && "Missing subprogram for label");
788  PreservedLabels[Fn].emplace_back(Node);
789  }
790  return Node;
791 }
792 
794  return DIExpression::get(VMContext, Addr);
795 }
796 
798  // TODO: Remove the callers of this signed version and delete.
799  SmallVector<uint64_t, 8> Addr(Signed.begin(), Signed.end());
800  return createExpression(Addr);
801 }
802 
803 template <class... Ts>
804 static DISubprogram *getSubprogram(bool IsDistinct, Ts &&... Args) {
805  if (IsDistinct)
806  return DISubprogram::getDistinct(std::forward<Ts>(Args)...);
807  return DISubprogram::get(std::forward<Ts>(Args)...);
808 }
809 
811  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
812  unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
814  DITemplateParameterArray TParams, DISubprogram *Decl,
815  DITypeArray ThrownTypes) {
816  bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
817  auto *Node = getSubprogram(
818  /*IsDistinct=*/IsDefinition, VMContext, getNonCompileUnitScope(Context),
819  Name, LinkageName, File, LineNo, Ty, ScopeLine, nullptr, 0, 0, Flags,
820  SPFlags, IsDefinition ? CUNode : nullptr, TParams, Decl,
821  MDTuple::getTemporary(VMContext, None).release(), ThrownTypes);
822 
823  if (IsDefinition)
824  AllSubprograms.push_back(Node);
825  trackIfUnresolved(Node);
826  return Node;
827 }
828 
830  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
831  unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
833  DITemplateParameterArray TParams, DISubprogram *Decl,
834  DITypeArray ThrownTypes) {
835  bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
837  Name, LinkageName, File, LineNo, Ty,
838  ScopeLine, nullptr, 0, 0, Flags, SPFlags,
839  IsDefinition ? CUNode : nullptr, TParams,
840  Decl, nullptr, ThrownTypes)
841  .release();
842 }
843 
845  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
846  unsigned LineNo, DISubroutineType *Ty, unsigned VIndex, int ThisAdjustment,
847  DIType *VTableHolder, DINode::DIFlags Flags,
848  DISubprogram::DISPFlags SPFlags, DITemplateParameterArray TParams,
849  DITypeArray ThrownTypes) {
851  "Methods should have both a Context and a context that isn't "
852  "the compile unit.");
853  // FIXME: Do we want to use different scope/lines?
854  bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
855  auto *SP = getSubprogram(
856  /*IsDistinct=*/IsDefinition, VMContext, cast<DIScope>(Context), Name,
857  LinkageName, F, LineNo, Ty, LineNo, VTableHolder, VIndex, ThisAdjustment,
858  Flags, SPFlags, IsDefinition ? CUNode : nullptr, TParams, nullptr,
859  nullptr, ThrownTypes);
860 
861  if (IsDefinition)
862  AllSubprograms.push_back(SP);
863  trackIfUnresolved(SP);
864  return SP;
865 }
866 
869  unsigned LineNo) {
870  return DICommonBlock::get(
871  VMContext, Scope, Decl, Name, File, LineNo);
872 }
873 
875  bool ExportSymbols) {
876 
877  // It is okay to *not* make anonymous top-level namespaces distinct, because
878  // all nodes that have an anonymous namespace as their parent scope are
879  // guaranteed to be unique and/or are linked to their containing
880  // DICompileUnit. This decision is an explicit tradeoff of link time versus
881  // memory usage versus code simplicity and may get revisited in the future.
883  ExportSymbols);
884 }
885 
887  StringRef ConfigurationMacros,
888  StringRef IncludePath, StringRef APINotesFile,
889  DIFile *File, unsigned LineNo, bool IsDecl) {
890  return DIModule::get(VMContext, File, getNonCompileUnitScope(Scope), Name,
891  ConfigurationMacros, IncludePath, APINotesFile, LineNo,
892  IsDecl);
893 }
894 
896  DIFile *File,
897  unsigned Discriminator) {
898  return DILexicalBlockFile::get(VMContext, Scope, File, Discriminator);
899 }
900 
902  unsigned Line, unsigned Col) {
903  // Make these distinct, to avoid merging two lexical blocks on the same
904  // file/line/column.
906  File, Line, Col);
907 }
908 
909 Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
910  DIExpression *Expr, const DILocation *DL,
911  Instruction *InsertBefore) {
912  return insertDeclare(Storage, VarInfo, Expr, DL, InsertBefore->getParent(),
913  InsertBefore);
914 }
915 
916 Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
917  DIExpression *Expr, const DILocation *DL,
918  BasicBlock *InsertAtEnd) {
919  // If this block already has a terminator then insert this intrinsic before
920  // the terminator. Otherwise, put it at the end of the block.
921  Instruction *InsertBefore = InsertAtEnd->getTerminator();
922  return insertDeclare(Storage, VarInfo, Expr, DL, InsertAtEnd, InsertBefore);
923 }
924 
925 Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
926  Instruction *InsertBefore) {
927  return insertLabel(
928  LabelInfo, DL, InsertBefore ? InsertBefore->getParent() : nullptr,
929  InsertBefore);
930 }
931 
932 Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
933  BasicBlock *InsertAtEnd) {
934  return insertLabel(LabelInfo, DL, InsertAtEnd, nullptr);
935 }
936 
937 Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V,
938  DILocalVariable *VarInfo,
939  DIExpression *Expr,
940  const DILocation *DL,
941  Instruction *InsertBefore) {
942  return insertDbgValueIntrinsic(
943  V, VarInfo, Expr, DL, InsertBefore ? InsertBefore->getParent() : nullptr,
944  InsertBefore);
945 }
946 
947 Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V,
948  DILocalVariable *VarInfo,
949  DIExpression *Expr,
950  const DILocation *DL,
951  BasicBlock *InsertAtEnd) {
952  return insertDbgValueIntrinsic(V, VarInfo, Expr, DL, InsertAtEnd, nullptr);
953 }
954 
955 /// Initialize IRBuilder for inserting dbg.declare and dbg.value intrinsics.
956 /// This abstracts over the various ways to specify an insert position.
958  BasicBlock *InsertBB, Instruction *InsertBefore) {
959  if (InsertBefore)
960  Builder.SetInsertPoint(InsertBefore);
961  else if (InsertBB)
962  Builder.SetInsertPoint(InsertBB);
963  Builder.SetCurrentDebugLocation(DL);
964 }
965 
967  assert(V && "no value passed to dbg intrinsic");
968  return MetadataAsValue::get(VMContext, ValueAsMetadata::get(V));
969 }
970 
972  return Intrinsic::getDeclaration(&M, UseDbgAddr ? Intrinsic::dbg_addr
973  : Intrinsic::dbg_declare);
974 }
975 
976 Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
977  DIExpression *Expr, const DILocation *DL,
978  BasicBlock *InsertBB, Instruction *InsertBefore) {
979  assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.declare");
980  assert(DL && "Expected debug loc");
981  assert(DL->getScope()->getSubprogram() ==
982  VarInfo->getScope()->getSubprogram() &&
983  "Expected matching subprograms");
984  if (!DeclareFn)
985  DeclareFn = getDeclareIntrin(M);
986 
987  trackIfUnresolved(VarInfo);
988  trackIfUnresolved(Expr);
989  Value *Args[] = {getDbgIntrinsicValueImpl(VMContext, Storage),
990  MetadataAsValue::get(VMContext, VarInfo),
991  MetadataAsValue::get(VMContext, Expr)};
992 
993  IRBuilder<> B(DL->getContext());
994  initIRBuilder(B, DL, InsertBB, InsertBefore);
995  return B.CreateCall(DeclareFn, Args);
996 }
997 
998 Instruction *DIBuilder::insertDbgValueIntrinsic(
999  Value *V, DILocalVariable *VarInfo, DIExpression *Expr,
1000  const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore) {
1001  assert(V && "no value passed to dbg.value");
1002  assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.value");
1003  assert(DL && "Expected debug loc");
1004  assert(DL->getScope()->getSubprogram() ==
1005  VarInfo->getScope()->getSubprogram() &&
1006  "Expected matching subprograms");
1007  if (!ValueFn)
1008  ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
1009 
1010  trackIfUnresolved(VarInfo);
1011  trackIfUnresolved(Expr);
1012  Value *Args[] = {getDbgIntrinsicValueImpl(VMContext, V),
1013  MetadataAsValue::get(VMContext, VarInfo),
1014  MetadataAsValue::get(VMContext, Expr)};
1015 
1016  IRBuilder<> B(DL->getContext());
1017  initIRBuilder(B, DL, InsertBB, InsertBefore);
1018  return B.CreateCall(ValueFn, Args);
1019 }
1020 
1021 Instruction *DIBuilder::insertLabel(
1022  DILabel *LabelInfo, const DILocation *DL,
1023  BasicBlock *InsertBB, Instruction *InsertBefore) {
1024  assert(LabelInfo && "empty or invalid DILabel* passed to dbg.label");
1025  assert(DL && "Expected debug loc");
1026  assert(DL->getScope()->getSubprogram() ==
1027  LabelInfo->getScope()->getSubprogram() &&
1028  "Expected matching subprograms");
1029  if (!LabelFn)
1030  LabelFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_label);
1031 
1032  trackIfUnresolved(LabelInfo);
1033  Value *Args[] = {MetadataAsValue::get(VMContext, LabelInfo)};
1034 
1035  IRBuilder<> B(DL->getContext());
1036  initIRBuilder(B, DL, InsertBB, InsertBefore);
1037  return B.CreateCall(LabelFn, Args);
1038 }
1039 
1041  DIType *VTableHolder) {
1042  {
1044  N->replaceVTableHolder(VTableHolder);
1045  T = N.get();
1046  }
1047 
1048  // If this didn't create a self-reference, just return.
1049  if (T != VTableHolder)
1050  return;
1051 
1052  // Look for unresolved operands. T will drop RAUW support, orphaning any
1053  // cycles underneath it.
1054  if (T->isResolved())
1055  for (const MDOperand &O : T->operands())
1056  if (auto *N = dyn_cast_or_null<MDNode>(O))
1057  trackIfUnresolved(N);
1058 }
1059 
1060 void DIBuilder::replaceArrays(DICompositeType *&T, DINodeArray Elements,
1061  DINodeArray TParams) {
1062  {
1064  if (Elements)
1065  N->replaceElements(Elements);
1066  if (TParams)
1067  N->replaceTemplateParams(DITemplateParameterArray(TParams));
1068  T = N.get();
1069  }
1070 
1071  // If T isn't resolved, there's no problem.
1072  if (!T->isResolved())
1073  return;
1074 
1075  // If T is resolved, it may be due to a self-reference cycle. Track the
1076  // arrays explicitly if they're unresolved, or else the cycles will be
1077  // orphaned.
1078  if (Elements)
1079  trackIfUnresolved(Elements.get());
1080  if (TParams)
1081  trackIfUnresolved(TParams.get());
1082 }
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
i
i
Definition: README.txt:29
llvm::EngineKind::Kind
Kind
Definition: ExecutionEngine.h:524
Signed
@ Signed
Definition: NVPTXISelLowering.cpp:4543
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
llvm::DILocalScope::getSubprogram
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
Definition: DebugInfoMetadata.cpp:805
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::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:1040
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:1295
IntrinsicInst.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
llvm::lltok::NameTableKind
@ NameTableKind
Definition: LLToken.h:477
llvm::DILexicalBlockFile
Definition: DebugInfoMetadata.h:2145
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
getDeclareIntrin
static Function * getDeclareIntrin(Module &M)
Definition: DIBuilder.cpp:971
llvm::MipsISD::Lo
@ Lo
Definition: MipsISelLowering.h:79
llvm::DICompileUnit::replaceRetainedTypes
void replaceRetainedTypes(DITypeArray N)
Definition: DebugInfoMetadata.h:1506
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
llvm::IRBuilder<>
llvm::DIType::cloneWithFlags
TempDIType cloneWithFlags(DIFlags NewFlags) const
Returns a new temporary DIType with updated Flags.
Definition: DebugInfoMetadata.h:711
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:140
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
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:829
Module.h
llvm::Optional
Definition: APInt.h:34
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::ValueAsMetadata::get
static ValueAsMetadata * get(Value *V)
Definition: Metadata.cpp:362
STLExtras.h
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::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: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::PointerUnion::get
T get() const
Returns the value of the specified pointer type.
Definition: PointerUnion.h:187
llvm::DINamespace
Definition: DebugInfoMetadata.h:2249
llvm::DILexicalBlock
Definition: DebugInfoMetadata.h:2094
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::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: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::NamedMDNode::addOperand
void addOperand(MDNode *M)
Definition: Metadata.cpp:1124
CommandLine.h
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
llvm::DIBuilder::replaceTemporary
NodeTy * replaceTemporary(TempMDNode &&N, NodeTy *Replacement)
Replace a temporary node.
Definition: DIBuilder.h:935
llvm::DIType::getFlags
DIFlags getFlags() const
Definition: DebugInfoMetadata.h:701
createTemplateValueParameterHelper
static DITemplateValueParameter * createTemplateValueParameterHelper(LLVMContext &VMContext, unsigned Tag, DIScope *Context, StringRef Name, DIType *Ty, bool IsDefault, Metadata *MD)
Definition: DIBuilder.cpp:422
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
Constants.h
llvm::DICompileUnit::replaceEnumTypes
void replaceEnumTypes(DICompositeTypeArray N)
Replace arrays.
Definition: DebugInfoMetadata.h:1503
llvm::DILocalVariable
Local variable.
Definition: DebugInfoMetadata.h:3041
getConstantOrNull
static ConstantAsMetadata * getConstantOrNull(Constant *C)
Definition: DIBuilder.cpp:354
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
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:1512
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
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: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
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:281
LLVMContextImpl.h
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::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:957
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:885
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: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
createTypeWithFlags
static DIType * createTypeWithFlags(const DIType *Ty, DINode::DIFlags FlagsToSet)
Definition: DIBuilder.cpp:577
llvm::None
const NoneType None
Definition: None.h:23
llvm::DIBuilder::createObjectPointerType
static DIType * createObjectPointerType(DIType *Ty)
Create a uniqued clone of Ty with FlagObjectPointer and FlagArtificial set.
Definition: DIBuilder.cpp:590
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:728
llvm::DILocalVariable::getScope
DILocalScope * getScope() const
Get the local scope for this variable.
Definition: DebugInfoMetadata.h:3094
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::dwarf::DW_LANG_lo_user
@ DW_LANG_lo_user
Definition: Dwarf.h:204
llvm::cl::opt< bool >
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:128
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: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::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:623
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::DICompileUnit::replaceGlobalVariables
void replaceGlobalVariables(DIGlobalVariableExpressionArray N)
Definition: DebugInfoMetadata.h:1509
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::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:440
DIBuilder.h
llvm::DICompileUnit
Compile unit.
Definition: DebugInfoMetadata.h:1313
llvm::DIImportedEntity
An imported module (C++ using directive or similar).
Definition: DebugInfoMetadata.h:3272
llvm::MDString::get
static MDString * get(LLVMContext &Context, StringRef Str)
Definition: Metadata.cpp:467
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
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:688
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
Builder
assume Assume Builder
Definition: AssumeBundleBuilder.cpp:649
llvm::DIBasicType
Basic type, like 'int' or 'float'.
Definition: DebugInfoMetadata.h:765
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:71
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:98
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:33
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
Dwarf.h
llvm::DINode
Tagged DWARF-like metadata node.
Definition: DebugInfoMetadata.h:123
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:2491
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:676
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: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::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: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::Type::getInt64Ty
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:205
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::DILabel::getScope
DILocalScope * getScope() const
Get the local scope for this label.
Definition: DebugInfoMetadata.h:3164
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::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:899
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
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:562
llvm::DIBuilder::getOrCreateArray
DINodeArray getOrCreateArray(ArrayRef< Metadata * > Elements)
Get a DINodeArray, create one if required.
Definition: DIBuilder.cpp:637
llvm::Module::getOrInsertNamedMetadata
NamedMDNode * getOrInsertNamedMetadata(StringRef Name)
Return the named MDNode in the module with the specified name.
Definition: Module.cpp:259
llvm::dwarf::DW_MACINFO_undef
@ DW_MACINFO_undef
Definition: Dwarf.h:382
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::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:2441
llvm::MDNode::isTemporary
bool isTemporary() const
Definition: Metadata.h:977
llvm::DIBuilder::createNullPtrType
DIBasicType * createNullPtrType()
Create C++11 nullptr type.
Definition: DIBuilder.cpp:258
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:657
llvm::DIBuilder::getOrCreateMacroArray
DIMacroNodeArray getOrCreateMacroArray(ArrayRef< Metadata * > Elements)
Get a DIMacroNodeArray, create one if required.
Definition: DIBuilder.cpp:642
llvm::DINode::DIFlags
DIFlags
Debug info flags.
Definition: DebugInfoMetadata.h:162
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:697
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:163
getSubprogram
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&... Args)
Definition: DIBuilder.cpp:804
llvm::DISubprogram
Subprogram description.
Definition: DebugInfoMetadata.h:1815
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:2301
llvm::IntegerType::get
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:276
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: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
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:411
llvm::DIType::isArtificial
bool isArtificial() const
Definition: DebugInfoMetadata.h:729
getDbgIntrinsicValueImpl
static Value * getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V)
Definition: DIBuilder.cpp:966
llvm::DIType::isObjectPointer
bool isObjectPointer() const
Definition: DebugInfoMetadata.h:730
CU
Definition: AArch64AsmBackend.cpp:515
llvm::DICompileUnit::replaceMacros
void replaceMacros(DIMacroNodeArray N)
Definition: DebugInfoMetadata.h:1515
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:606
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
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