LLVM  15.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"
17 #include "llvm/IR/Constants.h"
18 #include "llvm/IR/DebugInfo.h"
19 #include "llvm/IR/IRBuilder.h"
20 #include "llvm/IR/Module.h"
22 
23 using namespace llvm;
24 using namespace llvm::dwarf;
25 
26 static cl::opt<bool>
27  UseDbgAddr("use-dbg-addr",
28  llvm::cl::desc("Use llvm.dbg.addr for all local variables"),
29  cl::init(false), cl::Hidden);
30 
31 DIBuilder::DIBuilder(Module &m, bool AllowUnresolvedNodes, DICompileUnit *CU)
32  : M(m), VMContext(M.getContext()), CUNode(CU), DeclareFn(nullptr),
33  ValueFn(nullptr), LabelFn(nullptr), AddrFn(nullptr),
34  AllowUnresolvedNodes(AllowUnresolvedNodes) {
35  if (CUNode) {
36  if (const auto &ETs = CUNode->getEnumTypes())
37  AllEnumTypes.assign(ETs.begin(), ETs.end());
38  if (const auto &RTs = CUNode->getRetainedTypes())
39  AllRetainTypes.assign(RTs.begin(), RTs.end());
40  if (const auto &GVs = CUNode->getGlobalVariables())
41  AllGVs.assign(GVs.begin(), GVs.end());
42  if (const auto &IMs = CUNode->getImportedEntities())
43  AllImportedModules.assign(IMs.begin(), IMs.end());
44  if (const auto &MNs = CUNode->getMacros())
45  AllMacrosPerParent.insert({nullptr, {MNs.begin(), MNs.end()}});
46  }
47 }
48 
49 void DIBuilder::trackIfUnresolved(MDNode *N) {
50  if (!N)
51  return;
52  if (N->isResolved())
53  return;
54 
55  assert(AllowUnresolvedNodes && "Cannot handle unresolved nodes");
56  UnresolvedNodes.emplace_back(N);
57 }
58 
60  MDTuple *Temp = SP->getRetainedNodes().get();
61  if (!Temp || !Temp->isTemporary())
62  return;
63 
64  SmallVector<Metadata *, 16> RetainedNodes;
65 
66  auto PV = PreservedVariables.find(SP);
67  if (PV != PreservedVariables.end())
68  RetainedNodes.append(PV->second.begin(), PV->second.end());
69 
70  auto PL = PreservedLabels.find(SP);
71  if (PL != PreservedLabels.end())
72  RetainedNodes.append(PL->second.begin(), PL->second.end());
73 
74  DINodeArray Node = getOrCreateArray(RetainedNodes);
75 
76  TempMDTuple(Temp)->replaceAllUsesWith(Node.get());
77 }
78 
80  if (!CUNode) {
81  assert(!AllowUnresolvedNodes &&
82  "creating type nodes without a CU is not supported");
83  return;
84  }
85 
86  if (!AllEnumTypes.empty())
87  CUNode->replaceEnumTypes(MDTuple::get(VMContext, AllEnumTypes));
88 
89  SmallVector<Metadata *, 16> RetainValues;
90  // Declarations and definitions of the same type may be retained. Some
91  // clients RAUW these pairs, leaving duplicates in the retained types
92  // list. Use a set to remove the duplicates while we transform the
93  // TrackingVHs back into Values.
95  for (unsigned I = 0, E = AllRetainTypes.size(); I < E; I++)
96  if (RetainSet.insert(AllRetainTypes[I]).second)
97  RetainValues.push_back(AllRetainTypes[I]);
98 
99  if (!RetainValues.empty())
100  CUNode->replaceRetainedTypes(MDTuple::get(VMContext, RetainValues));
101 
102  DISubprogramArray SPs = MDTuple::get(VMContext, AllSubprograms);
103  for (auto *SP : SPs)
104  finalizeSubprogram(SP);
105  for (auto *N : RetainValues)
106  if (auto *SP = dyn_cast<DISubprogram>(N))
107  finalizeSubprogram(SP);
108 
109  if (!AllGVs.empty())
110  CUNode->replaceGlobalVariables(MDTuple::get(VMContext, AllGVs));
111 
112  if (!AllImportedModules.empty())
114  VMContext, SmallVector<Metadata *, 16>(AllImportedModules.begin(),
115  AllImportedModules.end())));
116 
117  for (const auto &I : AllMacrosPerParent) {
118  // DIMacroNode's with nullptr parent are DICompileUnit direct children.
119  if (!I.first) {
120  CUNode->replaceMacros(MDTuple::get(VMContext, I.second.getArrayRef()));
121  continue;
122  }
123  // Otherwise, it must be a temporary DIMacroFile that need to be resolved.
124  auto *TMF = cast<DIMacroFile>(I.first);
125  auto *MF = DIMacroFile::get(VMContext, dwarf::DW_MACINFO_start_file,
126  TMF->getLine(), TMF->getFile(),
127  getOrCreateMacroArray(I.second.getArrayRef()));
128  replaceTemporary(llvm::TempDIMacroNode(TMF), MF);
129  }
130 
131  // Now that all temp nodes have been replaced or deleted, resolve remaining
132  // cycles.
133  for (const auto &N : UnresolvedNodes)
134  if (N && !N->isResolved())
135  N->resolveCycles();
136  UnresolvedNodes.clear();
137 
138  // Can't handle unresolved nodes anymore.
139  AllowUnresolvedNodes = false;
140 }
141 
142 /// If N is compile unit return NULL otherwise return N.
144  if (!N || isa<DICompileUnit>(N))
145  return nullptr;
146  return cast<DIScope>(N);
147 }
148 
150  unsigned Lang, DIFile *File, StringRef Producer, bool isOptimized,
151  StringRef Flags, unsigned RunTimeVer, StringRef SplitName,
153  bool SplitDebugInlining, bool DebugInfoForProfiling,
154  DICompileUnit::DebugNameTableKind NameTableKind, bool RangesBaseAddress,
155  StringRef SysRoot, StringRef SDK) {
156 
157  assert(((Lang <= dwarf::DW_LANG_Fortran08 && Lang >= dwarf::DW_LANG_C89) ||
158  (Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
159  "Invalid Language tag");
160 
161  assert(!CUNode && "Can only make one compile unit per DIBuilder instance");
163  VMContext, Lang, File, Producer, isOptimized, Flags, RunTimeVer,
164  SplitName, Kind, nullptr, nullptr, nullptr, nullptr, nullptr, DWOId,
165  SplitDebugInlining, DebugInfoForProfiling, NameTableKind,
166  RangesBaseAddress, SysRoot, SDK);
167 
168  // Create a named metadata so that it is easier to find cu in a module.
169  NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu");
170  NMD->addOperand(CUNode);
171  trackIfUnresolved(CUNode);
172  return CUNode;
173 }
174 
175 static DIImportedEntity *
177  Metadata *NS, DIFile *File, unsigned Line, StringRef Name,
178  DINodeArray Elements,
179  SmallVectorImpl<TrackingMDNodeRef> &AllImportedModules) {
180  if (Line)
181  assert(File && "Source location has line number but no file");
182  unsigned EntitiesCount = C.pImpl->DIImportedEntitys.size();
183  auto *M = DIImportedEntity::get(C, Tag, Context, cast_or_null<DINode>(NS),
184  File, Line, Name, Elements);
185  if (EntitiesCount < C.pImpl->DIImportedEntitys.size())
186  // A new Imported Entity was just added to the context.
187  // Add it to the Imported Modules list.
188  AllImportedModules.emplace_back(M);
189  return M;
190 }
191 
193  DINamespace *NS, DIFile *File,
194  unsigned Line,
195  DINodeArray Elements) {
196  return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
197  Context, NS, File, Line, StringRef(), Elements,
198  AllImportedModules);
199 }
200 
202  DIImportedEntity *NS,
203  DIFile *File, unsigned Line,
204  DINodeArray Elements) {
205  return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
206  Context, NS, File, Line, StringRef(), Elements,
207  AllImportedModules);
208 }
209 
211  DIFile *File, unsigned Line,
212  DINodeArray Elements) {
213  return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
214  Context, M, File, Line, StringRef(), Elements,
215  AllImportedModules);
216 }
217 
220  DIFile *File, unsigned Line,
221  StringRef Name, DINodeArray Elements) {
222  // Make sure to use the unique identifier based metadata reference for
223  // types that have one.
224  return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_declaration,
225  Context, Decl, File, Line, Name, Elements,
226  AllImportedModules);
227 }
228 
232  return DIFile::get(VMContext, Filename, Directory, CS, Source);
233 }
234 
235 DIMacro *DIBuilder::createMacro(DIMacroFile *Parent, unsigned LineNumber,
236  unsigned MacroType, StringRef Name,
237  StringRef Value) {
238  assert(!Name.empty() && "Unable to create macro without name");
239  assert((MacroType == dwarf::DW_MACINFO_undef ||
240  MacroType == dwarf::DW_MACINFO_define) &&
241  "Unexpected macro type");
242  auto *M = DIMacro::get(VMContext, MacroType, LineNumber, Name, Value);
243  AllMacrosPerParent[Parent].insert(M);
244  return M;
245 }
246 
248  unsigned LineNumber, DIFile *File) {
250  LineNumber, File, DIMacroNodeArray())
251  .release();
252  AllMacrosPerParent[Parent].insert(MF);
253  // Add the new temporary DIMacroFile to the macro per parent map as a parent.
254  // This is needed to assure DIMacroFile with no children to have an entry in
255  // the map. Otherwise, it will not be resolved in DIBuilder::finalize().
256  AllMacrosPerParent.insert({MF, {}});
257  return MF;
258 }
259 
261  bool IsUnsigned) {
262  assert(!Name.empty() && "Unable to create enumerator without name");
263  return DIEnumerator::get(VMContext, APInt(64, Val, !IsUnsigned), IsUnsigned,
264  Name);
265 }
266 
268  assert(!Name.empty() && "Unable to create enumerator without name");
269  return DIEnumerator::get(VMContext, APInt(Value), Value.isUnsigned(), Name);
270 }
271 
273  assert(!Name.empty() && "Unable to create type without name");
274  return DIBasicType::get(VMContext, dwarf::DW_TAG_unspecified_type, Name);
275 }
276 
278  return createUnspecifiedType("decltype(nullptr)");
279 }
280 
282  unsigned Encoding,
283  DINode::DIFlags Flags) {
284  assert(!Name.empty() && "Unable to create type without name");
285  return DIBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits,
286  0, Encoding, Flags);
287 }
288 
290  assert(!Name.empty() && "Unable to create type without name");
291  return DIStringType::get(VMContext, dwarf::DW_TAG_string_type, Name,
292  SizeInBits, 0);
293 }
294 
296  DIVariable *StringLength,
297  DIExpression *StrLocationExp) {
298  assert(!Name.empty() && "Unable to create type without name");
299  return DIStringType::get(VMContext, dwarf::DW_TAG_string_type, Name,
300  StringLength, nullptr, StrLocationExp, 0, 0, 0);
301 }
302 
304  DIExpression *StringLengthExp,
305  DIExpression *StrLocationExp) {
306  assert(!Name.empty() && "Unable to create type without name");
307  return DIStringType::get(VMContext, dwarf::DW_TAG_string_type, Name, nullptr,
308  StringLengthExp, StrLocationExp, 0, 0, 0);
309 }
310 
312  return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, FromTy, 0,
313  0, 0, None, DINode::FlagZero);
314 }
315 
318  uint32_t AlignInBits,
319  Optional<unsigned> DWARFAddressSpace,
320  StringRef Name, DINodeArray Annotations) {
321  // FIXME: Why is there a name here?
322  return DIDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name,
323  nullptr, 0, nullptr, PointeeTy, SizeInBits,
324  AlignInBits, 0, DWARFAddressSpace, DINode::FlagZero,
325  nullptr, Annotations);
326 }
327 
329  DIType *Base,
330  uint64_t SizeInBits,
331  uint32_t AlignInBits,
332  DINode::DIFlags Flags) {
333  return DIDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "",
334  nullptr, 0, nullptr, PointeeTy, SizeInBits,
335  AlignInBits, 0, None, Flags, Base);
336 }
337 
340  uint32_t AlignInBits,
341  Optional<unsigned> DWARFAddressSpace) {
342  assert(RTy && "Unable to create reference type");
343  return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, RTy,
344  SizeInBits, AlignInBits, 0, DWARFAddressSpace,
345  DINode::FlagZero);
346 }
347 
349  DIFile *File, unsigned LineNo,
350  DIScope *Context, uint32_t AlignInBits,
351  DINodeArray Annotations) {
352  return DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File,
353  LineNo, getNonCompileUnitScope(Context), Ty, 0,
354  AlignInBits, 0, None, DINode::FlagZero, nullptr,
355  Annotations);
356 }
357 
359  assert(Ty && "Invalid type!");
360  assert(FriendTy && "Invalid friend type!");
361  return DIDerivedType::get(VMContext, dwarf::DW_TAG_friend, "", nullptr, 0, Ty,
362  FriendTy, 0, 0, 0, None, DINode::FlagZero);
363 }
364 
366  uint64_t BaseOffset,
367  uint32_t VBPtrOffset,
368  DINode::DIFlags Flags) {
369  assert(Ty && "Unable to create inheritance");
370  Metadata *ExtraData = ConstantAsMetadata::get(
371  ConstantInt::get(IntegerType::get(VMContext, 32), VBPtrOffset));
372  return DIDerivedType::get(VMContext, dwarf::DW_TAG_inheritance, "", nullptr,
373  0, Ty, BaseTy, 0, 0, BaseOffset, None, Flags,
374  ExtraData);
375 }
376 
378  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
379  uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
380  DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations) {
381  return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
382  LineNumber, getNonCompileUnitScope(Scope), Ty,
383  SizeInBits, AlignInBits, OffsetInBits, None, Flags,
384  nullptr, Annotations);
385 }
386 
388  if (C)
389  return ConstantAsMetadata::get(C);
390  return nullptr;
391 }
392 
394  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
395  uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
396  Constant *Discriminant, DINode::DIFlags Flags, DIType *Ty) {
397  return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
398  LineNumber, getNonCompileUnitScope(Scope), Ty,
399  SizeInBits, AlignInBits, OffsetInBits, None, Flags,
400  getConstantOrNull(Discriminant));
401 }
402 
404  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
405  uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits,
406  DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations) {
407  Flags |= DINode::FlagBitField;
408  return DIDerivedType::get(
409  VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
410  getNonCompileUnitScope(Scope), Ty, SizeInBits, /*AlignInBits=*/0,
411  OffsetInBits, None, Flags,
413  StorageOffsetInBits)),
414  Annotations);
415 }
416 
419  unsigned LineNumber, DIType *Ty,
420  DINode::DIFlags Flags, llvm::Constant *Val,
421  uint32_t AlignInBits) {
422  Flags |= DINode::FlagStaticMember;
423  return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
424  LineNumber, getNonCompileUnitScope(Scope), Ty, 0,
425  AlignInBits, 0, None, Flags,
426  getConstantOrNull(Val));
427 }
428 
430 DIBuilder::createObjCIVar(StringRef Name, DIFile *File, unsigned LineNumber,
431  uint64_t SizeInBits, uint32_t AlignInBits,
432  uint64_t OffsetInBits, DINode::DIFlags Flags,
433  DIType *Ty, MDNode *PropertyNode) {
434  return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
435  LineNumber, getNonCompileUnitScope(File), Ty,
436  SizeInBits, AlignInBits, OffsetInBits, None, Flags,
437  PropertyNode);
438 }
439 
442  StringRef GetterName, StringRef SetterName,
443  unsigned PropertyAttributes, DIType *Ty) {
444  return DIObjCProperty::get(VMContext, Name, File, LineNumber, GetterName,
445  SetterName, PropertyAttributes, Ty);
446 }
447 
450  DIType *Ty, bool isDefault) {
451  assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
452  return DITemplateTypeParameter::get(VMContext, Name, Ty, isDefault);
453 }
454 
458  bool IsDefault, Metadata *MD) {
459  assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
460  return DITemplateValueParameter::get(VMContext, Tag, Name, Ty, IsDefault, MD);
461 }
462 
465  DIType *Ty, bool isDefault,
466  Constant *Val) {
468  VMContext, dwarf::DW_TAG_template_value_parameter, Context, Name, Ty,
469  isDefault, getConstantOrNull(Val));
470 }
471 
474  DIType *Ty, StringRef Val) {
476  VMContext, dwarf::DW_TAG_GNU_template_template_param, Context, Name, Ty,
477  false, MDString::get(VMContext, Val));
478 }
479 
482  DIType *Ty, DINodeArray Val) {
484  VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty,
485  false, Val.get());
486 }
487 
489  DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
490  uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
491  DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
492  DIType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) {
493  assert((!Context || isa<DIScope>(Context)) &&
494  "createClassType should be called with a valid Context");
495 
496  auto *R = DICompositeType::get(
497  VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
498  getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBits,
499  OffsetInBits, Flags, Elements, 0, VTableHolder,
500  cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier);
501  trackIfUnresolved(R);
502  return R;
503 }
504 
506  DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
507  uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
508  DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang,
509  DIType *VTableHolder, StringRef UniqueIdentifier) {
510  auto *R = DICompositeType::get(
511  VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
512  getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBits, 0,
513  Flags, Elements, RunTimeLang, VTableHolder, nullptr, UniqueIdentifier);
514  trackIfUnresolved(R);
515  return R;
516 }
517 
519  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
520  uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
521  DINodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) {
522  auto *R = DICompositeType::get(
523  VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
524  getNonCompileUnitScope(Scope), nullptr, SizeInBits, AlignInBits, 0, Flags,
525  Elements, RunTimeLang, nullptr, nullptr, UniqueIdentifier);
526  trackIfUnresolved(R);
527  return R;
528 }
529 
532  unsigned LineNumber, uint64_t SizeInBits,
533  uint32_t AlignInBits, DINode::DIFlags Flags,
534  DIDerivedType *Discriminator, DINodeArray Elements,
535  StringRef UniqueIdentifier) {
536  auto *R = DICompositeType::get(
537  VMContext, dwarf::DW_TAG_variant_part, Name, File, LineNumber,
538  getNonCompileUnitScope(Scope), nullptr, SizeInBits, AlignInBits, 0, Flags,
539  Elements, 0, nullptr, nullptr, UniqueIdentifier, Discriminator);
540  trackIfUnresolved(R);
541  return R;
542 }
543 
545  DINode::DIFlags Flags,
546  unsigned CC) {
547  return DISubroutineType::get(VMContext, Flags, CC, ParameterTypes);
548 }
549 
551  DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
552  uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements,
553  DIType *UnderlyingType, StringRef UniqueIdentifier, bool IsScoped) {
554  auto *CTy = DICompositeType::get(
555  VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
556  getNonCompileUnitScope(Scope), UnderlyingType, SizeInBits, AlignInBits, 0,
557  IsScoped ? DINode::FlagEnumClass : DINode::FlagZero, Elements, 0, nullptr,
558  nullptr, UniqueIdentifier);
559  AllEnumTypes.push_back(CTy);
560  trackIfUnresolved(CTy);
561  return CTy;
562 }
563 
565  DIFile *File, unsigned LineNo,
566  uint64_t SizeInBits,
567  uint32_t AlignInBits, DIType *Ty) {
568  auto *R =
569  DIDerivedType::get(VMContext, dwarf::DW_TAG_set_type, Name, File, LineNo,
570  getNonCompileUnitScope(Scope), Ty, SizeInBits,
571  AlignInBits, 0, None, DINode::FlagZero);
572  trackIfUnresolved(R);
573  return R;
574 }
575 
578  DINodeArray Subscripts,
583  auto *R = DICompositeType::get(
584  VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0, nullptr, Ty, Size,
585  AlignInBits, 0, DINode::FlagZero, Subscripts, 0, nullptr, nullptr, "",
586  nullptr,
587  DL.is<DIExpression *>() ? (Metadata *)DL.get<DIExpression *>()
588  : (Metadata *)DL.get<DIVariable *>(),
589  AS.is<DIExpression *>() ? (Metadata *)AS.get<DIExpression *>()
590  : (Metadata *)AS.get<DIVariable *>(),
591  AL.is<DIExpression *>() ? (Metadata *)AL.get<DIExpression *>()
592  : (Metadata *)AL.get<DIVariable *>(),
593  RK.is<DIExpression *>() ? (Metadata *)RK.get<DIExpression *>()
594  : (Metadata *)RK.get<DIVariable *>());
595  trackIfUnresolved(R);
596  return R;
597 }
598 
600  uint32_t AlignInBits, DIType *Ty,
601  DINodeArray Subscripts) {
602  auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "",
603  nullptr, 0, nullptr, Ty, Size, AlignInBits, 0,
604  DINode::FlagVector, Subscripts, 0, nullptr);
605  trackIfUnresolved(R);
606  return R;
607 }
608 
610  auto NewSP = SP->cloneWithFlags(SP->getFlags() | DINode::FlagArtificial);
611  return MDNode::replaceWithDistinct(std::move(NewSP));
612 }
613 
615  DINode::DIFlags FlagsToSet) {
616  auto NewTy = Ty->cloneWithFlags(Ty->getFlags() | FlagsToSet);
617  return MDNode::replaceWithUniqued(std::move(NewTy));
618 }
619 
621  // FIXME: Restrict this to the nodes where it's valid.
622  if (Ty->isArtificial())
623  return Ty;
624  return createTypeWithFlags(Ty, DINode::FlagArtificial);
625 }
626 
628  // FIXME: Restrict this to the nodes where it's valid.
629  if (Ty->isObjectPointer())
630  return Ty;
631  DINode::DIFlags Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
632  return createTypeWithFlags(Ty, Flags);
633 }
634 
636  assert(T && "Expected non-null type");
637  assert((isa<DIType>(T) || (isa<DISubprogram>(T) &&
638  cast<DISubprogram>(T)->isDefinition() == false)) &&
639  "Expected type or subprogram declaration");
640  AllRetainTypes.emplace_back(T);
641 }
642 
644 
647  DIFile *F, unsigned Line, unsigned RuntimeLang,
648  uint64_t SizeInBits, uint32_t AlignInBits,
649  StringRef UniqueIdentifier) {
650  // FIXME: Define in terms of createReplaceableForwardDecl() by calling
651  // replaceWithUniqued().
652  auto *RetTy = DICompositeType::get(
653  VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr,
654  SizeInBits, AlignInBits, 0, DINode::FlagFwdDecl, nullptr, RuntimeLang,
655  nullptr, nullptr, UniqueIdentifier);
656  trackIfUnresolved(RetTy);
657  return RetTy;
658 }
659 
661  unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
662  unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits,
663  DINode::DIFlags Flags, StringRef UniqueIdentifier,
664  DINodeArray Annotations) {
665  auto *RetTy =
667  VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr,
668  SizeInBits, AlignInBits, 0, Flags, nullptr, RuntimeLang, nullptr,
669  nullptr, UniqueIdentifier, nullptr, nullptr, nullptr, nullptr,
670  nullptr, Annotations)
671  .release();
672  trackIfUnresolved(RetTy);
673  return RetTy;
674 }
675 
677  return MDTuple::get(VMContext, Elements);
678 }
679 
680 DIMacroNodeArray
682  return MDTuple::get(VMContext, Elements);
683 }
684 
687  for (Metadata *E : Elements) {
688  if (isa_and_nonnull<MDNode>(E))
689  Elts.push_back(cast<DIType>(E));
690  else
691  Elts.push_back(E);
692  }
693  return DITypeRefArray(MDNode::get(VMContext, Elts));
694 }
695 
696 DISubrange *DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
697  auto *LB = ConstantAsMetadata::get(
698  ConstantInt::getSigned(Type::getInt64Ty(VMContext), Lo));
699  auto *CountNode = ConstantAsMetadata::get(
700  ConstantInt::getSigned(Type::getInt64Ty(VMContext), Count));
701  return DISubrange::get(VMContext, CountNode, LB, nullptr, nullptr);
702 }
703 
705  auto *LB = ConstantAsMetadata::get(
706  ConstantInt::getSigned(Type::getInt64Ty(VMContext), Lo));
707  return DISubrange::get(VMContext, CountNode, LB, nullptr, nullptr);
708 }
709 
711  Metadata *UB, Metadata *Stride) {
712  return DISubrange::get(VMContext, CountNode, LB, UB, Stride);
713 }
714 
718  auto ConvToMetadata = [&](DIGenericSubrange::BoundType Bound) -> Metadata * {
719  return Bound.is<DIExpression *>() ? (Metadata *)Bound.get<DIExpression *>()
720  : (Metadata *)Bound.get<DIVariable *>();
721  };
722  return DIGenericSubrange::get(VMContext, ConvToMetadata(CountNode),
723  ConvToMetadata(LB), ConvToMetadata(UB),
724  ConvToMetadata(Stride));
725 }
726 
728 #ifndef NDEBUG
729  if (auto *CT =
730  dyn_cast_or_null<DICompositeType>(getNonCompileUnitScope(Context)))
731  assert(CT->getIdentifier().empty() &&
732  "Context of a global variable should not be a type with identifier");
733 #endif
734 }
735 
737  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
738  unsigned LineNumber, DIType *Ty, bool IsLocalToUnit, bool isDefined,
739  DIExpression *Expr, MDNode *Decl, MDTuple *TemplateParams,
740  uint32_t AlignInBits, DINodeArray Annotations) {
742 
744  VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
745  LineNumber, Ty, IsLocalToUnit, isDefined,
746  cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits,
747  Annotations);
748  if (!Expr)
749  Expr = createExpression();
750  auto *N = DIGlobalVariableExpression::get(VMContext, GV, Expr);
751  AllGVs.push_back(N);
752  return N;
753 }
754 
756  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
757  unsigned LineNumber, DIType *Ty, bool IsLocalToUnit, MDNode *Decl,
758  MDTuple *TemplateParams, uint32_t AlignInBits) {
760 
762  VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
763  LineNumber, Ty, IsLocalToUnit, false,
764  cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits,
765  nullptr)
766  .release();
767 }
768 
770  LLVMContext &VMContext,
771  DenseMap<MDNode *, SmallVector<TrackingMDNodeRef, 1>> &PreservedVariables,
772  DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
773  unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags,
774  uint32_t AlignInBits, DINodeArray Annotations = nullptr) {
775  // FIXME: Why getNonCompileUnitScope()?
776  // FIXME: Why is "!Context" okay here?
777  // FIXME: Why doesn't this check for a subprogram or lexical block (AFAICT
778  // the only valid scopes)?
780 
781  auto *Node = DILocalVariable::get(
782  VMContext, cast_or_null<DILocalScope>(Context), Name, File, LineNo, Ty,
783  ArgNo, Flags, AlignInBits, Annotations);
784  if (AlwaysPreserve) {
785  // The optimizer may remove local variables. If there is an interest
786  // to preserve variable info in such situation then stash it in a
787  // named mdnode.
789  assert(Fn && "Missing subprogram for local variable");
790  PreservedVariables[Fn].emplace_back(Node);
791  }
792  return Node;
793 }
794 
796  DIFile *File, unsigned LineNo,
797  DIType *Ty, bool AlwaysPreserve,
798  DINode::DIFlags Flags,
799  uint32_t AlignInBits) {
800  return createLocalVariable(VMContext, PreservedVariables, Scope, Name,
801  /* ArgNo */ 0, File, LineNo, Ty, AlwaysPreserve,
802  Flags, AlignInBits);
803 }
804 
806  DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
807  unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags,
808  DINodeArray Annotations) {
809  assert(ArgNo && "Expected non-zero argument number for parameter");
810  return createLocalVariable(VMContext, PreservedVariables, Scope, Name, ArgNo,
811  File, LineNo, Ty, AlwaysPreserve, Flags,
812  /*AlignInBits=*/0, Annotations);
813 }
814 
816  unsigned LineNo, bool AlwaysPreserve) {
818 
819  auto *Node = DILabel::get(VMContext, cast_or_null<DILocalScope>(Context),
820  Name, File, LineNo);
821 
822  if (AlwaysPreserve) {
823  /// The optimizer may remove labels. If there is an interest
824  /// to preserve label info in such situation then append it to
825  /// the list of retained nodes of the DISubprogram.
827  assert(Fn && "Missing subprogram for label");
828  PreservedLabels[Fn].emplace_back(Node);
829  }
830  return Node;
831 }
832 
834  return DIExpression::get(VMContext, Addr);
835 }
836 
837 template <class... Ts>
838 static DISubprogram *getSubprogram(bool IsDistinct, Ts &&...Args) {
839  if (IsDistinct)
840  return DISubprogram::getDistinct(std::forward<Ts>(Args)...);
841  return DISubprogram::get(std::forward<Ts>(Args)...);
842 }
843 
845  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
846  unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
848  DITemplateParameterArray TParams, DISubprogram *Decl,
849  DITypeArray ThrownTypes, DINodeArray Annotations,
850  StringRef TargetFuncName) {
851  bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
852  auto *Node = getSubprogram(
853  /*IsDistinct=*/IsDefinition, VMContext, getNonCompileUnitScope(Context),
854  Name, LinkageName, File, LineNo, Ty, ScopeLine, nullptr, 0, 0, Flags,
855  SPFlags, IsDefinition ? CUNode : nullptr, TParams, Decl,
856  MDTuple::getTemporary(VMContext, None).release(), ThrownTypes,
857  Annotations, TargetFuncName);
858 
859  if (IsDefinition)
860  AllSubprograms.push_back(Node);
861  trackIfUnresolved(Node);
862  return Node;
863 }
864 
866  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
867  unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
869  DITemplateParameterArray TParams, DISubprogram *Decl,
870  DITypeArray ThrownTypes) {
871  bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
873  Name, LinkageName, File, LineNo, Ty,
874  ScopeLine, nullptr, 0, 0, Flags, SPFlags,
875  IsDefinition ? CUNode : nullptr, TParams,
876  Decl, nullptr, ThrownTypes)
877  .release();
878 }
879 
881  DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
882  unsigned LineNo, DISubroutineType *Ty, unsigned VIndex, int ThisAdjustment,
883  DIType *VTableHolder, DINode::DIFlags Flags,
884  DISubprogram::DISPFlags SPFlags, DITemplateParameterArray TParams,
885  DITypeArray ThrownTypes) {
887  "Methods should have both a Context and a context that isn't "
888  "the compile unit.");
889  // FIXME: Do we want to use different scope/lines?
890  bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
891  auto *SP = getSubprogram(
892  /*IsDistinct=*/IsDefinition, VMContext, cast<DIScope>(Context), Name,
893  LinkageName, F, LineNo, Ty, LineNo, VTableHolder, VIndex, ThisAdjustment,
894  Flags, SPFlags, IsDefinition ? CUNode : nullptr, TParams, nullptr,
895  nullptr, ThrownTypes);
896 
897  if (IsDefinition)
898  AllSubprograms.push_back(SP);
899  trackIfUnresolved(SP);
900  return SP;
901 }
902 
904  DIGlobalVariable *Decl,
905  StringRef Name, DIFile *File,
906  unsigned LineNo) {
907  return DICommonBlock::get(VMContext, Scope, Decl, Name, File, LineNo);
908 }
909 
911  bool ExportSymbols) {
912 
913  // It is okay to *not* make anonymous top-level namespaces distinct, because
914  // all nodes that have an anonymous namespace as their parent scope are
915  // guaranteed to be unique and/or are linked to their containing
916  // DICompileUnit. This decision is an explicit tradeoff of link time versus
917  // memory usage versus code simplicity and may get revisited in the future.
919  ExportSymbols);
920 }
921 
923  StringRef ConfigurationMacros,
924  StringRef IncludePath, StringRef APINotesFile,
925  DIFile *File, unsigned LineNo, bool IsDecl) {
926  return DIModule::get(VMContext, File, getNonCompileUnitScope(Scope), Name,
927  ConfigurationMacros, IncludePath, APINotesFile, LineNo,
928  IsDecl);
929 }
930 
932  DIFile *File,
933  unsigned Discriminator) {
934  return DILexicalBlockFile::get(VMContext, Scope, File, Discriminator);
935 }
936 
938  unsigned Line, unsigned Col) {
939  // Make these distinct, to avoid merging two lexical blocks on the same
940  // file/line/column.
942  File, Line, Col);
943 }
944 
945 Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
946  DIExpression *Expr, const DILocation *DL,
947  Instruction *InsertBefore) {
948  return insertDeclare(Storage, VarInfo, Expr, DL, InsertBefore->getParent(),
949  InsertBefore);
950 }
951 
952 Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
953  DIExpression *Expr, const DILocation *DL,
954  BasicBlock *InsertAtEnd) {
955  // If this block already has a terminator then insert this intrinsic before
956  // the terminator. Otherwise, put it at the end of the block.
957  Instruction *InsertBefore = InsertAtEnd->getTerminator();
958  return insertDeclare(Storage, VarInfo, Expr, DL, InsertAtEnd, InsertBefore);
959 }
960 
961 Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
962  Instruction *InsertBefore) {
963  return insertLabel(LabelInfo, DL,
964  InsertBefore ? InsertBefore->getParent() : nullptr,
965  InsertBefore);
966 }
967 
968 Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
969  BasicBlock *InsertAtEnd) {
970  return insertLabel(LabelInfo, DL, InsertAtEnd, nullptr);
971 }
972 
973 Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V,
974  DILocalVariable *VarInfo,
975  DIExpression *Expr,
976  const DILocation *DL,
977  Instruction *InsertBefore) {
978  return insertDbgValueIntrinsic(
979  V, VarInfo, Expr, DL, InsertBefore ? InsertBefore->getParent() : nullptr,
980  InsertBefore);
981 }
982 
983 Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V,
984  DILocalVariable *VarInfo,
985  DIExpression *Expr,
986  const DILocation *DL,
987  BasicBlock *InsertAtEnd) {
988  return insertDbgValueIntrinsic(V, VarInfo, Expr, DL, InsertAtEnd, nullptr);
989 }
990 
991 Instruction *DIBuilder::insertDbgAddrIntrinsic(Value *V,
992  DILocalVariable *VarInfo,
993  DIExpression *Expr,
994  const DILocation *DL,
995  Instruction *InsertBefore) {
996  return insertDbgAddrIntrinsic(
997  V, VarInfo, Expr, DL, InsertBefore ? InsertBefore->getParent() : nullptr,
998  InsertBefore);
999 }
1000 
1001 Instruction *DIBuilder::insertDbgAddrIntrinsic(Value *V,
1002  DILocalVariable *VarInfo,
1003  DIExpression *Expr,
1004  const DILocation *DL,
1005  BasicBlock *InsertAtEnd) {
1006  return insertDbgAddrIntrinsic(V, VarInfo, Expr, DL, InsertAtEnd, nullptr);
1007 }
1008 
1009 /// Initialize IRBuilder for inserting dbg.declare and dbg.value intrinsics.
1010 /// This abstracts over the various ways to specify an insert position.
1012  BasicBlock *InsertBB, Instruction *InsertBefore) {
1013  if (InsertBefore)
1014  Builder.SetInsertPoint(InsertBefore);
1015  else if (InsertBB)
1016  Builder.SetInsertPoint(InsertBB);
1017  Builder.SetCurrentDebugLocation(DL);
1018 }
1019 
1021  assert(V && "no value passed to dbg intrinsic");
1022  return MetadataAsValue::get(VMContext, ValueAsMetadata::get(V));
1023 }
1024 
1026  return Intrinsic::getDeclaration(&M, UseDbgAddr ? Intrinsic::dbg_addr
1027  : Intrinsic::dbg_declare);
1028 }
1029 
1030 Instruction *DIBuilder::insertDbgValueIntrinsic(
1031  llvm::Value *Val, DILocalVariable *VarInfo, DIExpression *Expr,
1032  const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore) {
1033  if (!ValueFn)
1034  ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
1035  return insertDbgIntrinsic(ValueFn, Val, VarInfo, Expr, DL, InsertBB,
1036  InsertBefore);
1037 }
1038 
1039 Instruction *DIBuilder::insertDbgAddrIntrinsic(
1040  llvm::Value *Val, DILocalVariable *VarInfo, DIExpression *Expr,
1041  const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore) {
1042  if (!AddrFn)
1043  AddrFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_addr);
1044  return insertDbgIntrinsic(AddrFn, Val, VarInfo, Expr, DL, InsertBB,
1045  InsertBefore);
1046 }
1047 
1048 Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
1049  DIExpression *Expr, const DILocation *DL,
1050  BasicBlock *InsertBB,
1051  Instruction *InsertBefore) {
1052  assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.declare");
1053  assert(DL && "Expected debug loc");
1054  assert(DL->getScope()->getSubprogram() ==
1055  VarInfo->getScope()->getSubprogram() &&
1056  "Expected matching subprograms");
1057  if (!DeclareFn)
1058  DeclareFn = getDeclareIntrin(M);
1059 
1060  trackIfUnresolved(VarInfo);
1061  trackIfUnresolved(Expr);
1062  Value *Args[] = {getDbgIntrinsicValueImpl(VMContext, Storage),
1063  MetadataAsValue::get(VMContext, VarInfo),
1064  MetadataAsValue::get(VMContext, Expr)};
1065 
1066  IRBuilder<> B(DL->getContext());
1067  initIRBuilder(B, DL, InsertBB, InsertBefore);
1068  return B.CreateCall(DeclareFn, Args);
1069 }
1070 
1071 Instruction *DIBuilder::insertDbgIntrinsic(llvm::Function *IntrinsicFn,
1072  Value *V, DILocalVariable *VarInfo,
1073  DIExpression *Expr,
1074  const DILocation *DL,
1075  BasicBlock *InsertBB,
1076  Instruction *InsertBefore) {
1077  assert(IntrinsicFn && "must pass a non-null intrinsic function");
1078  assert(V && "must pass a value to a dbg intrinsic");
1079  assert(VarInfo &&
1080  "empty or invalid DILocalVariable* passed to debug intrinsic");
1081  assert(DL && "Expected debug loc");
1082  assert(DL->getScope()->getSubprogram() ==
1083  VarInfo->getScope()->getSubprogram() &&
1084  "Expected matching subprograms");
1085 
1086  trackIfUnresolved(VarInfo);
1087  trackIfUnresolved(Expr);
1088  Value *Args[] = {getDbgIntrinsicValueImpl(VMContext, V),
1089  MetadataAsValue::get(VMContext, VarInfo),
1090  MetadataAsValue::get(VMContext, Expr)};
1091 
1092  IRBuilder<> B(DL->getContext());
1093  initIRBuilder(B, DL, InsertBB, InsertBefore);
1094  return B.CreateCall(IntrinsicFn, Args);
1095 }
1096 
1097 Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
1098  BasicBlock *InsertBB,
1099  Instruction *InsertBefore) {
1100  assert(LabelInfo && "empty or invalid DILabel* passed to dbg.label");
1101  assert(DL && "Expected debug loc");
1102  assert(DL->getScope()->getSubprogram() ==
1103  LabelInfo->getScope()->getSubprogram() &&
1104  "Expected matching subprograms");
1105  if (!LabelFn)
1106  LabelFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_label);
1107 
1108  trackIfUnresolved(LabelInfo);
1109  Value *Args[] = {MetadataAsValue::get(VMContext, LabelInfo)};
1110 
1111  IRBuilder<> B(DL->getContext());
1112  initIRBuilder(B, DL, InsertBB, InsertBefore);
1113  return B.CreateCall(LabelFn, Args);
1114 }
1115 
1117  {
1119  N->replaceVTableHolder(VTableHolder);
1120  T = N.get();
1121  }
1122 
1123  // If this didn't create a self-reference, just return.
1124  if (T != VTableHolder)
1125  return;
1126 
1127  // Look for unresolved operands. T will drop RAUW support, orphaning any
1128  // cycles underneath it.
1129  if (T->isResolved())
1130  for (const MDOperand &O : T->operands())
1131  if (auto *N = dyn_cast_or_null<MDNode>(O))
1132  trackIfUnresolved(N);
1133 }
1134 
1135 void DIBuilder::replaceArrays(DICompositeType *&T, DINodeArray Elements,
1136  DINodeArray TParams) {
1137  {
1139  if (Elements)
1140  N->replaceElements(Elements);
1141  if (TParams)
1142  N->replaceTemplateParams(DITemplateParameterArray(TParams));
1143  T = N.get();
1144  }
1145 
1146  // If T isn't resolved, there's no problem.
1147  if (!T->isResolved())
1148  return;
1149 
1150  // If T is resolved, it may be due to a self-reference cycle. Track the
1151  // arrays explicitly if they're unresolved, or else the cycles will be
1152  // orphaned.
1153  if (Elements)
1154  trackIfUnresolved(Elements.get());
1155  if (TParams)
1156  trackIfUnresolved(TParams.get());
1157 }
llvm::DIBuilder::createModule
DIModule * createModule(DIScope *Scope, StringRef Name, StringRef ConfigurationMacros, StringRef IncludePath, StringRef APINotesFile={}, DIFile *File=nullptr, unsigned LineNo=0, bool IsDecl=false)
This creates new descriptor for a module with the specified parent scope.
Definition: DIBuilder.cpp:922
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::DIType
Base class for types.
Definition: DebugInfoMetadata.h:658
llvm::DILocalScope::getSubprogram
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
Definition: DebugInfoMetadata.cpp:930
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::DIBuilder::getOrCreateTypeArray
DITypeRefArray getOrCreateTypeArray(ArrayRef< Metadata * > Elements)
Get a DITypeRefArray, create one if required.
Definition: DIBuilder.cpp:685
llvm::AArch64CC::AL
@ AL
Definition: AArch64BaseInfo.h:269
llvm::NamedMDNode
A tuple of MDNodes.
Definition: Metadata.h:1477
llvm::DIBuilder::finalize
void finalize()
Construct any deferred debug info descriptors.
Definition: DIBuilder.cpp:79
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:1116
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:1410
llvm::DICompileUnit::getMacros
DIMacroNodeArray getMacros() const
Definition: DebugInfoMetadata.h:1467
llvm::DIGenericSubrange
Definition: DebugInfoMetadata.h:363
T
llvm::Function
Definition: Function.h:60
llvm::DIBuilder::finalizeSubprogram
void finalizeSubprogram(DISubprogram *SP)
Finalize a specific subprogram - no new variables may be added to this subprogram afterwards.
Definition: DIBuilder.cpp:59
llvm::DIBuilder::createBitFieldMemberType
DIDerivedType * createBitFieldMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations=nullptr)
Create debugging information entry for a bit field member.
Definition: DIBuilder.cpp:403
llvm::lltok::NameTableKind
@ NameTableKind
Definition: LLToken.h:415
llvm::DILexicalBlockFile
Definition: DebugInfoMetadata.h:2130
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1185
llvm::DIBuilder::createPointerType
DIDerivedType * createPointerType(DIType *PointeeTy, uint64_t SizeInBits, uint32_t AlignInBits=0, Optional< unsigned > DWARFAddressSpace=None, StringRef Name="", DINodeArray Annotations=nullptr)
Create debugging information entry for a pointer.
Definition: DIBuilder.cpp:317
llvm::DIStringType
String type, Fortran CHARACTER(n)
Definition: DebugInfoMetadata.h:832
llvm::DIFile::ChecksumInfo
A single checksum, represented by a Kind and a Value (a string).
Definition: DebugInfoMetadata.h:546
getDeclareIntrin
static Function * getDeclareIntrin(Module &M)
Definition: DIBuilder.cpp:1025
llvm::DICompileUnit::replaceRetainedTypes
void replaceRetainedTypes(DITypeArray N)
Definition: DebugInfoMetadata.h:1501
llvm::DIBuilder::createTempGlobalVariableFwdDecl
DIGlobalVariable * createTempGlobalVariableFwdDecl(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl=nullptr, MDTuple *TemplateParams=nullptr, uint32_t AlignInBits=0)
Identical to createGlobalVariable except that the resulting DbgNode is temporary and meant to be RAUW...
Definition: DIBuilder.cpp:755
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, DINodeArray Annotations=nullptr)
Definition: DIBuilder.cpp:769
llvm::IRBuilder<>
llvm::DIType::cloneWithFlags
TempDIType cloneWithFlags(DIFlags NewFlags) const
Returns a new temporary DIType with updated Flags.
Definition: DebugInfoMetadata.h:710
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:139
llvm::DILocation
Debug location.
Definition: DebugInfoMetadata.h:1551
llvm::getDISubprogram
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
Definition: DebugInfo.cpp:128
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:865
Module.h
llvm::Optional
Definition: APInt.h:33
llvm::ConstantAsMetadata::get
static ConstantAsMetadata * get(Constant *C)
Definition: Metadata.h:420
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:450
llvm::ValueAsMetadata::get
static ValueAsMetadata * get(Value *V)
Definition: Metadata.cpp:394
llvm::DIBuilder::createMemberType
DIDerivedType * createMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations=nullptr)
Create debugging information entry for a member.
Definition: DIBuilder.cpp:377
llvm::DIBuilder::createSubroutineType
DISubroutineType * createSubroutineType(DITypeRefArray ParameterTypes, DINode::DIFlags Flags=DINode::FlagZero, unsigned CC=0)
Create subroutine type.
Definition: DIBuilder.cpp:544
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2548
llvm::DIBuilder::createQualifiedType
DIDerivedType * createQualifiedType(unsigned Tag, DIType *FromTy)
Create debugging information entry for a qualified type, e.g.
Definition: DIBuilder.cpp:311
llvm::dwarf::Tag
Tag
Definition: Dwarf.h:105
llvm::DIBuilder::DIBuilder
DIBuilder(Module &M, bool AllowUnresolved=true, DICompileUnit *CU=nullptr)
Construct a builder for a module.
Definition: DIBuilder.cpp:31
llvm::DINameKind::LinkageName
@ LinkageName
llvm::DIBuilder::createStringType
DIStringType * createStringType(StringRef Name, uint64_t SizeInBits)
Create debugging information entry for a string type.
Definition: DIBuilder.cpp:289
llvm::DIBuilder::createObjCProperty
DIObjCProperty * createObjCProperty(StringRef Name, DIFile *File, unsigned LineNumber, StringRef GetterName, StringRef SetterName, unsigned PropertyAttributes, DIType *Ty)
Create debugging information entry for Objective-C property.
Definition: DIBuilder.cpp:441
llvm::DICompileUnit::DebugEmissionKind
DebugEmissionKind
Definition: DebugInfoMetadata.h:1321
llvm::DIBuilder::createReplaceableCompositeType
DICompositeType * createReplaceableCompositeType(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang=0, uint64_t SizeInBits=0, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagFwdDecl, StringRef UniqueIdentifier="", DINodeArray Annotations=nullptr)
Create a temporary forward-declared type.
Definition: DIBuilder.cpp:660
llvm::PointerUnion::get
T get() const
Returns the value of the specified pointer type.
Definition: PointerUnion.h:155
llvm::DINamespace
Definition: DebugInfoMetadata.h:2248
llvm::DILexicalBlock
Definition: DebugInfoMetadata.h:2077
llvm::DIBuilder::createFile
DIFile * createFile(StringRef Filename, StringRef Directory, Optional< DIFile::ChecksumInfo< StringRef >> Checksum=None, Optional< StringRef > Source=None)
Create a file descriptor to hold debugging information for a file.
Definition: DIBuilder.cpp:229
llvm::MDNode::get
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1289
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::DIBuilder::createTemplateParameterPack
DITemplateValueParameter * createTemplateParameterPack(DIScope *Scope, StringRef Name, DIType *Ty, DINodeArray Val)
Create debugging information for a template parameter pack.
Definition: DIBuilder.cpp:481
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:55
llvm::PointerUnion::is
bool is() const
Test if the Union currently holds the type matching T.
Definition: PointerUnion.h:150
llvm::Annotations
Annotations lets you mark points and ranges inside source code, for tests:
Definition: Annotations.h:48
llvm::DIBuilder::createAutoVariable
DILocalVariable * createAutoVariable(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve=false, DINode::DIFlags Flags=DINode::FlagZero, uint32_t AlignInBits=0)
Create a new descriptor for an auto variable.
Definition: DIBuilder.cpp:795
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::DITypeRefArray
Definition: DebugInfoMetadata.h:69
llvm::DIBuilder::createSetType
DIDerivedType * createSetType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, DIType *Ty)
Create debugging information entry for a set.
Definition: DIBuilder.cpp:564
llvm::NamedMDNode::addOperand
void addOperand(MDNode *M)
Definition: Metadata.cpp:1162
CommandLine.h
llvm::DIBuilder::createArtificialType
static DIType * createArtificialType(DIType *Ty)
Create a uniqued clone of Ty with FlagArtificial set.
Definition: DIBuilder.cpp:620
llvm::DIObjCProperty
Definition: DebugInfoMetadata.h:3203
llvm::DIBuilder::replaceTemporary
NodeTy * replaceTemporary(TempMDNode &&N, NodeTy *Replacement)
Replace a temporary node.
Definition: DIBuilder.h:1014
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:456
llvm::DIBuilder::createStaticMemberType
DIDerivedType * createStaticMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, DIType *Ty, DINode::DIFlags Flags, Constant *Val, uint32_t AlignInBits=0)
Create debugging information entry for a C++ static data member.
Definition: DIBuilder.cpp:418
Constants.h
llvm::DICompileUnit::replaceEnumTypes
void replaceEnumTypes(DICompositeTypeArray N)
Replace arrays.
Definition: DebugInfoMetadata.h:1498
llvm::DILocalVariable
Local variable.
Definition: DebugInfoMetadata.h:3048
getConstantOrNull
static ConstantAsMetadata * getConstantOrNull(Constant *C)
Definition: DIBuilder.cpp:387
llvm::DIMacro
Definition: DebugInfoMetadata.h:3438
llvm::DIBuilder::createMacro
DIMacro * createMacro(DIMacroFile *Parent, unsigned Line, unsigned MacroType, StringRef Name, StringRef Value=StringRef())
Create debugging information entry for a macro.
Definition: DIBuilder.cpp:235
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:667
llvm::DIBuilder::createTempMacroFile
DIMacroFile * createTempMacroFile(DIMacroFile *Parent, unsigned Line, DIFile *File)
Create debugging information temporary entry for a macro file.
Definition: DIBuilder.cpp:247
llvm::DICompileUnit::replaceImportedEntities
void replaceImportedEntities(DIImportedEntityArray N)
Definition: DebugInfoMetadata.h:1505
llvm::DIBuilder::createCommonBlock
DICommonBlock * createCommonBlock(DIScope *Scope, DIGlobalVariable *decl, StringRef Name, DIFile *File, unsigned LineNo)
Create common block entry for a Fortran common block.
Definition: DIBuilder.cpp:903
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:635
llvm::DISubprogram::DISPFlags
DISPFlags
Debug info subprogram flags.
Definition: DebugInfoMetadata.h:1812
llvm::MDTuple
Tuple of metadata.
Definition: Metadata.h:1230
llvm::DIBuilder::createEnumerator
DIEnumerator * createEnumerator(StringRef Name, const APSInt &Value)
Create a single enumerator value.
Definition: DIBuilder.cpp:267
llvm::DISubrange
Array subrange.
Definition: DebugInfoMetadata.h:300
llvm::DIBuilder::createFriend
DIDerivedType * createFriend(DIType *Ty, DIType *FriendTy)
Create debugging information entry for a 'friend'.
Definition: DIBuilder.cpp:358
llvm::DITemplateTypeParameter
Definition: DebugInfoMetadata.h:2393
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::Instruction
Definition: Instruction.h:42
LLVMContextImpl.h
llvm::APSInt
An arbitrary precision integer that knows its signedness.
Definition: APSInt.h:23
llvm::DIBuilder::createUnionType
DICompositeType * createUnionType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DINodeArray Elements, unsigned RunTimeLang=0, StringRef UniqueIdentifier="")
Create debugging information entry for an union.
Definition: DIBuilder.cpp:518
llvm::MDNode::getTemporary
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1301
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:1011
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:919
llvm::AArch64CC::PL
@ PL
Definition: AArch64BaseInfo.h:260
llvm::DIBuilder::createTypedef
DIDerivedType * createTypedef(DIType *Ty, StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context, uint32_t AlignInBits=0, DINodeArray Annotations=nullptr)
Create debugging information entry for a typedef.
Definition: DIBuilder.cpp:348
createImportedModule
static DIImportedEntity * createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context, Metadata *NS, DIFile *File, unsigned Line, StringRef Name, DINodeArray Elements, SmallVectorImpl< TrackingMDNodeRef > &AllImportedModules)
Definition: DIBuilder.cpp:176
llvm::DIBuilder::createVariantPart
DICompositeType * createVariantPart(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DIDerivedType *Discriminator, DINodeArray Elements, StringRef UniqueIdentifier="")
Create debugging information entry for a variant part.
Definition: DIBuilder.cpp:531
llvm::Metadata
Root of the metadata hierarchy.
Definition: Metadata.h:62
llvm::DIBuilder::replaceArrays
void replaceArrays(DICompositeType *&T, DINodeArray Elements, DINodeArray TParams=DINodeArray())
Replace arrays on a composite type.
Definition: DIBuilder.cpp:1135
createTypeWithFlags
static DIType * createTypeWithFlags(const DIType *Ty, DINode::DIFlags FlagsToSet)
Definition: DIBuilder.cpp:614
llvm::None
const NoneType None
Definition: None.h:24
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::DIBuilder::createObjectPointerType
static DIType * createObjectPointerType(DIType *Ty)
Create a uniqued clone of Ty with FlagObjectPointer and FlagArtificial set.
Definition: DIBuilder.cpp:627
llvm::DILocalVariable::getScope
DILocalScope * getScope() const
Get the local scope for this variable.
Definition: DebugInfoMetadata.h:3106
llvm::DICommonBlock
Definition: DebugInfoMetadata.h:2989
llvm::DIBuilder::createReferenceType
DIDerivedType * createReferenceType(unsigned Tag, DIType *RTy, uint64_t SizeInBits=0, uint32_t AlignInBits=0, Optional< unsigned > DWARFAddressSpace=None)
Create debugging information entry for a c++ style reference or rvalue reference type.
Definition: DIBuilder.cpp:339
llvm::dwarf::DW_LANG_lo_user
@ DW_LANG_lo_user
Definition: Dwarf.h:205
llvm::cl::opt< bool >
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:239
getNonCompileUnitScope
static DIScope * getNonCompileUnitScope(DIScope *N)
If N is compile unit return NULL otherwise return N.
Definition: DIBuilder.cpp:143
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::DIEnumerator
Enumeration value.
Definition: DebugInfoMetadata.h:411
llvm::DIBuilder::createMethod
DISubprogram * createMethod(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, unsigned VTableIndex=0, int ThisAdjustment=0, DIType *VTableHolder=nullptr, DINode::DIFlags Flags=DINode::FlagZero, DISubprogram::DISPFlags SPFlags=DISubprogram::SPFlagZero, DITemplateParameterArray TParams=nullptr, DITypeArray ThrownTypes=nullptr)
Create a new descriptor for the specified C++ method.
Definition: DIBuilder.cpp:880
llvm::DICompileUnit::getGlobalVariables
DIGlobalVariableExpressionArray getGlobalVariables() const
Definition: DebugInfoMetadata.h:1461
uint64_t
llvm::DIBuilder::createForwardDecl
DICompositeType * createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang=0, uint64_t SizeInBits=0, uint32_t AlignInBits=0, StringRef UniqueIdentifier="")
Create a permanent forward-declared type.
Definition: DIBuilder.cpp:646
llvm::DIBuilder::createArrayType
DICompositeType * createArrayType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts, PointerUnion< DIExpression *, DIVariable * > DataLocation=nullptr, PointerUnion< DIExpression *, DIVariable * > Associated=nullptr, PointerUnion< DIExpression *, DIVariable * > Allocated=nullptr, PointerUnion< DIExpression *, DIVariable * > Rank=nullptr)
Create debugging information entry for an array.
Definition: DIBuilder.cpp:577
Addr
uint64_t Addr
Definition: ELFObjHandler.cpp:78
llvm::DIBuilder::createEnumerationType
DICompositeType * createEnumerationType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements, DIType *UnderlyingType, StringRef UniqueIdentifier="", bool IsScoped=false)
Create debugging information entry for an enumeration.
Definition: DIBuilder.cpp:550
llvm::DIBuilder::createClassType
DICompositeType * createClassType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, DIType *VTableHolder=nullptr, MDNode *TemplateParms=nullptr, StringRef UniqueIdentifier="")
Create debugging information entry for a class.
Definition: DIBuilder.cpp:488
llvm::DIBuilder::createExpression
DIExpression * createExpression(ArrayRef< uint64_t > Addr=None)
Create a new descriptor for the specified variable which has a complex address expression for its add...
Definition: DIBuilder.cpp:833
llvm::DIGlobalVariable
Global variables.
Definition: DebugInfoMetadata.h:2904
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::MDNode::replaceWithUniqued
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithUniqued(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a uniqued one.
Definition: Metadata.h:1080
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
llvm::DIBuilder::createTemplateTemplateParameter
DITemplateValueParameter * createTemplateTemplateParameter(DIScope *Scope, StringRef Name, DIType *Ty, StringRef Val)
Create debugging information for a template template parameter.
Definition: DIBuilder.cpp:473
llvm::DenseMap
Definition: DenseMap.h:716
DebugInfo.h
llvm::DICompileUnit::getEnumTypes
DICompositeTypeArray getEnumTypes() const
Definition: DebugInfoMetadata.h:1455
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::DICompileUnit::replaceGlobalVariables
void replaceGlobalVariables(DIGlobalVariableExpressionArray N)
Definition: DebugInfoMetadata.h:1502
llvm::DIBuilder::createMemberPointerType
DIDerivedType * createMemberPointerType(DIType *PointeeTy, DIType *Class, uint64_t SizeInBits, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagZero)
Create debugging information entry for a pointer to member.
Definition: DIBuilder.cpp:328
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:432
DIBuilder.h
llvm::DICompileUnit
Compile unit.
Definition: DebugInfoMetadata.h:1316
llvm::DIImportedEntity
An imported module (C++ using directive or similar).
Definition: DebugInfoMetadata.h:3283
getSubprogram
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&...Args)
Definition: DIBuilder.cpp:838
llvm::MDString::get
static MDString * get(LLVMContext &Context, StringRef Str)
Definition: Metadata.cpp:499
llvm::DIMacroFile
Definition: DebugInfoMetadata.h:3489
llvm::DIBuilder::createArtificialSubprogram
static DISubprogram * createArtificialSubprogram(DISubprogram *SP)
Create a distinct clone of SP with FlagArtificial set.
Definition: DIBuilder.cpp:609
IRBuilder.h
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::MDTuple::get
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1256
checkGlobalVariableScope
static void checkGlobalVariableScope(DIScope *Context)
Definition: DIBuilder.cpp:727
llvm::DIBuilder::createLabel
DILabel * createLabel(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, bool AlwaysPreserve=false)
Create a new descriptor for an label.
Definition: DIBuilder.cpp:815
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::MDNode
Metadata node.
Definition: Metadata.h:926
llvm::DIBuilder::createImportedDeclaration
DIImportedEntity * createImportedDeclaration(DIScope *Context, DINode *Decl, DIFile *File, unsigned Line, StringRef Name="", DINodeArray Elements=nullptr)
Create a descriptor for an imported function.
Definition: DIBuilder.cpp:219
Builder
assume Assume Builder
Definition: AssumeBundleBuilder.cpp:651
llvm::DIBasicType
Basic type, like 'int' or 'float'.
Definition: DebugInfoMetadata.h:764
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
llvm::DISubroutineType
Type array for a subprogram.
Definition: DebugInfoMetadata.h:1265
llvm::DICompositeType
Composite types.
Definition: DebugInfoMetadata.h:1042
llvm::DIBuilder::createImportedModule
DIImportedEntity * createImportedModule(DIScope *Context, DINamespace *NS, DIFile *File, unsigned Line, DINodeArray Elements=nullptr)
Create a descriptor for an imported module.
Definition: DIBuilder.cpp:192
llvm::Sched::Source
@ Source
Definition: TargetLowering.h:99
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::DIBuilder::createLexicalBlockFile
DILexicalBlockFile * createLexicalBlockFile(DIScope *Scope, DIFile *File, unsigned Discriminator=0)
This creates a descriptor for a lexical block with a new file attached.
Definition: DIBuilder.cpp:931
llvm::DICompileUnit::DebugNameTableKind
DebugNameTableKind
Definition: DebugInfoMetadata.h:1329
llvm::DIBuilder::createVariantMemberType
DIDerivedType * createVariantMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, Constant *Discriminant, DINode::DIFlags Flags, DIType *Ty)
Create debugging information entry for a variant.
Definition: DIBuilder.cpp:393
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
Dwarf.h
llvm::DINode
Tagged DWARF-like metadata node.
Definition: DebugInfoMetadata.h:129
uint32_t
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::dwarf::DW_MACINFO_define
@ DW_MACINFO_define
Definition: Dwarf.h:386
llvm::MDTuple::getTemporary
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Return a temporary node.
Definition: Metadata.h:1276
llvm::DIVariable
Base class for variables.
Definition: DebugInfoMetadata.h:2482
llvm::MDNode::getDistinct
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1297
llvm::DIBuilder::getOrCreateGenericSubrange
DIGenericSubrange * getOrCreateGenericSubrange(DIGenericSubrange::BoundType Count, DIGenericSubrange::BoundType LowerBound, DIGenericSubrange::BoundType UpperBound, DIGenericSubrange::BoundType Stride)
Definition: DIBuilder.cpp:715
llvm::DIBuilder::createLexicalBlock
DILexicalBlock * createLexicalBlock(DIScope *Scope, DIFile *File, unsigned Line, unsigned Col)
This creates a descriptor for a lexical block with the specified parent context.
Definition: DIBuilder.cpp:937
llvm::PointerUnion
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
Definition: PointerUnion.h:112
llvm::DIBuilder::createTemplateTypeParameter
DITemplateTypeParameter * createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault)
Create debugging information for template type parameter.
Definition: DIBuilder.cpp:449
llvm::DIBuilder::createInheritance
DIDerivedType * createInheritance(DIType *Ty, DIType *BaseTy, uint64_t BaseOffset, uint32_t VBPtrOffset, DINode::DIFlags Flags)
Create debugging information entry to establish inheritance relationship between two types.
Definition: DIBuilder.cpp:365
llvm::DIBuilder::createCompileUnit
DICompileUnit * createCompileUnit(unsigned Lang, DIFile *File, StringRef Producer, bool isOptimized, StringRef Flags, unsigned RV, StringRef SplitName=StringRef(), DICompileUnit::DebugEmissionKind Kind=DICompileUnit::DebugEmissionKind::FullDebug, uint64_t DWOId=0, bool SplitDebugInlining=true, bool DebugInfoForProfiling=false, DICompileUnit::DebugNameTableKind NameTableKind=DICompileUnit::DebugNameTableKind::Default, bool RangesBaseAddress=false, StringRef SysRoot={}, StringRef SDK={})
A CompileUnit provides an anchor for all debugging information generated during this instance of comp...
Definition: DIBuilder.cpp:149
llvm::ConstantAsMetadata
Definition: Metadata.h:413
llvm::DIBuilder::createNameSpace
DINamespace * createNameSpace(DIScope *Scope, StringRef Name, bool ExportSymbols)
This creates new descriptor for a namespace with the specified parent scope.
Definition: DIBuilder.cpp:910
llvm::DIBuilder::createStructType
DICompositeType * createStructType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang=0, DIType *VTableHolder=nullptr, StringRef UniqueIdentifier="")
Create debugging information entry for a struct.
Definition: DIBuilder.cpp:505
llvm::Type::getInt64Ty
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:240
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
llvm::DILabel::getScope
DILocalScope * getScope() const
Get the local scope for this label.
Definition: DebugInfoMetadata.h:3178
llvm::DIBuilder::createUnspecifiedType
DIBasicType * createUnspecifiedType(StringRef Name)
Create a DWARF unspecified type.
Definition: DIBuilder.cpp:272
llvm::DIScope
Base class for scope-like contexts.
Definition: DebugInfoMetadata.h:471
llvm::DIBuilder::createObjCIVar
DIDerivedType * createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty, MDNode *PropertyNode)
Create debugging information entry for Objective-C instance variable.
Definition: DIBuilder.cpp:430
llvm::MetadataAsValue::get
static MetadataAsValue * get(LLVMContext &Context, Metadata *MD)
Definition: Metadata.cpp:102
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:933
llvm::dwarf::DW_MACINFO_start_file
@ DW_MACINFO_start_file
Definition: Dwarf.h:388
llvm::DIBuilder::createVectorType
DICompositeType * createVectorType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts)
Create debugging information entry for a vector type.
Definition: DIBuilder.cpp:599
llvm::DIBuilder::getOrCreateArray
DINodeArray getOrCreateArray(ArrayRef< Metadata * > Elements)
Get a DINodeArray, create one if required.
Definition: DIBuilder.cpp:676
llvm::Module::getOrInsertNamedMetadata
NamedMDNode * getOrInsertNamedMetadata(StringRef Name)
Return the named MDNode in the module with the specified name.
Definition: Module.cpp:260
llvm::dwarf::DW_MACINFO_undef
@ DW_MACINFO_undef
Definition: Dwarf.h:387
llvm::DIBuilder::createParameterVariable
DILocalVariable * createParameterVariable(DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve=false, DINode::DIFlags Flags=DINode::FlagZero, DINodeArray Annotations=nullptr)
Create a new descriptor for a parameter variable.
Definition: DIBuilder.cpp:805
llvm::DICompileUnit::getRetainedTypes
DIScopeArray getRetainedTypes() const
Definition: DebugInfoMetadata.h:1458
llvm::DIBuilder::createGlobalVariableExpression
DIGlobalVariableExpression * createGlobalVariableExpression(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool IsLocalToUnit, bool isDefined=true, DIExpression *Expr=nullptr, MDNode *Decl=nullptr, MDTuple *TemplateParams=nullptr, uint32_t AlignInBits=0, DINodeArray Annotations=nullptr)
Create a new descriptor for the specified variable.
Definition: DIBuilder.cpp:736
llvm::DIDerivedType
Derived types.
Definition: DebugInfoMetadata.h:924
llvm::DIGlobalVariableExpression
A pair of DIGlobalVariable and DIExpression.
Definition: DebugInfoMetadata.h:3348
llvm::DIBuilder::createTemplateValueParameter
DITemplateValueParameter * createTemplateValueParameter(DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault, Constant *Val)
Create debugging information for template value parameter.
Definition: DIBuilder.cpp:464
llvm::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:1090
llvm::DITemplateValueParameter
Definition: DebugInfoMetadata.h:2432
llvm::DIBuilder::createFunction
DISubprogram * createFunction(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine, DINode::DIFlags Flags=DINode::FlagZero, DISubprogram::DISPFlags SPFlags=DISubprogram::SPFlagZero, DITemplateParameterArray TParams=nullptr, DISubprogram *Decl=nullptr, DITypeArray ThrownTypes=nullptr, DINodeArray Annotations=nullptr, StringRef TargetFuncName="")
Create a new descriptor for the specified subprogram.
Definition: DIBuilder.cpp:844
llvm::MDNode::isTemporary
bool isTemporary() const
Definition: Metadata.h:1040
llvm::DIBuilder::createNullPtrType
DIBasicType * createNullPtrType()
Create C++11 nullptr type.
Definition: DIBuilder.cpp:277
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:696
llvm::DIBuilder::getOrCreateMacroArray
DIMacroNodeArray getOrCreateMacroArray(ArrayRef< Metadata * > Elements)
Get a DIMacroNodeArray, create one if required.
Definition: DIBuilder.cpp:681
llvm::DINode::DIFlags
DIFlags
Debug info flags.
Definition: DebugInfoMetadata.h:168
N
#define N
llvm::Instruction::getParent
const BasicBlock * getParent() const
Definition: Instruction.h:91
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.h:119
llvm::DISubprogram
Subprogram description.
Definition: DebugInfoMetadata.h:1797
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
llvm::DIModule
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Definition: DebugInfoMetadata.h:2297
llvm::IntegerType::get
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:311
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:3138
llvm::DIBuilder::createBasicType
DIBasicType * createBasicType(StringRef Name, uint64_t SizeInBits, unsigned Encoding, DINode::DIFlags Flags=DINode::FlagZero)
Create debugging information entry for a basic type.
Definition: DIBuilder.cpp:281
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:394
llvm::cl::desc
Definition: CommandLine.h:405
llvm::DICompileUnit::getImportedEntities
DIImportedEntityArray getImportedEntities() const
Definition: DebugInfoMetadata.h:1464
llvm::DIType::isArtificial
bool isArtificial() const
Definition: DebugInfoMetadata.h:728
getDbgIntrinsicValueImpl
static Value * getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V)
Definition: DIBuilder.cpp:1020
llvm::DIType::isObjectPointer
bool isObjectPointer() const
Definition: DebugInfoMetadata.h:729
CU
Definition: AArch64AsmBackend.cpp:505
llvm::DICompileUnit::replaceMacros
void replaceMacros(DIMacroNodeArray N)
Definition: DebugInfoMetadata.h:1508
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::MDOperand
Tracking metadata reference owned by Metadata.
Definition: Metadata.h:773
llvm::DIBuilder::createUnspecifiedParameter
DIBasicType * createUnspecifiedParameter()
Create unspecified parameter type for a subroutine type.
Definition: DIBuilder.cpp:643
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58
llvm::DIFile
File.
Definition: DebugInfoMetadata.h:525
llvm::SmallVectorImpl::emplace_back
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:927
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:365