LLVM  16.0.0git
DebugInfoMetadata.cpp
Go to the documentation of this file.
1 //===- DebugInfoMetadata.cpp - Implement debug info metadata --------------===//
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 debug info Metadata classes.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 #include "LLVMContextImpl.h"
15 #include "MetadataImpl.h"
16 #include "llvm/ADT/SmallSet.h"
17 #include "llvm/ADT/StringSwitch.h"
19 #include "llvm/IR/Function.h"
20 #include "llvm/IR/Type.h"
21 #include "llvm/IR/Value.h"
22 
23 #include <numeric>
24 
25 using namespace llvm;
26 
27 namespace llvm {
28 // Use FS-AFDO discriminator.
30  "enable-fs-discriminator", cl::Hidden,
31  cl::desc("Enable adding flow sensitive discriminators"));
32 } // namespace llvm
33 
34 const DIExpression::FragmentInfo DebugVariable::DefaultFragment = {
36 
37 DILocation::DILocation(LLVMContext &C, StorageType Storage, unsigned Line,
38  unsigned Column, ArrayRef<Metadata *> MDs,
39  bool ImplicitCode)
40  : MDNode(C, DILocationKind, Storage, MDs) {
41  assert((MDs.size() == 1 || MDs.size() == 2) &&
42  "Expected a scope and optional inlined-at");
43 
44  // Set line and column.
45  assert(Column < (1u << 16) && "Expected 16-bit column");
46 
47  SubclassData32 = Line;
48  SubclassData16 = Column;
49 
50  setImplicitCode(ImplicitCode);
51 }
52 
53 static void adjustColumn(unsigned &Column) {
54  // Set to unknown on overflow. We only have 16 bits to play with here.
55  if (Column >= (1u << 16))
56  Column = 0;
57 }
58 
60  unsigned Column, Metadata *Scope,
61  Metadata *InlinedAt, bool ImplicitCode,
62  StorageType Storage, bool ShouldCreate) {
63  // Fixup column.
65 
66  if (Storage == Uniqued) {
67  if (auto *N = getUniqued(Context.pImpl->DILocations,
68  DILocationInfo::KeyTy(Line, Column, Scope,
70  return N;
71  if (!ShouldCreate)
72  return nullptr;
73  } else {
74  assert(ShouldCreate && "Expected non-uniqued nodes to always be created");
75  }
76 
78  Ops.push_back(Scope);
79  if (InlinedAt)
80  Ops.push_back(InlinedAt);
81  return storeImpl(new (Ops.size(), Storage) DILocation(
82  Context, Storage, Line, Column, Ops, ImplicitCode),
83  Storage, Context.pImpl->DILocations);
84 }
85 
86 const DILocation *
88  if (Locs.empty())
89  return nullptr;
90  if (Locs.size() == 1)
91  return Locs[0];
92  auto *Merged = Locs[0];
93  for (const DILocation *L : llvm::drop_begin(Locs)) {
94  Merged = getMergedLocation(Merged, L);
95  if (Merged == nullptr)
96  break;
97  }
98  return Merged;
99 }
100 
102  const DILocation *LocB) {
103  if (!LocA || !LocB)
104  return nullptr;
105 
106  if (LocA == LocB)
107  return LocA;
108 
110  DIScope *S = LocA->getScope();
111  DILocation *L = LocA->getInlinedAt();
112  while (S) {
113  Locations.insert(std::make_pair(S, L));
114  S = S->getScope();
115  if (!S && L) {
116  S = L->getScope();
117  L = L->getInlinedAt();
118  }
119  }
120  S = LocB->getScope();
121  L = LocB->getInlinedAt();
122  while (S) {
123  if (Locations.count(std::make_pair(S, L)))
124  break;
125  S = S->getScope();
126  if (!S && L) {
127  S = L->getScope();
128  L = L->getInlinedAt();
129  }
130  }
131 
132  // If the two locations are irreconsilable, just pick one. This is misleading,
133  // but on the other hand, it's a "line 0" location.
134  if (!S || !isa<DILocalScope>(S))
135  S = LocA->getScope();
136  return DILocation::get(LocA->getContext(), 0, 0, S, L);
137 }
138 
140  unsigned CI) {
141  std::array<unsigned, 3> Components = {BD, DF, CI};
142  uint64_t RemainingWork = 0U;
143  // We use RemainingWork to figure out if we have no remaining components to
144  // encode. For example: if BD != 0 but DF == 0 && CI == 0, we don't need to
145  // encode anything for the latter 2.
146  // Since any of the input components is at most 32 bits, their sum will be
147  // less than 34 bits, and thus RemainingWork won't overflow.
148  RemainingWork =
149  std::accumulate(Components.begin(), Components.end(), RemainingWork);
150 
151  int I = 0;
152  unsigned Ret = 0;
153  unsigned NextBitInsertionIndex = 0;
154  while (RemainingWork > 0) {
155  unsigned C = Components[I++];
156  RemainingWork -= C;
157  unsigned EC = encodeComponent(C);
158  Ret |= (EC << NextBitInsertionIndex);
159  NextBitInsertionIndex += encodingBits(C);
160  }
161 
162  // Encoding may be unsuccessful because of overflow. We determine success by
163  // checking equivalence of components before & after encoding. Alternatively,
164  // we could determine Success during encoding, but the current alternative is
165  // simpler.
166  unsigned TBD, TDF, TCI = 0;
167  decodeDiscriminator(Ret, TBD, TDF, TCI);
168  if (TBD == BD && TDF == DF && TCI == CI)
169  return Ret;
170  return None;
171 }
172 
173 void DILocation::decodeDiscriminator(unsigned D, unsigned &BD, unsigned &DF,
174  unsigned &CI) {
179 }
181 
184 #define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME)
185 #include "llvm/IR/DebugInfoFlags.def"
186  .Default(DINode::FlagZero);
187 }
188 
190  switch (Flag) {
191 #define HANDLE_DI_FLAG(ID, NAME) \
192  case Flag##NAME: \
193  return "DIFlag" #NAME;
194 #include "llvm/IR/DebugInfoFlags.def"
195  }
196  return "";
197 }
198 
200  SmallVectorImpl<DIFlags> &SplitFlags) {
201  // Flags that are packed together need to be specially handled, so
202  // that, for example, we emit "DIFlagPublic" and not
203  // "DIFlagPrivate | DIFlagProtected".
204  if (DIFlags A = Flags & FlagAccessibility) {
205  if (A == FlagPrivate)
206  SplitFlags.push_back(FlagPrivate);
207  else if (A == FlagProtected)
208  SplitFlags.push_back(FlagProtected);
209  else
210  SplitFlags.push_back(FlagPublic);
211  Flags &= ~A;
212  }
213  if (DIFlags R = Flags & FlagPtrToMemberRep) {
214  if (R == FlagSingleInheritance)
215  SplitFlags.push_back(FlagSingleInheritance);
216  else if (R == FlagMultipleInheritance)
217  SplitFlags.push_back(FlagMultipleInheritance);
218  else
219  SplitFlags.push_back(FlagVirtualInheritance);
220  Flags &= ~R;
221  }
222  if ((Flags & FlagIndirectVirtualBase) == FlagIndirectVirtualBase) {
223  Flags &= ~FlagIndirectVirtualBase;
224  SplitFlags.push_back(FlagIndirectVirtualBase);
225  }
226 
227 #define HANDLE_DI_FLAG(ID, NAME) \
228  if (DIFlags Bit = Flags & Flag##NAME) { \
229  SplitFlags.push_back(Bit); \
230  Flags &= ~Bit; \
231  }
232 #include "llvm/IR/DebugInfoFlags.def"
233  return Flags;
234 }
235 
237  if (auto *T = dyn_cast<DIType>(this))
238  return T->getScope();
239 
240  if (auto *SP = dyn_cast<DISubprogram>(this))
241  return SP->getScope();
242 
243  if (auto *LB = dyn_cast<DILexicalBlockBase>(this))
244  return LB->getScope();
245 
246  if (auto *NS = dyn_cast<DINamespace>(this))
247  return NS->getScope();
248 
249  if (auto *CB = dyn_cast<DICommonBlock>(this))
250  return CB->getScope();
251 
252  if (auto *M = dyn_cast<DIModule>(this))
253  return M->getScope();
254 
255  assert((isa<DIFile>(this) || isa<DICompileUnit>(this)) &&
256  "Unhandled type of scope.");
257  return nullptr;
258 }
259 
261  if (auto *T = dyn_cast<DIType>(this))
262  return T->getName();
263  if (auto *SP = dyn_cast<DISubprogram>(this))
264  return SP->getName();
265  if (auto *NS = dyn_cast<DINamespace>(this))
266  return NS->getName();
267  if (auto *CB = dyn_cast<DICommonBlock>(this))
268  return CB->getName();
269  if (auto *M = dyn_cast<DIModule>(this))
270  return M->getName();
271  assert((isa<DILexicalBlockBase>(this) || isa<DIFile>(this) ||
272  isa<DICompileUnit>(this)) &&
273  "Unhandled type of scope.");
274  return "";
275 }
276 
277 #ifndef NDEBUG
278 static bool isCanonical(const MDString *S) {
279  return !S || !S->getString().empty();
280 }
281 #endif
282 
284 GenericDINode *GenericDINode::getImpl(LLVMContext &Context, unsigned Tag,
285  MDString *Header,
286  ArrayRef<Metadata *> DwarfOps,
287  StorageType Storage, bool ShouldCreate) {
288  unsigned Hash = 0;
289  if (Storage == Uniqued) {
290  GenericDINodeInfo::KeyTy Key(Tag, Header, DwarfOps);
291  if (auto *N = getUniqued(Context.pImpl->GenericDINodes, Key))
292  return N;
293  if (!ShouldCreate)
294  return nullptr;
295  Hash = Key.getHash();
296  } else {
297  assert(ShouldCreate && "Expected non-uniqued nodes to always be created");
298  }
299 
300  // Use a nullptr for empty headers.
301  assert(isCanonical(Header) && "Expected canonical MDString");
302  Metadata *PreOps[] = {Header};
303  return storeImpl(new (DwarfOps.size() + 1, Storage) GenericDINode(
304  Context, Storage, Hash, Tag, PreOps, DwarfOps),
305  Storage, Context.pImpl->GenericDINodes);
306 }
307 
308 void GenericDINode::recalculateHash() {
309  setHash(GenericDINodeInfo::KeyTy::calculateHash(this));
310 }
311 
312 #define UNWRAP_ARGS_IMPL(...) __VA_ARGS__
313 #define UNWRAP_ARGS(ARGS) UNWRAP_ARGS_IMPL ARGS
314 #define DEFINE_GETIMPL_LOOKUP(CLASS, ARGS) \
315  do { \
316  if (Storage == Uniqued) { \
317  if (auto *N = getUniqued(Context.pImpl->CLASS##s, \
318  CLASS##Info::KeyTy(UNWRAP_ARGS(ARGS)))) \
319  return N; \
320  if (!ShouldCreate) \
321  return nullptr; \
322  } else { \
323  assert(ShouldCreate && \
324  "Expected non-uniqued nodes to always be created"); \
325  } \
326  } while (false)
327 #define DEFINE_GETIMPL_STORE(CLASS, ARGS, OPS) \
328  return storeImpl(new (std::size(OPS), Storage) \
329  CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS), \
330  Storage, Context.pImpl->CLASS##s)
331 #define DEFINE_GETIMPL_STORE_NO_OPS(CLASS, ARGS) \
332  return storeImpl(new (0u, Storage) \
333  CLASS(Context, Storage, UNWRAP_ARGS(ARGS)), \
334  Storage, Context.pImpl->CLASS##s)
335 #define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS) \
336  return storeImpl(new (std::size(OPS), Storage) CLASS(Context, Storage, OPS), \
337  Storage, Context.pImpl->CLASS##s)
338 #define DEFINE_GETIMPL_STORE_N(CLASS, ARGS, OPS, NUM_OPS) \
339  return storeImpl(new (NUM_OPS, Storage) \
340  CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS), \
341  Storage, Context.pImpl->CLASS##s)
342 
343 DISubrange::DISubrange(LLVMContext &C, StorageType Storage,
345  : DINode(C, DISubrangeKind, Storage, dwarf::DW_TAG_subrange_type, Ops) {}
346 DISubrange *DISubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo,
347  StorageType Storage, bool ShouldCreate) {
349  ConstantInt::getSigned(Type::getInt64Ty(Context), Count));
350  auto *LB = ConstantAsMetadata::get(
352  return getImpl(Context, CountNode, LB, nullptr, nullptr, Storage,
353  ShouldCreate);
354 }
355 
356 DISubrange *DISubrange::getImpl(LLVMContext &Context, Metadata *CountNode,
357  int64_t Lo, StorageType Storage,
358  bool ShouldCreate) {
359  auto *LB = ConstantAsMetadata::get(
361  return getImpl(Context, CountNode, LB, nullptr, nullptr, Storage,
362  ShouldCreate);
363 }
364 
365 DISubrange *DISubrange::getImpl(LLVMContext &Context, Metadata *CountNode,
366  Metadata *LB, Metadata *UB, Metadata *Stride,
367  StorageType Storage, bool ShouldCreate) {
368  DEFINE_GETIMPL_LOOKUP(DISubrange, (CountNode, LB, UB, Stride));
369  Metadata *Ops[] = {CountNode, LB, UB, Stride};
371 }
372 
373 DISubrange::BoundType DISubrange::getCount() const {
374  Metadata *CB = getRawCountNode();
375  if (!CB)
376  return BoundType();
377 
378  assert((isa<ConstantAsMetadata>(CB) || isa<DIVariable>(CB) ||
379  isa<DIExpression>(CB)) &&
380  "Count must be signed constant or DIVariable or DIExpression");
381 
382  if (auto *MD = dyn_cast<ConstantAsMetadata>(CB))
383  return BoundType(cast<ConstantInt>(MD->getValue()));
384 
385  if (auto *MD = dyn_cast<DIVariable>(CB))
386  return BoundType(MD);
387 
388  if (auto *MD = dyn_cast<DIExpression>(CB))
389  return BoundType(MD);
390 
391  return BoundType();
392 }
393 
394 DISubrange::BoundType DISubrange::getLowerBound() const {
395  Metadata *LB = getRawLowerBound();
396  if (!LB)
397  return BoundType();
398 
399  assert((isa<ConstantAsMetadata>(LB) || isa<DIVariable>(LB) ||
400  isa<DIExpression>(LB)) &&
401  "LowerBound must be signed constant or DIVariable or DIExpression");
402 
403  if (auto *MD = dyn_cast<ConstantAsMetadata>(LB))
404  return BoundType(cast<ConstantInt>(MD->getValue()));
405 
406  if (auto *MD = dyn_cast<DIVariable>(LB))
407  return BoundType(MD);
408 
409  if (auto *MD = dyn_cast<DIExpression>(LB))
410  return BoundType(MD);
411 
412  return BoundType();
413 }
414 
415 DISubrange::BoundType DISubrange::getUpperBound() const {
416  Metadata *UB = getRawUpperBound();
417  if (!UB)
418  return BoundType();
419 
420  assert((isa<ConstantAsMetadata>(UB) || isa<DIVariable>(UB) ||
421  isa<DIExpression>(UB)) &&
422  "UpperBound must be signed constant or DIVariable or DIExpression");
423 
424  if (auto *MD = dyn_cast<ConstantAsMetadata>(UB))
425  return BoundType(cast<ConstantInt>(MD->getValue()));
426 
427  if (auto *MD = dyn_cast<DIVariable>(UB))
428  return BoundType(MD);
429 
430  if (auto *MD = dyn_cast<DIExpression>(UB))
431  return BoundType(MD);
432 
433  return BoundType();
434 }
435 
436 DISubrange::BoundType DISubrange::getStride() const {
437  Metadata *ST = getRawStride();
438  if (!ST)
439  return BoundType();
440 
441  assert((isa<ConstantAsMetadata>(ST) || isa<DIVariable>(ST) ||
442  isa<DIExpression>(ST)) &&
443  "Stride must be signed constant or DIVariable or DIExpression");
444 
445  if (auto *MD = dyn_cast<ConstantAsMetadata>(ST))
446  return BoundType(cast<ConstantInt>(MD->getValue()));
447 
448  if (auto *MD = dyn_cast<DIVariable>(ST))
449  return BoundType(MD);
450 
451  if (auto *MD = dyn_cast<DIExpression>(ST))
452  return BoundType(MD);
453 
454  return BoundType();
455 }
456 DIGenericSubrange::DIGenericSubrange(LLVMContext &C, StorageType Storage,
458  : DINode(C, DIGenericSubrangeKind, Storage, dwarf::DW_TAG_generic_subrange,
459  Ops) {}
460 
461 DIGenericSubrange *DIGenericSubrange::getImpl(LLVMContext &Context,
462  Metadata *CountNode, Metadata *LB,
463  Metadata *UB, Metadata *Stride,
464  StorageType Storage,
465  bool ShouldCreate) {
466  DEFINE_GETIMPL_LOOKUP(DIGenericSubrange, (CountNode, LB, UB, Stride));
467  Metadata *Ops[] = {CountNode, LB, UB, Stride};
469 }
470 
472  Metadata *CB = getRawCountNode();
473  if (!CB)
474  return BoundType();
475 
476  assert((isa<DIVariable>(CB) || isa<DIExpression>(CB)) &&
477  "Count must be signed constant or DIVariable or DIExpression");
478 
479  if (auto *MD = dyn_cast<DIVariable>(CB))
480  return BoundType(MD);
481 
482  if (auto *MD = dyn_cast<DIExpression>(CB))
483  return BoundType(MD);
484 
485  return BoundType();
486 }
487 
489  Metadata *LB = getRawLowerBound();
490  if (!LB)
491  return BoundType();
492 
493  assert((isa<DIVariable>(LB) || isa<DIExpression>(LB)) &&
494  "LowerBound must be signed constant or DIVariable or DIExpression");
495 
496  if (auto *MD = dyn_cast<DIVariable>(LB))
497  return BoundType(MD);
498 
499  if (auto *MD = dyn_cast<DIExpression>(LB))
500  return BoundType(MD);
501 
502  return BoundType();
503 }
504 
506  Metadata *UB = getRawUpperBound();
507  if (!UB)
508  return BoundType();
509 
510  assert((isa<DIVariable>(UB) || isa<DIExpression>(UB)) &&
511  "UpperBound must be signed constant or DIVariable or DIExpression");
512 
513  if (auto *MD = dyn_cast<DIVariable>(UB))
514  return BoundType(MD);
515 
516  if (auto *MD = dyn_cast<DIExpression>(UB))
517  return BoundType(MD);
518 
519  return BoundType();
520 }
521 
523  Metadata *ST = getRawStride();
524  if (!ST)
525  return BoundType();
526 
527  assert((isa<DIVariable>(ST) || isa<DIExpression>(ST)) &&
528  "Stride must be signed constant or DIVariable or DIExpression");
529 
530  if (auto *MD = dyn_cast<DIVariable>(ST))
531  return BoundType(MD);
532 
533  if (auto *MD = dyn_cast<DIExpression>(ST))
534  return BoundType(MD);
535 
536  return BoundType();
537 }
538 
539 DIEnumerator::DIEnumerator(LLVMContext &C, StorageType Storage,
540  const APInt &Value, bool IsUnsigned,
542  : DINode(C, DIEnumeratorKind, Storage, dwarf::DW_TAG_enumerator, Ops),
543  Value(Value) {
544  SubclassData32 = IsUnsigned;
545 }
546 DIEnumerator *DIEnumerator::getImpl(LLVMContext &Context, const APInt &Value,
547  bool IsUnsigned, MDString *Name,
548  StorageType Storage, bool ShouldCreate) {
549  assert(isCanonical(Name) && "Expected canonical MDString");
551  Metadata *Ops[] = {Name};
553 }
554 
555 DIBasicType *DIBasicType::getImpl(LLVMContext &Context, unsigned Tag,
556  MDString *Name, uint64_t SizeInBits,
557  uint32_t AlignInBits, unsigned Encoding,
558  DIFlags Flags, StorageType Storage,
559  bool ShouldCreate) {
560  assert(isCanonical(Name) && "Expected canonical MDString");
562  (Tag, Name, SizeInBits, AlignInBits, Encoding, Flags));
563  Metadata *Ops[] = {nullptr, nullptr, Name};
565  (Tag, SizeInBits, AlignInBits, Encoding, Flags), Ops);
566 }
567 
569  switch (getEncoding()) {
570  case dwarf::DW_ATE_signed:
571  case dwarf::DW_ATE_signed_char:
572  return Signedness::Signed;
573  case dwarf::DW_ATE_unsigned:
574  case dwarf::DW_ATE_unsigned_char:
575  return Signedness::Unsigned;
576  default:
577  return None;
578  }
579 }
580 
581 DIStringType *DIStringType::getImpl(LLVMContext &Context, unsigned Tag,
582  MDString *Name, Metadata *StringLength,
583  Metadata *StringLengthExp,
584  Metadata *StringLocationExp,
585  uint64_t SizeInBits, uint32_t AlignInBits,
586  unsigned Encoding, StorageType Storage,
587  bool ShouldCreate) {
588  assert(isCanonical(Name) && "Expected canonical MDString");
592  Metadata *Ops[] = {nullptr, nullptr, Name,
595  Ops);
596 }
597 DIType *DIDerivedType::getClassType() const {
598  assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
599  return cast_or_null<DIType>(getExtraData());
600 }
602  assert(getTag() == dwarf::DW_TAG_inheritance);
603  if (auto *CM = cast_or_null<ConstantAsMetadata>(getExtraData()))
604  if (auto *CI = dyn_cast_or_null<ConstantInt>(CM->getValue()))
605  return static_cast<uint32_t>(CI->getZExtValue());
606  return 0;
607 }
609  assert(getTag() == dwarf::DW_TAG_member && isBitField());
610  if (auto *C = cast_or_null<ConstantAsMetadata>(getExtraData()))
611  return C->getValue();
612  return nullptr;
613 }
614 
616  assert(getTag() == dwarf::DW_TAG_member && isStaticMember());
617  if (auto *C = cast_or_null<ConstantAsMetadata>(getExtraData()))
618  return C->getValue();
619  return nullptr;
620 }
622  assert(getTag() == dwarf::DW_TAG_member && !isStaticMember());
623  if (auto *C = cast_or_null<ConstantAsMetadata>(getExtraData()))
624  return C->getValue();
625  return nullptr;
626 }
627 
628 DIDerivedType *DIDerivedType::getImpl(
629  LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
630  unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
631  uint32_t AlignInBits, uint64_t OffsetInBits,
632  Optional<unsigned> DWARFAddressSpace, DIFlags Flags, Metadata *ExtraData,
633  Metadata *Annotations, StorageType Storage, bool ShouldCreate) {
634  assert(isCanonical(Name) && "Expected canonical MDString");
637  AlignInBits, OffsetInBits, DWARFAddressSpace, Flags,
642  DWARFAddressSpace, Flags),
643  Ops);
644 }
645 
646 DICompositeType *DICompositeType::getImpl(
647  LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
648  unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
649  uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags,
650  Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder,
651  Metadata *TemplateParams, MDString *Identifier, Metadata *Discriminator,
652  Metadata *DataLocation, Metadata *Associated, Metadata *Allocated,
653  Metadata *Rank, Metadata *Annotations, StorageType Storage,
654  bool ShouldCreate) {
655  assert(isCanonical(Name) && "Expected canonical MDString");
656 
657  // Keep this in sync with buildODRType.
661  RuntimeLang, VTableHolder, TemplateParams, Identifier,
663  Rank, Annotations));
664  Metadata *Ops[] = {File, Scope, Name, BaseType,
667  Rank, Annotations};
670  (Tag, Line, RuntimeLang, SizeInBits, AlignInBits, OffsetInBits, Flags),
671  Ops);
672 }
673 
675  LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name,
676  Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType,
677  uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
678  DIFlags Flags, Metadata *Elements, unsigned RuntimeLang,
679  Metadata *VTableHolder, Metadata *TemplateParams, Metadata *Discriminator,
680  Metadata *DataLocation, Metadata *Associated, Metadata *Allocated,
681  Metadata *Rank, Metadata *Annotations) {
682  assert(!Identifier.getString().empty() && "Expected valid identifier");
684  return nullptr;
685  auto *&CT = (*Context.pImpl->DITypeMap)[&Identifier];
686  if (!CT)
687  return CT = DICompositeType::getDistinct(
689  AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
692 
693  if (CT->getTag() != Tag)
694  return nullptr;
695 
696  // Only mutate CT if it's a forward declaration and the new operands aren't.
697  assert(CT->getRawIdentifier() == &Identifier && "Wrong ODR identifier?");
698  if (!CT->isForwardDecl() || (Flags & DINode::FlagFwdDecl))
699  return CT;
700 
701  // Mutate CT in place. Keep this in sync with getImpl.
702  CT->mutate(Tag, Line, RuntimeLang, SizeInBits, AlignInBits, OffsetInBits,
703  Flags);
704  Metadata *Ops[] = {File, Scope, Name, BaseType,
707  Rank, Annotations};
708  assert((std::end(Ops) - std::begin(Ops)) == (int)CT->getNumOperands() &&
709  "Mismatched number of operands");
710  for (unsigned I = 0, E = CT->getNumOperands(); I != E; ++I)
711  if (Ops[I] != CT->getOperand(I))
712  CT->setOperand(I, Ops[I]);
713  return CT;
714 }
715 
716 DICompositeType *DICompositeType::getODRType(
717  LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name,
718  Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType,
719  uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
720  DIFlags Flags, Metadata *Elements, unsigned RuntimeLang,
721  Metadata *VTableHolder, Metadata *TemplateParams, Metadata *Discriminator,
722  Metadata *DataLocation, Metadata *Associated, Metadata *Allocated,
723  Metadata *Rank, Metadata *Annotations) {
724  assert(!Identifier.getString().empty() && "Expected valid identifier");
726  return nullptr;
727  auto *&CT = (*Context.pImpl->DITypeMap)[&Identifier];
728  if (!CT) {
730  Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
734  } else {
735  if (CT->getTag() != Tag)
736  return nullptr;
737  }
738  return CT;
739 }
740 
742  MDString &Identifier) {
743  assert(!Identifier.getString().empty() && "Expected valid identifier");
745  return nullptr;
746  return Context.pImpl->DITypeMap->lookup(&Identifier);
747 }
748 DISubroutineType::DISubroutineType(LLVMContext &C, StorageType Storage,
749  DIFlags Flags, uint8_t CC,
751  : DIType(C, DISubroutineTypeKind, Storage, dwarf::DW_TAG_subroutine_type, 0,
752  0, 0, 0, Flags, Ops),
753  CC(CC) {}
754 
755 DISubroutineType *DISubroutineType::getImpl(LLVMContext &Context, DIFlags Flags,
756  uint8_t CC, Metadata *TypeArray,
757  StorageType Storage,
758  bool ShouldCreate) {
760  Metadata *Ops[] = {nullptr, nullptr, nullptr, TypeArray};
762 }
763 
764 DIFile::DIFile(LLVMContext &C, StorageType Storage,
765  Optional<ChecksumInfo<MDString *>> CS, Optional<MDString *> Src,
767  : DIScope(C, DIFileKind, Storage, dwarf::DW_TAG_file_type, Ops),
768  Checksum(CS), Source(Src) {}
769 
770 // FIXME: Implement this string-enum correspondence with a .def file and macros,
771 // so that the association is explicit rather than implied.
772 static const char *ChecksumKindName[DIFile::CSK_Last] = {
773  "CSK_MD5",
774  "CSK_SHA1",
775  "CSK_SHA256",
776 };
777 
778 StringRef DIFile::getChecksumKindAsString(ChecksumKind CSKind) {
779  assert(CSKind <= DIFile::CSK_Last && "Invalid checksum kind");
780  // The first space was originally the CSK_None variant, which is now
781  // obsolete, but the space is still reserved in ChecksumKind, so we account
782  // for it here.
783  return ChecksumKindName[CSKind - 1];
784 }
785 
788  .Case("CSK_MD5", DIFile::CSK_MD5)
789  .Case("CSK_SHA1", DIFile::CSK_SHA1)
790  .Case("CSK_SHA256", DIFile::CSK_SHA256)
791  .Default(None);
792 }
793 
794 DIFile *DIFile::getImpl(LLVMContext &Context, MDString *Filename,
795  MDString *Directory,
797  Optional<MDString *> Source, StorageType Storage,
798  bool ShouldCreate) {
799  assert(isCanonical(Filename) && "Expected canonical MDString");
800  assert(isCanonical(Directory) && "Expected canonical MDString");
801  assert((!CS || isCanonical(CS->Value)) && "Expected canonical MDString");
802  assert((!Source || isCanonical(*Source)) && "Expected canonical MDString");
804  Metadata *Ops[] = {Filename, Directory, CS ? CS->Value : nullptr,
805  Source.value_or(nullptr)};
806  DEFINE_GETIMPL_STORE(DIFile, (CS, Source), Ops);
807 }
808 DICompileUnit::DICompileUnit(LLVMContext &C, StorageType Storage,
809  unsigned SourceLanguage, bool IsOptimized,
810  unsigned RuntimeVersion, unsigned EmissionKind,
811  uint64_t DWOId, bool SplitDebugInlining,
812  bool DebugInfoForProfiling, unsigned NameTableKind,
813  bool RangesBaseAddress, ArrayRef<Metadata *> Ops)
814  : DIScope(C, DICompileUnitKind, Storage, dwarf::DW_TAG_compile_unit, Ops),
815  SourceLanguage(SourceLanguage), IsOptimized(IsOptimized),
816  RuntimeVersion(RuntimeVersion), EmissionKind(EmissionKind), DWOId(DWOId),
817  SplitDebugInlining(SplitDebugInlining),
818  DebugInfoForProfiling(DebugInfoForProfiling),
819  NameTableKind(NameTableKind), RangesBaseAddress(RangesBaseAddress) {
820  assert(Storage != Uniqued);
821 }
822 
823 DICompileUnit *DICompileUnit::getImpl(
824  LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
825  MDString *Producer, bool IsOptimized, MDString *Flags,
826  unsigned RuntimeVersion, MDString *SplitDebugFilename,
827  unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes,
828  Metadata *GlobalVariables, Metadata *ImportedEntities, Metadata *Macros,
829  uint64_t DWOId, bool SplitDebugInlining, bool DebugInfoForProfiling,
830  unsigned NameTableKind, bool RangesBaseAddress, MDString *SysRoot,
831  MDString *SDK, StorageType Storage, bool ShouldCreate) {
832  assert(Storage != Uniqued && "Cannot unique DICompileUnit");
833  assert(isCanonical(Producer) && "Expected canonical MDString");
834  assert(isCanonical(Flags) && "Expected canonical MDString");
835  assert(isCanonical(SplitDebugFilename) && "Expected canonical MDString");
836 
837  Metadata *Ops[] = {File,
838  Producer,
839  Flags,
841  EnumTypes,
845  Macros,
846  SysRoot,
847  SDK};
848  return storeImpl(new (std::size(Ops), Storage) DICompileUnit(
849  Context, Storage, SourceLanguage, IsOptimized,
850  RuntimeVersion, EmissionKind, DWOId, SplitDebugInlining,
851  DebugInfoForProfiling, NameTableKind, RangesBaseAddress,
852  Ops),
853  Storage);
854 }
855 
859  .Case("NoDebug", NoDebug)
860  .Case("FullDebug", FullDebug)
861  .Case("LineTablesOnly", LineTablesOnly)
862  .Case("DebugDirectivesOnly", DebugDirectivesOnly)
863  .Default(None);
864 }
865 
869  .Case("Default", DebugNameTableKind::Default)
872  .Default(None);
873 }
874 
876  switch (EK) {
877  case NoDebug:
878  return "NoDebug";
879  case FullDebug:
880  return "FullDebug";
881  case LineTablesOnly:
882  return "LineTablesOnly";
883  case DebugDirectivesOnly:
884  return "DebugDirectivesOnly";
885  }
886  return nullptr;
887 }
888 
890  switch (NTK) {
892  return nullptr;
894  return "GNU";
896  return "None";
897  }
898  return nullptr;
899 }
900 DISubprogram::DISubprogram(LLVMContext &C, StorageType Storage, unsigned Line,
901  unsigned ScopeLine, unsigned VirtualIndex,
902  int ThisAdjustment, DIFlags Flags, DISPFlags SPFlags,
904  : DILocalScope(C, DISubprogramKind, Storage, dwarf::DW_TAG_subprogram, Ops),
905  Line(Line), ScopeLine(ScopeLine), VirtualIndex(VirtualIndex),
906  ThisAdjustment(ThisAdjustment), Flags(Flags), SPFlags(SPFlags) {
907  static_assert(dwarf::DW_VIRTUALITY_max < 4, "Virtuality out of range");
908 }
910 DISubprogram::toSPFlags(bool IsLocalToUnit, bool IsDefinition, bool IsOptimized,
911  unsigned Virtuality, bool IsMainSubprogram) {
912  // We're assuming virtuality is the low-order field.
913  static_assert(int(SPFlagVirtual) == int(dwarf::DW_VIRTUALITY_virtual) &&
914  int(SPFlagPureVirtual) ==
915  int(dwarf::DW_VIRTUALITY_pure_virtual),
916  "Virtuality constant mismatch");
917  return static_cast<DISPFlags>(
918  (Virtuality & SPFlagVirtuality) |
919  (IsLocalToUnit ? SPFlagLocalToUnit : SPFlagZero) |
920  (IsDefinition ? SPFlagDefinition : SPFlagZero) |
921  (IsOptimized ? SPFlagOptimized : SPFlagZero) |
922  (IsMainSubprogram ? SPFlagMainSubprogram : SPFlagZero));
923 }
924 
926  if (auto *Block = dyn_cast<DILexicalBlockBase>(this))
927  return Block->getScope()->getSubprogram();
928  return const_cast<DISubprogram *>(cast<DISubprogram>(this));
929 }
930 
932  if (auto *File = dyn_cast<DILexicalBlockFile>(this))
933  return File->getScope()->getNonLexicalBlockFileScope();
934  return const_cast<DILocalScope *>(this);
935 }
936 
939 #define HANDLE_DISP_FLAG(ID, NAME) .Case("DISPFlag" #NAME, SPFlag##NAME)
940 #include "llvm/IR/DebugInfoFlags.def"
941  .Default(SPFlagZero);
942 }
943 
945  switch (Flag) {
946  // Appease a warning.
947  case SPFlagVirtuality:
948  return "";
949 #define HANDLE_DISP_FLAG(ID, NAME) \
950  case SPFlag##NAME: \
951  return "DISPFlag" #NAME;
952 #include "llvm/IR/DebugInfoFlags.def"
953  }
954  return "";
955 }
956 
959  SmallVectorImpl<DISPFlags> &SplitFlags) {
960  // Multi-bit fields can require special handling. In our case, however, the
961  // only multi-bit field is virtuality, and all its values happen to be
962  // single-bit values, so the right behavior just falls out.
963 #define HANDLE_DISP_FLAG(ID, NAME) \
964  if (DISPFlags Bit = Flags & SPFlag##NAME) { \
965  SplitFlags.push_back(Bit); \
966  Flags &= ~Bit; \
967  }
968 #include "llvm/IR/DebugInfoFlags.def"
969  return Flags;
970 }
971 
972 DISubprogram *DISubprogram::getImpl(
974  MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
975  unsigned ScopeLine, Metadata *ContainingType, unsigned VirtualIndex,
976  int ThisAdjustment, DIFlags Flags, DISPFlags SPFlags, Metadata *Unit,
977  Metadata *TemplateParams, Metadata *Declaration, Metadata *RetainedNodes,
978  Metadata *ThrownTypes, Metadata *Annotations, MDString *TargetFuncName,
979  StorageType Storage, bool ShouldCreate) {
980  assert(isCanonical(Name) && "Expected canonical MDString");
981  assert(isCanonical(LinkageName) && "Expected canonical MDString");
982  assert(isCanonical(TargetFuncName) && "Expected canonical MDString");
984  (Scope, Name, LinkageName, File, Line, Type, ScopeLine,
985  ContainingType, VirtualIndex, ThisAdjustment, Flags,
986  SPFlags, Unit, TemplateParams, Declaration,
988  TargetFuncName));
994  if (!TargetFuncName) {
995  Ops.pop_back();
996  if (!Annotations) {
997  Ops.pop_back();
998  if (!ThrownTypes) {
999  Ops.pop_back();
1000  if (!TemplateParams) {
1001  Ops.pop_back();
1002  if (!ContainingType)
1003  Ops.pop_back();
1004  }
1005  }
1006  }
1007  }
1009  DISubprogram,
1010  (Line, ScopeLine, VirtualIndex, ThisAdjustment, Flags, SPFlags), Ops,
1011  Ops.size());
1012 }
1013 
1014 bool DISubprogram::describes(const Function *F) const {
1015  assert(F && "Invalid function");
1016  return F->getSubprogram() == this;
1017 }
1019  StorageType Storage,
1021  : DILocalScope(C, ID, Storage, dwarf::DW_TAG_lexical_block, Ops) {}
1022 
1023 DILexicalBlock *DILexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope,
1024  Metadata *File, unsigned Line,
1025  unsigned Column, StorageType Storage,
1026  bool ShouldCreate) {
1027  // Fixup column.
1028  adjustColumn(Column);
1029 
1030  assert(Scope && "Expected scope");
1031  DEFINE_GETIMPL_LOOKUP(DILexicalBlock, (Scope, File, Line, Column));
1032  Metadata *Ops[] = {File, Scope};
1033  DEFINE_GETIMPL_STORE(DILexicalBlock, (Line, Column), Ops);
1034 }
1035 
1036 DILexicalBlockFile *DILexicalBlockFile::getImpl(LLVMContext &Context,
1037  Metadata *Scope, Metadata *File,
1038  unsigned Discriminator,
1039  StorageType Storage,
1040  bool ShouldCreate) {
1041  assert(Scope && "Expected scope");
1042  DEFINE_GETIMPL_LOOKUP(DILexicalBlockFile, (Scope, File, Discriminator));
1043  Metadata *Ops[] = {File, Scope};
1044  DEFINE_GETIMPL_STORE(DILexicalBlockFile, (Discriminator), Ops);
1045 }
1046 
1047 DINamespace::DINamespace(LLVMContext &Context, StorageType Storage,
1048  bool ExportSymbols, ArrayRef<Metadata *> Ops)
1049  : DIScope(Context, DINamespaceKind, Storage, dwarf::DW_TAG_namespace, Ops),
1050  ExportSymbols(ExportSymbols) {}
1051 DINamespace *DINamespace::getImpl(LLVMContext &Context, Metadata *Scope,
1052  MDString *Name, bool ExportSymbols,
1053  StorageType Storage, bool ShouldCreate) {
1054  assert(isCanonical(Name) && "Expected canonical MDString");
1055  DEFINE_GETIMPL_LOOKUP(DINamespace, (Scope, Name, ExportSymbols));
1056  // The nullptr is for DIScope's File operand. This should be refactored.
1057  Metadata *Ops[] = {nullptr, Scope, Name};
1058  DEFINE_GETIMPL_STORE(DINamespace, (ExportSymbols), Ops);
1059 }
1060 
1061 DICommonBlock::DICommonBlock(LLVMContext &Context, StorageType Storage,
1062  unsigned LineNo, ArrayRef<Metadata *> Ops)
1063  : DIScope(Context, DICommonBlockKind, Storage, dwarf::DW_TAG_common_block,
1064  Ops),
1065  LineNo(LineNo) {}
1066 DICommonBlock *DICommonBlock::getImpl(LLVMContext &Context, Metadata *Scope,
1067  Metadata *Decl, MDString *Name,
1068  Metadata *File, unsigned LineNo,
1069  StorageType Storage, bool ShouldCreate) {
1070  assert(isCanonical(Name) && "Expected canonical MDString");
1072  // The nullptr is for DIScope's File operand. This should be refactored.
1073  Metadata *Ops[] = {Scope, Decl, Name, File};
1074  DEFINE_GETIMPL_STORE(DICommonBlock, (LineNo), Ops);
1075 }
1076 
1077 DIModule::DIModule(LLVMContext &Context, StorageType Storage, unsigned LineNo,
1078  bool IsDecl, ArrayRef<Metadata *> Ops)
1079  : DIScope(Context, DIModuleKind, Storage, dwarf::DW_TAG_module, Ops),
1080  LineNo(LineNo), IsDecl(IsDecl) {}
1081 DIModule *DIModule::getImpl(LLVMContext &Context, Metadata *File,
1083  MDString *ConfigurationMacros,
1084  MDString *IncludePath, MDString *APINotesFile,
1085  unsigned LineNo, bool IsDecl, StorageType Storage,
1086  bool ShouldCreate) {
1087  assert(isCanonical(Name) && "Expected canonical MDString");
1089  IncludePath, APINotesFile, LineNo, IsDecl));
1092  DEFINE_GETIMPL_STORE(DIModule, (LineNo, IsDecl), Ops);
1093 }
1094 DITemplateTypeParameter::DITemplateTypeParameter(LLVMContext &Context,
1095  StorageType Storage,
1096  bool IsDefault,
1098  : DITemplateParameter(Context, DITemplateTypeParameterKind, Storage,
1099  dwarf::DW_TAG_template_type_parameter, IsDefault,
1100  Ops) {}
1101 
1103 DITemplateTypeParameter::getImpl(LLVMContext &Context, MDString *Name,
1104  Metadata *Type, bool isDefault,
1105  StorageType Storage, bool ShouldCreate) {
1106  assert(isCanonical(Name) && "Expected canonical MDString");
1108  Metadata *Ops[] = {Name, Type};
1110 }
1111 
1112 DITemplateValueParameter *DITemplateValueParameter::getImpl(
1113  LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type,
1114  bool isDefault, Metadata *Value, StorageType Storage, bool ShouldCreate) {
1115  assert(isCanonical(Name) && "Expected canonical MDString");
1117  (Tag, Name, Type, isDefault, Value));
1118  Metadata *Ops[] = {Name, Type, Value};
1120 }
1121 
1123 DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
1124  MDString *LinkageName, Metadata *File, unsigned Line,
1125  Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
1126  Metadata *StaticDataMemberDeclaration,
1127  Metadata *TemplateParams, uint32_t AlignInBits,
1128  Metadata *Annotations, StorageType Storage,
1129  bool ShouldCreate) {
1130  assert(isCanonical(Name) && "Expected canonical MDString");
1131  assert(isCanonical(LinkageName) && "Expected canonical MDString");
1134  (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition,
1136  Metadata *Ops[] = {Scope,
1137  Name,
1138  File,
1139  Type,
1140  Name,
1141  LinkageName,
1144  Annotations};
1146  (Line, IsLocalToUnit, IsDefinition, AlignInBits), Ops);
1147 }
1148 
1150 DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
1151  Metadata *File, unsigned Line, Metadata *Type,
1152  unsigned Arg, DIFlags Flags, uint32_t AlignInBits,
1153  Metadata *Annotations, StorageType Storage,
1154  bool ShouldCreate) {
1155  // 64K ought to be enough for any frontend.
1156  assert(Arg <= UINT16_MAX && "Expected argument number to fit in 16-bits");
1157 
1158  assert(Scope && "Expected scope");
1159  assert(isCanonical(Name) && "Expected canonical MDString");
1161  Flags, AlignInBits, Annotations));
1162  Metadata *Ops[] = {Scope, Name, File, Type, Annotations};
1163  DEFINE_GETIMPL_STORE(DILocalVariable, (Line, Arg, Flags, AlignInBits), Ops);
1164 }
1165 
1167  signed Line, ArrayRef<Metadata *> Ops,
1168  uint32_t AlignInBits)
1169  : DINode(C, ID, Storage, dwarf::DW_TAG_variable, Ops), Line(Line),
1170  AlignInBits(AlignInBits) {}
1172  // This is used by the Verifier so be mindful of broken types.
1173  const Metadata *RawType = getRawType();
1174  while (RawType) {
1175  // Try to get the size directly.
1176  if (auto *T = dyn_cast<DIType>(RawType))
1177  if (uint64_t Size = T->getSizeInBits())
1178  return Size;
1179 
1180  if (auto *DT = dyn_cast<DIDerivedType>(RawType)) {
1181  // Look at the base type.
1182  RawType = DT->getRawBaseType();
1183  continue;
1184  }
1185 
1186  // Missing type or size.
1187  break;
1188  }
1189 
1190  // Fail gracefully.
1191  return None;
1192 }
1193 
1194 DILabel::DILabel(LLVMContext &C, StorageType Storage, unsigned Line,
1196  : DINode(C, DILabelKind, Storage, dwarf::DW_TAG_label, Ops), Line(Line) {}
1197 DILabel *DILabel::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
1198  Metadata *File, unsigned Line, StorageType Storage,
1199  bool ShouldCreate) {
1200  assert(Scope && "Expected scope");
1201  assert(isCanonical(Name) && "Expected canonical MDString");
1203  Metadata *Ops[] = {Scope, Name, File};
1204  DEFINE_GETIMPL_STORE(DILabel, (Line), Ops);
1205 }
1206 
1207 DIExpression *DIExpression::getImpl(LLVMContext &Context,
1208  ArrayRef<uint64_t> Elements,
1209  StorageType Storage, bool ShouldCreate) {
1210  DEFINE_GETIMPL_LOOKUP(DIExpression, (Elements));
1212 }
1215 }
1217  return getNumElements() > 0 && getElement(0) == dwarf::DW_OP_deref;
1218 }
1219 
1221  uint64_t Op = getOp();
1222 
1223  if (Op >= dwarf::DW_OP_breg0 && Op <= dwarf::DW_OP_breg31)
1224  return 2;
1225 
1226  switch (Op) {
1229  case dwarf::DW_OP_bregx:
1230  return 3;
1231  case dwarf::DW_OP_constu:
1232  case dwarf::DW_OP_consts:
1233  case dwarf::DW_OP_deref_size:
1234  case dwarf::DW_OP_plus_uconst:
1237  case dwarf::DW_OP_LLVM_arg:
1238  case dwarf::DW_OP_regx:
1239  return 2;
1240  default:
1241  return 1;
1242  }
1243 }
1244 
1246  for (auto I = expr_op_begin(), E = expr_op_end(); I != E; ++I) {
1247  // Check that there's space for the operand.
1248  if (I->get() + I->getSize() > E->get())
1249  return false;
1250 
1251  uint64_t Op = I->getOp();
1252  if ((Op >= dwarf::DW_OP_reg0 && Op <= dwarf::DW_OP_reg31) ||
1253  (Op >= dwarf::DW_OP_breg0 && Op <= dwarf::DW_OP_breg31))
1254  return true;
1255 
1256  // Check that the operand is valid.
1257  switch (Op) {
1258  default:
1259  return false;
1261  // A fragment operator must appear at the end.
1262  return I->get() + I->getSize() == E->get();
1263  case dwarf::DW_OP_stack_value: {
1264  // Must be the last one or followed by a DW_OP_LLVM_fragment.
1265  if (I->get() + I->getSize() == E->get())
1266  break;
1267  auto J = I;
1268  if ((++J)->getOp() != dwarf::DW_OP_LLVM_fragment)
1269  return false;
1270  break;
1271  }
1272  case dwarf::DW_OP_swap: {
1273  // Must be more than one implicit element on the stack.
1274 
1275  // FIXME: A better way to implement this would be to add a local variable
1276  // that keeps track of the stack depth and introduce something like a
1277  // DW_LLVM_OP_implicit_location as a placeholder for the location this
1278  // DIExpression is attached to, or else pass the number of implicit stack
1279  // elements into isValid.
1280  if (getNumElements() == 1)
1281  return false;
1282  break;
1283  }
1285  // An entry value operator must appear at the beginning and the number of
1286  // operations it cover can currently only be 1, because we support only
1287  // entry values of a simple register location. One reason for this is that
1288  // we currently can't calculate the size of the resulting DWARF block for
1289  // other expressions.
1290  return I->get() == expr_op_begin()->get() && I->getArg(0) == 1;
1291  }
1294  case dwarf::DW_OP_LLVM_arg:
1296  case dwarf::DW_OP_constu:
1297  case dwarf::DW_OP_plus_uconst:
1298  case dwarf::DW_OP_plus:
1299  case dwarf::DW_OP_minus:
1300  case dwarf::DW_OP_mul:
1301  case dwarf::DW_OP_div:
1302  case dwarf::DW_OP_mod:
1303  case dwarf::DW_OP_or:
1304  case dwarf::DW_OP_and:
1305  case dwarf::DW_OP_xor:
1306  case dwarf::DW_OP_shl:
1307  case dwarf::DW_OP_shr:
1308  case dwarf::DW_OP_shra:
1309  case dwarf::DW_OP_deref:
1310  case dwarf::DW_OP_deref_size:
1311  case dwarf::DW_OP_xderef:
1312  case dwarf::DW_OP_lit0:
1313  case dwarf::DW_OP_not:
1314  case dwarf::DW_OP_dup:
1315  case dwarf::DW_OP_regx:
1316  case dwarf::DW_OP_bregx:
1317  case dwarf::DW_OP_push_object_address:
1318  case dwarf::DW_OP_over:
1319  case dwarf::DW_OP_consts:
1320  break;
1321  }
1322  }
1323  return true;
1324 }
1325 
1327  if (!isValid())
1328  return false;
1329 
1330  if (getNumElements() == 0)
1331  return false;
1332 
1333  for (const auto &It : expr_ops()) {
1334  switch (It.getOp()) {
1335  default:
1336  break;
1337  case dwarf::DW_OP_stack_value:
1339  return true;
1340  }
1341  }
1342 
1343  return false;
1344 }
1345 
1347  if (!isValid())
1348  return false;
1349 
1350  if (getNumElements() == 0)
1351  return false;
1352 
1353  // If there are any elements other than fragment or tag_offset, then some
1354  // kind of complex computation occurs.
1355  for (const auto &It : expr_ops()) {
1356  switch (It.getOp()) {
1359  continue;
1360  default:
1361  return true;
1362  }
1363  }
1364 
1365  return false;
1366 }
1367 
1370  for (auto I = Start; I != End; ++I)
1371  if (I->getOp() == dwarf::DW_OP_LLVM_fragment) {
1372  DIExpression::FragmentInfo Info = {I->getArg(1), I->getArg(0)};
1373  return Info;
1374  }
1375  return None;
1376 }
1377 
1379  int64_t Offset) {
1380  if (Offset > 0) {
1381  Ops.push_back(dwarf::DW_OP_plus_uconst);
1382  Ops.push_back(Offset);
1383  } else if (Offset < 0) {
1384  Ops.push_back(dwarf::DW_OP_constu);
1385  // Avoid UB when encountering LLONG_MIN, because in 2's complement
1386  // abs(LLONG_MIN) is LLONG_MAX+1.
1387  uint64_t AbsMinusOne = -(Offset+1);
1388  Ops.push_back(AbsMinusOne + 1);
1389  Ops.push_back(dwarf::DW_OP_minus);
1390  }
1391 }
1392 
1393 bool DIExpression::extractIfOffset(int64_t &Offset) const {
1394  if (getNumElements() == 0) {
1395  Offset = 0;
1396  return true;
1397  }
1398 
1399  if (getNumElements() == 2 && Elements[0] == dwarf::DW_OP_plus_uconst) {
1400  Offset = Elements[1];
1401  return true;
1402  }
1403 
1404  if (getNumElements() == 3 && Elements[0] == dwarf::DW_OP_constu) {
1405  if (Elements[2] == dwarf::DW_OP_plus) {
1406  Offset = Elements[1];
1407  return true;
1408  }
1409  if (Elements[2] == dwarf::DW_OP_minus) {
1410  Offset = -Elements[1];
1411  return true;
1412  }
1413  }
1414 
1415  return false;
1416 }
1417 
1418 bool DIExpression::hasAllLocationOps(unsigned N) const {
1420  for (auto ExprOp : expr_ops())
1421  if (ExprOp.getOp() == dwarf::DW_OP_LLVM_arg)
1422  SeenOps.insert(ExprOp.getArg(0));
1423  for (uint64_t Idx = 0; Idx < N; ++Idx)
1424  if (!is_contained(SeenOps, Idx))
1425  return false;
1426  return true;
1427 }
1428 
1430  unsigned &AddrClass) {
1431  // FIXME: This seems fragile. Nothing that verifies that these elements
1432  // actually map to ops and not operands.
1433  const unsigned PatternSize = 4;
1434  if (Expr->Elements.size() >= PatternSize &&
1435  Expr->Elements[PatternSize - 4] == dwarf::DW_OP_constu &&
1436  Expr->Elements[PatternSize - 2] == dwarf::DW_OP_swap &&
1437  Expr->Elements[PatternSize - 1] == dwarf::DW_OP_xderef) {
1438  AddrClass = Expr->Elements[PatternSize - 3];
1439 
1440  if (Expr->Elements.size() == PatternSize)
1441  return nullptr;
1442  return DIExpression::get(Expr->getContext(),
1443  makeArrayRef(&*Expr->Elements.begin(),
1444  Expr->Elements.size() - PatternSize));
1445  }
1446  return Expr;
1447 }
1448 
1450  int64_t Offset) {
1452  if (Flags & DIExpression::DerefBefore)
1453  Ops.push_back(dwarf::DW_OP_deref);
1454 
1455  appendOffset(Ops, Offset);
1456  if (Flags & DIExpression::DerefAfter)
1457  Ops.push_back(dwarf::DW_OP_deref);
1458 
1459  bool StackValue = Flags & DIExpression::StackValue;
1460  bool EntryValue = Flags & DIExpression::EntryValue;
1461 
1462  return prependOpcodes(Expr, Ops, StackValue, EntryValue);
1463 }
1464 
1466  ArrayRef<uint64_t> Ops,
1467  unsigned ArgNo, bool StackValue) {
1468  assert(Expr && "Can't add ops to this expression");
1469 
1470  // Handle non-variadic intrinsics by prepending the opcodes.
1471  if (!any_of(Expr->expr_ops(),
1472  [](auto Op) { return Op.getOp() == dwarf::DW_OP_LLVM_arg; })) {
1473  assert(ArgNo == 0 &&
1474  "Location Index must be 0 for a non-variadic expression.");
1475  SmallVector<uint64_t, 8> NewOps(Ops.begin(), Ops.end());
1476  return DIExpression::prependOpcodes(Expr, NewOps, StackValue);
1477  }
1478 
1479  SmallVector<uint64_t, 8> NewOps;
1480  for (auto Op : Expr->expr_ops()) {
1481  Op.appendToVector(NewOps);
1482  if (Op.getOp() == dwarf::DW_OP_LLVM_arg && Op.getArg(0) == ArgNo)
1483  NewOps.insert(NewOps.end(), Ops.begin(), Ops.end());
1484  }
1485 
1486  return DIExpression::get(Expr->getContext(), NewOps);
1487 }
1488 
1490  uint64_t OldArg, uint64_t NewArg) {
1491  assert(Expr && "Can't replace args in this expression");
1492 
1493  SmallVector<uint64_t, 8> NewOps;
1494 
1495  for (auto Op : Expr->expr_ops()) {
1496  if (Op.getOp() != dwarf::DW_OP_LLVM_arg || Op.getArg(0) < OldArg) {
1497  Op.appendToVector(NewOps);
1498  continue;
1499  }
1500  NewOps.push_back(dwarf::DW_OP_LLVM_arg);
1501  uint64_t Arg = Op.getArg(0) == OldArg ? NewArg : Op.getArg(0);
1502  // OldArg has been deleted from the Op list, so decrement all indices
1503  // greater than it.
1504  if (Arg > OldArg)
1505  --Arg;
1506  NewOps.push_back(Arg);
1507  }
1508  return DIExpression::get(Expr->getContext(), NewOps);
1509 }
1510 
1513  bool StackValue, bool EntryValue) {
1514  assert(Expr && "Can't prepend ops to this expression");
1515 
1516  if (EntryValue) {
1517  Ops.push_back(dwarf::DW_OP_LLVM_entry_value);
1518  // Use a block size of 1 for the target register operand. The
1519  // DWARF backend currently cannot emit entry values with a block
1520  // size > 1.
1521  Ops.push_back(1);
1522  }
1523 
1524  // If there are no ops to prepend, do not even add the DW_OP_stack_value.
1525  if (Ops.empty())
1526  StackValue = false;
1527  for (auto Op : Expr->expr_ops()) {
1528  // A DW_OP_stack_value comes at the end, but before a DW_OP_LLVM_fragment.
1529  if (StackValue) {
1530  if (Op.getOp() == dwarf::DW_OP_stack_value)
1531  StackValue = false;
1532  else if (Op.getOp() == dwarf::DW_OP_LLVM_fragment) {
1533  Ops.push_back(dwarf::DW_OP_stack_value);
1534  StackValue = false;
1535  }
1536  }
1537  Op.appendToVector(Ops);
1538  }
1539  if (StackValue)
1540  Ops.push_back(dwarf::DW_OP_stack_value);
1541  return DIExpression::get(Expr->getContext(), Ops);
1542 }
1543 
1545  ArrayRef<uint64_t> Ops) {
1546  assert(Expr && !Ops.empty() && "Can't append ops to this expression");
1547 
1548  // Copy Expr's current op list.
1550  for (auto Op : Expr->expr_ops()) {
1551  // Append new opcodes before DW_OP_{stack_value, LLVM_fragment}.
1552  if (Op.getOp() == dwarf::DW_OP_stack_value ||
1553  Op.getOp() == dwarf::DW_OP_LLVM_fragment) {
1554  NewOps.append(Ops.begin(), Ops.end());
1555 
1556  // Ensure that the new opcodes are only appended once.
1557  Ops = None;
1558  }
1559  Op.appendToVector(NewOps);
1560  }
1561 
1562  NewOps.append(Ops.begin(), Ops.end());
1563  auto *result = DIExpression::get(Expr->getContext(), NewOps);
1564  assert(result->isValid() && "concatenated expression is not valid");
1565  return result;
1566 }
1567 
1569  ArrayRef<uint64_t> Ops) {
1570  assert(Expr && !Ops.empty() && "Can't append ops to this expression");
1571  assert(none_of(Ops,
1572  [](uint64_t Op) {
1573  return Op == dwarf::DW_OP_stack_value ||
1575  }) &&
1576  "Can't append this op");
1577 
1578  // Append a DW_OP_deref after Expr's current op list if it's non-empty and
1579  // has no DW_OP_stack_value.
1580  //
1581  // Match .* DW_OP_stack_value (DW_OP_LLVM_fragment A B)?.
1583  unsigned DropUntilStackValue = FI ? 3 : 0;
1584  ArrayRef<uint64_t> ExprOpsBeforeFragment =
1585  Expr->getElements().drop_back(DropUntilStackValue);
1586  bool NeedsDeref = (Expr->getNumElements() > DropUntilStackValue) &&
1587  (ExprOpsBeforeFragment.back() != dwarf::DW_OP_stack_value);
1588  bool NeedsStackValue = NeedsDeref || ExprOpsBeforeFragment.empty();
1589 
1590  // Append a DW_OP_deref after Expr's current op list if needed, then append
1591  // the new ops, and finally ensure that a single DW_OP_stack_value is present.
1593  if (NeedsDeref)
1594  NewOps.push_back(dwarf::DW_OP_deref);
1595  NewOps.append(Ops.begin(), Ops.end());
1596  if (NeedsStackValue)
1597  NewOps.push_back(dwarf::DW_OP_stack_value);
1598  return DIExpression::append(Expr, NewOps);
1599 }
1600 
1602  const DIExpression *Expr, unsigned OffsetInBits, unsigned SizeInBits) {
1604  // Copy over the expression, but leave off any trailing DW_OP_LLVM_fragment.
1605  if (Expr) {
1606  for (auto Op : Expr->expr_ops()) {
1607  switch (Op.getOp()) {
1608  default:
1609  break;
1610  case dwarf::DW_OP_shr:
1611  case dwarf::DW_OP_shra:
1612  case dwarf::DW_OP_shl:
1613  case dwarf::DW_OP_plus:
1614  case dwarf::DW_OP_plus_uconst:
1615  case dwarf::DW_OP_minus:
1616  // We can't safely split arithmetic or shift operations into multiple
1617  // fragments because we can't express carry-over between fragments.
1618  //
1619  // FIXME: We *could* preserve the lowest fragment of a constant offset
1620  // operation if the offset fits into SizeInBits.
1621  return None;
1623  // Make the new offset point into the existing fragment.
1624  uint64_t FragmentOffsetInBits = Op.getArg(0);
1625  uint64_t FragmentSizeInBits = Op.getArg(1);
1626  (void)FragmentSizeInBits;
1627  assert((OffsetInBits + SizeInBits <= FragmentSizeInBits) &&
1628  "new fragment outside of original fragment");
1629  OffsetInBits += FragmentOffsetInBits;
1630  continue;
1631  }
1632  }
1633  Op.appendToVector(Ops);
1634  }
1635  }
1636  assert(Expr && "Unknown DIExpression");
1637  Ops.push_back(dwarf::DW_OP_LLVM_fragment);
1638  Ops.push_back(OffsetInBits);
1639  Ops.push_back(SizeInBits);
1640  return DIExpression::get(Expr->getContext(), Ops);
1641 }
1642 
1643 std::pair<DIExpression *, const ConstantInt *>
1645  // Copy the APInt so we can modify it.
1646  APInt NewInt = CI->getValue();
1648 
1649  // Fold operators only at the beginning of the expression.
1650  bool First = true;
1651  bool Changed = false;
1652  for (auto Op : expr_ops()) {
1653  switch (Op.getOp()) {
1654  default:
1655  // We fold only the leading part of the expression; if we get to a part
1656  // that we're going to copy unchanged, and haven't done any folding,
1657  // then the entire expression is unchanged and we can return early.
1658  if (!Changed)
1659  return {this, CI};
1660  First = false;
1661  break;
1663  if (!First)
1664  break;
1665  Changed = true;
1666  if (Op.getArg(1) == dwarf::DW_ATE_signed)
1667  NewInt = NewInt.sextOrTrunc(Op.getArg(0));
1668  else {
1669  assert(Op.getArg(1) == dwarf::DW_ATE_unsigned && "Unexpected operand");
1670  NewInt = NewInt.zextOrTrunc(Op.getArg(0));
1671  }
1672  continue;
1673  }
1674  Op.appendToVector(Ops);
1675  }
1676  if (!Changed)
1677  return {this, CI};
1678  return {DIExpression::get(getContext(), Ops),
1679  ConstantInt::get(getContext(), NewInt)};
1680 }
1681 
1683  uint64_t Result = 0;
1684  for (auto ExprOp : expr_ops())
1685  if (ExprOp.getOp() == dwarf::DW_OP_LLVM_arg)
1686  Result = std::max(Result, ExprOp.getArg(0) + 1);
1687  assert(hasAllLocationOps(Result) &&
1688  "Expression is missing one or more location operands.");
1689  return Result;
1690 }
1691 
1694 
1695  // Recognize signed and unsigned constants.
1696  // An signed constants can be represented as DW_OP_consts C DW_OP_stack_value
1697  // (DW_OP_LLVM_fragment of Len).
1698  // An unsigned constant can be represented as
1699  // DW_OP_constu C DW_OP_stack_value (DW_OP_LLVM_fragment of Len).
1700 
1701  if ((getNumElements() != 2 && getNumElements() != 3 &&
1702  getNumElements() != 6) ||
1703  (getElement(0) != dwarf::DW_OP_consts &&
1704  getElement(0) != dwarf::DW_OP_constu))
1705  return None;
1706 
1707  if (getNumElements() == 2 && getElement(0) == dwarf::DW_OP_consts)
1708  return SignedOrUnsignedConstant::SignedConstant;
1709 
1710  if ((getNumElements() == 3 && getElement(2) != dwarf::DW_OP_stack_value) ||
1711  (getNumElements() == 6 && (getElement(2) != dwarf::DW_OP_stack_value ||
1713  return None;
1714  return getElement(0) == dwarf::DW_OP_constu
1715  ? SignedOrUnsignedConstant::UnsignedConstant
1716  : SignedOrUnsignedConstant::SignedConstant;
1717 }
1718 
1719 DIExpression::ExtOps DIExpression::getExtOps(unsigned FromSize, unsigned ToSize,
1720  bool Signed) {
1721  dwarf::TypeKind TK = Signed ? dwarf::DW_ATE_signed : dwarf::DW_ATE_unsigned;
1723  dwarf::DW_OP_LLVM_convert, ToSize, TK}};
1724  return Ops;
1725 }
1726 
1728  unsigned FromSize, unsigned ToSize,
1729  bool Signed) {
1730  return appendToStack(Expr, getExtOps(FromSize, ToSize, Signed));
1731 }
1732 
1734 DIGlobalVariableExpression::getImpl(LLVMContext &Context, Metadata *Variable,
1736  bool ShouldCreate) {
1738  Metadata *Ops[] = {Variable, Expression};
1740 }
1741 DIObjCProperty::DIObjCProperty(LLVMContext &C, StorageType Storage,
1742  unsigned Line, unsigned Attributes,
1744  : DINode(C, DIObjCPropertyKind, Storage, dwarf::DW_TAG_APPLE_property, Ops),
1745  Line(Line), Attributes(Attributes) {}
1746 
1747 DIObjCProperty *DIObjCProperty::getImpl(
1748  LLVMContext &Context, MDString *Name, Metadata *File, unsigned Line,
1749  MDString *GetterName, MDString *SetterName, unsigned Attributes,
1750  Metadata *Type, StorageType Storage, bool ShouldCreate) {
1751  assert(isCanonical(Name) && "Expected canonical MDString");
1752  assert(isCanonical(GetterName) && "Expected canonical MDString");
1753  assert(isCanonical(SetterName) && "Expected canonical MDString");
1755  SetterName, Attributes, Type));
1756  Metadata *Ops[] = {Name, File, GetterName, SetterName, Type};
1757  DEFINE_GETIMPL_STORE(DIObjCProperty, (Line, Attributes), Ops);
1758 }
1759 
1760 DIImportedEntity *DIImportedEntity::getImpl(LLVMContext &Context, unsigned Tag,
1761  Metadata *Scope, Metadata *Entity,
1762  Metadata *File, unsigned Line,
1763  MDString *Name, Metadata *Elements,
1764  StorageType Storage,
1765  bool ShouldCreate) {
1766  assert(isCanonical(Name) && "Expected canonical MDString");
1768  (Tag, Scope, Entity, File, Line, Name, Elements));
1769  Metadata *Ops[] = {Scope, Entity, Name, File, Elements};
1770  DEFINE_GETIMPL_STORE(DIImportedEntity, (Tag, Line), Ops);
1771 }
1772 
1773 DIMacro *DIMacro::getImpl(LLVMContext &Context, unsigned MIType, unsigned Line,
1774  MDString *Name, MDString *Value, StorageType Storage,
1775  bool ShouldCreate) {
1776  assert(isCanonical(Name) && "Expected canonical MDString");
1778  Metadata *Ops[] = {Name, Value};
1779  DEFINE_GETIMPL_STORE(DIMacro, (MIType, Line), Ops);
1780 }
1781 
1782 DIMacroFile *DIMacroFile::getImpl(LLVMContext &Context, unsigned MIType,
1783  unsigned Line, Metadata *File,
1784  Metadata *Elements, StorageType Storage,
1785  bool ShouldCreate) {
1787  Metadata *Ops[] = {File, Elements};
1788  DEFINE_GETIMPL_STORE(DIMacroFile, (MIType, Line), Ops);
1789 }
1790 
1791 DIArgList *DIArgList::getImpl(LLVMContext &Context,
1793  StorageType Storage, bool ShouldCreate) {
1796 }
1797 
1799  ValueAsMetadata **OldVMPtr = static_cast<ValueAsMetadata **>(Ref);
1800  assert((!New || isa<ValueAsMetadata>(New)) &&
1801  "DIArgList must be passed a ValueAsMetadata");
1802  untrack();
1803  bool Uniq = isUniqued();
1804  if (Uniq) {
1805  // We need to update the uniqueness once the Args are updated since they
1806  // form the key to the DIArgLists store.
1807  eraseFromStore();
1808  }
1809  ValueAsMetadata *NewVM = cast_or_null<ValueAsMetadata>(New);
1810  for (ValueAsMetadata *&VM : Args) {
1811  if (&VM == OldVMPtr) {
1812  if (NewVM)
1813  VM = NewVM;
1814  else
1815  VM = ValueAsMetadata::get(UndefValue::get(VM->getValue()->getType()));
1816  }
1817  }
1818  if (Uniq) {
1819  if (uniquify() != this)
1821  }
1822  track();
1823 }
1824 void DIArgList::track() {
1825  for (ValueAsMetadata *&VAM : Args)
1826  if (VAM)
1827  MetadataTracking::track(&VAM, *VAM, *this);
1828 }
1829 void DIArgList::untrack() {
1830  for (ValueAsMetadata *&VAM : Args)
1831  if (VAM)
1832  MetadataTracking::untrack(&VAM, *VAM);
1833 }
1834 void DIArgList::dropAllReferences() {
1835  untrack();
1836  Args.clear();
1838 }
llvm::DIExpression::prepend
static DIExpression * prepend(const DIExpression *Expr, uint8_t Flags, int64_t Offset=0)
Prepend DIExpr with a deref and offset operation and optionally turn it into a stack value or/and an ...
Definition: DebugInfoMetadata.cpp:1449
llvm::StringSwitch::Case
StringSwitch & Case(StringLiteral S, T Value)
Definition: StringSwitch.h:69
getNextComponentInDiscriminator
static unsigned getNextComponentInDiscriminator(unsigned D)
Returns the next component stored in discriminator.
Definition: Discriminator.h:38
llvm::DICompileUnit::Macros
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata Metadata * Macros
Definition: DebugInfoMetadata.h:1433
llvm::LLVMContext::pImpl
LLVMContextImpl *const pImpl
Definition: LLVMContext.h:69
llvm::DICompileUnit::DebugNameTableKind::GNU
@ GNU
llvm::dwarf::DW_VIRTUALITY_max
@ DW_VIRTUALITY_max
Definition: Dwarf.h:192
Signed
@ Signed
Definition: NVPTXISelLowering.cpp:4710
llvm::DIGenericSubrange::getRawLowerBound
Metadata * getRawLowerBound() const
Definition: DebugInfoMetadata.h:391
llvm::DIArgList
List of ValueAsMetadata, to be used as an argument to a dbg.value intrinsic.
Definition: DebugInfoMetadata.h:3565
llvm::ArrayRef::drop_back
ArrayRef< T > drop_back(size_t N=1) const
Drop the last N elements of the array.
Definition: ArrayRef.h:209
llvm::DICompileUnit::nameTableKindString
static const char * nameTableKindString(DebugNameTableKind PK)
Definition: DebugInfoMetadata.cpp:889
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::DIType
Base class for types.
Definition: DebugInfoMetadata.h:658
llvm::MDNode::storeImpl
static T * storeImpl(T *N, StorageType Storage, StoreT &Store)
Definition: MetadataImpl.h:42
llvm::DILocalScope::getSubprogram
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
Definition: DebugInfoMetadata.cpp:925
llvm::DILabel::Name
Metadata MDString * Name
Definition: DebugInfoMetadata.h:3179
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::DIExpression::getNumLocationOperands
uint64_t getNumLocationOperands() const
Return the number of unique location operands referred to (via DW_OP_LLVM_arg) in this expression; th...
Definition: DebugInfoMetadata.cpp:1682
getUnsignedFromPrefixEncoding
static unsigned getUnsignedFromPrefixEncoding(unsigned U)
Reverse transformation as getPrefixEncodingFromUnsigned.
Definition: Discriminator.h:30
llvm::DILexicalBlockFile::File
Metadata Metadata * File
Definition: DebugInfoMetadata.h:2177
llvm::DIExpression::createFragmentExpression
static Optional< DIExpression * > createFragmentExpression(const DIExpression *Expr, unsigned OffsetInBits, unsigned SizeInBits)
Create a DIExpression to describe one part of an aggregate variable that is fragmented across multipl...
Definition: DebugInfoMetadata.cpp:1601
llvm::DIEnumerator::Name
int64_t bool MDString * Name
Definition: DebugInfoMetadata.h:443
llvm::none_of
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1604
llvm::MetadataTracking::untrack
static void untrack(Metadata *&MD)
Stop tracking a reference to metadata.
Definition: Metadata.h:248
llvm::drop_begin
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
Definition: STLExtras.h:268
llvm::DILabel::File
Metadata MDString Metadata * File
Definition: DebugInfoMetadata.h:3179
llvm::DIGenericSubrange::getRawCountNode
Metadata * getRawCountNode() const
Definition: DebugInfoMetadata.h:390
llvm::DIMacro::MIType
unsigned MIType
Definition: DebugInfoMetadata.h:3480
MetadataImpl.h
llvm::DICompileUnit::File
unsigned Metadata * File
Definition: DebugInfoMetadata.h:1429
llvm::DILocation::getMergedLocation
static const DILocation * getMergedLocation(const DILocation *LocA, const DILocation *LocB)
When two instructions are combined into a single instruction we also need to combine the original loc...
Definition: DebugInfoMetadata.cpp:101
DebugInfoMetadata.h
llvm::DIGenericSubrange
Definition: DebugInfoMetadata.h:363
T
llvm::DIDerivedType::File
unsigned StringRef DIFile * File
Definition: DebugInfoMetadata.h:979
llvm::Function
Definition: Function.h:60
llvm::DICompositeType::Identifier
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString * Identifier
Definition: DebugInfoMetadata.h:1126
llvm::DICompileUnit::ImportedEntities
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata * ImportedEntities
Definition: DebugInfoMetadata.h:1433
llvm::MetadataTracking::track
static bool track(Metadata *&MD)
Track the reference to metadata.
Definition: Metadata.h:223
llvm::DILocalVariable::Name
Metadata MDString * Name
Definition: DebugInfoMetadata.h:3105
llvm::DICompileUnit::SDK
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata Metadata uint64_t bool bool unsigned bool MDString MDString * SDK
Definition: DebugInfoMetadata.h:1436
llvm::DICommonBlock::File
Metadata Metadata MDString Metadata * File
Definition: DebugInfoMetadata.h:3032
llvm::lltok::NameTableKind
@ NameTableKind
Definition: LLToken.h:428
llvm::ConstantInt::getValue
const APInt & getValue() const
Return the constant as an APInt value reference.
Definition: Constants.h:133
llvm::DILexicalBlockFile
Definition: DebugInfoMetadata.h:2140
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1181
getImpl
static LazyValueInfoImpl & getImpl(void *&PImpl, AssumptionCache *AC, const Module *M)
This lazily constructs the LazyValueInfoImpl.
Definition: LazyValueInfo.cpp:1515
llvm::getUniqued
static T * getUniqued(DenseSet< T *, InfoT > &Store, const typename InfoT::KeyTy &Key)
Definition: MetadataImpl.h:22
llvm::DIVariable::getSizeInBits
Optional< uint64_t > getSizeInBits() const
Determines the size of the variable's type.
Definition: DebugInfoMetadata.cpp:1171
llvm::DIStringType
String type, Fortran CHARACTER(n)
Definition: DebugInfoMetadata.h:832
llvm::DITemplateParameter::isDefault
bool isDefault() const
Definition: DebugInfoMetadata.h:2395
llvm::DIFile::ChecksumInfo
A single checksum, represented by a Kind and a Value (a string).
Definition: DebugInfoMetadata.h:546
llvm::MipsISD::Lo
@ Lo
Definition: MipsISelLowering.h:79
llvm::DIFile::Directory
MDString MDString * Directory
Definition: DebugInfoMetadata.h:603
llvm::Metadata::SubclassData32
unsigned SubclassData32
Definition: Metadata.h:77
llvm::SmallDenseSet
Implements a dense probed hash-table based set with some number of buckets stored inline.
Definition: DenseSet.h:286
llvm::DILexicalBlockFile::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:2177
llvm::APInt::zextOrTrunc
APInt zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
Definition: APInt.cpp:994
llvm::DISubroutineType::TypeArray
DIFlags uint8_t Metadata * TypeArray
Definition: DebugInfoMetadata.h:1297
llvm::DICompositeType::Scope
unsigned MDString Metadata unsigned Metadata * Scope
Definition: DebugInfoMetadata.h:1123
encodingBits
static unsigned encodingBits(unsigned C)
Definition: Discriminator.h:49
llvm::DICompositeType::TemplateParams
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata * TemplateParams
Definition: DebugInfoMetadata.h:1126
llvm::DIScope::getName
StringRef getName() const
Definition: DebugInfoMetadata.cpp:260
llvm::DICompileUnit::GlobalVariables
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata * GlobalVariables
Definition: DebugInfoMetadata.h:1432
llvm::DIBasicType::Signedness::Unsigned
@ Unsigned
llvm::DISubprogram::TemplateParams
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata * TemplateParams
Definition: DebugInfoMetadata.h:1911
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:139
llvm::dwarf::DW_OP_LLVM_tag_offset
@ DW_OP_LLVM_tag_offset
Only used in LLVM metadata.
Definition: Dwarf.h:145
llvm::EnableFSDiscriminator
cl::opt< bool > EnableFSDiscriminator
Definition: TargetPassConfig.cpp:390
llvm::DIType::isStaticMember
bool isStaticMember() const
Definition: DebugInfoMetadata.h:735
llvm::DILocation
Debug location.
Definition: DebugInfoMetadata.h:1557
llvm::DISubrange::getUpperBound
BoundType getUpperBound() const
Definition: DebugInfoMetadata.cpp:415
llvm::DIModule::ConfigurationMacros
Metadata Metadata MDString MDString * ConfigurationMacros
Definition: DebugInfoMetadata.h:2350
llvm::Metadata::SubclassData16
unsigned short SubclassData16
Definition: Metadata.h:76
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::DISubprogram::File
Metadata MDString MDString Metadata * File
Definition: DebugInfoMetadata.h:1907
llvm::sys::path::end
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:235
llvm::sys::path::begin
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:226
llvm::SmallSet
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
Definition: SmallSet.h:136
llvm::DIExpression::extractIfOffset
bool extractIfOffset(int64_t &Offset) const
If this is a constant offset, extract it.
Definition: DebugInfoMetadata.cpp:1393
llvm::Optional< unsigned >
llvm::DICompositeType::Associated
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata Metadata Metadata * Associated
Definition: DebugInfoMetadata.h:1128
llvm::ConstantAsMetadata::get
static ConstantAsMetadata * get(Constant *C)
Definition: Metadata.h:420
llvm::DICompileUnit::EnumTypes
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata * EnumTypes
Definition: DebugInfoMetadata.h:1431
llvm::DIBasicType::AlignInBits
unsigned StringRef uint64_t FlagZero unsigned StringRef uint64_t uint32_t AlignInBits
Definition: DebugInfoMetadata.h:809
llvm::max
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Definition: FileCheck.cpp:337
llvm::DISubprogram::splitFlags
static DISPFlags splitFlags(DISPFlags Flags, SmallVectorImpl< DISPFlags > &SplitFlags)
Split up a flags bitfield for easier printing.
Definition: DebugInfoMetadata.cpp:958
llvm::DIExpression::ExprOperand::getSize
unsigned getSize() const
Return the size of the operand.
Definition: DebugInfoMetadata.cpp:1220
llvm::DICompileUnit::RetainedTypes
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata * RetainedTypes
Definition: DebugInfoMetadata.h:1432
llvm::ValueAsMetadata::get
static ValueAsMetadata * get(Value *V)
Definition: Metadata.cpp:393
llvm::MipsISD::Ret
@ Ret
Definition: MipsISelLowering.h:119
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2558
llvm::dwarf::Tag
Tag
Definition: Dwarf.h:105
BaseType
llvm::DINode::FlagAccessibility
@ FlagAccessibility
Definition: DebugInfoMetadata.h:172
llvm::GenericDINode::DwarfOps
unsigned MDString ArrayRef< Metadata * > DwarfOps
Definition: DebugInfoMetadata.h:267
llvm::DINode::FlagPtrToMemberRep
@ FlagPtrToMemberRep
Definition: DebugInfoMetadata.h:173
llvm::DICompileUnit::Producer
unsigned Metadata MDString * Producer
Definition: DebugInfoMetadata.h:1429
llvm::detail::DenseSetImpl< ValueT, SmallDenseMap< ValueT, detail::DenseSetEmpty, 4, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::insert
std::pair< iterator, bool > insert(const ValueT &V)
Definition: DenseSet.h:206
llvm::DICompositeType::Line
unsigned MDString Metadata unsigned Line
Definition: DebugInfoMetadata.h:1122
llvm::DICompileUnit::DebugEmissionKind
DebugEmissionKind
Definition: DebugInfoMetadata.h:1327
llvm::DICompositeType::Discriminator
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata * Discriminator
Definition: DebugInfoMetadata.h:1127
llvm::DIImportedEntity::Scope
unsigned Metadata * Scope
Definition: DebugInfoMetadata.h:3330
llvm::DIModule::IncludePath
Metadata Metadata MDString MDString MDString * IncludePath
Definition: DebugInfoMetadata.h:2350
llvm::DINamespace
Definition: DebugInfoMetadata.h:2258
llvm::DICompileUnit::emissionKindString
static const char * emissionKindString(DebugEmissionKind EK)
Definition: DebugInfoMetadata.cpp:875
llvm::DIDerivedType::Flags
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t uint64_t Optional< unsigned > DIFlags Flags
Definition: DebugInfoMetadata.h:982
llvm::DILocalVariable::Line
Metadata MDString Metadata unsigned Line
Definition: DebugInfoMetadata.h:3106
llvm::DILexicalBlock
Definition: DebugInfoMetadata.h:2087
llvm::ArrayRef::empty
bool empty() const
empty - Check if the array is empty.
Definition: ArrayRef.h:159
llvm::MDNode::get
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1400
llvm::DIModule::Scope
Metadata Metadata * Scope
Definition: DebugInfoMetadata.h:2349
llvm::GenericDINode::getTag
dwarf::Tag getTag() const
Definition: DebugInfoMetadata.cpp:283
llvm::DIObjCProperty::Name
MDString * Name
Definition: DebugInfoMetadata.h:3253
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::DILocation::InlinedAt
unsigned unsigned DILocalScope DILocation * InlinedAt
Definition: DebugInfoMetadata.h:1595
llvm::DICompileUnit::SysRoot
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata Metadata uint64_t bool bool unsigned bool MDString * SysRoot
Definition: DebugInfoMetadata.h:1435
llvm::DILocalVariable::File
Metadata MDString Metadata * File
Definition: DebugInfoMetadata.h:3105
llvm::Annotations
Annotations lets you mark points and ranges inside source code, for tests:
Definition: Annotations.h:48
llvm::MDNode::storeDistinctInContext
void storeDistinctInContext()
Definition: Metadata.cpp:947
result
It looks like we only need to define PPCfmarto for these because according to these instructions perform RTO on fma s result
Definition: README_P9.txt:256
llvm::DICompositeType::getODRTypeIfExists
static DICompositeType * getODRTypeIfExists(LLVMContext &Context, MDString &Identifier)
Definition: DebugInfoMetadata.cpp:741
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::DIExpression::getElement
uint64_t getElement(unsigned I) const
Definition: DebugInfoMetadata.h:2586
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:187
llvm::ConstantInt
This is the shared class of boolean and integer constants.
Definition: Constants.h:79
llvm::DIObjCProperty
Definition: DebugInfoMetadata.h:3213
llvm::DIExpression::appendOpsToArg
static DIExpression * appendOpsToArg(const DIExpression *Expr, ArrayRef< uint64_t > Ops, unsigned ArgNo, bool StackValue=false)
Create a copy of Expr by appending the given list of Ops to each instance of the operand DW_OP_LLVM_a...
Definition: DebugInfoMetadata.cpp:1465
llvm::DICommonBlock::Name
Metadata Metadata MDString * Name
Definition: DebugInfoMetadata.h:3031
llvm::ArrayRef::back
const T & back() const
back - Get the last element.
Definition: ArrayRef.h:173
llvm::DISubprogram::Unit
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata * Unit
Definition: DebugInfoMetadata.h:1910
llvm::DIStringType::SizeInBits
unsigned MDString Metadata Metadata Metadata uint64_t SizeInBits
Definition: DebugInfoMetadata.h:879
llvm::ModRefInfo::Ref
@ Ref
The access may reference the value stored in memory.
llvm::DISubrange::getCount
BoundType getCount() const
Definition: DebugInfoMetadata.cpp:373
llvm::DIFile::CS
MDString MDString Optional< ChecksumInfo< MDString * > > CS
Definition: DebugInfoMetadata.h:604
llvm::DILocalScope::getNonLexicalBlockFileScope
DILocalScope * getNonLexicalBlockFileScope() const
Get the first non DILexicalBlockFile scope of this scope.
Definition: DebugInfoMetadata.cpp:931
llvm::DILocalVariable
Local variable.
Definition: DebugInfoMetadata.h:3058
llvm::DIMacro
Definition: DebugInfoMetadata.h:3448
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
DEFINE_GETIMPL_STORE
#define DEFINE_GETIMPL_STORE(CLASS, ARGS, OPS)
Definition: DebugInfoMetadata.cpp:327
llvm::DISubprogram::SPFlagVirtuality
@ SPFlagVirtuality
Definition: DebugInfoMetadata.h:1823
llvm::DICompileUnit::LineTablesOnly
@ LineTablesOnly
Definition: DebugInfoMetadata.h:1330
llvm::DILocalVariable::Type
Metadata MDString Metadata unsigned Metadata * Type
Definition: DebugInfoMetadata.h:3106
llvm::DISubprogram::Type
Metadata MDString MDString Metadata unsigned Metadata * Type
Definition: DebugInfoMetadata.h:1908
llvm::DIFile::CSK_Last
@ CSK_Last
Definition: DebugInfoMetadata.h:542
llvm::GenericDINode::Header
unsigned MDString * Header
Definition: DebugInfoMetadata.h:266
llvm::DIImportedEntity::Entity
unsigned Metadata Metadata * Entity
Definition: DebugInfoMetadata.h:3330
llvm::DISubprogram::DISPFlags
DISPFlags
Debug info subprogram flags.
Definition: DebugInfoMetadata.h:1818
llvm::DIDerivedType::getConstant
Constant * getConstant() const
Definition: DebugInfoMetadata.cpp:615
DEFINE_GETIMPL_STORE_NO_OPS
#define DEFINE_GETIMPL_STORE_NO_OPS(CLASS, ARGS)
Definition: DebugInfoMetadata.cpp:331
llvm::DINode::getTag
dwarf::Tag getTag() const
Definition: DebugInfoMetadata.cpp:180
DEFINE_GETIMPL_LOOKUP
#define DEFINE_GETIMPL_LOOKUP(CLASS, ARGS)
Definition: DebugInfoMetadata.cpp:314
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:486
llvm::DILocalVariable::AlignInBits
Metadata MDString Metadata unsigned Metadata unsigned DIFlags uint32_t AlignInBits
Definition: DebugInfoMetadata.h:3107
llvm::DIDerivedType::getVBPtrOffset
uint32_t getVBPtrOffset() const
Definition: DebugInfoMetadata.cpp:601
llvm::DISubrange
Array subrange.
Definition: DebugInfoMetadata.h:300
DEFINE_GETIMPL_STORE_N
#define DEFINE_GETIMPL_STORE_N(CLASS, ARGS, OPS, NUM_OPS)
Definition: DebugInfoMetadata.cpp:338
llvm::DISubrange::CountNode
Metadata * CountNode
Definition: DebugInfoMetadata.h:330
llvm::Metadata::StorageType
StorageType
Active type of storage.
Definition: Metadata.h:70
llvm::LLVMContext::isODRUniquingDebugTypes
bool isODRUniquingDebugTypes() const
Whether there is a string map for uniquing debug info identifiers across the context.
Definition: LLVMContext.cpp:340
llvm::DITemplateTypeParameter
Definition: DebugInfoMetadata.h:2403
llvm::DIMacroFile::File
unsigned unsigned Metadata * File
Definition: DebugInfoMetadata.h:3533
llvm::DILocation::Scope
unsigned unsigned DILocalScope * Scope
Definition: DebugInfoMetadata.h:1594
First
into llvm powi allowing the code generator to produce balanced multiplication trees First
Definition: README.txt:54
llvm::DIBasicType::Name
unsigned StringRef Name
Definition: DebugInfoMetadata.h:802
llvm::DIDerivedType::SizeInBits
unsigned StringRef DIFile unsigned DIScope DIType uint64_t SizeInBits
Definition: DebugInfoMetadata.h:980
llvm::DIBasicType::getEncoding
unsigned getEncoding() const
Definition: DebugInfoMetadata.h:818
llvm::DIFile::getChecksumKind
static Optional< ChecksumKind > getChecksumKind(StringRef CSKindStr)
Definition: DebugInfoMetadata.cpp:786
llvm::MCID::Flag
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:147
LLVMContextImpl.h
llvm::DICompositeType::DataLocation
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata Metadata * DataLocation
Definition: DebugInfoMetadata.h:1127
llvm::DILocalVariable::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:3105
llvm::DISubprogram::TargetFuncName
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata Metadata Metadata Metadata MDString * TargetFuncName
Definition: DebugInfoMetadata.h:1913
llvm::UndefValue::get
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
Definition: Constants.cpp:1713
llvm::DILocation::decodeDiscriminator
static void decodeDiscriminator(unsigned D, unsigned &BD, unsigned &DF, unsigned &CI)
Raw decoder for values in an encoded discriminator D.
Definition: DebugInfoMetadata.cpp:173
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:879
llvm::DICompositeType::Allocated
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata Metadata Metadata Metadata * Allocated
Definition: DebugInfoMetadata.h:1128
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::SmallVectorImpl::append
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:669
llvm::DILexicalBlockBase::DILexicalBlockBase
DILexicalBlockBase(LLVMContext &C, unsigned ID, StorageType Storage, ArrayRef< Metadata * > Ops)
Definition: DebugInfoMetadata.cpp:1018
llvm::DIGenericSubrange::getRawUpperBound
Metadata * getRawUpperBound() const
Definition: DebugInfoMetadata.h:392
llvm::Metadata
Root of the metadata hierarchy.
Definition: Metadata.h:62
llvm::DICompileUnit::DebugDirectivesOnly
@ DebugDirectivesOnly
Definition: DebugInfoMetadata.h:1331
llvm::None
const NoneType None
Definition: None.h:24
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
Type.h
DF
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
llvm::DISubprogram::Declaration
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata * Declaration
Definition: DebugInfoMetadata.h:1911
llvm::DICompileUnit::FullDebug
@ FullDebug
Definition: DebugInfoMetadata.h:1329
llvm::DINode::splitFlags
static DIFlags splitFlags(DIFlags Flags, SmallVectorImpl< DIFlags > &SplitFlags)
Split up a flags bitfield.
Definition: DebugInfoMetadata.cpp:199
llvm::DIFile::Filename
MDString * Filename
Definition: DebugInfoMetadata.h:603
llvm::DIBasicType::Signedness::Signed
@ Signed
llvm::DICompositeType::AlignInBits
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t AlignInBits
Definition: DebugInfoMetadata.h:1124
llvm::DIArgList::handleChangedOperand
void handleChangedOperand(void *Ref, Metadata *New)
Definition: DebugInfoMetadata.cpp:1798
llvm::DICompositeType::buildODRType
static DICompositeType * buildODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder, Metadata *TemplateParams, Metadata *Discriminator, Metadata *DataLocation, Metadata *Associated, Metadata *Allocated, Metadata *Rank, Metadata *Annotations)
Build a DICompositeType with the given ODR identifier.
Definition: DebugInfoMetadata.cpp:674
llvm::lltok::EmissionKind
@ EmissionKind
Definition: LLToken.h:427
llvm::DICommonBlock
Definition: DebugInfoMetadata.h:2999
llvm::DIExpression::append
static DIExpression * append(const DIExpression *Expr, ArrayRef< uint64_t > Ops)
Append the opcodes Ops to DIExpr.
Definition: DebugInfoMetadata.cpp:1544
llvm::DICompositeType::Elements
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata * Elements
Definition: DebugInfoMetadata.h:1125
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
llvm::DIExpression::ExtOps
std::array< uint64_t, 6 > ExtOps
Definition: DebugInfoMetadata.h:2843
llvm::DIExpression::isImplicit
bool isImplicit() const
Return whether this is an implicit location description.
Definition: DebugInfoMetadata.cpp:1326
llvm::DIGlobalVariable::Line
Metadata MDString MDString Metadata unsigned Line
Definition: DebugInfoMetadata.h:2969
llvm::cl::opt< bool >
llvm::DISubprogram::LinkageName
Metadata MDString MDString * LinkageName
Definition: DebugInfoMetadata.h:1907
encodeComponent
static unsigned encodeComponent(unsigned C)
Definition: Discriminator.h:45
llvm::dwarf::DW_OP_LLVM_entry_value
@ DW_OP_LLVM_entry_value
Only used in LLVM metadata.
Definition: Dwarf.h:146
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::DICompositeType::SizeInBits
unsigned MDString Metadata unsigned Metadata Metadata uint64_t SizeInBits
Definition: DebugInfoMetadata.h:1123
llvm::DIGlobalVariable::LinkageName
Metadata MDString MDString * LinkageName
Definition: DebugInfoMetadata.h:2968
llvm::DIDerivedType::getStorageOffsetInBits
Constant * getStorageOffsetInBits() const
Definition: DebugInfoMetadata.cpp:608
llvm::DIExpression::extractAddressClass
static const DIExpression * extractAddressClass(const DIExpression *Expr, unsigned &AddrClass)
Checks if the last 4 elements of the expression are DW_OP_constu <DWARF Address Space> DW_OP_swap DW_...
Definition: DebugInfoMetadata.cpp:1429
llvm::DIEnumerator
Enumeration value.
Definition: DebugInfoMetadata.h:411
llvm::DILabel::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:3179
llvm::DIVariable::getRawType
Metadata * getRawType() const
Definition: DebugInfoMetadata.h:2541
llvm::DIExpression::appendToStack
static DIExpression * appendToStack(const DIExpression *Expr, ArrayRef< uint64_t > Ops)
Convert DIExpr into a stack value if it isn't one already by appending DW_OP_deref if needed,...
Definition: DebugInfoMetadata.cpp:1568
llvm::DIFile::CSK_SHA256
@ CSK_SHA256
Definition: DebugInfoMetadata.h:541
uint64_t
llvm::DINamespace::Name
Metadata MDString * Name
Definition: DebugInfoMetadata.h:2288
llvm::DISubprogram::toSPFlags
static DISPFlags toSPFlags(bool IsLocalToUnit, bool IsDefinition, bool IsOptimized, unsigned Virtuality=SPFlagNonvirtual, bool IsMainSubprogram=false)
Definition: DebugInfoMetadata.cpp:910
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::DIDerivedType::Name
unsigned StringRef Name
Definition: DebugInfoMetadata.h:979
llvm::DIModule::Name
Metadata Metadata MDString * Name
Definition: DebugInfoMetadata.h:2349
llvm::DIExpression::StackValue
@ StackValue
Definition: DebugInfoMetadata.h:2766
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
llvm::DIExpression::isConstant
llvm::Optional< SignedOrUnsignedConstant > isConstant() const
Determine whether this represents a constant value, if so.
Definition: DebugInfoMetadata.cpp:1693
llvm::DIGlobalVariable::Type
Metadata MDString MDString Metadata unsigned Metadata * Type
Definition: DebugInfoMetadata.h:2969
llvm::DITemplateTypeParameter::Name
MDString * Name
Definition: DebugInfoMetadata.h:2432
llvm::DIGlobalVariable
Global variables.
Definition: DebugInfoMetadata.h:2914
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
I
#define I(x, y, z)
Definition: MD5.cpp:58
Attributes
AMDGPU Kernel Attributes
Definition: AMDGPULowerKernelAttributes.cpp:349
llvm::DITemplateValueParameter::Name
unsigned MDString * Name
Definition: DebugInfoMetadata.h:2478
size
i< reg-> size
Definition: README.txt:166
llvm::DICompileUnit
Compile unit.
Definition: DebugInfoMetadata.h:1322
llvm::DIImportedEntity
An imported module (C++ using directive or similar).
Definition: DebugInfoMetadata.h:3293
llvm::DISubprogram::Name
Metadata MDString * Name
Definition: DebugInfoMetadata.h:1907
llvm::is_contained
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
Definition: STLExtras.h:1673
llvm::DIGlobalVariable::Name
Metadata MDString * Name
Definition: DebugInfoMetadata.h:2968
llvm::DIModule::APINotesFile
Metadata Metadata MDString MDString MDString MDString * APINotesFile
Definition: DebugInfoMetadata.h:2351
llvm::DIMacroFile
Definition: DebugInfoMetadata.h:3499
llvm::DIMacroFile::Elements
unsigned unsigned Metadata Metadata * Elements
Definition: DebugInfoMetadata.h:3534
llvm::DIExpression::DerefBefore
@ DerefBefore
Definition: DebugInfoMetadata.h:2764
llvm::DISubroutineType::Flags
DIFlags Flags
Definition: DebugInfoMetadata.h:1297
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::DISubprogram::getFlagString
static StringRef getFlagString(DISPFlags Flag)
Definition: DebugInfoMetadata.cpp:944
llvm::DIBasicType::SizeInBits
unsigned StringRef uint64_t SizeInBits
Definition: DebugInfoMetadata.h:802
llvm::DIBasicType::getSignedness
Optional< Signedness > getSignedness() const
Return the signedness of this type, or None if this type is neither signed nor unsigned.
Definition: DebugInfoMetadata.cpp:568
llvm::DIDerivedType::ExtraData
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t uint64_t Optional< unsigned > DIFlags Metadata * ExtraData
Definition: DebugInfoMetadata.h:983
llvm::MDNode::dropAllReferences
void dropAllReferences()
Definition: Metadata.cpp:799
llvm::DINode::getFlag
static DIFlags getFlag(StringRef Flag)
Definition: DebugInfoMetadata.cpp:182
llvm::DIType::isBitField
bool isBitField() const
Definition: DebugInfoMetadata.h:734
llvm::MDNode
Metadata node.
Definition: Metadata.h:944
llvm::DIGenericSubrange::getCount
BoundType getCount() const
Definition: DebugInfoMetadata.cpp:471
ChecksumKindName
static const char * ChecksumKindName[DIFile::CSK_Last]
Definition: DebugInfoMetadata.cpp:772
llvm::DIExpression::replaceArg
static DIExpression * replaceArg(const DIExpression *Expr, uint64_t OldArg, uint64_t NewArg)
Create a copy of Expr with each instance of DW_OP_LLVM_arg, \p OldArg replaced with DW_OP_LLVM_arg,...
Definition: DebugInfoMetadata.cpp:1489
llvm::DIBasicType
Basic type, like 'int' or 'float'.
Definition: DebugInfoMetadata.h:764
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
llvm::DISubrange::getStride
BoundType getStride() const
Definition: DebugInfoMetadata.cpp:436
llvm::DISubprogram::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:1907
llvm::DISubroutineType
Type array for a subprogram.
Definition: DebugInfoMetadata.h:1265
llvm::dwarf::SourceLanguage
SourceLanguage
Definition: Dwarf.h:201
llvm::Expression
Class representing an expression and its matching format.
Definition: FileCheckImpl.h:237
llvm::DICompositeType
Composite types.
Definition: DebugInfoMetadata.h:1042
llvm::dwarf::DW_OP_LLVM_arg
@ DW_OP_LLVM_arg
Only used in LLVM metadata.
Definition: Dwarf.h:148
llvm::DIScope::getScope
DIScope * getScope() const
Definition: DebugInfoMetadata.cpp:236
llvm::DILocation::encodeDiscriminator
static Optional< unsigned > encodeDiscriminator(unsigned BD, unsigned DF, unsigned CI)
Raw encoding of the discriminator.
Definition: DebugInfoMetadata.cpp:139
llvm::DICompileUnit::NoDebug
@ NoDebug
Definition: DebugInfoMetadata.h:1328
llvm::DIDerivedType::OffsetInBits
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t uint64_t OffsetInBits
Definition: DebugInfoMetadata.h:981
llvm::DICompositeType::OffsetInBits
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t OffsetInBits
Definition: DebugInfoMetadata.h:1124
llvm::Sched::Source
@ Source
Definition: TargetLowering.h:98
llvm::DIDerivedType::Line
unsigned StringRef DIFile unsigned Line
Definition: DebugInfoMetadata.h:979
llvm::dwarf::DW_OP_LLVM_fragment
@ DW_OP_LLVM_fragment
Only used in LLVM metadata.
Definition: Dwarf.h:143
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::DITemplateParameter
Base class for template parameters.
Definition: DebugInfoMetadata.h:2380
llvm::dwarf::DW_OP_LLVM_implicit_pointer
@ DW_OP_LLVM_implicit_pointer
Only used in LLVM metadata.
Definition: Dwarf.h:147
llvm::DICompileUnit::DebugNameTableKind
DebugNameTableKind
Definition: DebugInfoMetadata.h:1335
llvm::min
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Definition: FileCheck.cpp:357
llvm::any_of
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1597
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Dwarf.h
llvm::DIStringType::AlignInBits
unsigned MDString Metadata Metadata Metadata uint64_t uint32_t AlignInBits
Definition: DebugInfoMetadata.h:879
llvm::DIGenericSubrange::getStride
BoundType getStride() const
Definition: DebugInfoMetadata.cpp:522
llvm::DINode
Tagged DWARF-like metadata node.
Definition: DebugInfoMetadata.h:129
llvm::DILocation::Line
unsigned Line
Definition: DebugInfoMetadata.h:1594
llvm::MDNode::isUniqued
bool isUniqued() const
Definition: Metadata.h:1126
llvm::DICompositeType::File
unsigned MDString Metadata * File
Definition: DebugInfoMetadata.h:1122
llvm::DICompileUnit::getEmissionKind
DebugEmissionKind getEmissionKind() const
Definition: DebugInfoMetadata.h:1447
uint32_t
llvm::DICompositeType::VTableHolder
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata * VTableHolder
Definition: DebugInfoMetadata.h:1125
llvm::DIObjCProperty::SetterName
MDString Metadata unsigned MDString MDString * SetterName
Definition: DebugInfoMetadata.h:3254
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::DIExpression::ExprOperand::getOp
uint64_t getOp() const
Get the operand code.
Definition: DebugInfoMetadata.h:2625
llvm::GenericDINode
Generic tagged DWARF-like metadata node.
Definition: DebugInfoMetadata.h:227
CC
auto CC
Definition: RISCVRedundantCopyElimination.cpp:79
llvm::DIImportedEntity::File
unsigned Metadata Metadata Metadata * File
Definition: DebugInfoMetadata.h:3331
llvm::MDNode::getDistinct
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1408
llvm::Metadata::Storage
unsigned char Storage
Storage flag for non-uniqued, otherwise unowned, metadata.
Definition: Metadata.h:73
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::DIBasicType::Flags
unsigned StringRef uint64_t FlagZero unsigned StringRef uint64_t uint32_t unsigned DIFlags Flags
Definition: DebugInfoMetadata.h:809
llvm::DIExpression::expr_op_iterator
An iterator for expression operands.
Definition: DebugInfoMetadata.h:2646
llvm::DIMacro::Name
unsigned unsigned MDString * Name
Definition: DebugInfoMetadata.h:3480
llvm::MDNode::getContext
LLVMContext & getContext() const
Definition: Metadata.h:1108
llvm::DIStringType::StringLocationExp
unsigned MDString Metadata Metadata Metadata * StringLocationExp
Definition: DebugInfoMetadata.h:878
llvm::DIExpression::getFragmentInfo
static Optional< FragmentInfo > getFragmentInfo(expr_op_iterator Start, expr_op_iterator End)
Retrieve the details of this fragment expression.
Definition: DebugInfoMetadata.cpp:1369
llvm::DIGlobalVariable::StaticDataMemberDeclaration
Metadata MDString MDString Metadata unsigned Metadata bool bool Metadata * StaticDataMemberDeclaration
Definition: DebugInfoMetadata.h:2970
llvm::DIImportedEntity::Name
unsigned Metadata Metadata Metadata unsigned MDString * Name
Definition: DebugInfoMetadata.h:3331
llvm::DICompileUnit::SplitDebugFilename
unsigned Metadata MDString bool MDString unsigned MDString * SplitDebugFilename
Definition: DebugInfoMetadata.h:1431
llvm::DISubrange::getLowerBound
BoundType getLowerBound() const
Definition: DebugInfoMetadata.cpp:394
llvm::DICompositeType::Flags
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Flags
Definition: DebugInfoMetadata.h:1124
llvm::dwarf::TypeKind
TypeKind
Definition: Dwarf.h:151
llvm::DISubprogram::RetainedNodes
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata Metadata * RetainedNodes
Definition: DebugInfoMetadata.h:1912
llvm::DIExpression::appendOffset
static void appendOffset(SmallVectorImpl< uint64_t > &Ops, int64_t Offset)
Append Ops with operations to apply the Offset.
Definition: DebugInfoMetadata.cpp:1378
llvm::DIExpression::prependOpcodes
static DIExpression * prependOpcodes(const DIExpression *Expr, SmallVectorImpl< uint64_t > &Ops, bool StackValue=false, bool EntryValue=false)
Prepend DIExpr with the given opcodes and optionally turn it into a stack value.
Definition: DebugInfoMetadata.cpp:1511
llvm::DIGenericSubrange::BoundType
PointerUnion< DIVariable *, DIExpression * > BoundType
Definition: DebugInfoMetadata.h:395
llvm::Type::getInt64Ty
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:240
DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS
#define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS)
Definition: DebugInfoMetadata.cpp:335
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
llvm::DIExpression::appendExt
static DIExpression * appendExt(const DIExpression *Expr, unsigned FromSize, unsigned ToSize, bool Signed)
Append a zero- or sign-extension to Expr.
Definition: DebugInfoMetadata.cpp:1727
llvm::DIExpression::isEntryValue
bool isEntryValue() const
Check if the expression consists of exactly one entry value operand.
Definition: DebugInfoMetadata.cpp:1213
llvm::DIExpression::DerefAfter
@ DerefAfter
Definition: DebugInfoMetadata.h:2765
adjustColumn
static void adjustColumn(unsigned &Column)
Definition: DebugInfoMetadata.cpp:53
llvm::DIScope
Base class for scope-like contexts.
Definition: DebugInfoMetadata.h:471
llvm::DISubprogram::ThrownTypes
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata Metadata Metadata * ThrownTypes
Definition: DebugInfoMetadata.h:1912
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:348
llvm::ArrayRef::begin
iterator begin() const
Definition: ArrayRef.h:152
llvm::DILexicalBlock::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:2126
llvm::APInt::sextOrTrunc
APInt sextOrTrunc(unsigned width) const
Sign extend or truncate to width.
Definition: APInt.cpp:1002
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:893
llvm::DIExpression::startsWithDeref
bool startsWithDeref() const
Return whether the first element a DW_OP_deref.
Definition: DebugInfoMetadata.cpp:1216
llvm::DIExpression::isComplex
bool isComplex() const
Return whether the location is computed on the expression stack, meaning it cannot be a simple regist...
Definition: DebugInfoMetadata.cpp:1346
llvm::DICompileUnit::Flags
unsigned Metadata MDString bool MDString * Flags
Definition: DebugInfoMetadata.h:1430
llvm::DILocation::ImplicitCode
unsigned unsigned DILocalScope DILocation bool ImplicitCode
Definition: DebugInfoMetadata.h:1596
Function.h
llvm::DIExpression::constantFold
std::pair< DIExpression *, const ConstantInt * > constantFold(const ConstantInt *CI)
Try to shorten an expression with an initial constant operand.
Definition: DebugInfoMetadata.cpp:1644
llvm::DIExpression::getElements
ArrayRef< uint64_t > getElements() const
Definition: DebugInfoMetadata.h:2582
StringSwitch.h
llvm::DIStringType::Name
unsigned MDString * Name
Definition: DebugInfoMetadata.h:877
llvm::DICompileUnit::DebugNameTableKind::Default
@ Default
llvm::DIExpression::getExtOps
static ExtOps getExtOps(unsigned FromSize, unsigned ToSize, bool Signed)
Returns the ops for a zero- or sign-extension in a DIExpression.
Definition: DebugInfoMetadata.cpp:1719
llvm::dwarf::DW_OP_LLVM_convert
@ DW_OP_LLVM_convert
Only used in LLVM metadata.
Definition: Dwarf.h:144
llvm::DIDerivedType
Derived types.
Definition: DebugInfoMetadata.h:924
llvm::DIGlobalVariable::AlignInBits
Metadata MDString MDString Metadata unsigned Metadata bool bool Metadata Metadata uint32_t AlignInBits
Definition: DebugInfoMetadata.h:2971
llvm::DIGlobalVariableExpression
A pair of DIGlobalVariable and DIExpression.
Definition: DebugInfoMetadata.h:3358
llvm::makeArrayRef
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:475
llvm::DIExpression::FragmentInfo
Holds the characteristics of one fragment of a larger variable.
Definition: DebugInfoMetadata.h:2720
llvm::DINamespace::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:2288
llvm::DISubprogram::Annotations
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata Metadata Metadata Metadata * Annotations
Definition: DebugInfoMetadata.h:1913
llvm::DINode::getFlagString
static StringRef getFlagString(DIFlags Flag)
Definition: DebugInfoMetadata.cpp:189
llvm::DICompositeType::Rank
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata Metadata Metadata Metadata Metadata * Rank
Definition: DebugInfoMetadata.h:1129
llvm::DILexicalBlock::File
Metadata Metadata * File
Definition: DebugInfoMetadata.h:2126
llvm::DITemplateValueParameter
Definition: DebugInfoMetadata.h:2442
llvm::DITemplateValueParameter::Type
unsigned MDString Metadata * Type
Definition: DebugInfoMetadata.h:2478
llvm::DIExpression::ExprOperand::get
const uint64_t * get() const
Definition: DebugInfoMetadata.h:2622
llvm::DISubprogram::ContainingType
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata * ContainingType
Definition: DebugInfoMetadata.h:1909
llvm::DINode::DIFlags
DIFlags
Debug info flags.
Definition: DebugInfoMetadata.h:168
llvm::DIObjCProperty::GetterName
MDString Metadata unsigned MDString * GetterName
Definition: DebugInfoMetadata.h:3254
llvm::DIGenericSubrange::getLowerBound
BoundType getLowerBound() const
Definition: DebugInfoMetadata.cpp:488
llvm::DIVariable::DIVariable
DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, signed Line, ArrayRef< Metadata * > Ops, uint32_t AlignInBits=0)
Definition: DebugInfoMetadata.cpp:1166
llvm::DIExpression::hasAllLocationOps
bool hasAllLocationOps(unsigned N) const
Returns true iff this DIExpression contains at least one instance of DW_OP_LLVM_arg,...
Definition: DebugInfoMetadata.cpp:1418
llvm::DILocation::getMergedLocations
static const DILocation * getMergedLocations(ArrayRef< const DILocation * > Locs)
Try to combine the vector of locations passed as input in a single one.
Definition: DebugInfoMetadata.cpp:87
llvm::DIStringType::StringLength
unsigned MDString Metadata * StringLength
Definition: DebugInfoMetadata.h:877
N
#define N
llvm::DIFile::CSK_MD5
@ CSK_MD5
Definition: DebugInfoMetadata.h:539
llvm::DICompileUnit::DebugNameTableKind::None
@ None
llvm::DIGlobalVariable::File
Metadata MDString MDString Metadata * File
Definition: DebugInfoMetadata.h:2968
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:164
llvm::DIStringType::StringLengthExp
unsigned MDString Metadata Metadata * StringLengthExp
Definition: DebugInfoMetadata.h:878
llvm::DICompositeType::BaseType
unsigned MDString Metadata unsigned Metadata Metadata * BaseType
Definition: DebugInfoMetadata.h:1123
llvm::DIFile::CSK_SHA1
@ CSK_SHA1
Definition: DebugInfoMetadata.h:540
llvm::LLVMContextImpl::DITypeMap
Optional< DenseMap< const MDString *, DICompositeType * > > DITypeMap
Definition: LLVMContextImpl.h:1423
llvm::DIExpression::getNumElements
unsigned getNumElements() const
Definition: DebugInfoMetadata.h:2584
llvm::DISubprogram
Subprogram description.
Definition: DebugInfoMetadata.h:1803
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
llvm::DIExpression::expr_op_end
expr_op_iterator expr_op_end() const
Definition: DebugInfoMetadata.h:2702
llvm::ValueAsMetadata
Value wrapper in the Metadata hierarchy.
Definition: Metadata.h:345
llvm::DIModule
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Definition: DebugInfoMetadata.h:2307
llvm::StringSwitch::Default
R Default(T Value)
Definition: StringSwitch.h:182
llvm::StringSwitch
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:44
llvm::DIDerivedType::BaseType
unsigned StringRef DIFile unsigned DIScope DIType * BaseType
Definition: DebugInfoMetadata.h:980
isCanonical
static bool isCanonical(const MDString *S)
Definition: DebugInfoMetadata.cpp:278
llvm::DIEnumerator::IsUnsigned
int64_t bool IsUnsigned
Definition: DebugInfoMetadata.h:443
llvm::DIDerivedType::AlignInBits
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t AlignInBits
Definition: DebugInfoMetadata.h:981
llvm::DILabel
Label.
Definition: DebugInfoMetadata.h:3148
llvm::DICompileUnit::getNameTableKind
DebugNameTableKind getNameTableKind() const
Definition: DebugInfoMetadata.h:1454
llvm::DIGenericSubrange::getRawStride
Metadata * getRawStride() const
Definition: DebugInfoMetadata.h:393
llvm::DILocalScope
A scope for locals.
Definition: DebugInfoMetadata.h:1527
llvm::DIDerivedType::Scope
unsigned StringRef DIFile unsigned DIScope * Scope
Definition: DebugInfoMetadata.h:980
llvm::DIObjCProperty::File
MDString Metadata * File
Definition: DebugInfoMetadata.h:3253
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:394
llvm::lltok::ChecksumKind
@ ChecksumKind
Definition: LLToken.h:433
llvm::cl::desc
Definition: CommandLine.h:412
llvm::DILocation::Column
unsigned unsigned Column
Definition: DebugInfoMetadata.h:1594
llvm::MDString::getString
StringRef getString() const
Definition: Metadata.cpp:508
llvm::DICompositeType::Name
unsigned MDString * Name
Definition: DebugInfoMetadata.h:1122
llvm::DIDerivedType::getDiscriminantValue
Constant * getDiscriminantValue() const
Definition: DebugInfoMetadata.cpp:621
llvm::MDString
A single uniqued string.
Definition: Metadata.h:612
llvm::DIMacroFile::MIType
unsigned MIType
Definition: DebugInfoMetadata.h:3533
Value.h
llvm::DIModule::File
Metadata * File
Definition: DebugInfoMetadata.h:2349
llvm::DIGlobalVariable::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:2968
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::Metadata::Uniqued
@ Uniqued
Definition: Metadata.h:70
llvm::DIExpression::EntryValue
@ EntryValue
Definition: DebugInfoMetadata.h:2767
llvm::ArrayRef::end
iterator end() const
Definition: ArrayRef.h:153
llvm::DISubprogram::getFlag
static DISPFlags getFlag(StringRef Flag)
Definition: DebugInfoMetadata.cpp:937
llvm::DIFile
File.
Definition: DebugInfoMetadata.h:525
llvm::DIGenericSubrange::getUpperBound
BoundType getUpperBound() const
Definition: DebugInfoMetadata.cpp:505
llvm::DIGlobalVariable::TemplateParams
Metadata MDString MDString Metadata unsigned Metadata bool bool Metadata Metadata * TemplateParams
Definition: DebugInfoMetadata.h:2970
llvm::DIExpression::isValid
bool isValid() const
Definition: DebugInfoMetadata.cpp:1245
llvm::DIExpression::expr_ops
iterator_range< expr_op_iterator > expr_ops() const
Definition: DebugInfoMetadata.h:2705
SmallSet.h
llvm::DICommonBlock::Decl
Metadata Metadata * Decl
Definition: DebugInfoMetadata.h:3031
llvm::DICommonBlock::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:3031
llvm::SmallVectorImpl::insert
iterator insert(iterator I, T &&Elt)
Definition: SmallVector.h:791
llvm::DIExpression::getFragmentInfo
Optional< FragmentInfo > getFragmentInfo() const
Retrieve the details of this fragment expression.
Definition: DebugInfoMetadata.h:2730
llvm::DIExpression::expr_op_begin
expr_op_iterator expr_op_begin() const
Visit the elements via ExprOperand wrappers.
Definition: DebugInfoMetadata.h:2699