LLVM  13.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"
18 #include "llvm/IR/DIBuilder.h"
19 #include "llvm/IR/Function.h"
20 #include "llvm/IR/Instructions.h"
21 
22 #include <numeric>
23 
24 using namespace llvm;
25 
26 const DIExpression::FragmentInfo DebugVariable::DefaultFragment = {
28 
29 DILocation::DILocation(LLVMContext &C, StorageType Storage, unsigned Line,
30  unsigned Column, ArrayRef<Metadata *> MDs,
31  bool ImplicitCode)
32  : MDNode(C, DILocationKind, Storage, MDs) {
33  assert((MDs.size() == 1 || MDs.size() == 2) &&
34  "Expected a scope and optional inlined-at");
35 
36  // Set line and column.
37  assert(Column < (1u << 16) && "Expected 16-bit column");
38 
39  SubclassData32 = Line;
40  SubclassData16 = Column;
41 
42  setImplicitCode(ImplicitCode);
43 }
44 
45 static void adjustColumn(unsigned &Column) {
46  // Set to unknown on overflow. We only have 16 bits to play with here.
47  if (Column >= (1u << 16))
48  Column = 0;
49 }
50 
52  unsigned Column, Metadata *Scope,
53  Metadata *InlinedAt, bool ImplicitCode,
54  StorageType Storage, bool ShouldCreate) {
55  // Fixup column.
57 
58  if (Storage == Uniqued) {
59  if (auto *N = getUniqued(Context.pImpl->DILocations,
60  DILocationInfo::KeyTy(Line, Column, Scope,
62  return N;
63  if (!ShouldCreate)
64  return nullptr;
65  } else {
66  assert(ShouldCreate && "Expected non-uniqued nodes to always be created");
67  }
68 
70  Ops.push_back(Scope);
71  if (InlinedAt)
72  Ops.push_back(InlinedAt);
73  return storeImpl(new (Ops.size()) DILocation(Context, Storage, Line, Column,
74  Ops, ImplicitCode),
75  Storage, Context.pImpl->DILocations);
76 }
77 
78 const
80  if (Locs.empty())
81  return nullptr;
82  if (Locs.size() == 1)
83  return Locs[0];
84  auto *Merged = Locs[0];
85  for (const DILocation *L : llvm::drop_begin(Locs)) {
86  Merged = getMergedLocation(Merged, L);
87  if (Merged == nullptr)
88  break;
89  }
90  return Merged;
91 }
92 
94  const DILocation *LocB) {
95  if (!LocA || !LocB)
96  return nullptr;
97 
98  if (LocA == LocB)
99  return LocA;
100 
101  SmallPtrSet<DILocation *, 5> InlinedLocationsA;
102  for (DILocation *L = LocA->getInlinedAt(); L; L = L->getInlinedAt())
103  InlinedLocationsA.insert(L);
105  DIScope *S = LocA->getScope();
106  DILocation *L = LocA->getInlinedAt();
107  while (S) {
108  Locations.insert(std::make_pair(S, L));
109  S = S->getScope();
110  if (!S && L) {
111  S = L->getScope();
112  L = L->getInlinedAt();
113  }
114  }
115  const DILocation *Result = LocB;
116  S = LocB->getScope();
117  L = LocB->getInlinedAt();
118  while (S) {
119  if (Locations.count(std::make_pair(S, L)))
120  break;
121  S = S->getScope();
122  if (!S && L) {
123  S = L->getScope();
124  L = L->getInlinedAt();
125  }
126  }
127 
128  // If the two locations are irreconsilable, just pick one. This is misleading,
129  // but on the other hand, it's a "line 0" location.
130  if (!S || !isa<DILocalScope>(S))
131  S = LocA->getScope();
132  return DILocation::get(Result->getContext(), 0, 0, S, L);
133 }
134 
135 Optional<unsigned> DILocation::encodeDiscriminator(unsigned BD, unsigned DF, unsigned CI) {
136  std::array<unsigned, 3> Components = {BD, DF, CI};
137  uint64_t RemainingWork = 0U;
138  // We use RemainingWork to figure out if we have no remaining components to
139  // encode. For example: if BD != 0 but DF == 0 && CI == 0, we don't need to
140  // encode anything for the latter 2.
141  // Since any of the input components is at most 32 bits, their sum will be
142  // less than 34 bits, and thus RemainingWork won't overflow.
143  RemainingWork = std::accumulate(Components.begin(), Components.end(), RemainingWork);
144 
145  int I = 0;
146  unsigned Ret = 0;
147  unsigned NextBitInsertionIndex = 0;
148  while (RemainingWork > 0) {
149  unsigned C = Components[I++];
150  RemainingWork -= C;
151  unsigned EC = encodeComponent(C);
152  Ret |= (EC << NextBitInsertionIndex);
153  NextBitInsertionIndex += encodingBits(C);
154  }
155 
156  // Encoding may be unsuccessful because of overflow. We determine success by
157  // checking equivalence of components before & after encoding. Alternatively,
158  // we could determine Success during encoding, but the current alternative is
159  // simpler.
160  unsigned TBD, TDF, TCI = 0;
161  decodeDiscriminator(Ret, TBD, TDF, TCI);
162  if (TBD == BD && TDF == DF && TCI == CI)
163  return Ret;
164  return None;
165 }
166 
167 void DILocation::decodeDiscriminator(unsigned D, unsigned &BD, unsigned &DF,
168  unsigned &CI) {
169  BD = getUnsignedFromPrefixEncoding(D);
170  DF = getUnsignedFromPrefixEncoding(getNextComponentInDiscriminator(D));
171  CI = getUnsignedFromPrefixEncoding(
172  getNextComponentInDiscriminator(getNextComponentInDiscriminator(D)));
173 }
174 
175 
178 #define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME)
179 #include "llvm/IR/DebugInfoFlags.def"
180  .Default(DINode::FlagZero);
181 }
182 
184  switch (Flag) {
185 #define HANDLE_DI_FLAG(ID, NAME) \
186  case Flag##NAME: \
187  return "DIFlag" #NAME;
188 #include "llvm/IR/DebugInfoFlags.def"
189  }
190  return "";
191 }
192 
194  SmallVectorImpl<DIFlags> &SplitFlags) {
195  // Flags that are packed together need to be specially handled, so
196  // that, for example, we emit "DIFlagPublic" and not
197  // "DIFlagPrivate | DIFlagProtected".
198  if (DIFlags A = Flags & FlagAccessibility) {
199  if (A == FlagPrivate)
200  SplitFlags.push_back(FlagPrivate);
201  else if (A == FlagProtected)
202  SplitFlags.push_back(FlagProtected);
203  else
204  SplitFlags.push_back(FlagPublic);
205  Flags &= ~A;
206  }
207  if (DIFlags R = Flags & FlagPtrToMemberRep) {
208  if (R == FlagSingleInheritance)
209  SplitFlags.push_back(FlagSingleInheritance);
210  else if (R == FlagMultipleInheritance)
211  SplitFlags.push_back(FlagMultipleInheritance);
212  else
213  SplitFlags.push_back(FlagVirtualInheritance);
214  Flags &= ~R;
215  }
216  if ((Flags & FlagIndirectVirtualBase) == FlagIndirectVirtualBase) {
217  Flags &= ~FlagIndirectVirtualBase;
218  SplitFlags.push_back(FlagIndirectVirtualBase);
219  }
220 
221 #define HANDLE_DI_FLAG(ID, NAME) \
222  if (DIFlags Bit = Flags & Flag##NAME) { \
223  SplitFlags.push_back(Bit); \
224  Flags &= ~Bit; \
225  }
226 #include "llvm/IR/DebugInfoFlags.def"
227  return Flags;
228 }
229 
231  if (auto *T = dyn_cast<DIType>(this))
232  return T->getScope();
233 
234  if (auto *SP = dyn_cast<DISubprogram>(this))
235  return SP->getScope();
236 
237  if (auto *LB = dyn_cast<DILexicalBlockBase>(this))
238  return LB->getScope();
239 
240  if (auto *NS = dyn_cast<DINamespace>(this))
241  return NS->getScope();
242 
243  if (auto *CB = dyn_cast<DICommonBlock>(this))
244  return CB->getScope();
245 
246  if (auto *M = dyn_cast<DIModule>(this))
247  return M->getScope();
248 
249  assert((isa<DIFile>(this) || isa<DICompileUnit>(this)) &&
250  "Unhandled type of scope.");
251  return nullptr;
252 }
253 
255  if (auto *T = dyn_cast<DIType>(this))
256  return T->getName();
257  if (auto *SP = dyn_cast<DISubprogram>(this))
258  return SP->getName();
259  if (auto *NS = dyn_cast<DINamespace>(this))
260  return NS->getName();
261  if (auto *CB = dyn_cast<DICommonBlock>(this))
262  return CB->getName();
263  if (auto *M = dyn_cast<DIModule>(this))
264  return M->getName();
265  assert((isa<DILexicalBlockBase>(this) || isa<DIFile>(this) ||
266  isa<DICompileUnit>(this)) &&
267  "Unhandled type of scope.");
268  return "";
269 }
270 
271 #ifndef NDEBUG
272 static bool isCanonical(const MDString *S) {
273  return !S || !S->getString().empty();
274 }
275 #endif
276 
277 GenericDINode *GenericDINode::getImpl(LLVMContext &Context, unsigned Tag,
278  MDString *Header,
279  ArrayRef<Metadata *> DwarfOps,
280  StorageType Storage, bool ShouldCreate) {
281  unsigned Hash = 0;
282  if (Storage == Uniqued) {
283  GenericDINodeInfo::KeyTy Key(Tag, Header, DwarfOps);
284  if (auto *N = getUniqued(Context.pImpl->GenericDINodes, Key))
285  return N;
286  if (!ShouldCreate)
287  return nullptr;
288  Hash = Key.getHash();
289  } else {
290  assert(ShouldCreate && "Expected non-uniqued nodes to always be created");
291  }
292 
293  // Use a nullptr for empty headers.
294  assert(isCanonical(Header) && "Expected canonical MDString");
295  Metadata *PreOps[] = {Header};
296  return storeImpl(new (DwarfOps.size() + 1) GenericDINode(
297  Context, Storage, Hash, Tag, PreOps, DwarfOps),
298  Storage, Context.pImpl->GenericDINodes);
299 }
300 
301 void GenericDINode::recalculateHash() {
302  setHash(GenericDINodeInfo::KeyTy::calculateHash(this));
303 }
304 
305 #define UNWRAP_ARGS_IMPL(...) __VA_ARGS__
306 #define UNWRAP_ARGS(ARGS) UNWRAP_ARGS_IMPL ARGS
307 #define DEFINE_GETIMPL_LOOKUP(CLASS, ARGS) \
308  do { \
309  if (Storage == Uniqued) { \
310  if (auto *N = getUniqued(Context.pImpl->CLASS##s, \
311  CLASS##Info::KeyTy(UNWRAP_ARGS(ARGS)))) \
312  return N; \
313  if (!ShouldCreate) \
314  return nullptr; \
315  } else { \
316  assert(ShouldCreate && \
317  "Expected non-uniqued nodes to always be created"); \
318  } \
319  } while (false)
320 #define DEFINE_GETIMPL_STORE(CLASS, ARGS, OPS) \
321  return storeImpl(new (array_lengthof(OPS)) \
322  CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS), \
323  Storage, Context.pImpl->CLASS##s)
324 #define DEFINE_GETIMPL_STORE_NO_OPS(CLASS, ARGS) \
325  return storeImpl(new (0u) CLASS(Context, Storage, UNWRAP_ARGS(ARGS)), \
326  Storage, Context.pImpl->CLASS##s)
327 #define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS) \
328  return storeImpl(new (array_lengthof(OPS)) CLASS(Context, Storage, OPS), \
329  Storage, Context.pImpl->CLASS##s)
330 #define DEFINE_GETIMPL_STORE_N(CLASS, ARGS, OPS, NUM_OPS) \
331  return storeImpl(new (NUM_OPS) \
332  CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS), \
333  Storage, Context.pImpl->CLASS##s)
334 
335 DISubrange *DISubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo,
336  StorageType Storage, bool ShouldCreate) {
339  auto *LB = ConstantAsMetadata::get(
341  return getImpl(Context, CountNode, LB, nullptr, nullptr, Storage,
342  ShouldCreate);
343 }
344 
345 DISubrange *DISubrange::getImpl(LLVMContext &Context, Metadata *CountNode,
346  int64_t Lo, StorageType Storage,
347  bool ShouldCreate) {
348  auto *LB = ConstantAsMetadata::get(
350  return getImpl(Context, CountNode, LB, nullptr, nullptr, Storage,
351  ShouldCreate);
352 }
353 
354 DISubrange *DISubrange::getImpl(LLVMContext &Context, Metadata *CountNode,
355  Metadata *LB, Metadata *UB, Metadata *Stride,
356  StorageType Storage, bool ShouldCreate) {
357  DEFINE_GETIMPL_LOOKUP(DISubrange, (CountNode, LB, UB, Stride));
358  Metadata *Ops[] = {CountNode, LB, UB, Stride};
360 }
361 
362 DISubrange::BoundType DISubrange::getCount() const {
363  Metadata *CB = getRawCountNode();
364  if (!CB)
365  return BoundType();
366 
367  assert((isa<ConstantAsMetadata>(CB) || isa<DIVariable>(CB) ||
368  isa<DIExpression>(CB)) &&
369  "Count must be signed constant or DIVariable or DIExpression");
370 
371  if (auto *MD = dyn_cast<ConstantAsMetadata>(CB))
372  return BoundType(cast<ConstantInt>(MD->getValue()));
373 
374  if (auto *MD = dyn_cast<DIVariable>(CB))
375  return BoundType(MD);
376 
377  if (auto *MD = dyn_cast<DIExpression>(CB))
378  return BoundType(MD);
379 
380  return BoundType();
381 }
382 
383 DISubrange::BoundType DISubrange::getLowerBound() const {
384  Metadata *LB = getRawLowerBound();
385  if (!LB)
386  return BoundType();
387 
388  assert((isa<ConstantAsMetadata>(LB) || isa<DIVariable>(LB) ||
389  isa<DIExpression>(LB)) &&
390  "LowerBound must be signed constant or DIVariable or DIExpression");
391 
392  if (auto *MD = dyn_cast<ConstantAsMetadata>(LB))
393  return BoundType(cast<ConstantInt>(MD->getValue()));
394 
395  if (auto *MD = dyn_cast<DIVariable>(LB))
396  return BoundType(MD);
397 
398  if (auto *MD = dyn_cast<DIExpression>(LB))
399  return BoundType(MD);
400 
401  return BoundType();
402 }
403 
404 DISubrange::BoundType DISubrange::getUpperBound() const {
405  Metadata *UB = getRawUpperBound();
406  if (!UB)
407  return BoundType();
408 
409  assert((isa<ConstantAsMetadata>(UB) || isa<DIVariable>(UB) ||
410  isa<DIExpression>(UB)) &&
411  "UpperBound must be signed constant or DIVariable or DIExpression");
412 
413  if (auto *MD = dyn_cast<ConstantAsMetadata>(UB))
414  return BoundType(cast<ConstantInt>(MD->getValue()));
415 
416  if (auto *MD = dyn_cast<DIVariable>(UB))
417  return BoundType(MD);
418 
419  if (auto *MD = dyn_cast<DIExpression>(UB))
420  return BoundType(MD);
421 
422  return BoundType();
423 }
424 
425 DISubrange::BoundType DISubrange::getStride() const {
426  Metadata *ST = getRawStride();
427  if (!ST)
428  return BoundType();
429 
430  assert((isa<ConstantAsMetadata>(ST) || isa<DIVariable>(ST) ||
431  isa<DIExpression>(ST)) &&
432  "Stride must be signed constant or DIVariable or DIExpression");
433 
434  if (auto *MD = dyn_cast<ConstantAsMetadata>(ST))
435  return BoundType(cast<ConstantInt>(MD->getValue()));
436 
437  if (auto *MD = dyn_cast<DIVariable>(ST))
438  return BoundType(MD);
439 
440  if (auto *MD = dyn_cast<DIExpression>(ST))
441  return BoundType(MD);
442 
443  return BoundType();
444 }
445 
446 DIGenericSubrange *DIGenericSubrange::getImpl(LLVMContext &Context,
447  Metadata *CountNode, Metadata *LB,
448  Metadata *UB, Metadata *Stride,
449  StorageType Storage,
450  bool ShouldCreate) {
451  DEFINE_GETIMPL_LOOKUP(DIGenericSubrange, (CountNode, LB, UB, Stride));
452  Metadata *Ops[] = {CountNode, LB, UB, Stride};
454 }
455 
457  Metadata *CB = getRawCountNode();
458  if (!CB)
459  return BoundType();
460 
461  assert((isa<DIVariable>(CB) || isa<DIExpression>(CB)) &&
462  "Count must be signed constant or DIVariable or DIExpression");
463 
464  if (auto *MD = dyn_cast<DIVariable>(CB))
465  return BoundType(MD);
466 
467  if (auto *MD = dyn_cast<DIExpression>(CB))
468  return BoundType(MD);
469 
470  return BoundType();
471 }
472 
474  Metadata *LB = getRawLowerBound();
475  if (!LB)
476  return BoundType();
477 
478  assert((isa<DIVariable>(LB) || isa<DIExpression>(LB)) &&
479  "LowerBound must be signed constant or DIVariable or DIExpression");
480 
481  if (auto *MD = dyn_cast<DIVariable>(LB))
482  return BoundType(MD);
483 
484  if (auto *MD = dyn_cast<DIExpression>(LB))
485  return BoundType(MD);
486 
487  return BoundType();
488 }
489 
491  Metadata *UB = getRawUpperBound();
492  if (!UB)
493  return BoundType();
494 
495  assert((isa<DIVariable>(UB) || isa<DIExpression>(UB)) &&
496  "UpperBound must be signed constant or DIVariable or DIExpression");
497 
498  if (auto *MD = dyn_cast<DIVariable>(UB))
499  return BoundType(MD);
500 
501  if (auto *MD = dyn_cast<DIExpression>(UB))
502  return BoundType(MD);
503 
504  return BoundType();
505 }
506 
508  Metadata *ST = getRawStride();
509  if (!ST)
510  return BoundType();
511 
512  assert((isa<DIVariable>(ST) || isa<DIExpression>(ST)) &&
513  "Stride must be signed constant or DIVariable or DIExpression");
514 
515  if (auto *MD = dyn_cast<DIVariable>(ST))
516  return BoundType(MD);
517 
518  if (auto *MD = dyn_cast<DIExpression>(ST))
519  return BoundType(MD);
520 
521  return BoundType();
522 }
523 
524 DIEnumerator *DIEnumerator::getImpl(LLVMContext &Context, const APInt &Value,
525  bool IsUnsigned, MDString *Name,
526  StorageType Storage, bool ShouldCreate) {
527  assert(isCanonical(Name) && "Expected canonical MDString");
529  Metadata *Ops[] = {Name};
531 }
532 
533 DIBasicType *DIBasicType::getImpl(LLVMContext &Context, unsigned Tag,
534  MDString *Name, uint64_t SizeInBits,
535  uint32_t AlignInBits, unsigned Encoding,
536  DIFlags Flags, StorageType Storage,
537  bool ShouldCreate) {
538  assert(isCanonical(Name) && "Expected canonical MDString");
540  (Tag, Name, SizeInBits, AlignInBits, Encoding, Flags));
541  Metadata *Ops[] = {nullptr, nullptr, Name};
543  Flags), Ops);
544 }
545 
547  switch (getEncoding()) {
548  case dwarf::DW_ATE_signed:
549  case dwarf::DW_ATE_signed_char:
550  return Signedness::Signed;
551  case dwarf::DW_ATE_unsigned:
552  case dwarf::DW_ATE_unsigned_char:
553  return Signedness::Unsigned;
554  default:
555  return None;
556  }
557 }
558 
559 DIStringType *DIStringType::getImpl(LLVMContext &Context, unsigned Tag,
560  MDString *Name, Metadata *StringLength,
561  Metadata *StringLengthExp,
562  uint64_t SizeInBits, uint32_t AlignInBits,
563  unsigned Encoding, StorageType Storage,
564  bool ShouldCreate) {
565  assert(isCanonical(Name) && "Expected canonical MDString");
567  SizeInBits, AlignInBits, Encoding));
568  Metadata *Ops[] = {nullptr, nullptr, Name, StringLength, StringLengthExp};
570  Ops);
571 }
572 
573 DIDerivedType *DIDerivedType::getImpl(
574  LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
575  unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
576  uint32_t AlignInBits, uint64_t OffsetInBits,
577  Optional<unsigned> DWARFAddressSpace, DIFlags Flags, Metadata *ExtraData,
578  StorageType Storage, bool ShouldCreate) {
579  assert(isCanonical(Name) && "Expected canonical MDString");
582  AlignInBits, OffsetInBits, DWARFAddressSpace, Flags,
583  ExtraData));
584  Metadata *Ops[] = {File, Scope, Name, BaseType, ExtraData};
587  DWARFAddressSpace, Flags), Ops);
588 }
589 
590 DICompositeType *DICompositeType::getImpl(
591  LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
592  unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
593  uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags,
594  Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder,
595  Metadata *TemplateParams, MDString *Identifier, Metadata *Discriminator,
596  Metadata *DataLocation, Metadata *Associated, Metadata *Allocated,
597  Metadata *Rank, StorageType Storage, bool ShouldCreate) {
598  assert(isCanonical(Name) && "Expected canonical MDString");
599 
600  // Keep this in sync with buildODRType.
606  Metadata *Ops[] = {File, Scope, Name, BaseType,
609  Rank};
612  Ops);
613 }
614 
616  LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name,
617  Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType,
618  uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
619  DIFlags Flags, Metadata *Elements, unsigned RuntimeLang,
620  Metadata *VTableHolder, Metadata *TemplateParams, Metadata *Discriminator,
621  Metadata *DataLocation, Metadata *Associated, Metadata *Allocated,
622  Metadata *Rank) {
623  assert(!Identifier.getString().empty() && "Expected valid identifier");
625  return nullptr;
626  auto *&CT = (*Context.pImpl->DITypeMap)[&Identifier];
627  if (!CT)
628  return CT = DICompositeType::getDistinct(
630  AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
633 
634  // Only mutate CT if it's a forward declaration and the new operands aren't.
635  assert(CT->getRawIdentifier() == &Identifier && "Wrong ODR identifier?");
636  if (!CT->isForwardDecl() || (Flags & DINode::FlagFwdDecl))
637  return CT;
638 
639  // Mutate CT in place. Keep this in sync with getImpl.
640  CT->mutate(Tag, Line, RuntimeLang, SizeInBits, AlignInBits, OffsetInBits,
641  Flags);
642  Metadata *Ops[] = {File, Scope, Name, BaseType,
645  Rank};
646  assert((std::end(Ops) - std::begin(Ops)) == (int)CT->getNumOperands() &&
647  "Mismatched number of operands");
648  for (unsigned I = 0, E = CT->getNumOperands(); I != E; ++I)
649  if (Ops[I] != CT->getOperand(I))
650  CT->setOperand(I, Ops[I]);
651  return CT;
652 }
653 
654 DICompositeType *DICompositeType::getODRType(
655  LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name,
656  Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType,
657  uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
658  DIFlags Flags, Metadata *Elements, unsigned RuntimeLang,
659  Metadata *VTableHolder, Metadata *TemplateParams, Metadata *Discriminator,
660  Metadata *DataLocation, Metadata *Associated, Metadata *Allocated,
661  Metadata *Rank) {
662  assert(!Identifier.getString().empty() && "Expected valid identifier");
664  return nullptr;
665  auto *&CT = (*Context.pImpl->DITypeMap)[&Identifier];
666  if (!CT)
668  Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
671  Allocated, Rank);
672  return CT;
673 }
674 
676  MDString &Identifier) {
677  assert(!Identifier.getString().empty() && "Expected valid identifier");
679  return nullptr;
680  return Context.pImpl->DITypeMap->lookup(&Identifier);
681 }
682 
683 DISubroutineType *DISubroutineType::getImpl(LLVMContext &Context, DIFlags Flags,
684  uint8_t CC, Metadata *TypeArray,
685  StorageType Storage,
686  bool ShouldCreate) {
688  Metadata *Ops[] = {nullptr, nullptr, nullptr, TypeArray};
690 }
691 
692 // FIXME: Implement this string-enum correspondence with a .def file and macros,
693 // so that the association is explicit rather than implied.
694 static const char *ChecksumKindName[DIFile::CSK_Last] = {
695  "CSK_MD5",
696  "CSK_SHA1",
697  "CSK_SHA256",
698 };
699 
700 StringRef DIFile::getChecksumKindAsString(ChecksumKind CSKind) {
701  assert(CSKind <= DIFile::CSK_Last && "Invalid checksum kind");
702  // The first space was originally the CSK_None variant, which is now
703  // obsolete, but the space is still reserved in ChecksumKind, so we account
704  // for it here.
705  return ChecksumKindName[CSKind - 1];
706 }
707 
710  .Case("CSK_MD5", DIFile::CSK_MD5)
711  .Case("CSK_SHA1", DIFile::CSK_SHA1)
712  .Case("CSK_SHA256", DIFile::CSK_SHA256)
713  .Default(None);
714 }
715 
716 DIFile *DIFile::getImpl(LLVMContext &Context, MDString *Filename,
717  MDString *Directory,
719  Optional<MDString *> Source, StorageType Storage,
720  bool ShouldCreate) {
721  assert(isCanonical(Filename) && "Expected canonical MDString");
722  assert(isCanonical(Directory) && "Expected canonical MDString");
723  assert((!CS || isCanonical(CS->Value)) && "Expected canonical MDString");
724  assert((!Source || isCanonical(*Source)) && "Expected canonical MDString");
726  Metadata *Ops[] = {Filename, Directory, CS ? CS->Value : nullptr,
727  Source.getValueOr(nullptr)};
728  DEFINE_GETIMPL_STORE(DIFile, (CS, Source), Ops);
729 }
730 
731 DICompileUnit *DICompileUnit::getImpl(
733  MDString *Producer, bool IsOptimized, MDString *Flags,
734  unsigned RuntimeVersion, MDString *SplitDebugFilename,
735  unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes,
736  Metadata *GlobalVariables, Metadata *ImportedEntities, Metadata *Macros,
737  uint64_t DWOId, bool SplitDebugInlining, bool DebugInfoForProfiling,
738  unsigned NameTableKind, bool RangesBaseAddress, MDString *SysRoot,
739  MDString *SDK, StorageType Storage, bool ShouldCreate) {
740  assert(Storage != Uniqued && "Cannot unique DICompileUnit");
741  assert(isCanonical(Producer) && "Expected canonical MDString");
742  assert(isCanonical(Flags) && "Expected canonical MDString");
743  assert(isCanonical(SplitDebugFilename) && "Expected canonical MDString");
744 
745  Metadata *Ops[] = {File,
746  Producer,
747  Flags,
749  EnumTypes,
753  Macros,
754  SysRoot,
755  SDK};
756  return storeImpl(new (array_lengthof(Ops)) DICompileUnit(
757  Context, Storage, SourceLanguage, IsOptimized,
758  RuntimeVersion, EmissionKind, DWOId, SplitDebugInlining,
759  DebugInfoForProfiling, NameTableKind, RangesBaseAddress,
760  Ops),
761  Storage);
762 }
763 
767  .Case("NoDebug", NoDebug)
768  .Case("FullDebug", FullDebug)
769  .Case("LineTablesOnly", LineTablesOnly)
770  .Case("DebugDirectivesOnly", DebugDirectivesOnly)
771  .Default(None);
772 }
773 
777  .Case("Default", DebugNameTableKind::Default)
780  .Default(None);
781 }
782 
784  switch (EK) {
785  case NoDebug: return "NoDebug";
786  case FullDebug: return "FullDebug";
787  case LineTablesOnly: return "LineTablesOnly";
788  case DebugDirectivesOnly: return "DebugDirectivesOnly";
789  }
790  return nullptr;
791 }
792 
794  switch (NTK) {
796  return nullptr;
798  return "GNU";
800  return "None";
801  }
802  return nullptr;
803 }
804 
806  if (auto *Block = dyn_cast<DILexicalBlockBase>(this))
807  return Block->getScope()->getSubprogram();
808  return const_cast<DISubprogram *>(cast<DISubprogram>(this));
809 }
810 
812  if (auto *File = dyn_cast<DILexicalBlockFile>(this))
813  return File->getScope()->getNonLexicalBlockFileScope();
814  return const_cast<DILocalScope *>(this);
815 }
816 
819 #define HANDLE_DISP_FLAG(ID, NAME) .Case("DISPFlag" #NAME, SPFlag##NAME)
820 #include "llvm/IR/DebugInfoFlags.def"
821  .Default(SPFlagZero);
822 }
823 
825  switch (Flag) {
826  // Appease a warning.
827  case SPFlagVirtuality:
828  return "";
829 #define HANDLE_DISP_FLAG(ID, NAME) \
830  case SPFlag##NAME: \
831  return "DISPFlag" #NAME;
832 #include "llvm/IR/DebugInfoFlags.def"
833  }
834  return "";
835 }
836 
839  SmallVectorImpl<DISPFlags> &SplitFlags) {
840  // Multi-bit fields can require special handling. In our case, however, the
841  // only multi-bit field is virtuality, and all its values happen to be
842  // single-bit values, so the right behavior just falls out.
843 #define HANDLE_DISP_FLAG(ID, NAME) \
844  if (DISPFlags Bit = Flags & SPFlag##NAME) { \
845  SplitFlags.push_back(Bit); \
846  Flags &= ~Bit; \
847  }
848 #include "llvm/IR/DebugInfoFlags.def"
849  return Flags;
850 }
851 
852 DISubprogram *DISubprogram::getImpl(
854  MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
855  unsigned ScopeLine, Metadata *ContainingType, unsigned VirtualIndex,
856  int ThisAdjustment, DIFlags Flags, DISPFlags SPFlags, Metadata *Unit,
857  Metadata *TemplateParams, Metadata *Declaration, Metadata *RetainedNodes,
858  Metadata *ThrownTypes, StorageType Storage, bool ShouldCreate) {
859  assert(isCanonical(Name) && "Expected canonical MDString");
860  assert(isCanonical(LinkageName) && "Expected canonical MDString");
862  (Scope, Name, LinkageName, File, Line, Type, ScopeLine,
863  ContainingType, VirtualIndex, ThisAdjustment, Flags,
864  SPFlags, Unit, TemplateParams, Declaration,
869  if (!ThrownTypes) {
870  Ops.pop_back();
871  if (!TemplateParams) {
872  Ops.pop_back();
873  if (!ContainingType)
874  Ops.pop_back();
875  }
876  }
878  DISubprogram,
879  (Line, ScopeLine, VirtualIndex, ThisAdjustment, Flags, SPFlags), Ops,
880  Ops.size());
881 }
882 
883 bool DISubprogram::describes(const Function *F) const {
884  assert(F && "Invalid function");
885  return F->getSubprogram() == this;
886 }
887 
888 DILexicalBlock *DILexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope,
889  Metadata *File, unsigned Line,
890  unsigned Column, StorageType Storage,
891  bool ShouldCreate) {
892  // Fixup column.
893  adjustColumn(Column);
894 
895  assert(Scope && "Expected scope");
896  DEFINE_GETIMPL_LOOKUP(DILexicalBlock, (Scope, File, Line, Column));
897  Metadata *Ops[] = {File, Scope};
898  DEFINE_GETIMPL_STORE(DILexicalBlock, (Line, Column), Ops);
899 }
900 
901 DILexicalBlockFile *DILexicalBlockFile::getImpl(LLVMContext &Context,
903  unsigned Discriminator,
904  StorageType Storage,
905  bool ShouldCreate) {
906  assert(Scope && "Expected scope");
908  Metadata *Ops[] = {File, Scope};
909  DEFINE_GETIMPL_STORE(DILexicalBlockFile, (Discriminator), Ops);
910 }
911 
912 DINamespace *DINamespace::getImpl(LLVMContext &Context, Metadata *Scope,
913  MDString *Name, bool ExportSymbols,
914  StorageType Storage, bool ShouldCreate) {
915  assert(isCanonical(Name) && "Expected canonical MDString");
916  DEFINE_GETIMPL_LOOKUP(DINamespace, (Scope, Name, ExportSymbols));
917  // The nullptr is for DIScope's File operand. This should be refactored.
918  Metadata *Ops[] = {nullptr, Scope, Name};
919  DEFINE_GETIMPL_STORE(DINamespace, (ExportSymbols), Ops);
920 }
921 
922 DICommonBlock *DICommonBlock::getImpl(LLVMContext &Context, Metadata *Scope,
923  Metadata *Decl, MDString *Name,
924  Metadata *File, unsigned LineNo,
925  StorageType Storage, bool ShouldCreate) {
926  assert(isCanonical(Name) && "Expected canonical MDString");
928  // The nullptr is for DIScope's File operand. This should be refactored.
929  Metadata *Ops[] = {Scope, Decl, Name, File};
930  DEFINE_GETIMPL_STORE(DICommonBlock, (LineNo), Ops);
931 }
932 
933 DIModule *DIModule::getImpl(LLVMContext &Context, Metadata *File,
935  MDString *ConfigurationMacros,
936  MDString *IncludePath, MDString *APINotesFile,
937  unsigned LineNo, bool IsDecl, StorageType Storage,
938  bool ShouldCreate) {
939  assert(isCanonical(Name) && "Expected canonical MDString");
941  IncludePath, APINotesFile, LineNo, IsDecl));
944  DEFINE_GETIMPL_STORE(DIModule, (LineNo, IsDecl), Ops);
945 }
946 
948 DITemplateTypeParameter::getImpl(LLVMContext &Context, MDString *Name,
949  Metadata *Type, bool isDefault,
950  StorageType Storage, bool ShouldCreate) {
951  assert(isCanonical(Name) && "Expected canonical MDString");
953  Metadata *Ops[] = {Name, Type};
955 }
956 
957 DITemplateValueParameter *DITemplateValueParameter::getImpl(
958  LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type,
959  bool isDefault, Metadata *Value, StorageType Storage, bool ShouldCreate) {
960  assert(isCanonical(Name) && "Expected canonical MDString");
962  (Tag, Name, Type, isDefault, Value));
963  Metadata *Ops[] = {Name, Type, Value};
965 }
966 
968 DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
969  MDString *LinkageName, Metadata *File, unsigned Line,
970  Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
971  Metadata *StaticDataMemberDeclaration,
972  Metadata *TemplateParams, uint32_t AlignInBits,
973  StorageType Storage, bool ShouldCreate) {
974  assert(isCanonical(Name) && "Expected canonical MDString");
975  assert(isCanonical(LinkageName) && "Expected canonical MDString");
977  Type, IsLocalToUnit, IsDefinition,
980  Metadata *Ops[] = {Scope,
981  Name,
982  File,
983  Type,
984  Name,
985  LinkageName,
989  (Line, IsLocalToUnit, IsDefinition, AlignInBits), Ops);
990 }
991 
992 DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope,
994  unsigned Line, Metadata *Type,
995  unsigned Arg, DIFlags Flags,
996  uint32_t AlignInBits,
997  StorageType Storage,
998  bool ShouldCreate) {
999  // 64K ought to be enough for any frontend.
1000  assert(Arg <= UINT16_MAX && "Expected argument number to fit in 16-bits");
1001 
1002  assert(Scope && "Expected scope");
1003  assert(isCanonical(Name) && "Expected canonical MDString");
1005  (Scope, Name, File, Line, Type, Arg, Flags,
1006  AlignInBits));
1007  Metadata *Ops[] = {Scope, Name, File, Type};
1008  DEFINE_GETIMPL_STORE(DILocalVariable, (Line, Arg, Flags, AlignInBits), Ops);
1009 }
1010 
1012  // This is used by the Verifier so be mindful of broken types.
1013  const Metadata *RawType = getRawType();
1014  while (RawType) {
1015  // Try to get the size directly.
1016  if (auto *T = dyn_cast<DIType>(RawType))
1017  if (uint64_t Size = T->getSizeInBits())
1018  return Size;
1019 
1020  if (auto *DT = dyn_cast<DIDerivedType>(RawType)) {
1021  // Look at the base type.
1022  RawType = DT->getRawBaseType();
1023  continue;
1024  }
1025 
1026  // Missing type or size.
1027  break;
1028  }
1029 
1030  // Fail gracefully.
1031  return None;
1032 }
1033 
1034 DILabel *DILabel::getImpl(LLVMContext &Context, Metadata *Scope,
1035  MDString *Name, Metadata *File, unsigned Line,
1036  StorageType Storage,
1037  bool ShouldCreate) {
1038  assert(Scope && "Expected scope");
1039  assert(isCanonical(Name) && "Expected canonical MDString");
1041  (Scope, Name, File, Line));
1042  Metadata *Ops[] = {Scope, Name, File};
1043  DEFINE_GETIMPL_STORE(DILabel, (Line), Ops);
1044 }
1045 
1046 DIExpression *DIExpression::getImpl(LLVMContext &Context,
1047  ArrayRef<uint64_t> Elements,
1048  StorageType Storage, bool ShouldCreate) {
1049  DEFINE_GETIMPL_LOOKUP(DIExpression, (Elements));
1051 }
1052 
1054  uint64_t Op = getOp();
1055 
1056  if (Op >= dwarf::DW_OP_breg0 && Op <= dwarf::DW_OP_breg31)
1057  return 2;
1058 
1059  switch (Op) {
1062  case dwarf::DW_OP_bregx:
1063  return 3;
1064  case dwarf::DW_OP_constu:
1065  case dwarf::DW_OP_consts:
1066  case dwarf::DW_OP_deref_size:
1067  case dwarf::DW_OP_plus_uconst:
1070  case dwarf::DW_OP_LLVM_arg:
1071  case dwarf::DW_OP_regx:
1072  return 2;
1073  default:
1074  return 1;
1075  }
1076 }
1077 
1079  for (auto I = expr_op_begin(), E = expr_op_end(); I != E; ++I) {
1080  // Check that there's space for the operand.
1081  if (I->get() + I->getSize() > E->get())
1082  return false;
1083 
1084  uint64_t Op = I->getOp();
1085  if ((Op >= dwarf::DW_OP_reg0 && Op <= dwarf::DW_OP_reg31) ||
1086  (Op >= dwarf::DW_OP_breg0 && Op <= dwarf::DW_OP_breg31))
1087  return true;
1088 
1089  // Check that the operand is valid.
1090  switch (Op) {
1091  default:
1092  return false;
1094  // A fragment operator must appear at the end.
1095  return I->get() + I->getSize() == E->get();
1096  case dwarf::DW_OP_stack_value: {
1097  // Must be the last one or followed by a DW_OP_LLVM_fragment.
1098  if (I->get() + I->getSize() == E->get())
1099  break;
1100  auto J = I;
1101  if ((++J)->getOp() != dwarf::DW_OP_LLVM_fragment)
1102  return false;
1103  break;
1104  }
1105  case dwarf::DW_OP_swap: {
1106  // Must be more than one implicit element on the stack.
1107 
1108  // FIXME: A better way to implement this would be to add a local variable
1109  // that keeps track of the stack depth and introduce something like a
1110  // DW_LLVM_OP_implicit_location as a placeholder for the location this
1111  // DIExpression is attached to, or else pass the number of implicit stack
1112  // elements into isValid.
1113  if (getNumElements() == 1)
1114  return false;
1115  break;
1116  }
1118  // An entry value operator must appear at the beginning and the number of
1119  // operations it cover can currently only be 1, because we support only
1120  // entry values of a simple register location. One reason for this is that
1121  // we currently can't calculate the size of the resulting DWARF block for
1122  // other expressions.
1123  return I->get() == expr_op_begin()->get() && I->getArg(0) == 1;
1124  }
1127  case dwarf::DW_OP_LLVM_arg:
1129  case dwarf::DW_OP_constu:
1130  case dwarf::DW_OP_plus_uconst:
1131  case dwarf::DW_OP_plus:
1132  case dwarf::DW_OP_minus:
1133  case dwarf::DW_OP_mul:
1134  case dwarf::DW_OP_div:
1135  case dwarf::DW_OP_mod:
1136  case dwarf::DW_OP_or:
1137  case dwarf::DW_OP_and:
1138  case dwarf::DW_OP_xor:
1139  case dwarf::DW_OP_shl:
1140  case dwarf::DW_OP_shr:
1141  case dwarf::DW_OP_shra:
1142  case dwarf::DW_OP_deref:
1143  case dwarf::DW_OP_deref_size:
1144  case dwarf::DW_OP_xderef:
1145  case dwarf::DW_OP_lit0:
1146  case dwarf::DW_OP_not:
1147  case dwarf::DW_OP_dup:
1148  case dwarf::DW_OP_regx:
1149  case dwarf::DW_OP_bregx:
1150  case dwarf::DW_OP_push_object_address:
1151  case dwarf::DW_OP_over:
1152  case dwarf::DW_OP_consts:
1153  break;
1154  }
1155  }
1156  return true;
1157 }
1158 
1160  if (!isValid())
1161  return false;
1162 
1163  if (getNumElements() == 0)
1164  return false;
1165 
1166  for (const auto &It : expr_ops()) {
1167  switch (It.getOp()) {
1168  default:
1169  break;
1170  case dwarf::DW_OP_stack_value:
1172  return true;
1173  }
1174  }
1175 
1176  return false;
1177 }
1178 
1180  if (!isValid())
1181  return false;
1182 
1183  if (getNumElements() == 0)
1184  return false;
1185 
1186  // If there are any elements other than fragment or tag_offset, then some
1187  // kind of complex computation occurs.
1188  for (const auto &It : expr_ops()) {
1189  switch (It.getOp()) {
1192  continue;
1193  default: return true;
1194  }
1195  }
1196 
1197  return false;
1198 }
1199 
1202  for (auto I = Start; I != End; ++I)
1203  if (I->getOp() == dwarf::DW_OP_LLVM_fragment) {
1204  DIExpression::FragmentInfo Info = {I->getArg(1), I->getArg(0)};
1205  return Info;
1206  }
1207  return None;
1208 }
1209 
1211  int64_t Offset) {
1212  if (Offset > 0) {
1213  Ops.push_back(dwarf::DW_OP_plus_uconst);
1214  Ops.push_back(Offset);
1215  } else if (Offset < 0) {
1216  Ops.push_back(dwarf::DW_OP_constu);
1217  Ops.push_back(-Offset);
1218  Ops.push_back(dwarf::DW_OP_minus);
1219  }
1220 }
1221 
1223  if (getNumElements() == 0) {
1224  Offset = 0;
1225  return true;
1226  }
1227 
1228  if (getNumElements() == 2 && Elements[0] == dwarf::DW_OP_plus_uconst) {
1229  Offset = Elements[1];
1230  return true;
1231  }
1232 
1233  if (getNumElements() == 3 && Elements[0] == dwarf::DW_OP_constu) {
1234  if (Elements[2] == dwarf::DW_OP_plus) {
1235  Offset = Elements[1];
1236  return true;
1237  }
1238  if (Elements[2] == dwarf::DW_OP_minus) {
1239  Offset = -Elements[1];
1240  return true;
1241  }
1242  }
1243 
1244  return false;
1245 }
1246 
1248  unsigned &AddrClass) {
1249  // FIXME: This seems fragile. Nothing that verifies that these elements
1250  // actually map to ops and not operands.
1251  const unsigned PatternSize = 4;
1252  if (Expr->Elements.size() >= PatternSize &&
1253  Expr->Elements[PatternSize - 4] == dwarf::DW_OP_constu &&
1254  Expr->Elements[PatternSize - 2] == dwarf::DW_OP_swap &&
1255  Expr->Elements[PatternSize - 1] == dwarf::DW_OP_xderef) {
1256  AddrClass = Expr->Elements[PatternSize - 3];
1257 
1258  if (Expr->Elements.size() == PatternSize)
1259  return nullptr;
1260  return DIExpression::get(Expr->getContext(),
1261  makeArrayRef(&*Expr->Elements.begin(),
1262  Expr->Elements.size() - PatternSize));
1263  }
1264  return Expr;
1265 }
1266 
1268  int64_t Offset) {
1270  if (Flags & DIExpression::DerefBefore)
1271  Ops.push_back(dwarf::DW_OP_deref);
1272 
1273  appendOffset(Ops, Offset);
1274  if (Flags & DIExpression::DerefAfter)
1275  Ops.push_back(dwarf::DW_OP_deref);
1276 
1277  bool StackValue = Flags & DIExpression::StackValue;
1278  bool EntryValue = Flags & DIExpression::EntryValue;
1279 
1280  return prependOpcodes(Expr, Ops, StackValue, EntryValue);
1281 }
1282 
1284  ArrayRef<uint64_t> Ops,
1285  unsigned ArgNo, bool StackValue) {
1286  assert(Expr && "Can't add ops to this expression");
1287 
1288  // Handle non-variadic intrinsics by prepending the opcodes.
1289  if (!any_of(Expr->expr_ops(),
1290  [](auto Op) { return Op.getOp() == dwarf::DW_OP_LLVM_arg; })) {
1291  assert(ArgNo == 0 &&
1292  "Location Index must be 0 for a non-variadic expression.");
1293  SmallVector<uint64_t, 8> NewOps(Ops.begin(), Ops.end());
1294  return DIExpression::prependOpcodes(Expr, NewOps, StackValue);
1295  }
1296 
1297  SmallVector<uint64_t, 8> NewOps;
1298  for (auto Op : Expr->expr_ops()) {
1299  Op.appendToVector(NewOps);
1300  if (Op.getOp() == dwarf::DW_OP_LLVM_arg && Op.getArg(0) == ArgNo)
1301  NewOps.insert(NewOps.end(), Ops.begin(), Ops.end());
1302  }
1303 
1304  return DIExpression::get(Expr->getContext(), NewOps);
1305 }
1306 
1308  uint64_t OldArg, uint64_t NewArg) {
1309  assert(Expr && "Can't replace args in this expression");
1310 
1311  SmallVector<uint64_t, 8> NewOps;
1312 
1313  for (auto Op : Expr->expr_ops()) {
1314  if (Op.getOp() != dwarf::DW_OP_LLVM_arg || Op.getArg(0) < OldArg) {
1315  Op.appendToVector(NewOps);
1316  continue;
1317  }
1318  NewOps.push_back(dwarf::DW_OP_LLVM_arg);
1319  uint64_t Arg = Op.getArg(0) == OldArg ? NewArg : Op.getArg(0);
1320  // OldArg has been deleted from the Op list, so decrement all indices
1321  // greater than it.
1322  if (Arg > OldArg)
1323  --Arg;
1324  NewOps.push_back(Arg);
1325  }
1326  return DIExpression::get(Expr->getContext(), NewOps);
1327 }
1328 
1331  bool StackValue,
1332  bool EntryValue) {
1333  assert(Expr && "Can't prepend ops to this expression");
1334 
1335  if (EntryValue) {
1336  Ops.push_back(dwarf::DW_OP_LLVM_entry_value);
1337  // Use a block size of 1 for the target register operand. The
1338  // DWARF backend currently cannot emit entry values with a block
1339  // size > 1.
1340  Ops.push_back(1);
1341  }
1342 
1343  // If there are no ops to prepend, do not even add the DW_OP_stack_value.
1344  if (Ops.empty())
1345  StackValue = false;
1346  for (auto Op : Expr->expr_ops()) {
1347  // A DW_OP_stack_value comes at the end, but before a DW_OP_LLVM_fragment.
1348  if (StackValue) {
1349  if (Op.getOp() == dwarf::DW_OP_stack_value)
1350  StackValue = false;
1351  else if (Op.getOp() == dwarf::DW_OP_LLVM_fragment) {
1352  Ops.push_back(dwarf::DW_OP_stack_value);
1353  StackValue = false;
1354  }
1355  }
1356  Op.appendToVector(Ops);
1357  }
1358  if (StackValue)
1359  Ops.push_back(dwarf::DW_OP_stack_value);
1360  return DIExpression::get(Expr->getContext(), Ops);
1361 }
1362 
1364  ArrayRef<uint64_t> Ops) {
1365  assert(Expr && !Ops.empty() && "Can't append ops to this expression");
1366 
1367  // Copy Expr's current op list.
1369  for (auto Op : Expr->expr_ops()) {
1370  // Append new opcodes before DW_OP_{stack_value, LLVM_fragment}.
1371  if (Op.getOp() == dwarf::DW_OP_stack_value ||
1372  Op.getOp() == dwarf::DW_OP_LLVM_fragment) {
1373  NewOps.append(Ops.begin(), Ops.end());
1374 
1375  // Ensure that the new opcodes are only appended once.
1376  Ops = None;
1377  }
1378  Op.appendToVector(NewOps);
1379  }
1380 
1381  NewOps.append(Ops.begin(), Ops.end());
1382  auto *result = DIExpression::get(Expr->getContext(), NewOps);
1383  assert(result->isValid() && "concatenated expression is not valid");
1384  return result;
1385 }
1386 
1388  ArrayRef<uint64_t> Ops) {
1389  assert(Expr && !Ops.empty() && "Can't append ops to this expression");
1390  assert(none_of(Ops,
1391  [](uint64_t Op) {
1392  return Op == dwarf::DW_OP_stack_value ||
1394  }) &&
1395  "Can't append this op");
1396 
1397  // Append a DW_OP_deref after Expr's current op list if it's non-empty and
1398  // has no DW_OP_stack_value.
1399  //
1400  // Match .* DW_OP_stack_value (DW_OP_LLVM_fragment A B)?.
1402  unsigned DropUntilStackValue = FI.hasValue() ? 3 : 0;
1403  ArrayRef<uint64_t> ExprOpsBeforeFragment =
1404  Expr->getElements().drop_back(DropUntilStackValue);
1405  bool NeedsDeref = (Expr->getNumElements() > DropUntilStackValue) &&
1406  (ExprOpsBeforeFragment.back() != dwarf::DW_OP_stack_value);
1407  bool NeedsStackValue = NeedsDeref || ExprOpsBeforeFragment.empty();
1408 
1409  // Append a DW_OP_deref after Expr's current op list if needed, then append
1410  // the new ops, and finally ensure that a single DW_OP_stack_value is present.
1412  if (NeedsDeref)
1413  NewOps.push_back(dwarf::DW_OP_deref);
1414  NewOps.append(Ops.begin(), Ops.end());
1415  if (NeedsStackValue)
1416  NewOps.push_back(dwarf::DW_OP_stack_value);
1417  return DIExpression::append(Expr, NewOps);
1418 }
1419 
1421  const DIExpression *Expr, unsigned OffsetInBits, unsigned SizeInBits) {
1423  // Copy over the expression, but leave off any trailing DW_OP_LLVM_fragment.
1424  if (Expr) {
1425  for (auto Op : Expr->expr_ops()) {
1426  switch (Op.getOp()) {
1427  default: break;
1428  case dwarf::DW_OP_shr:
1429  case dwarf::DW_OP_shra:
1430  case dwarf::DW_OP_shl:
1431  case dwarf::DW_OP_plus:
1432  case dwarf::DW_OP_plus_uconst:
1433  case dwarf::DW_OP_minus:
1434  // We can't safely split arithmetic or shift operations into multiple
1435  // fragments because we can't express carry-over between fragments.
1436  //
1437  // FIXME: We *could* preserve the lowest fragment of a constant offset
1438  // operation if the offset fits into SizeInBits.
1439  return None;
1441  // Make the new offset point into the existing fragment.
1442  uint64_t FragmentOffsetInBits = Op.getArg(0);
1443  uint64_t FragmentSizeInBits = Op.getArg(1);
1444  (void)FragmentSizeInBits;
1445  assert((OffsetInBits + SizeInBits <= FragmentSizeInBits) &&
1446  "new fragment outside of original fragment");
1447  OffsetInBits += FragmentOffsetInBits;
1448  continue;
1449  }
1450  }
1451  Op.appendToVector(Ops);
1452  }
1453  }
1454  assert(Expr && "Unknown DIExpression");
1455  Ops.push_back(dwarf::DW_OP_LLVM_fragment);
1456  Ops.push_back(OffsetInBits);
1457  Ops.push_back(SizeInBits);
1458  return DIExpression::get(Expr->getContext(), Ops);
1459 }
1460 
1463 
1464  // Recognize signed and unsigned constants.
1465  // An signed constants can be represented as DW_OP_consts C DW_OP_stack_value
1466  // (DW_OP_LLVM_fragment of Len).
1467  // An unsigned constant can be represented as
1468  // DW_OP_constu C DW_OP_stack_value (DW_OP_LLVM_fragment of Len).
1469 
1470  if ((getNumElements() != 2 && getNumElements() != 3 &&
1471  getNumElements() != 6) ||
1472  (getElement(0) != dwarf::DW_OP_consts &&
1473  getElement(0) != dwarf::DW_OP_constu))
1474  return None;
1475 
1476  if (getNumElements() == 2 && getElement(0) == dwarf::DW_OP_consts)
1477  return SignedOrUnsignedConstant::SignedConstant;
1478 
1479  if ((getNumElements() == 3 && getElement(2) != dwarf::DW_OP_stack_value) ||
1480  (getNumElements() == 6 && (getElement(2) != dwarf::DW_OP_stack_value ||
1482  return None;
1483  return getElement(0) == dwarf::DW_OP_constu
1484  ? SignedOrUnsignedConstant::UnsignedConstant
1485  : SignedOrUnsignedConstant::SignedConstant;
1486 }
1487 
1488 DIExpression::ExtOps DIExpression::getExtOps(unsigned FromSize, unsigned ToSize,
1489  bool Signed) {
1490  dwarf::TypeKind TK = Signed ? dwarf::DW_ATE_signed : dwarf::DW_ATE_unsigned;
1492  dwarf::DW_OP_LLVM_convert, ToSize, TK}};
1493  return Ops;
1494 }
1495 
1497  unsigned FromSize, unsigned ToSize,
1498  bool Signed) {
1499  return appendToStack(Expr, getExtOps(FromSize, ToSize, Signed));
1500 }
1501 
1503 DIGlobalVariableExpression::getImpl(LLVMContext &Context, Metadata *Variable,
1505  bool ShouldCreate) {
1507  Metadata *Ops[] = {Variable, Expression};
1509 }
1510 
1511 DIObjCProperty *DIObjCProperty::getImpl(
1512  LLVMContext &Context, MDString *Name, Metadata *File, unsigned Line,
1513  MDString *GetterName, MDString *SetterName, unsigned Attributes,
1514  Metadata *Type, StorageType Storage, bool ShouldCreate) {
1515  assert(isCanonical(Name) && "Expected canonical MDString");
1516  assert(isCanonical(GetterName) && "Expected canonical MDString");
1517  assert(isCanonical(SetterName) && "Expected canonical MDString");
1518  DEFINE_GETIMPL_LOOKUP(DIObjCProperty, (Name, File, Line, GetterName,
1519  SetterName, Attributes, Type));
1520  Metadata *Ops[] = {Name, File, GetterName, SetterName, Type};
1521  DEFINE_GETIMPL_STORE(DIObjCProperty, (Line, Attributes), Ops);
1522 }
1523 
1524 DIImportedEntity *DIImportedEntity::getImpl(LLVMContext &Context, unsigned Tag,
1525  Metadata *Scope, Metadata *Entity,
1526  Metadata *File, unsigned Line,
1528  bool ShouldCreate) {
1529  assert(isCanonical(Name) && "Expected canonical MDString");
1531  (Tag, Scope, Entity, File, Line, Name));
1532  Metadata *Ops[] = {Scope, Entity, Name, File};
1533  DEFINE_GETIMPL_STORE(DIImportedEntity, (Tag, Line), Ops);
1534 }
1535 
1536 DIMacro *DIMacro::getImpl(LLVMContext &Context, unsigned MIType,
1537  unsigned Line, MDString *Name, MDString *Value,
1538  StorageType Storage, bool ShouldCreate) {
1539  assert(isCanonical(Name) && "Expected canonical MDString");
1540  DEFINE_GETIMPL_LOOKUP(DIMacro, (MIType, Line, Name, Value));
1541  Metadata *Ops[] = { Name, Value };
1542  DEFINE_GETIMPL_STORE(DIMacro, (MIType, Line), Ops);
1543 }
1544 
1545 DIMacroFile *DIMacroFile::getImpl(LLVMContext &Context, unsigned MIType,
1546  unsigned Line, Metadata *File,
1547  Metadata *Elements, StorageType Storage,
1548  bool ShouldCreate) {
1550  (MIType, Line, File, Elements));
1551  Metadata *Ops[] = { File, Elements };
1552  DEFINE_GETIMPL_STORE(DIMacroFile, (MIType, Line), Ops);
1553 }
1554 
1555 DIArgList *DIArgList::getImpl(LLVMContext &Context,
1557  StorageType Storage, bool ShouldCreate) {
1560 }
1561 
1563  ValueAsMetadata **OldVMPtr = static_cast<ValueAsMetadata **>(Ref);
1564  assert((!New || isa<ValueAsMetadata>(New)) &&
1565  "DIArgList must be passed a ValueAsMetadata");
1566  untrack();
1567  ValueAsMetadata *NewVM = cast_or_null<ValueAsMetadata>(New);
1568  for (ValueAsMetadata *&VM : Args) {
1569  if (&VM == OldVMPtr) {
1570  if (NewVM)
1571  VM = NewVM;
1572  else
1573  VM = ValueAsMetadata::get(UndefValue::get(VM->getValue()->getType()));
1574  }
1575  }
1576  track();
1577 }
1578 void DIArgList::track() {
1579  for (ValueAsMetadata *&VAM : Args)
1580  if (VAM)
1581  MetadataTracking::track(&VAM, *VAM, *this);
1582 }
1583 void DIArgList::untrack() {
1584  for (ValueAsMetadata *&VAM : Args)
1585  if (VAM)
1586  MetadataTracking::untrack(&VAM, *VAM);
1587 }
1588 void DIArgList::dropAllReferences() {
1589  untrack();
1590  Args.clear();
1592 }
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:1267
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::StringSwitch::Case
StringSwitch & Case(StringLiteral S, T Value)
Definition: StringSwitch.h:67
llvm::DICompileUnit::Macros
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata Metadata * Macros
Definition: DebugInfoMetadata.h:1432
llvm::LLVMContext::pImpl
LLVMContextImpl *const pImpl
Definition: LLVMContext.h:70
llvm::DICompileUnit::DebugNameTableKind::GNU
@ GNU
Signed
@ Signed
Definition: NVPTXISelLowering.cpp:4543
llvm::DIGenericSubrange::getRawLowerBound
Metadata * getRawLowerBound() const
Definition: DebugInfoMetadata.h:388
llvm::DIArgList
List of ValueAsMetadata, to be used as an argument to a dbg.value intrinsic.
Definition: DebugInfoMetadata.h:3534
llvm::ArrayRef::drop_back
ArrayRef< T > drop_back(size_t N=1) const
Drop the last N elements of the array.
Definition: ArrayRef.h:208
llvm::DIBasicType::Tag
unsigned Tag
Definition: DebugInfoMetadata.h:803
llvm::DICompileUnit::nameTableKindString
static const char * nameTableKindString(DebugNameTableKind PK)
Definition: DebugInfoMetadata.cpp:793
llvm
Definition: AllocatorList.h:23
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:805
llvm::DILabel::Name
Metadata MDString * Name
Definition: DebugInfoMetadata.h:3155
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::DILexicalBlockFile::File
Metadata Metadata * File
Definition: DebugInfoMetadata.h:2181
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:1420
llvm::StringRef::empty
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:156
llvm::DIEnumerator::Name
int64_t bool MDString * Name
Definition: DebugInfoMetadata.h:444
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:1496
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:266
llvm::DILabel::File
Metadata MDString Metadata * File
Definition: DebugInfoMetadata.h:3155
llvm::DIGenericSubrange::getRawCountNode
Metadata * getRawCountNode() const
Definition: DebugInfoMetadata.h:387
MetadataImpl.h
llvm::DICompileUnit::File
unsigned Metadata * File
Definition: DebugInfoMetadata.h:1428
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:93
DebugInfoMetadata.h
llvm::DIGenericSubrange
Definition: DebugInfoMetadata.h:358
llvm::DIDerivedType::File
unsigned StringRef DIFile * File
Definition: DebugInfoMetadata.h:968
llvm::Function
Definition: Function.h:61
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:1128
llvm::DICompileUnit::ImportedEntities
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata * ImportedEntities
Definition: DebugInfoMetadata.h:1432
llvm::StringSwitch::Default
LLVM_NODISCARD R Default(T Value)
Definition: StringSwitch.h:181
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:3084
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:1435
llvm::DICommonBlock::File
Metadata Metadata MDString Metadata * File
Definition: DebugInfoMetadata.h:3015
llvm::lltok::NameTableKind
@ NameTableKind
Definition: LLToken.h:477
llvm::DILexicalBlockFile
Definition: DebugInfoMetadata.h:2145
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
getImpl
static LazyValueInfoImpl & getImpl(void *&PImpl, AssumptionCache *AC, const Module *M)
This lazily constructs the LazyValueInfoImpl.
Definition: LazyValueInfo.cpp:1490
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:1011
llvm::DIStringType
String type, Fortran CHARACTER(n)
Definition: DebugInfoMetadata.h:833
llvm::DITemplateParameter::isDefault
bool isDefault() const
Definition: DebugInfoMetadata.h:2391
llvm::DIFile::ChecksumInfo
A single checksum, represented by a Kind and a Value (a string).
Definition: DebugInfoMetadata.h:548
llvm::MipsISD::Lo
@ Lo
Definition: MipsISelLowering.h:79
llvm::DIFile::Directory
MDString MDString * Directory
Definition: DebugInfoMetadata.h:603
llvm::DILexicalBlockFile::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:2181
llvm::DISubroutineType::TypeArray
DIFlags uint8_t Metadata * TypeArray
Definition: DebugInfoMetadata.h:1294
llvm::DICompositeType::Scope
unsigned MDString Metadata unsigned Metadata * Scope
Definition: DebugInfoMetadata.h:1125
llvm::DICompositeType::TemplateParams
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata * TemplateParams
Definition: DebugInfoMetadata.h:1128
llvm::DIScope::getName
StringRef getName() const
Definition: DebugInfoMetadata.cpp:254
llvm::DICompileUnit::GlobalVariables
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata * GlobalVariables
Definition: DebugInfoMetadata.h:1431
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:1937
llvm::dwarf::DW_OP_LLVM_tag_offset
@ DW_OP_LLVM_tag_offset
Only used in LLVM metadata.
Definition: Dwarf.h:144
llvm::DILocation
Debug location.
Definition: DebugInfoMetadata.h:1558
llvm::DISubrange::getUpperBound
BoundType getUpperBound() const
Definition: DebugInfoMetadata.cpp:404
llvm::DIModule::ConfigurationMacros
Metadata Metadata MDString MDString * ConfigurationMacros
Definition: DebugInfoMetadata.h:2346
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:46
llvm::DISubprogram::File
Metadata MDString MDString Metadata * File
Definition: DebugInfoMetadata.h:1933
llvm::sys::path::end
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:233
llvm::sys::path::begin
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:224
llvm::SmallSet
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
Definition: SmallSet.h:134
llvm::DIExpression::extractIfOffset
bool extractIfOffset(int64_t &Offset) const
If this is a constant offset, extract it.
Definition: DebugInfoMetadata.cpp:1222
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:1130
llvm::DIDerivedType::Tag
unsigned Tag
Definition: DebugInfoMetadata.h:968
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::ConstantAsMetadata::get
static ConstantAsMetadata * get(Constant *C)
Definition: Metadata.h:419
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:449
llvm::DICompileUnit::EnumTypes
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata * EnumTypes
Definition: DebugInfoMetadata.h:1430
llvm::DIBasicType::AlignInBits
unsigned StringRef uint64_t FlagZero unsigned StringRef uint64_t uint32_t AlignInBits
Definition: DebugInfoMetadata.h:810
llvm::DISubprogram::splitFlags
static DISPFlags splitFlags(DISPFlags Flags, SmallVectorImpl< DISPFlags > &SplitFlags)
Split up a flags bitfield for easier printing.
Definition: DebugInfoMetadata.cpp:838
llvm::DIExpression::ExprOperand::getSize
unsigned getSize() const
Return the size of the operand.
Definition: DebugInfoMetadata.cpp:1053
llvm::DICompileUnit::RetainedTypes
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata * RetainedTypes
Definition: DebugInfoMetadata.h:1431
llvm::ValueAsMetadata::get
static ValueAsMetadata * get(Value *V)
Definition: Metadata.cpp:362
llvm::MipsISD::Ret
@ Ret
Definition: MipsISelLowering.h:116
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2559
BaseType
llvm::DINode::FlagAccessibility
@ FlagAccessibility
Definition: DebugInfoMetadata.h:166
llvm::GenericDINode::DwarfOps
unsigned MDString ArrayRef< Metadata * > DwarfOps
Definition: DebugInfoMetadata.h:259
llvm::DINode::FlagPtrToMemberRep
@ FlagPtrToMemberRep
Definition: DebugInfoMetadata.h:167
llvm::DICompileUnit::Producer
unsigned Metadata MDString * Producer
Definition: DebugInfoMetadata.h:1428
llvm::DICompositeType::Line
unsigned MDString Metadata unsigned Line
Definition: DebugInfoMetadata.h:1124
llvm::DICompileUnit::DebugEmissionKind
DebugEmissionKind
Definition: DebugInfoMetadata.h:1318
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:1129
llvm::DIModule::IncludePath
Metadata Metadata MDString MDString MDString * IncludePath
Definition: DebugInfoMetadata.h:2346
llvm::DINamespace
Definition: DebugInfoMetadata.h:2249
llvm::DICompileUnit::emissionKindString
static const char * emissionKindString(DebugEmissionKind EK)
Definition: DebugInfoMetadata.cpp:783
llvm::DIDerivedType::Flags
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t uint64_t Optional< unsigned > DIFlags Flags
Definition: DebugInfoMetadata.h:971
llvm::DILocalVariable::Line
Metadata MDString Metadata unsigned Line
Definition: DebugInfoMetadata.h:3085
llvm::DILexicalBlock
Definition: DebugInfoMetadata.h:2094
llvm::ArrayRef::empty
bool empty() const
empty - Check if the array is empty.
Definition: ArrayRef.h:158
llvm::MDNode::get
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1198
llvm::DIModule::Scope
Metadata Metadata * Scope
Definition: DebugInfoMetadata.h:2345
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::DILocation::InlinedAt
unsigned unsigned DILocalScope DILocation * InlinedAt
Definition: DebugInfoMetadata.h:1629
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:1434
llvm::DILocalVariable::File
Metadata MDString Metadata * File
Definition: DebugInfoMetadata.h:3084
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::Optional::hasValue
constexpr bool hasValue() const
Definition: Optional.h:286
llvm::DICompositeType::getODRTypeIfExists
static DICompositeType * getODRTypeIfExists(LLVMContext &Context, MDString &Identifier)
Definition: DebugInfoMetadata.cpp:675
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::DIExpression::getElement
uint64_t getElement(unsigned I) const
Definition: DebugInfoMetadata.h:2587
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:205
llvm::DIObjCProperty
Definition: DebugInfoMetadata.h:3189
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:1283
llvm::DICommonBlock::Name
Metadata Metadata MDString * Name
Definition: DebugInfoMetadata.h:3014
llvm::ArrayRef::back
const T & back() const
back - Get the last element.
Definition: ArrayRef.h:172
llvm::DISubprogram::Unit
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata * Unit
Definition: DebugInfoMetadata.h:1936
llvm::ModRefInfo::Ref
@ Ref
The access may reference the value stored in memory.
llvm::DISubrange::getCount
BoundType getCount() const
Definition: DebugInfoMetadata.cpp:362
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:811
llvm::DILocalVariable
Local variable.
Definition: DebugInfoMetadata.h:3041
llvm::DIMacro
Definition: DebugInfoMetadata.h:3421
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::SmallVectorImpl::append
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:648
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:320
llvm::DISubprogram::SPFlagVirtuality
@ SPFlagVirtuality
Definition: DebugInfoMetadata.h:1835
llvm::DICompileUnit::LineTablesOnly
@ LineTablesOnly
Definition: DebugInfoMetadata.h:1321
llvm::DISubprogram::Type
Metadata MDString MDString Metadata unsigned Metadata * Type
Definition: DebugInfoMetadata.h:1934
llvm::DIFile::CSK_Last
@ CSK_Last
Definition: DebugInfoMetadata.h:543
llvm::GenericDINode::Header
unsigned MDString * Header
Definition: DebugInfoMetadata.h:258
llvm::DISubprogram::DISPFlags
DISPFlags
Debug info subprogram flags.
Definition: DebugInfoMetadata.h:1830
DEFINE_GETIMPL_STORE_NO_OPS
#define DEFINE_GETIMPL_STORE_NO_OPS(CLASS, ARGS)
Definition: DebugInfoMetadata.cpp:324
DEFINE_GETIMPL_LOOKUP
#define DEFINE_GETIMPL_LOOKUP(CLASS, ARGS)
Definition: DebugInfoMetadata.cpp:307
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:481
llvm::DILocalVariable::AlignInBits
Metadata MDString Metadata unsigned Metadata unsigned DIFlags uint32_t AlignInBits
Definition: DebugInfoMetadata.h:3086
llvm::DISubrange
Array subrange.
Definition: DebugInfoMetadata.h:292
DEFINE_GETIMPL_STORE_N
#define DEFINE_GETIMPL_STORE_N(CLASS, ARGS, OPS, NUM_OPS)
Definition: DebugInfoMetadata.cpp:330
llvm::DISubrange::CountNode
Metadata * CountNode
Definition: DebugInfoMetadata.h:323
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:320
llvm::DITemplateTypeParameter
Definition: DebugInfoMetadata.h:2399
llvm::DILocation::Scope
unsigned unsigned DILocalScope * Scope
Definition: DebugInfoMetadata.h:1628
llvm::DIBasicType::Name
unsigned StringRef Name
Definition: DebugInfoMetadata.h:803
llvm::DIDerivedType::SizeInBits
unsigned StringRef DIFile unsigned DIScope DIType uint64_t SizeInBits
Definition: DebugInfoMetadata.h:969
llvm::DIBasicType::getEncoding
unsigned getEncoding() const
Definition: DebugInfoMetadata.h:819
llvm::DIFile::getChecksumKind
static Optional< ChecksumKind > getChecksumKind(StringRef CSKindStr)
Definition: DebugInfoMetadata.cpp:708
llvm::MCID::Flag
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:146
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:1129
llvm::DILocalVariable::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:3084
llvm::UndefValue::get
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
Definition: Constants.cpp:1770
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:167
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:1130
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::DIGenericSubrange::getRawUpperBound
Metadata * getRawUpperBound() const
Definition: DebugInfoMetadata.h:389
llvm::Metadata
Root of the metadata hierarchy.
Definition: Metadata.h:62
llvm::DICompileUnit::DebugDirectivesOnly
@ DebugDirectivesOnly
Definition: DebugInfoMetadata.h:1322
llvm::array_lengthof
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
Definition: STLExtras.h:1325
llvm::None
const NoneType None
Definition: None.h:23
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:1937
llvm::DICompileUnit::FullDebug
@ FullDebug
Definition: DebugInfoMetadata.h:1320
llvm::DINode::splitFlags
static DIFlags splitFlags(DIFlags Flags, SmallVectorImpl< DIFlags > &SplitFlags)
Split up a flags bitfield.
Definition: DebugInfoMetadata.cpp:193
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:1126
llvm::DIArgList::handleChangedOperand
void handleChangedOperand(void *Ref, Metadata *New)
Definition: DebugInfoMetadata.cpp:1562
llvm::lltok::EmissionKind
@ EmissionKind
Definition: LLToken.h:476
llvm::DICommonBlock
Definition: DebugInfoMetadata.h:2979
llvm::DIExpression::append
static DIExpression * append(const DIExpression *Expr, ArrayRef< uint64_t > Ops)
Append the opcodes Ops to DIExpr.
Definition: DebugInfoMetadata.cpp:1363
llvm::DICompositeType::Elements
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata * Elements
Definition: DebugInfoMetadata.h:1127
llvm::DIExpression::ExtOps
std::array< uint64_t, 6 > ExtOps
Definition: DebugInfoMetadata.h:2831
llvm::DIExpression::isImplicit
bool isImplicit() const
Return whether this is an implicit location description.
Definition: DebugInfoMetadata.cpp:1159
llvm::DIGlobalVariable::Line
Metadata MDString MDString Metadata unsigned Line
Definition: DebugInfoMetadata.h:2951
llvm::DIStringType::AlignInBits
unsigned MDString Metadata Metadata uint64_t uint32_t AlignInBits
Definition: DebugInfoMetadata.h:876
llvm::DISubprogram::LinkageName
Metadata MDString MDString * LinkageName
Definition: DebugInfoMetadata.h:1933
llvm::dwarf::DW_OP_LLVM_entry_value
@ DW_OP_LLVM_entry_value
Only used in LLVM metadata.
Definition: Dwarf.h:145
llvm::DICompositeType::SizeInBits
unsigned MDString Metadata unsigned Metadata Metadata uint64_t SizeInBits
Definition: DebugInfoMetadata.h:1125
llvm::DIGlobalVariable::LinkageName
Metadata MDString MDString * LinkageName
Definition: DebugInfoMetadata.h:2950
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:1247
llvm::DIEnumerator
Enumeration value.
Definition: DebugInfoMetadata.h:408
llvm::DILabel::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:3155
llvm::DIVariable::getRawType
Metadata * getRawType() const
Definition: DebugInfoMetadata.h:2542
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:1387
llvm::DIFile::CSK_SHA256
@ CSK_SHA256
Definition: DebugInfoMetadata.h:542
llvm::DINamespace::Name
Metadata MDString * Name
Definition: DebugInfoMetadata.h:2282
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::DIDerivedType::Name
unsigned StringRef Name
Definition: DebugInfoMetadata.h:968
llvm::DIModule::Name
Metadata Metadata MDString * Name
Definition: DebugInfoMetadata.h:2345
llvm::DIExpression::StackValue
@ StackValue
Definition: DebugInfoMetadata.h:2755
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:1462
llvm::DIGlobalVariable::Type
Metadata MDString MDString Metadata unsigned Metadata * Type
Definition: DebugInfoMetadata.h:2951
llvm::DITemplateTypeParameter::Name
MDString * Name
Definition: DebugInfoMetadata.h:2431
llvm::DIGlobalVariable
Global variables.
Definition: DebugInfoMetadata.h:2899
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
I
#define I(x, y, z)
Definition: MD5.cpp:59
DIBuilder.h
llvm::DITemplateValueParameter::Name
unsigned MDString * Name
Definition: DebugInfoMetadata.h:2477
llvm::DICompileUnit
Compile unit.
Definition: DebugInfoMetadata.h:1313
llvm::DIImportedEntity
An imported module (C++ using directive or similar).
Definition: DebugInfoMetadata.h:3272
llvm::DISubprogram::Name
Metadata MDString * Name
Definition: DebugInfoMetadata.h:1933
llvm::DIGlobalVariable::Name
Metadata MDString * Name
Definition: DebugInfoMetadata.h:2950
llvm::DIModule::APINotesFile
Metadata Metadata MDString MDString MDString MDString * APINotesFile
Definition: DebugInfoMetadata.h:2347
llvm::DIMacroFile
Definition: DebugInfoMetadata.h:3470
llvm::DIExpression::DerefBefore
@ DerefBefore
Definition: DebugInfoMetadata.h:2753
llvm::DISubroutineType::Flags
DIFlags Flags
Definition: DebugInfoMetadata.h:1294
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::DISubprogram::getFlagString
static StringRef getFlagString(DISPFlags Flag)
Definition: DebugInfoMetadata.cpp:824
llvm::DIBasicType::SizeInBits
unsigned StringRef uint64_t SizeInBits
Definition: DebugInfoMetadata.h:803
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:546
llvm::MDNode::dropAllReferences
void dropAllReferences()
Definition: Metadata.cpp:702
llvm::DINode::getFlag
static DIFlags getFlag(StringRef Flag)
Definition: DebugInfoMetadata.cpp:176
llvm::MDNode
Metadata node.
Definition: Metadata.h:897
llvm::DIGenericSubrange::getCount
BoundType getCount() const
Definition: DebugInfoMetadata.cpp:456
ChecksumKindName
static const char * ChecksumKindName[DIFile::CSK_Last]
Definition: DebugInfoMetadata.cpp:694
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:1307
llvm::DIBasicType
Basic type, like 'int' or 'float'.
Definition: DebugInfoMetadata.h:765
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:70
llvm::DISubrange::getStride
BoundType getStride() const
Definition: DebugInfoMetadata.cpp:425
llvm::DISubprogram::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:1933
llvm::DISubroutineType
Type array for a subprogram.
Definition: DebugInfoMetadata.h:1259
llvm::dwarf::SourceLanguage
SourceLanguage
Definition: Dwarf.h:200
llvm::Expression
Class representing an expression and its matching format.
Definition: FileCheckImpl.h:237
llvm::DICompositeType
Composite types.
Definition: DebugInfoMetadata.h:1047
llvm::dwarf::DW_OP_LLVM_arg
@ DW_OP_LLVM_arg
Only used in LLVM metadata.
Definition: Dwarf.h:147
llvm::DIScope::getScope
DIScope * getScope() const
Definition: DebugInfoMetadata.cpp:230
llvm::DILocation::encodeDiscriminator
static Optional< unsigned > encodeDiscriminator(unsigned BD, unsigned DF, unsigned CI)
Raw encoding of the discriminator.
Definition: DebugInfoMetadata.cpp:135
llvm::DICompileUnit::NoDebug
@ NoDebug
Definition: DebugInfoMetadata.h:1319
llvm::DIDerivedType::OffsetInBits
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t uint64_t OffsetInBits
Definition: DebugInfoMetadata.h:970
llvm::DICompositeType::OffsetInBits
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t OffsetInBits
Definition: DebugInfoMetadata.h:1126
llvm::Sched::Source
@ Source
Definition: TargetLowering.h:99
llvm::DIDerivedType::Line
unsigned StringRef DIFile unsigned Line
Definition: DebugInfoMetadata.h:968
llvm::dwarf::DW_OP_LLVM_fragment
@ DW_OP_LLVM_fragment
Only used in LLVM metadata.
Definition: Dwarf.h:142
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::dwarf::DW_OP_LLVM_implicit_pointer
@ DW_OP_LLVM_implicit_pointer
Only used in LLVM metadata.
Definition: Dwarf.h:146
llvm::DICompileUnit::DebugNameTableKind
DebugNameTableKind
Definition: DebugInfoMetadata.h:1326
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:1489
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::DIGenericSubrange::getStride
BoundType getStride() const
Definition: DebugInfoMetadata.cpp:507
llvm::DILocation::Line
unsigned Line
Definition: DebugInfoMetadata.h:1628
llvm::DITemplateValueParameter::Tag
unsigned Tag
Definition: DebugInfoMetadata.h:2477
llvm::DICompositeType::File
unsigned MDString Metadata * File
Definition: DebugInfoMetadata.h:1124
llvm::DICompileUnit::getEmissionKind
DebugEmissionKind getEmissionKind() const
Definition: DebugInfoMetadata.h:1446
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:1127
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)
Build a DICompositeType with the given ODR identifier.
Definition: DebugInfoMetadata.cpp:615
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:2616
llvm::GenericDINode
Generic tagged DWARF-like metadata node.
Definition: DebugInfoMetadata.h:221
llvm::MDNode::getDistinct
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1206
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:149
llvm::DIBasicType::Flags
unsigned StringRef uint64_t FlagZero unsigned StringRef uint64_t uint32_t unsigned DIFlags Flags
Definition: DebugInfoMetadata.h:810
llvm::DIExpression::expr_op_iterator
An iterator for expression operands.
Definition: DebugInfoMetadata.h:2637
llvm::MDNode::getContext
LLVMContext & getContext() const
Definition: Metadata.h:957
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:1201
llvm::DIGlobalVariable::StaticDataMemberDeclaration
Metadata MDString MDString Metadata unsigned Metadata bool bool Metadata * StaticDataMemberDeclaration
Definition: DebugInfoMetadata.h:2953
llvm::DICompileUnit::SplitDebugFilename
unsigned Metadata MDString bool MDString unsigned MDString * SplitDebugFilename
Definition: DebugInfoMetadata.h:1430
llvm::DIStringType::Tag
unsigned Tag
Definition: DebugInfoMetadata.h:874
llvm::DISubrange::getLowerBound
BoundType getLowerBound() const
Definition: DebugInfoMetadata.cpp:383
llvm::DICompositeType::Flags
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Flags
Definition: DebugInfoMetadata.h:1126
llvm::dwarf::TypeKind
TypeKind
Definition: Dwarf.h:150
llvm::DISubprogram::RetainedNodes
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata Metadata * RetainedNodes
Definition: DebugInfoMetadata.h:1938
llvm::DIExpression::appendOffset
static void appendOffset(SmallVectorImpl< uint64_t > &Ops, int64_t Offset)
Append Ops with operations to apply the Offset.
Definition: DebugInfoMetadata.cpp:1210
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:1329
llvm::DIGenericSubrange::BoundType
PointerUnion< DIVariable *, DIExpression * > BoundType
Definition: DebugInfoMetadata.h:392
llvm::Type::getInt64Ty
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:198
DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS
#define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS)
Definition: DebugInfoMetadata.cpp:327
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
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:1496
llvm::DIExpression::DerefAfter
@ DerefAfter
Definition: DebugInfoMetadata.h:2754
adjustColumn
static void adjustColumn(unsigned &Column)
Definition: DebugInfoMetadata.cpp:45
llvm::GenericDINode::Tag
unsigned Tag
Definition: DebugInfoMetadata.h:258
llvm::DIScope
Base class for scope-like contexts.
Definition: DebugInfoMetadata.h:472
llvm::DISubprogram::ThrownTypes
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata Metadata Metadata * ThrownTypes
Definition: DebugInfoMetadata.h:1938
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:314
llvm::ArrayRef::begin
iterator begin() const
Definition: ArrayRef.h:151
llvm::DICompositeType::Tag
unsigned Tag
Definition: DebugInfoMetadata.h:1124
llvm::DILexicalBlock::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:2131
llvm::ConstantInt::getSigned
static ConstantInt * getSigned(IntegerType *Ty, int64_t V)
Return a ConstantInt with the specified value for the specified type.
Definition: Constants.cpp:899
llvm::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:1179
llvm::DICompileUnit::Flags
unsigned Metadata MDString bool MDString * Flags
Definition: DebugInfoMetadata.h:1429
llvm::DILocation::ImplicitCode
unsigned unsigned DILocalScope DILocation bool ImplicitCode
Definition: DebugInfoMetadata.h:1630
Function.h
llvm::DIExpression::getElements
ArrayRef< uint64_t > getElements() const
Definition: DebugInfoMetadata.h:2583
StringSwitch.h
llvm::DIStringType::Name
unsigned MDString * Name
Definition: DebugInfoMetadata.h:874
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:1488
llvm::dwarf::DW_OP_LLVM_convert
@ DW_OP_LLVM_convert
Only used in LLVM metadata.
Definition: Dwarf.h:143
llvm::DIDerivedType
Derived types.
Definition: DebugInfoMetadata.h:913
llvm::DIGlobalVariable::AlignInBits
Metadata MDString MDString Metadata unsigned Metadata bool bool Metadata Metadata uint32_t AlignInBits
Definition: DebugInfoMetadata.h:2954
llvm::DIGlobalVariableExpression
A pair of DIGlobalVariable and DIExpression.
Definition: DebugInfoMetadata.h:3331
llvm::DIStringType::SizeInBits
unsigned MDString Metadata Metadata uint64_t SizeInBits
Definition: DebugInfoMetadata.h:875
llvm::makeArrayRef
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:474
llvm::DIExpression::FragmentInfo
Holds the characteristics of one fragment of a larger variable.
Definition: DebugInfoMetadata.h:2713
llvm::DINamespace::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:2282
llvm::DINode::getFlagString
static StringRef getFlagString(DIFlags Flag)
Definition: DebugInfoMetadata.cpp:183
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:1131
llvm::DILexicalBlock::File
Metadata Metadata * File
Definition: DebugInfoMetadata.h:2131
llvm::DITemplateValueParameter
Definition: DebugInfoMetadata.h:2441
llvm::DITemplateValueParameter::Type
unsigned MDString Metadata * Type
Definition: DebugInfoMetadata.h:2477
Instructions.h
llvm::DIExpression::ExprOperand::get
const uint64_t * get() const
Definition: DebugInfoMetadata.h:2613
llvm::DISubprogram::ContainingType
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata * ContainingType
Definition: DebugInfoMetadata.h:1935
llvm::DINode::DIFlags
DIFlags
Debug info flags.
Definition: DebugInfoMetadata.h:162
llvm::DIGenericSubrange::getLowerBound
BoundType getLowerBound() const
Definition: DebugInfoMetadata.cpp:473
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:79
llvm::DIStringType::StringLength
unsigned MDString Metadata * StringLength
Definition: DebugInfoMetadata.h:874
N
#define N
llvm::DIFile::CSK_MD5
@ CSK_MD5
Definition: DebugInfoMetadata.h:540
llvm::DICompileUnit::DebugNameTableKind::None
@ None
llvm::DIGlobalVariable::File
Metadata MDString MDString Metadata * File
Definition: DebugInfoMetadata.h:2951
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:163
llvm::DIStringType::StringLengthExp
unsigned MDString Metadata Metadata * StringLengthExp
Definition: DebugInfoMetadata.h:875
llvm::max
Align max(MaybeAlign Lhs, Align Rhs)
Definition: Alignment.h:350
llvm::DICompositeType::BaseType
unsigned MDString Metadata unsigned Metadata Metadata * BaseType
Definition: DebugInfoMetadata.h:1125
llvm::DIFile::CSK_SHA1
@ CSK_SHA1
Definition: DebugInfoMetadata.h:541
llvm::LLVMContextImpl::DITypeMap
Optional< DenseMap< const MDString *, DICompositeType * > > DITypeMap
Definition: LLVMContextImpl.h:1387
llvm::DIExpression::getNumElements
unsigned getNumElements() const
Definition: DebugInfoMetadata.h:2585
llvm::DISubprogram
Subprogram description.
Definition: DebugInfoMetadata.h:1815
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::DIExpression::expr_op_end
expr_op_iterator expr_op_end() const
Definition: DebugInfoMetadata.h:2693
llvm::ValueAsMetadata
Value wrapper in the Metadata hierarchy.
Definition: Metadata.h:344
llvm::DIModule
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Definition: DebugInfoMetadata.h:2301
llvm::StringSwitch
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:42
llvm::DIDerivedType::BaseType
unsigned StringRef DIFile unsigned DIScope DIType * BaseType
Definition: DebugInfoMetadata.h:969
isCanonical
static bool isCanonical(const MDString *S)
Definition: DebugInfoMetadata.cpp:272
llvm::DIEnumerator::IsUnsigned
int64_t bool IsUnsigned
Definition: DebugInfoMetadata.h:444
llvm::DIDerivedType::AlignInBits
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t AlignInBits
Definition: DebugInfoMetadata.h:970
llvm::DILabel
Label.
Definition: DebugInfoMetadata.h:3121
llvm::DICompileUnit::getNameTableKind
DebugNameTableKind getNameTableKind() const
Definition: DebugInfoMetadata.h:1453
llvm::DIGenericSubrange::getRawStride
Metadata * getRawStride() const
Definition: DebugInfoMetadata.h:390
llvm::DILocalScope
A scope for locals.
Definition: DebugInfoMetadata.h:1528
llvm::DIDerivedType::Scope
unsigned StringRef DIFile unsigned DIScope * Scope
Definition: DebugInfoMetadata.h:969
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:389
llvm::lltok::ChecksumKind
@ ChecksumKind
Definition: LLToken.h:482
llvm::DILocation::Column
unsigned unsigned Column
Definition: DebugInfoMetadata.h:1628
llvm::MDString::getString
StringRef getString() const
Definition: Metadata.cpp:477
llvm::DICompositeType::Name
unsigned MDString * Name
Definition: DebugInfoMetadata.h:1124
llvm::MDString
A single uniqued string.
Definition: Metadata.h:611
llvm::DIModule::File
Metadata * File
Definition: DebugInfoMetadata.h:2345
llvm::DIGlobalVariable::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:2950
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::Metadata::Uniqued
@ Uniqued
Definition: Metadata.h:70
llvm::DIExpression::EntryValue
@ EntryValue
Definition: DebugInfoMetadata.h:2756
File
Instrumentation for Order File
Definition: InstrOrderFile.cpp:206
llvm::ArrayRef::end
iterator end() const
Definition: ArrayRef.h:152
llvm::DISubprogram::getFlag
static DISPFlags getFlag(StringRef Flag)
Definition: DebugInfoMetadata.cpp:817
llvm::DIFile
File.
Definition: DebugInfoMetadata.h:526
llvm::DIGenericSubrange::getUpperBound
BoundType getUpperBound() const
Definition: DebugInfoMetadata.cpp:490
llvm::DIGlobalVariable::TemplateParams
Metadata MDString MDString Metadata unsigned Metadata bool bool Metadata Metadata * TemplateParams
Definition: DebugInfoMetadata.h:2954
llvm::DIExpression::isValid
bool isValid() const
Definition: DebugInfoMetadata.cpp:1078
llvm::DIExpression::expr_ops
iterator_range< expr_op_iterator > expr_ops() const
Definition: DebugInfoMetadata.h:2696
SmallSet.h
llvm::SmallPtrSetImpl::insert
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition: SmallPtrSet.h:364
llvm::DICommonBlock::Decl
Metadata Metadata * Decl
Definition: DebugInfoMetadata.h:3014
llvm::DICommonBlock::Scope
Metadata * Scope
Definition: DebugInfoMetadata.h:3014
llvm::SmallVectorImpl::insert
iterator insert(iterator I, T &&Elt)
Definition: SmallVector.h:773
llvm::DIExpression::getFragmentInfo
Optional< FragmentInfo > getFragmentInfo() const
Retrieve the details of this fragment expression.
Definition: DebugInfoMetadata.h:2723
llvm::DIExpression::expr_op_begin
expr_op_iterator expr_op_begin() const
Visit the elements via ExprOperand wrappers.
Definition: DebugInfoMetadata.h:2690