LLVM  8.0.0svn
LLVMContextImpl.h
Go to the documentation of this file.
1 //===- LLVMContextImpl.h - The LLVMContextImpl opaque class -----*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares LLVMContextImpl, the opaque implementation
11 // of LLVMContext.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_LIB_IR_LLVMCONTEXTIMPL_H
16 #define LLVM_LIB_IR_LLVMCONTEXTIMPL_H
17 
18 #include "AttributeImpl.h"
19 #include "ConstantsContext.h"
20 #include "llvm/ADT/APFloat.h"
21 #include "llvm/ADT/APInt.h"
22 #include "llvm/ADT/ArrayRef.h"
23 #include "llvm/ADT/DenseMap.h"
24 #include "llvm/ADT/DenseMapInfo.h"
25 #include "llvm/ADT/DenseSet.h"
26 #include "llvm/ADT/FoldingSet.h"
27 #include "llvm/ADT/Hashing.h"
28 #include "llvm/ADT/Optional.h"
29 #include "llvm/ADT/STLExtras.h"
30 #include "llvm/ADT/SmallPtrSet.h"
31 #include "llvm/ADT/SmallVector.h"
32 #include "llvm/ADT/StringMap.h"
33 #include "llvm/ADT/StringRef.h"
34 #include "llvm/ADT/StringSet.h"
36 #include "llvm/IR/Constants.h"
38 #include "llvm/IR/DerivedTypes.h"
39 #include "llvm/IR/LLVMContext.h"
40 #include "llvm/IR/Metadata.h"
41 #include "llvm/IR/TrackingMDRef.h"
42 #include "llvm/Support/Allocator.h"
43 #include "llvm/Support/Casting.h"
45 #include <algorithm>
46 #include <cassert>
47 #include <cstddef>
48 #include <cstdint>
49 #include <memory>
50 #include <string>
51 #include <utility>
52 #include <vector>
53 
54 namespace llvm {
55 
56 class ConstantFP;
57 class ConstantInt;
58 class Type;
59 class Value;
60 class ValueHandleBase;
61 
63  static inline APInt getEmptyKey() {
64  APInt V(nullptr, 0);
65  V.U.VAL = 0;
66  return V;
67  }
68 
69  static inline APInt getTombstoneKey() {
70  APInt V(nullptr, 0);
71  V.U.VAL = 1;
72  return V;
73  }
74 
75  static unsigned getHashValue(const APInt &Key) {
76  return static_cast<unsigned>(hash_value(Key));
77  }
78 
79  static bool isEqual(const APInt &LHS, const APInt &RHS) {
80  return LHS.getBitWidth() == RHS.getBitWidth() && LHS == RHS;
81  }
82 };
83 
85  static inline APFloat getEmptyKey() { return APFloat(APFloat::Bogus(), 1); }
86  static inline APFloat getTombstoneKey() { return APFloat(APFloat::Bogus(), 2); }
87 
88  static unsigned getHashValue(const APFloat &Key) {
89  return static_cast<unsigned>(hash_value(Key));
90  }
91 
92  static bool isEqual(const APFloat &LHS, const APFloat &RHS) {
93  return LHS.bitwiseIsEqual(RHS);
94  }
95 };
96 
98  struct KeyTy {
100  bool isPacked;
101 
102  KeyTy(const ArrayRef<Type*>& E, bool P) :
103  ETypes(E), isPacked(P) {}
104 
106  : ETypes(ST->elements()), isPacked(ST->isPacked()) {}
107 
108  bool operator==(const KeyTy& that) const {
109  if (isPacked != that.isPacked)
110  return false;
111  if (ETypes != that.ETypes)
112  return false;
113  return true;
114  }
115  bool operator!=(const KeyTy& that) const {
116  return !this->operator==(that);
117  }
118  };
119 
120  static inline StructType* getEmptyKey() {
122  }
123 
124  static inline StructType* getTombstoneKey() {
126  }
127 
128  static unsigned getHashValue(const KeyTy& Key) {
129  return hash_combine(hash_combine_range(Key.ETypes.begin(),
130  Key.ETypes.end()),
131  Key.isPacked);
132  }
133 
134  static unsigned getHashValue(const StructType *ST) {
135  return getHashValue(KeyTy(ST));
136  }
137 
138  static bool isEqual(const KeyTy& LHS, const StructType *RHS) {
139  if (RHS == getEmptyKey() || RHS == getTombstoneKey())
140  return false;
141  return LHS == KeyTy(RHS);
142  }
143 
144  static bool isEqual(const StructType *LHS, const StructType *RHS) {
145  return LHS == RHS;
146  }
147 };
148 
150  struct KeyTy {
151  const Type *ReturnType;
153  bool isVarArg;
154 
155  KeyTy(const Type* R, const ArrayRef<Type*>& P, bool V) :
156  ReturnType(R), Params(P), isVarArg(V) {}
157  KeyTy(const FunctionType *FT)
158  : ReturnType(FT->getReturnType()), Params(FT->params()),
159  isVarArg(FT->isVarArg()) {}
160 
161  bool operator==(const KeyTy& that) const {
162  if (ReturnType != that.ReturnType)
163  return false;
164  if (isVarArg != that.isVarArg)
165  return false;
166  if (Params != that.Params)
167  return false;
168  return true;
169  }
170  bool operator!=(const KeyTy& that) const {
171  return !this->operator==(that);
172  }
173  };
174 
175  static inline FunctionType* getEmptyKey() {
177  }
178 
179  static inline FunctionType* getTombstoneKey() {
181  }
182 
183  static unsigned getHashValue(const KeyTy& Key) {
184  return hash_combine(Key.ReturnType,
185  hash_combine_range(Key.Params.begin(),
186  Key.Params.end()),
187  Key.isVarArg);
188  }
189 
190  static unsigned getHashValue(const FunctionType *FT) {
191  return getHashValue(KeyTy(FT));
192  }
193 
194  static bool isEqual(const KeyTy& LHS, const FunctionType *RHS) {
195  if (RHS == getEmptyKey() || RHS == getTombstoneKey())
196  return false;
197  return LHS == KeyTy(RHS);
198  }
199 
200  static bool isEqual(const FunctionType *LHS, const FunctionType *RHS) {
201  return LHS == RHS;
202  }
203 };
204 
205 /// Structure for hashing arbitrary MDNode operands.
207  ArrayRef<Metadata *> RawOps;
209  unsigned Hash;
210 
211 protected:
213  : RawOps(Ops), Hash(calculateHash(Ops)) {}
214 
215  template <class NodeTy>
216  MDNodeOpsKey(const NodeTy *N, unsigned Offset = 0)
217  : Ops(N->op_begin() + Offset, N->op_end()), Hash(N->getHash()) {}
218 
219  template <class NodeTy>
220  bool compareOps(const NodeTy *RHS, unsigned Offset = 0) const {
221  if (getHash() != RHS->getHash())
222  return false;
223 
224  assert((RawOps.empty() || Ops.empty()) && "Two sets of operands?");
225  return RawOps.empty() ? compareOps(Ops, RHS, Offset)
226  : compareOps(RawOps, RHS, Offset);
227  }
228 
229  static unsigned calculateHash(MDNode *N, unsigned Offset = 0);
230 
231 private:
232  template <class T>
233  static bool compareOps(ArrayRef<T> Ops, const MDNode *RHS, unsigned Offset) {
234  if (Ops.size() != RHS->getNumOperands() - Offset)
235  return false;
236  return std::equal(Ops.begin(), Ops.end(), RHS->op_begin() + Offset);
237  }
238 
239  static unsigned calculateHash(ArrayRef<Metadata *> Ops);
240 
241 public:
242  unsigned getHash() const { return Hash; }
243 };
244 
245 template <class NodeTy> struct MDNodeKeyImpl;
246 
247 /// Configuration point for MDNodeInfo::isEqual().
248 template <class NodeTy> struct MDNodeSubsetEqualImpl {
250 
251  static bool isSubsetEqual(const KeyTy &LHS, const NodeTy *RHS) {
252  return false;
253  }
254 
255  static bool isSubsetEqual(const NodeTy *LHS, const NodeTy *RHS) {
256  return false;
257  }
258 };
259 
260 /// DenseMapInfo for MDTuple.
261 ///
262 /// Note that we don't need the is-function-local bit, since that's implicit in
263 /// the operands.
264 template <> struct MDNodeKeyImpl<MDTuple> : MDNodeOpsKey {
267 
268  bool isKeyOf(const MDTuple *RHS) const { return compareOps(RHS); }
269 
270  unsigned getHashValue() const { return getHash(); }
271 
272  static unsigned calculateHash(MDTuple *N) {
273  return MDNodeOpsKey::calculateHash(N);
274  }
275 };
276 
277 /// DenseMapInfo for DILocation.
278 template <> struct MDNodeKeyImpl<DILocation> {
279  unsigned Line;
280  unsigned Column;
284 
285  MDNodeKeyImpl(unsigned Line, unsigned Column, Metadata *Scope,
286  Metadata *InlinedAt, bool ImplicitCode)
287  : Line(Line), Column(Column), Scope(Scope), InlinedAt(InlinedAt),
288  ImplicitCode(ImplicitCode) {}
290  : Line(L->getLine()), Column(L->getColumn()), Scope(L->getRawScope()),
291  InlinedAt(L->getRawInlinedAt()), ImplicitCode(L->isImplicitCode()) {}
292 
293  bool isKeyOf(const DILocation *RHS) const {
294  return Line == RHS->getLine() && Column == RHS->getColumn() &&
295  Scope == RHS->getRawScope() && InlinedAt == RHS->getRawInlinedAt() &&
296  ImplicitCode == RHS->isImplicitCode();
297  }
298 
299  unsigned getHashValue() const {
300  return hash_combine(Line, Column, Scope, InlinedAt, ImplicitCode);
301  }
302 };
303 
304 /// DenseMapInfo for GenericDINode.
305 template <> struct MDNodeKeyImpl<GenericDINode> : MDNodeOpsKey {
306  unsigned Tag;
308 
309  MDNodeKeyImpl(unsigned Tag, MDString *Header, ArrayRef<Metadata *> DwarfOps)
310  : MDNodeOpsKey(DwarfOps), Tag(Tag), Header(Header) {}
312  : MDNodeOpsKey(N, 1), Tag(N->getTag()), Header(N->getRawHeader()) {}
313 
314  bool isKeyOf(const GenericDINode *RHS) const {
315  return Tag == RHS->getTag() && Header == RHS->getRawHeader() &&
316  compareOps(RHS, 1);
317  }
318 
319  unsigned getHashValue() const { return hash_combine(getHash(), Tag, Header); }
320 
321  static unsigned calculateHash(GenericDINode *N) {
322  return MDNodeOpsKey::calculateHash(N, 1);
323  }
324 };
325 
326 template <> struct MDNodeKeyImpl<DISubrange> {
328  int64_t LowerBound;
329 
330  MDNodeKeyImpl(Metadata *CountNode, int64_t LowerBound)
331  : CountNode(CountNode), LowerBound(LowerBound) {}
333  : CountNode(N->getRawCountNode()),
334  LowerBound(N->getLowerBound()) {}
335 
336  bool isKeyOf(const DISubrange *RHS) const {
337  if (LowerBound != RHS->getLowerBound())
338  return false;
339 
340  if (auto *RHSCount = RHS->getCount().dyn_cast<ConstantInt*>())
341  if (auto *MD = dyn_cast<ConstantAsMetadata>(CountNode))
342  if (RHSCount->getSExtValue() ==
343  cast<ConstantInt>(MD->getValue())->getSExtValue())
344  return true;
345 
346  return CountNode == RHS->getRawCountNode();
347  }
348 
349  unsigned getHashValue() const {
350  if (auto *MD = dyn_cast<ConstantAsMetadata>(CountNode))
351  return hash_combine(cast<ConstantInt>(MD->getValue())->getSExtValue(),
352  LowerBound);
353  return hash_combine(CountNode, LowerBound);
354  }
355 };
356 
357 template <> struct MDNodeKeyImpl<DIEnumerator> {
358  int64_t Value;
361 
362  MDNodeKeyImpl(int64_t Value, bool IsUnsigned, MDString *Name)
363  : Value(Value), Name(Name), IsUnsigned(IsUnsigned) {}
365  : Value(N->getValue()), Name(N->getRawName()),
366  IsUnsigned(N->isUnsigned()) {}
367 
368  bool isKeyOf(const DIEnumerator *RHS) const {
369  return Value == RHS->getValue() && IsUnsigned == RHS->isUnsigned() &&
370  Name == RHS->getRawName();
371  }
372 
373  unsigned getHashValue() const { return hash_combine(Value, Name); }
374 };
375 
376 template <> struct MDNodeKeyImpl<DIBasicType> {
377  unsigned Tag;
379  uint64_t SizeInBits;
381  unsigned Encoding;
382  unsigned Flags;
383 
384  MDNodeKeyImpl(unsigned Tag, MDString *Name, uint64_t SizeInBits,
385  uint32_t AlignInBits, unsigned Encoding, unsigned Flags)
386  : Tag(Tag), Name(Name), SizeInBits(SizeInBits), AlignInBits(AlignInBits),
387  Encoding(Encoding), Flags(Flags) {}
389  : Tag(N->getTag()), Name(N->getRawName()), SizeInBits(N->getSizeInBits()),
390  AlignInBits(N->getAlignInBits()), Encoding(N->getEncoding()), Flags(N->getFlags()) {}
391 
392  bool isKeyOf(const DIBasicType *RHS) const {
393  return Tag == RHS->getTag() && Name == RHS->getRawName() &&
394  SizeInBits == RHS->getSizeInBits() &&
395  AlignInBits == RHS->getAlignInBits() &&
396  Encoding == RHS->getEncoding() &&
397  Flags == RHS->getFlags();
398  }
399 
400  unsigned getHashValue() const {
401  return hash_combine(Tag, Name, SizeInBits, AlignInBits, Encoding);
402  }
403 };
404 
405 template <> struct MDNodeKeyImpl<DIDerivedType> {
406  unsigned Tag;
409  unsigned Line;
412  uint64_t SizeInBits;
413  uint64_t OffsetInBits;
416  unsigned Flags;
418 
419  MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *File, unsigned Line,
420  Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
421  uint32_t AlignInBits, uint64_t OffsetInBits,
422  Optional<unsigned> DWARFAddressSpace, unsigned Flags,
423  Metadata *ExtraData)
424  : Tag(Tag), Name(Name), File(File), Line(Line), Scope(Scope),
425  BaseType(BaseType), SizeInBits(SizeInBits), OffsetInBits(OffsetInBits),
426  AlignInBits(AlignInBits), DWARFAddressSpace(DWARFAddressSpace),
427  Flags(Flags), ExtraData(ExtraData) {}
429  : Tag(N->getTag()), Name(N->getRawName()), File(N->getRawFile()),
430  Line(N->getLine()), Scope(N->getRawScope()),
431  BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()),
432  OffsetInBits(N->getOffsetInBits()), AlignInBits(N->getAlignInBits()),
433  DWARFAddressSpace(N->getDWARFAddressSpace()), Flags(N->getFlags()),
434  ExtraData(N->getRawExtraData()) {}
435 
436  bool isKeyOf(const DIDerivedType *RHS) const {
437  return Tag == RHS->getTag() && Name == RHS->getRawName() &&
438  File == RHS->getRawFile() && Line == RHS->getLine() &&
439  Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() &&
440  SizeInBits == RHS->getSizeInBits() &&
441  AlignInBits == RHS->getAlignInBits() &&
442  OffsetInBits == RHS->getOffsetInBits() &&
443  DWARFAddressSpace == RHS->getDWARFAddressSpace() &&
444  Flags == RHS->getFlags() &&
445  ExtraData == RHS->getRawExtraData();
446  }
447 
448  unsigned getHashValue() const {
449  // If this is a member inside an ODR type, only hash the type and the name.
450  // Otherwise the hash will be stronger than
451  // MDNodeSubsetEqualImpl::isODRMember().
452  if (Tag == dwarf::DW_TAG_member && Name)
453  if (auto *CT = dyn_cast_or_null<DICompositeType>(Scope))
454  if (CT->getRawIdentifier())
455  return hash_combine(Name, Scope);
456 
457  // Intentionally computes the hash on a subset of the operands for
458  // performance reason. The subset has to be significant enough to avoid
459  // collision "most of the time". There is no correctness issue in case of
460  // collision because of the full check above.
461  return hash_combine(Tag, Name, File, Line, Scope, BaseType, Flags);
462  }
463 };
464 
467 
468  static bool isSubsetEqual(const KeyTy &LHS, const DIDerivedType *RHS) {
469  return isODRMember(LHS.Tag, LHS.Scope, LHS.Name, RHS);
470  }
471 
472  static bool isSubsetEqual(const DIDerivedType *LHS, const DIDerivedType *RHS) {
473  return isODRMember(LHS->getTag(), LHS->getRawScope(), LHS->getRawName(),
474  RHS);
475  }
476 
477  /// Subprograms compare equal if they declare the same function in an ODR
478  /// type.
479  static bool isODRMember(unsigned Tag, const Metadata *Scope,
480  const MDString *Name, const DIDerivedType *RHS) {
481  // Check whether the LHS is eligible.
482  if (Tag != dwarf::DW_TAG_member || !Name)
483  return false;
484 
485  auto *CT = dyn_cast_or_null<DICompositeType>(Scope);
486  if (!CT || !CT->getRawIdentifier())
487  return false;
488 
489  // Compare to the RHS.
490  return Tag == RHS->getTag() && Name == RHS->getRawName() &&
491  Scope == RHS->getRawScope();
492  }
493 };
494 
495 template <> struct MDNodeKeyImpl<DICompositeType> {
496  unsigned Tag;
499  unsigned Line;
502  uint64_t SizeInBits;
503  uint64_t OffsetInBits;
505  unsigned Flags;
507  unsigned RuntimeLang;
512 
513  MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *File, unsigned Line,
514  Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
515  uint32_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
516  Metadata *Elements, unsigned RuntimeLang,
517  Metadata *VTableHolder, Metadata *TemplateParams,
518  MDString *Identifier, Metadata *Discriminator)
519  : Tag(Tag), Name(Name), File(File), Line(Line), Scope(Scope),
520  BaseType(BaseType), SizeInBits(SizeInBits), OffsetInBits(OffsetInBits),
521  AlignInBits(AlignInBits), Flags(Flags), Elements(Elements),
522  RuntimeLang(RuntimeLang), VTableHolder(VTableHolder),
523  TemplateParams(TemplateParams), Identifier(Identifier),
524  Discriminator(Discriminator) {}
526  : Tag(N->getTag()), Name(N->getRawName()), File(N->getRawFile()),
527  Line(N->getLine()), Scope(N->getRawScope()),
528  BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()),
529  OffsetInBits(N->getOffsetInBits()), AlignInBits(N->getAlignInBits()),
530  Flags(N->getFlags()), Elements(N->getRawElements()),
531  RuntimeLang(N->getRuntimeLang()), VTableHolder(N->getRawVTableHolder()),
532  TemplateParams(N->getRawTemplateParams()),
533  Identifier(N->getRawIdentifier()),
534  Discriminator(N->getRawDiscriminator()) {}
535 
536  bool isKeyOf(const DICompositeType *RHS) const {
537  return Tag == RHS->getTag() && Name == RHS->getRawName() &&
538  File == RHS->getRawFile() && Line == RHS->getLine() &&
539  Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() &&
540  SizeInBits == RHS->getSizeInBits() &&
541  AlignInBits == RHS->getAlignInBits() &&
542  OffsetInBits == RHS->getOffsetInBits() && Flags == RHS->getFlags() &&
543  Elements == RHS->getRawElements() &&
544  RuntimeLang == RHS->getRuntimeLang() &&
545  VTableHolder == RHS->getRawVTableHolder() &&
546  TemplateParams == RHS->getRawTemplateParams() &&
547  Identifier == RHS->getRawIdentifier() &&
548  Discriminator == RHS->getRawDiscriminator();
549  }
550 
551  unsigned getHashValue() const {
552  // Intentionally computes the hash on a subset of the operands for
553  // performance reason. The subset has to be significant enough to avoid
554  // collision "most of the time". There is no correctness issue in case of
555  // collision because of the full check above.
556  return hash_combine(Name, File, Line, BaseType, Scope, Elements,
557  TemplateParams);
558  }
559 };
560 
561 template <> struct MDNodeKeyImpl<DISubroutineType> {
562  unsigned Flags;
563  uint8_t CC;
565 
566  MDNodeKeyImpl(unsigned Flags, uint8_t CC, Metadata *TypeArray)
567  : Flags(Flags), CC(CC), TypeArray(TypeArray) {}
569  : Flags(N->getFlags()), CC(N->getCC()), TypeArray(N->getRawTypeArray()) {}
570 
571  bool isKeyOf(const DISubroutineType *RHS) const {
572  return Flags == RHS->getFlags() && CC == RHS->getCC() &&
573  TypeArray == RHS->getRawTypeArray();
574  }
575 
576  unsigned getHashValue() const { return hash_combine(Flags, CC, TypeArray); }
577 };
578 
579 template <> struct MDNodeKeyImpl<DIFile> {
584 
585  MDNodeKeyImpl(MDString *Filename, MDString *Directory,
587  Optional<MDString *> Source)
588  : Filename(Filename), Directory(Directory), Checksum(Checksum),
589  Source(Source) {}
591  : Filename(N->getRawFilename()), Directory(N->getRawDirectory()),
592  Checksum(N->getRawChecksum()), Source(N->getRawSource()) {}
593 
594  bool isKeyOf(const DIFile *RHS) const {
595  return Filename == RHS->getRawFilename() &&
596  Directory == RHS->getRawDirectory() &&
597  Checksum == RHS->getRawChecksum() &&
598  Source == RHS->getRawSource();
599  }
600 
601  unsigned getHashValue() const {
602  return hash_combine(
603  Filename, Directory, Checksum ? Checksum->Kind : 0,
604  Checksum ? Checksum->Value : nullptr, Source.getValueOr(nullptr));
605  }
606 };
607 
608 template <> struct MDNodeKeyImpl<DISubprogram> {
613  unsigned Line;
617  unsigned ScopeLine;
619  unsigned Virtuality;
620  unsigned VirtualIndex;
622  unsigned Flags;
629 
630  MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *LinkageName,
631  Metadata *File, unsigned Line, Metadata *Type,
632  bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
633  Metadata *ContainingType, unsigned Virtuality,
634  unsigned VirtualIndex, int ThisAdjustment, unsigned Flags,
635  bool IsOptimized, Metadata *Unit, Metadata *TemplateParams,
636  Metadata *Declaration, Metadata *RetainedNodes,
637  Metadata *ThrownTypes)
638  : Scope(Scope), Name(Name), LinkageName(LinkageName), File(File),
639  Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit),
640  IsDefinition(IsDefinition), ScopeLine(ScopeLine),
641  ContainingType(ContainingType), Virtuality(Virtuality),
642  VirtualIndex(VirtualIndex), ThisAdjustment(ThisAdjustment),
643  Flags(Flags), IsOptimized(IsOptimized), Unit(Unit),
644  TemplateParams(TemplateParams), Declaration(Declaration),
645  RetainedNodes(RetainedNodes), ThrownTypes(ThrownTypes) {}
647  : Scope(N->getRawScope()), Name(N->getRawName()),
648  LinkageName(N->getRawLinkageName()), File(N->getRawFile()),
649  Line(N->getLine()), Type(N->getRawType()),
650  IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()),
651  ScopeLine(N->getScopeLine()), ContainingType(N->getRawContainingType()),
652  Virtuality(N->getVirtuality()), VirtualIndex(N->getVirtualIndex()),
653  ThisAdjustment(N->getThisAdjustment()), Flags(N->getFlags()),
654  IsOptimized(N->isOptimized()), Unit(N->getRawUnit()),
655  TemplateParams(N->getRawTemplateParams()),
656  Declaration(N->getRawDeclaration()), RetainedNodes(N->getRawRetainedNodes()),
657  ThrownTypes(N->getRawThrownTypes()) {}
658 
659  bool isKeyOf(const DISubprogram *RHS) const {
660  return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
661  LinkageName == RHS->getRawLinkageName() &&
662  File == RHS->getRawFile() && Line == RHS->getLine() &&
663  Type == RHS->getRawType() && IsLocalToUnit == RHS->isLocalToUnit() &&
664  IsDefinition == RHS->isDefinition() &&
665  ScopeLine == RHS->getScopeLine() &&
666  ContainingType == RHS->getRawContainingType() &&
667  Virtuality == RHS->getVirtuality() &&
668  VirtualIndex == RHS->getVirtualIndex() &&
669  ThisAdjustment == RHS->getThisAdjustment() &&
670  Flags == RHS->getFlags() && IsOptimized == RHS->isOptimized() &&
671  Unit == RHS->getUnit() &&
672  TemplateParams == RHS->getRawTemplateParams() &&
673  Declaration == RHS->getRawDeclaration() &&
674  RetainedNodes == RHS->getRawRetainedNodes() &&
675  ThrownTypes == RHS->getRawThrownTypes();
676  }
677 
678  unsigned getHashValue() const {
679  // If this is a declaration inside an ODR type, only hash the type and the
680  // name. Otherwise the hash will be stronger than
681  // MDNodeSubsetEqualImpl::isDeclarationOfODRMember().
682  if (!IsDefinition && LinkageName)
683  if (auto *CT = dyn_cast_or_null<DICompositeType>(Scope))
684  if (CT->getRawIdentifier())
685  return hash_combine(LinkageName, Scope);
686 
687  // Intentionally computes the hash on a subset of the operands for
688  // performance reason. The subset has to be significant enough to avoid
689  // collision "most of the time". There is no correctness issue in case of
690  // collision because of the full check above.
691  return hash_combine(Name, Scope, File, Type, Line);
692  }
693 };
694 
695 template <> struct MDNodeSubsetEqualImpl<DISubprogram> {
697 
698  static bool isSubsetEqual(const KeyTy &LHS, const DISubprogram *RHS) {
699  return isDeclarationOfODRMember(LHS.IsDefinition, LHS.Scope,
700  LHS.LinkageName, LHS.TemplateParams, RHS);
701  }
702 
703  static bool isSubsetEqual(const DISubprogram *LHS, const DISubprogram *RHS) {
704  return isDeclarationOfODRMember(LHS->isDefinition(), LHS->getRawScope(),
705  LHS->getRawLinkageName(),
706  LHS->getRawTemplateParams(), RHS);
707  }
708 
709  /// Subprograms compare equal if they declare the same function in an ODR
710  /// type.
711  static bool isDeclarationOfODRMember(bool IsDefinition, const Metadata *Scope,
712  const MDString *LinkageName,
713  const Metadata *TemplateParams,
714  const DISubprogram *RHS) {
715  // Check whether the LHS is eligible.
716  if (IsDefinition || !Scope || !LinkageName)
717  return false;
718 
719  auto *CT = dyn_cast_or_null<DICompositeType>(Scope);
720  if (!CT || !CT->getRawIdentifier())
721  return false;
722 
723  // Compare to the RHS.
724  // FIXME: We need to compare template parameters here to avoid incorrect
725  // collisions in mapMetadata when RF_MoveDistinctMDs and a ODR-DISubprogram
726  // has a non-ODR template parameter (i.e., a DICompositeType that does not
727  // have an identifier). Eventually we should decouple ODR logic from
728  // uniquing logic.
729  return IsDefinition == RHS->isDefinition() && Scope == RHS->getRawScope() &&
730  LinkageName == RHS->getRawLinkageName() &&
731  TemplateParams == RHS->getRawTemplateParams();
732  }
733 };
734 
735 template <> struct MDNodeKeyImpl<DILexicalBlock> {
738  unsigned Line;
739  unsigned Column;
740 
741  MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Line, unsigned Column)
742  : Scope(Scope), File(File), Line(Line), Column(Column) {}
744  : Scope(N->getRawScope()), File(N->getRawFile()), Line(N->getLine()),
745  Column(N->getColumn()) {}
746 
747  bool isKeyOf(const DILexicalBlock *RHS) const {
748  return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
749  Line == RHS->getLine() && Column == RHS->getColumn();
750  }
751 
752  unsigned getHashValue() const {
753  return hash_combine(Scope, File, Line, Column);
754  }
755 };
756 
757 template <> struct MDNodeKeyImpl<DILexicalBlockFile> {
760  unsigned Discriminator;
761 
762  MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Discriminator)
763  : Scope(Scope), File(File), Discriminator(Discriminator) {}
765  : Scope(N->getRawScope()), File(N->getRawFile()),
766  Discriminator(N->getDiscriminator()) {}
767 
768  bool isKeyOf(const DILexicalBlockFile *RHS) const {
769  return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
770  Discriminator == RHS->getDiscriminator();
771  }
772 
773  unsigned getHashValue() const {
774  return hash_combine(Scope, File, Discriminator);
775  }
776 };
777 
778 template <> struct MDNodeKeyImpl<DINamespace> {
782 
783  MDNodeKeyImpl(Metadata *Scope, MDString *Name, bool ExportSymbols)
784  : Scope(Scope), Name(Name), ExportSymbols(ExportSymbols) {}
786  : Scope(N->getRawScope()), Name(N->getRawName()),
787  ExportSymbols(N->getExportSymbols()) {}
788 
789  bool isKeyOf(const DINamespace *RHS) const {
790  return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
791  ExportSymbols == RHS->getExportSymbols();
792  }
793 
794  unsigned getHashValue() const {
795  return hash_combine(Scope, Name);
796  }
797 };
798 
799 template <> struct MDNodeKeyImpl<DIModule> {
805 
806  MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *ConfigurationMacros,
807  MDString *IncludePath, MDString *ISysRoot)
808  : Scope(Scope), Name(Name), ConfigurationMacros(ConfigurationMacros),
809  IncludePath(IncludePath), ISysRoot(ISysRoot) {}
811  : Scope(N->getRawScope()), Name(N->getRawName()),
812  ConfigurationMacros(N->getRawConfigurationMacros()),
813  IncludePath(N->getRawIncludePath()), ISysRoot(N->getRawISysRoot()) {}
814 
815  bool isKeyOf(const DIModule *RHS) const {
816  return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
817  ConfigurationMacros == RHS->getRawConfigurationMacros() &&
818  IncludePath == RHS->getRawIncludePath() &&
819  ISysRoot == RHS->getRawISysRoot();
820  }
821 
822  unsigned getHashValue() const {
823  return hash_combine(Scope, Name,
824  ConfigurationMacros, IncludePath, ISysRoot);
825  }
826 };
827 
831 
832  MDNodeKeyImpl(MDString *Name, Metadata *Type) : Name(Name), Type(Type) {}
834  : Name(N->getRawName()), Type(N->getRawType()) {}
835 
836  bool isKeyOf(const DITemplateTypeParameter *RHS) const {
837  return Name == RHS->getRawName() && Type == RHS->getRawType();
838  }
839 
840  unsigned getHashValue() const { return hash_combine(Name, Type); }
841 };
842 
844  unsigned Tag;
848 
849  MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *Type, Metadata *Value)
850  : Tag(Tag), Name(Name), Type(Type), Value(Value) {}
852  : Tag(N->getTag()), Name(N->getRawName()), Type(N->getRawType()),
853  Value(N->getValue()) {}
854 
855  bool isKeyOf(const DITemplateValueParameter *RHS) const {
856  return Tag == RHS->getTag() && Name == RHS->getRawName() &&
857  Type == RHS->getRawType() && Value == RHS->getValue();
858  }
859 
860  unsigned getHashValue() const { return hash_combine(Tag, Name, Type, Value); }
861 };
862 
863 template <> struct MDNodeKeyImpl<DIGlobalVariable> {
868  unsigned Line;
875 
876  MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *LinkageName,
877  Metadata *File, unsigned Line, Metadata *Type,
878  bool IsLocalToUnit, bool IsDefinition,
879  Metadata *StaticDataMemberDeclaration, Metadata *TemplateParams,
880  uint32_t AlignInBits)
881  : Scope(Scope), Name(Name), LinkageName(LinkageName), File(File),
882  Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit),
883  IsDefinition(IsDefinition),
884  StaticDataMemberDeclaration(StaticDataMemberDeclaration),
885  TemplateParams(TemplateParams), AlignInBits(AlignInBits) {}
887  : Scope(N->getRawScope()), Name(N->getRawName()),
888  LinkageName(N->getRawLinkageName()), File(N->getRawFile()),
889  Line(N->getLine()), Type(N->getRawType()),
890  IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()),
891  StaticDataMemberDeclaration(N->getRawStaticDataMemberDeclaration()),
892  TemplateParams(N->getRawTemplateParams()),
893  AlignInBits(N->getAlignInBits()) {}
894 
895  bool isKeyOf(const DIGlobalVariable *RHS) const {
896  return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
897  LinkageName == RHS->getRawLinkageName() &&
898  File == RHS->getRawFile() && Line == RHS->getLine() &&
899  Type == RHS->getRawType() && IsLocalToUnit == RHS->isLocalToUnit() &&
900  IsDefinition == RHS->isDefinition() &&
901  StaticDataMemberDeclaration ==
903  TemplateParams == RHS->getRawTemplateParams() &&
904  AlignInBits == RHS->getAlignInBits();
905  }
906 
907  unsigned getHashValue() const {
908  // We do not use AlignInBits in hashing function here on purpose:
909  // in most cases this param for local variable is zero (for function param
910  // it is always zero). This leads to lots of hash collisions and errors on
911  // cases with lots of similar variables.
912  // clang/test/CodeGen/debug-info-257-args.c is an example of this problem,
913  // generated IR is random for each run and test fails with Align included.
914  // TODO: make hashing work fine with such situations
915  return hash_combine(Scope, Name, LinkageName, File, Line, Type,
916  IsLocalToUnit, IsDefinition, /* AlignInBits, */
917  StaticDataMemberDeclaration);
918  }
919 };
920 
921 template <> struct MDNodeKeyImpl<DILocalVariable> {
925  unsigned Line;
927  unsigned Arg;
928  unsigned Flags;
930 
931  MDNodeKeyImpl(Metadata *Scope, MDString *Name, Metadata *File, unsigned Line,
932  Metadata *Type, unsigned Arg, unsigned Flags,
933  uint32_t AlignInBits)
934  : Scope(Scope), Name(Name), File(File), Line(Line), Type(Type), Arg(Arg),
935  Flags(Flags), AlignInBits(AlignInBits) {}
937  : Scope(N->getRawScope()), Name(N->getRawName()), File(N->getRawFile()),
938  Line(N->getLine()), Type(N->getRawType()), Arg(N->getArg()),
939  Flags(N->getFlags()), AlignInBits(N->getAlignInBits()) {}
940 
941  bool isKeyOf(const DILocalVariable *RHS) const {
942  return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
943  File == RHS->getRawFile() && Line == RHS->getLine() &&
944  Type == RHS->getRawType() && Arg == RHS->getArg() &&
945  Flags == RHS->getFlags() && AlignInBits == RHS->getAlignInBits();
946  }
947 
948  unsigned getHashValue() const {
949  // We do not use AlignInBits in hashing function here on purpose:
950  // in most cases this param for local variable is zero (for function param
951  // it is always zero). This leads to lots of hash collisions and errors on
952  // cases with lots of similar variables.
953  // clang/test/CodeGen/debug-info-257-args.c is an example of this problem,
954  // generated IR is random for each run and test fails with Align included.
955  // TODO: make hashing work fine with such situations
956  return hash_combine(Scope, Name, File, Line, Type, Arg, Flags);
957  }
958 };
959 
960 template <> struct MDNodeKeyImpl<DILabel> {
964  unsigned Line;
965 
966  MDNodeKeyImpl(Metadata *Scope, MDString *Name, Metadata *File, unsigned Line)
967  : Scope(Scope), Name(Name), File(File), Line(Line) {}
969  : Scope(N->getRawScope()), Name(N->getRawName()), File(N->getRawFile()),
970  Line(N->getLine()) {}
971 
972  bool isKeyOf(const DILabel *RHS) const {
973  return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
974  File == RHS->getRawFile() && Line == RHS->getLine();
975  }
976 
977  /// Using name and line to get hash value. It should already be mostly unique.
978  unsigned getHashValue() const {
979  return hash_combine(Scope, Name, Line);
980  }
981 };
982 
983 template <> struct MDNodeKeyImpl<DIExpression> {
985 
986  MDNodeKeyImpl(ArrayRef<uint64_t> Elements) : Elements(Elements) {}
987  MDNodeKeyImpl(const DIExpression *N) : Elements(N->getElements()) {}
988 
989  bool isKeyOf(const DIExpression *RHS) const {
990  return Elements == RHS->getElements();
991  }
992 
993  unsigned getHashValue() const {
994  return hash_combine_range(Elements.begin(), Elements.end());
995  }
996 };
997 
1001 
1002  MDNodeKeyImpl(Metadata *Variable, Metadata *Expression)
1003  : Variable(Variable), Expression(Expression) {}
1005  : Variable(N->getRawVariable()), Expression(N->getRawExpression()) {}
1006 
1007  bool isKeyOf(const DIGlobalVariableExpression *RHS) const {
1008  return Variable == RHS->getRawVariable() &&
1009  Expression == RHS->getRawExpression();
1010  }
1011 
1012  unsigned getHashValue() const { return hash_combine(Variable, Expression); }
1013 };
1014 
1015 template <> struct MDNodeKeyImpl<DIObjCProperty> {
1018  unsigned Line;
1021  unsigned Attributes;
1023 
1024  MDNodeKeyImpl(MDString *Name, Metadata *File, unsigned Line,
1025  MDString *GetterName, MDString *SetterName, unsigned Attributes,
1026  Metadata *Type)
1027  : Name(Name), File(File), Line(Line), GetterName(GetterName),
1028  SetterName(SetterName), Attributes(Attributes), Type(Type) {}
1030  : Name(N->getRawName()), File(N->getRawFile()), Line(N->getLine()),
1031  GetterName(N->getRawGetterName()), SetterName(N->getRawSetterName()),
1032  Attributes(N->getAttributes()), Type(N->getRawType()) {}
1033 
1034  bool isKeyOf(const DIObjCProperty *RHS) const {
1035  return Name == RHS->getRawName() && File == RHS->getRawFile() &&
1036  Line == RHS->getLine() && GetterName == RHS->getRawGetterName() &&
1037  SetterName == RHS->getRawSetterName() &&
1038  Attributes == RHS->getAttributes() && Type == RHS->getRawType();
1039  }
1040 
1041  unsigned getHashValue() const {
1042  return hash_combine(Name, File, Line, GetterName, SetterName, Attributes,
1043  Type);
1044  }
1045 };
1046 
1047 template <> struct MDNodeKeyImpl<DIImportedEntity> {
1048  unsigned Tag;
1052  unsigned Line;
1054 
1055  MDNodeKeyImpl(unsigned Tag, Metadata *Scope, Metadata *Entity, Metadata *File,
1056  unsigned Line, MDString *Name)
1057  : Tag(Tag), Scope(Scope), Entity(Entity), File(File), Line(Line),
1058  Name(Name) {}
1060  : Tag(N->getTag()), Scope(N->getRawScope()), Entity(N->getRawEntity()),
1061  File(N->getRawFile()), Line(N->getLine()), Name(N->getRawName()) {}
1062 
1063  bool isKeyOf(const DIImportedEntity *RHS) const {
1064  return Tag == RHS->getTag() && Scope == RHS->getRawScope() &&
1065  Entity == RHS->getRawEntity() && File == RHS->getFile() &&
1066  Line == RHS->getLine() && Name == RHS->getRawName();
1067  }
1068 
1069  unsigned getHashValue() const {
1070  return hash_combine(Tag, Scope, Entity, File, Line, Name);
1071  }
1072 };
1073 
1074 template <> struct MDNodeKeyImpl<DIMacro> {
1075  unsigned MIType;
1076  unsigned Line;
1079 
1080  MDNodeKeyImpl(unsigned MIType, unsigned Line, MDString *Name, MDString *Value)
1081  : MIType(MIType), Line(Line), Name(Name), Value(Value) {}
1083  : MIType(N->getMacinfoType()), Line(N->getLine()), Name(N->getRawName()),
1084  Value(N->getRawValue()) {}
1085 
1086  bool isKeyOf(const DIMacro *RHS) const {
1087  return MIType == RHS->getMacinfoType() && Line == RHS->getLine() &&
1088  Name == RHS->getRawName() && Value == RHS->getRawValue();
1089  }
1090 
1091  unsigned getHashValue() const {
1092  return hash_combine(MIType, Line, Name, Value);
1093  }
1094 };
1095 
1096 template <> struct MDNodeKeyImpl<DIMacroFile> {
1097  unsigned MIType;
1098  unsigned Line;
1101 
1102  MDNodeKeyImpl(unsigned MIType, unsigned Line, Metadata *File,
1103  Metadata *Elements)
1104  : MIType(MIType), Line(Line), File(File), Elements(Elements) {}
1106  : MIType(N->getMacinfoType()), Line(N->getLine()), File(N->getRawFile()),
1107  Elements(N->getRawElements()) {}
1108 
1109  bool isKeyOf(const DIMacroFile *RHS) const {
1110  return MIType == RHS->getMacinfoType() && Line == RHS->getLine() &&
1111  File == RHS->getRawFile() && Elements == RHS->getRawElements();
1112  }
1113 
1114  unsigned getHashValue() const {
1115  return hash_combine(MIType, Line, File, Elements);
1116  }
1117 };
1118 
1119 /// DenseMapInfo for MDNode subclasses.
1120 template <class NodeTy> struct MDNodeInfo {
1123 
1124  static inline NodeTy *getEmptyKey() {
1126  }
1127 
1128  static inline NodeTy *getTombstoneKey() {
1130  }
1131 
1132  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
1133 
1134  static unsigned getHashValue(const NodeTy *N) {
1135  return KeyTy(N).getHashValue();
1136  }
1137 
1138  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1139  if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1140  return false;
1141  return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1142  }
1143 
1144  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1145  if (LHS == RHS)
1146  return true;
1147  if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1148  return false;
1149  return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1150  }
1151 };
1152 
1153 #define HANDLE_MDNODE_LEAF(CLASS) using CLASS##Info = MDNodeInfo<CLASS>;
1154 #include "llvm/IR/Metadata.def"
1155 
1156 /// Map-like storage for metadata attachments.
1159 
1160 public:
1161  bool empty() const { return Attachments.empty(); }
1162  size_t size() const { return Attachments.size(); }
1163 
1164  /// Get a particular attachment (if any).
1165  MDNode *lookup(unsigned ID) const;
1166 
1167  /// Set an attachment to a particular node.
1168  ///
1169  /// Set the \c ID attachment to \c MD, replacing the current attachment at \c
1170  /// ID (if anyway).
1171  void set(unsigned ID, MDNode &MD);
1172 
1173  /// Remove an attachment.
1174  ///
1175  /// Remove the attachment at \c ID, if any.
1176  bool erase(unsigned ID);
1177 
1178  /// Copy out all the attachments.
1179  ///
1180  /// Copies all the current attachments into \c Result, sorting by attachment
1181  /// ID. This function does \em not clear \c Result.
1182  void getAll(SmallVectorImpl<std::pair<unsigned, MDNode *>> &Result) const;
1183 
1184  /// Erase matching attachments.
1185  ///
1186  /// Erases all attachments matching the \c shouldRemove predicate.
1187  template <class PredTy> void remove_if(PredTy shouldRemove) {
1188  Attachments.erase(llvm::remove_if(Attachments, shouldRemove),
1189  Attachments.end());
1190  }
1191 };
1192 
1193 /// Multimap-like storage for metadata attachments for globals. This differs
1194 /// from MDAttachmentMap in that it allows multiple attachments per metadata
1195 /// kind.
1197  struct Attachment {
1198  unsigned MDKind;
1199  TrackingMDNodeRef Node;
1200  };
1201  SmallVector<Attachment, 1> Attachments;
1202 
1203 public:
1204  bool empty() const { return Attachments.empty(); }
1205 
1206  /// Appends all attachments with the given ID to \c Result in insertion order.
1207  /// If the global has no attachments with the given ID, or if ID is invalid,
1208  /// leaves Result unchanged.
1209  void get(unsigned ID, SmallVectorImpl<MDNode *> &Result) const;
1210 
1211  /// Returns the first attachment with the given ID or nullptr if no such
1212  /// attachment exists.
1213  MDNode *lookup(unsigned ID) const;
1214 
1215  void insert(unsigned ID, MDNode &MD);
1216  bool erase(unsigned ID);
1217 
1218  /// Appends all attachments for the global to \c Result, sorting by attachment
1219  /// ID. Attachments with the same ID appear in insertion order. This function
1220  /// does \em not clear \c Result.
1221  void getAll(SmallVectorImpl<std::pair<unsigned, MDNode *>> &Result) const;
1222 };
1223 
1225 public:
1226  /// OwnedModules - The set of modules instantiated in this context, and which
1227  /// will be automatically deleted if this context is deleted.
1229 
1230  LLVMContext::InlineAsmDiagHandlerTy InlineAsmDiagHandler = nullptr;
1231  void *InlineAsmDiagContext = nullptr;
1232 
1233  std::unique_ptr<DiagnosticHandler> DiagHandler;
1234  bool RespectDiagnosticFilters = false;
1235  bool DiagnosticsHotnessRequested = false;
1236  uint64_t DiagnosticsHotnessThreshold = 0;
1237  std::unique_ptr<yaml::Output> DiagnosticsOutputFile;
1238 
1239  LLVMContext::YieldCallbackTy YieldCallback = nullptr;
1240  void *YieldOpaqueHandle = nullptr;
1241 
1242  using IntMapTy =
1245 
1246  using FPMapTy =
1249 
1253 
1257 
1259 
1260 #define HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS) \
1261  DenseSet<CLASS *, CLASS##Info> CLASS##s;
1262 #include "llvm/IR/Metadata.def"
1263 
1264  // Optional map for looking up composite types by identifier.
1266 
1267  // MDNodes may be uniqued or not uniqued. When they're not uniqued, they
1268  // aren't in the MDNodeSet, but they're still shared between objects, so no
1269  // one object can destroy them. Keep track of them here so we can delete
1270  // them on context teardown.
1271  std::vector<MDNode *> DistinctMDNodes;
1272 
1274 
1277 
1280 
1283 
1285 
1287 
1289 
1293 
1295 
1296  ConstantInt *TheTrueVal = nullptr;
1297  ConstantInt *TheFalseVal = nullptr;
1298 
1299  std::unique_ptr<ConstantTokenNone> TheNoneToken;
1300 
1301  // Basic type instances.
1302  Type VoidTy, LabelTy, HalfTy, FloatTy, DoubleTy, MetadataTy, TokenTy;
1303  Type X86_FP80Ty, FP128Ty, PPC_FP128Ty, X86_MMXTy;
1304  IntegerType Int1Ty, Int8Ty, Int16Ty, Int32Ty, Int64Ty, Int128Ty;
1305 
1306  /// TypeAllocator - All dynamically allocated types are allocated from this.
1307  /// They live forever until the context is torn down.
1309 
1311 
1317  unsigned NamedStructTypesUniqueID = 0;
1318 
1321  DenseMap<Type*, PointerType*> PointerTypes; // Pointers in AddrSpace = 0
1323 
1324  /// ValueHandles - This map keeps track of all of the value handles that are
1325  /// watching a Value*. The Value::HasValueHandle bit is used to know
1326  /// whether or not a value has an entry in this map.
1329 
1330  /// CustomMDKindNames - Map to hold the metadata string to ID mapping.
1332 
1333  /// Collection of per-instruction metadata used in this context.
1335 
1336  /// Collection of per-GlobalObject metadata used in this context.
1338 
1339  /// Collection of per-GlobalObject sections used in this context.
1341 
1342  /// Stable collection of section strings.
1344 
1345  /// DiscriminatorTable - This table maps file:line locations to an
1346  /// integer representing the next DWARF path discriminator to assign to
1347  /// instructions in different blocks at the same location.
1349 
1350  int getOrAddScopeRecordIdxEntry(MDNode *N, int ExistingIdx);
1351  int getOrAddScopeInlinedAtIdxEntry(MDNode *Scope, MDNode *IA,int ExistingIdx);
1352 
1353  /// A set of interned tags for operand bundles. The StringMap maps
1354  /// bundle tags to their IDs.
1355  ///
1356  /// \see LLVMContext::getOperandBundleTagID
1358 
1359  StringMapEntry<uint32_t> *getOrInsertBundleTag(StringRef Tag);
1360  void getOperandBundleTags(SmallVectorImpl<StringRef> &Tags) const;
1361  uint32_t getOperandBundleTagID(StringRef Tag) const;
1362 
1363  /// A set of interned synchronization scopes. The StringMap maps
1364  /// synchronization scope names to their respective synchronization scope IDs.
1366 
1367  /// getOrInsertSyncScopeID - Maps synchronization scope name to
1368  /// synchronization scope ID. Every synchronization scope registered with
1369  /// LLVMContext has unique ID except pre-defined ones.
1370  SyncScope::ID getOrInsertSyncScopeID(StringRef SSN);
1371 
1372  /// getSyncScopeNames - Populates client supplied SmallVector with
1373  /// synchronization scope names registered with LLVMContext. Synchronization
1374  /// scope names are ordered by increasing synchronization scope IDs.
1375  void getSyncScopeNames(SmallVectorImpl<StringRef> &SSNs) const;
1376 
1377  /// Maintain the GC name for each function.
1378  ///
1379  /// This saves allocating an additional word in Function for programs which
1380  /// do not use GC (i.e., most programs) at the cost of increased overhead for
1381  /// clients which do use GC.
1383 
1384  /// Flag to indicate if Value (other than GlobalValue) retains their name or
1385  /// not.
1386  bool DiscardValueNames = false;
1387 
1389  ~LLVMContextImpl();
1390 
1391  /// Destroy the ConstantArrays if they are not used.
1392  void dropTriviallyDeadConstantArrays();
1393 
1394  mutable OptPassGate *OPG = nullptr;
1395 
1396  /// Access the object which can disable optional passes and individual
1397  /// optimizations at compile time.
1398  OptPassGate &getOptPassGate() const;
1399 
1400  /// Set the object which can disable optional passes and individual
1401  /// optimizations at compile time.
1402  ///
1403  /// The lifetime of the object must be guaranteed to extend as long as the
1404  /// LLVMContext is used by compilation.
1405  void setOptPassGate(OptPassGate&);
1406 };
1407 
1408 } // end namespace llvm
1409 
1410 #endif // LLVM_LIB_IR_LLVMCONTEXTIMPL_H
static unsigned calculateHash(MDNode *N, unsigned Offset=0)
DIFlags getFlags() const
static APInt getTombstoneKey()
uint64_t CallInst * C
static bool isEqual(const KeyTy &LHS, const FunctionType *RHS)
static APFloat getTombstoneKey()
MDString * getRawName() const
DenseMap< unsigned, IntegerType * > IntegerTypes
ArrayRef< uint64_t > getElements() const
uint64_t getOffsetInBits() const
Type
MessagePack types as defined in the standard, with the exception of Integer being divided into a sign...
Definition: MsgPackReader.h:49
static bool isEqual(const NodeTy *LHS, const NodeTy *RHS)
bool isKeyOf(const MDTuple *RHS) const
StringMap< MDString, BumpPtrAllocator > MDStringCache
static bool isSubsetEqual(const KeyTy &LHS, const NodeTy *RHS)
unsigned getLine() const
MDNodeKeyImpl(Metadata *Scope, MDString *Name, Metadata *File, unsigned Line, Metadata *Type, unsigned Arg, unsigned Flags, uint32_t AlignInBits)
static unsigned getHashValue(const KeyTy &Key)
FoldingSet< AttributeImpl > AttrsSet
MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine, Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex, int ThisAdjustment, unsigned Flags, bool IsOptimized, Metadata *Unit, Metadata *TemplateParams, Metadata *Declaration, Metadata *RetainedNodes, Metadata *ThrownTypes)
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
static unsigned getHashValue(const KeyTy &Key)
Metadata * getRawScope() const
Structure for hashing arbitrary MDNode operands.
MDString * getRawName() const
Metadata * getRawVTableHolder() const
DenseMap< std::pair< const Function *, const BasicBlock * >, BlockAddress * > BlockAddresses
iterator begin() const
Definition: ArrayRef.h:137
MDString * getRawName() const
Extensions to this class implement mechanisms to disable passes and individual optimizations at compi...
Definition: OptBisect.h:32
static StructType * getTombstoneKey()
void(*)(LLVMContext *Context, void *OpaqueHandle) YieldCallbackTy
Defines the type of a yield callback.
Definition: LLVMContext.h:175
Configuration point for MDNodeInfo::isEqual().
MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder, Metadata *TemplateParams, MDString *Identifier, Metadata *Discriminator)
DenseMap< Value *, ValueAsMetadata * > ValuesAsMetadata
unsigned getDiscriminator() const
MDString * getRawValue() const
bool isKeyOf(const DIMacro *RHS) const
MDNodeKeyImpl(const GenericDINode *N)
MDNodeKeyImpl(unsigned Line, unsigned Column, Metadata *Scope, Metadata *InlinedAt, bool ImplicitCode)
constexpr T getValueOr(U &&value) const LLVM_LVALUE_FUNCTION
Definition: Optional.h:190
Metadata * getRawFile() const
Return the raw underlying file.
static bool isEqual(const KeyTy &LHS, const StructType *RHS)
This file contains the declarations for metadata subclasses.
Metadata * getRawInlinedAt() const
bool operator!=(const KeyTy &that) const
static unsigned getHashValue(const StructType *ST)
bool isKeyOf(const DINamespace *RHS) const
MDNodeKeyImpl(MDString *Name, Metadata *File, unsigned Line, MDString *GetterName, MDString *SetterName, unsigned Attributes, Metadata *Type)
MDNodeKeyImpl(unsigned Tag, MDString *Name, uint64_t SizeInBits, uint32_t AlignInBits, unsigned Encoding, unsigned Flags)
Metadata node.
Definition: Metadata.h:864
Metadata * getRawScope() const
MDNodeOpsKey(const NodeTy *N, unsigned Offset=0)
DenseMap< std::pair< Type *, unsigned >, PointerType * > ASPointerTypes
MDNodeKeyImpl(const DISubrange *N)
Metadata * getRawTemplateParams() const
MDNodeKeyImpl(const DITemplateTypeParameter *N)
unsigned getVirtuality(StringRef VirtualityString)
Definition: Dwarf.cpp:291
MDNodeKeyImpl(ArrayRef< uint64_t > Elements)
MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Line, unsigned Column)
Multimap-like storage for metadata attachments for globals.
static unsigned calculateHash(GenericDINode *N)
Tuple of metadata.
Definition: Metadata.h:1106
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
unsigned getBitWidth() const
Return the number of bits in the APInt.
Definition: APInt.h:1503
MDNodeKeyImpl(const DIEnumerator *N)
MDString * getRawName() const
static bool isSubsetEqual(const KeyTy &LHS, const DISubprogram *RHS)
static NodeTy * getEmptyKey()
bool isKeyOf(const DISubroutineType *RHS) const
The address of a basic block.
Definition: Constants.h:836
Metadata * getRawTypeArray() const
DenseMap< const Instruction *, MDAttachmentMap > InstructionMetadata
Collection of per-instruction metadata used in this context.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
static bool isDeclarationOfODRMember(bool IsDefinition, const Metadata *Scope, const MDString *LinkageName, const Metadata *TemplateParams, const DISubprogram *RHS)
Subprograms compare equal if they declare the same function in an ODR type.
MDNodeKeyImpl(const DIGlobalVariable *N)
static unsigned getHashValue(const APFloat &Key)
MDNodeKeyImpl(unsigned MIType, unsigned Line, Metadata *File, Metadata *Elements)
static bool isEqual(const APInt &LHS, const APInt &RHS)
unsigned getTag() const
Class to represent struct types.
Definition: DerivedTypes.h:201
Array subrange.
KeyTy(const FunctionType *FT)
uint64_t VAL
Used to store the <= 64 bits integer value.
Definition: APInt.h:94
unsigned getHashValue() const
Using name and line to get hash value. It should already be mostly unique.
MDNodeKeyImpl(const DIBasicType *N)
MDString * getRawSetterName() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
DenseMap< std::pair< Type *, uint64_t >, ArrayType * > ArrayTypes
std::unique_ptr< DiagnosticHandler > DiagHandler
MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition, Metadata *StaticDataMemberDeclaration, Metadata *TemplateParams, uint32_t AlignInBits)
std::vector< MDNode * > DistinctMDNodes
uint64_t getSizeInBits() const
Metadata * getRawType() const
DenseMap< const Value *, ValueName * > ValueNames
static const uint16_t * lookup(unsigned opcode, unsigned domain, ArrayRef< uint16_t[3]> Table)
BumpPtrAllocator TypeAllocator
TypeAllocator - All dynamically allocated types are allocated from this.
unsigned getHash() const
This file implements a class to represent arbitrary precision integral constant values and operations...
static unsigned getHashValue(const FunctionType *FT)
MDString * getRawISysRoot() const
static StructType * getEmptyKey()
ConstantUniqueMap< InlineAsm > InlineAsms
op_iterator op_begin() const
Definition: Metadata.h:1059
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
MDNodeKeyImpl(const DISubprogram *N)
bool getExportSymbols() const
MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *ConfigurationMacros, MDString *IncludePath, MDString *ISysRoot)
Subprogram description.
Key
PAL metadata keys.
Class to represent function types.
Definition: DerivedTypes.h:103
Optional< DIFile::ChecksumInfo< MDString * > > Checksum
unsigned getRuntimeLang() const
MDString * getRawName() const
Class to represent array types.
Definition: DerivedTypes.h:369
Enumeration value.
std::unique_ptr< ConstantTokenNone > TheNoneToken
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
hash_code hash_value(const APFloat &Arg)
See friend declarations above.
Definition: APFloat.cpp:4431
uint32_t getAlignInBits() const
ArrayConstantsTy ArrayConstants
bool isKeyOf(const DISubprogram *RHS) const
Metadata * getRawEntity() const
Debug location.
DenseMap< std::pair< Type *, unsigned >, VectorType * > VectorTypes
MDNodeKeyImpl(MDString *Name, Metadata *Type)
bool isKeyOf(const DITemplateValueParameter *RHS) const
bool isKeyOf(const DIMacroFile *RHS) const
StringMap< SyncScope::ID > SSC
A set of interned synchronization scopes.
Class to represent pointers.
Definition: DerivedTypes.h:467
Metadata * getRawFile() const
unsigned getLine() const
bool isKeyOf(const DIGlobalVariable *RHS) const
MDNodeKeyImpl(unsigned Tag, Metadata *Scope, Metadata *Entity, Metadata *File, unsigned Line, MDString *Name)
bool isKeyOf(const DISubrange *RHS) const
DenseMap< PointerType *, std::unique_ptr< ConstantPointerNull > > CPNConstants
#define P(N)
StringMap< unsigned > CustomMDKindNames
CustomMDKindNames - Map to hold the metadata string to ID mapping.
bool operator==(const KeyTy &that) const
bool isKeyOf(const DILexicalBlock *RHS) const
unsigned getColumn() const
static bool isSubsetEqual(const DIDerivedType *LHS, const DIDerivedType *RHS)
Metadata * getRawDiscriminator() const
MDNodeKeyImpl(Metadata *Variable, Metadata *Expression)
A single checksum, represented by a Kind and a Value (a string).
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:69
bool operator!=(const KeyTy &that) const
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:141
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:149
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
CountType getCount() const
This file contains the declarations for the subclasses of Constant, which represent the different fla...
MDNodeKeyImpl(const DIExpression *N)
static unsigned calculateHash(MDTuple *N)
MDNodeKeyImpl(unsigned MIType, unsigned Line, MDString *Name, MDString *Value)
unsigned getAttributes() const
bool compareOps(const NodeTy *RHS, unsigned Offset=0) const
StringMap< uint32_t > BundleTagCache
A set of interned tags for operand bundles.
bool isKeyOf(const DIGlobalVariableExpression *RHS) const
static bool isEqual(const FunctionType *LHS, const FunctionType *RHS)
MDNodeKeyImpl(const DIObjCProperty *N)
MDNodeKeyImpl(const DISubroutineType *N)
MDNodeKeyImpl(Metadata *Scope, MDString *Name, bool ExportSymbols)
A pair of DIGlobalVariable and DIExpression.
This file declares a class to represent arbitrary precision floating point values and provide a varie...
bool isKeyOf(const DIImportedEntity *RHS) const
This file defines various helper methods and classes used by LLVMContextImpl for creating and managin...
ValueHandlesTy ValueHandles
MDNodeKeyImpl(const DILexicalBlockFile *N)
MDNodeKeyImpl(const DICompositeType *N)
static bool isSubsetEqual(const DISubprogram *LHS, const DISubprogram *RHS)
Class to represent integer types.
Definition: DerivedTypes.h:40
static FunctionType * getEmptyKey()
MDNodeKeyImpl(const DIDerivedType *N)
auto remove_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::remove_if which take ranges instead of having to pass begin/end explicitly...
Definition: STLExtras.h:1082
bool isKeyOf(const DILabel *RHS) const
static unsigned getHashValue(const NodeTy *N)
MDString * getRawConfigurationMacros() const
bool isKeyOf(const DIEnumerator *RHS) const
iterator erase(const_iterator CI)
Definition: SmallVector.h:445
unsigned getLine() const
bool isKeyOf(const DIBasicType *RHS) const
DenseMap< const GlobalObject *, StringRef > GlobalObjectSections
Collection of per-GlobalObject sections used in this context.
static bool isEqual(const APFloat &LHS, const APFloat &RHS)
size_t size() const
Definition: SmallVector.h:53
Metadata * getRawType() const
MDString * getRawName() const
MDString * getRawName() const
FoldingSet - This template class is used to instantiate a specialized implementation of the folding s...
Definition: FoldingSet.h:474
VectorConstantsTy VectorConstants
MDNodeKeyImpl(int64_t Value, bool IsUnsigned, MDString *Name)
An imported module (C++ using directive or similar).
static bool isEqual(const KeyTy &LHS, const NodeTy *RHS)
Metadata * getRawElements() const
int64_t getValue() const
DenseMap< Metadata *, MetadataAsValue * > MetadataAsValues
MDNodeKeyImpl(MDString *Filename, MDString *Directory, Optional< DIFile::ChecksumInfo< MDString *>> Checksum, Optional< MDString *> Source)
static bool isSubsetEqual(const NodeTy *LHS, const NodeTy *RHS)
Metadata * getRawScope() const
DenseMap< const GlobalObject *, MDGlobalAttachmentMap > GlobalObjectMetadata
Collection of per-GlobalObject metadata used in this context.
This is the shared class of boolean and integer constants.
Definition: Constants.h:84
MDNodeKeyImpl(Metadata *CountNode, int64_t LowerBound)
Metadata * getRawTemplateParams() const
static NodeTy * getTombstoneKey()
unsigned getLine() const
MDNodeKeyImpl(const DIGlobalVariableExpression *N)
bool isKeyOf(const DIDerivedType *RHS) const
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:847
iterator end() const
Definition: ArrayRef.h:138
FunctionTypeSet FunctionTypes
MDString * getRawHeader() const
FoldingSet< AttributeListImpl > AttrsLists
MDNodeKeyImpl(ArrayRef< Metadata *> Ops)
Optional< MDString * > Source
static Optional< unsigned > getTag(const TargetRegisterInfo *TRI, const MachineInstr &MI, const LoadInfo &LI)
Metadata * getRawElements() const
Metadata * getRawFile() const
DWARF expression.
bool isKeyOf(const DITemplateTypeParameter *RHS) const
SmallPtrSet< Module *, 4 > OwnedModules
OwnedModules - The set of modules instantiated in this context, and which will be automatically delet...
MDNodeKeyImpl(const DITemplateValueParameter *N)
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
Definition: StringMap.h:220
MDNodeKeyImpl(const DINamespace *N)
Class to represent vector types.
Definition: DerivedTypes.h:393
static bool isEqual(const StructType *LHS, const StructType *RHS)
This file contains constants used for implementing Dwarf debug support.
Class for arbitrary precision integers.
Definition: APInt.h:70
Metadata * getRawFile() const
bool isKeyOf(const DICompositeType *RHS) const
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
Definition: Hashing.h:601
A (clang) module that has been imported by the compile unit.
void(*)(const SMDiagnostic &, void *Context, unsigned LocCookie) InlineAsmDiagHandlerTy
Definition: LLVMContext.h:171
DenseMapInfo for MDNode subclasses.
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
Definition: Hashing.h:479
static bool isSubsetEqual(const KeyTy &LHS, const DIDerivedType *RHS)
Generic tagged DWARF-like metadata node.
MDNodeKeyImpl(const DILocalVariable *N)
MDNodeKeyImpl(Metadata *Scope, MDString *Name, Metadata *File, unsigned Line)
Metadata * getRawFile() const
MDNodeKeyImpl(const DIImportedEntity *N)
Metadata * getRawBaseType() const
static FunctionType * getTombstoneKey()
MDString * getRawName() const
MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *Type, Metadata *Value)
MDNodeKeyImpl(const DILocation *L)
bool isKeyOf(const DILexicalBlockFile *RHS) const
Type array for a subprogram.
StructTypeSet AnonStructTypes
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
Definition: SmallVector.h:133
MDString * getRawIdentifier() const
unsigned getEncoding() const
bool isKeyOf(const GenericDINode *RHS) const
static unsigned getHashValue(const APInt &Key)
DenseMap< std::pair< const char *, unsigned >, unsigned > DiscriminatorTable
DiscriminatorTable - This table maps file:line locations to an integer representing the next DWARF pa...
LLVM_NODISCARD bool empty() const
Definition: SmallVector.h:56
StringMap< StructType * > NamedStructTypes
Metadata * getRawScope() const
static bool isODRMember(unsigned Tag, const Metadata *Scope, const MDString *Name, const DIDerivedType *RHS)
Subprograms compare equal if they declare the same function in an ODR type.
std::unique_ptr< yaml::Output > DiagnosticsOutputFile
#define N
static const fltSemantics & Bogus() LLVM_READNONE
A Pseudo fltsemantic used to construct APFloats that cannot conflict with anything real...
Definition: APFloat.cpp:132
DenseMap< const Function *, std::string > GCNames
Maintain the GC name for each function.
MDString * getRawName() const
DenseMap< Type *, std::unique_ptr< ConstantAggregateZero > > CAZConstants
unsigned getMacinfoType() const
ConstantUniqueMap< ConstantExpr > ExprConstants
bool operator==(const KeyTy &that) const
MDString * getRawLinkageName() const
Metadata * getRawStaticDataMemberDeclaration() const
KeyTy(const Type *R, const ArrayRef< Type *> &P, bool V)
unsigned getTag() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, Optional< unsigned > DWARFAddressSpace, unsigned Flags, Metadata *ExtraData)
uint32_t getAlignInBits() const
MDNodeKeyImpl(unsigned Tag, MDString *Header, ArrayRef< Metadata *> DwarfOps)
bool isKeyOf(const DIFile *RHS) const
StructConstantsTy StructConstants
unsigned getSizeInBits(unsigned Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI) const
Get the size in bits of Reg.
DenseMap< Type *, std::unique_ptr< UndefValue > > UVConstants
void remove_if(PredTy shouldRemove)
Erase matching attachments.
bool bitwiseIsEqual(const APFloat &RHS) const
Definition: APFloat.h:1112
Metadata * getRawScope() const
MDNodeKeyImpl(const DILexicalBlock *N)
StringSet - A wrapper for StringMap that provides set-like functionality.
Definition: StringSet.h:28
bool isKeyOf(const DIModule *RHS) const
FoldingSet< AttributeSetNode > AttrsSetNodes
Metadata * getRawScope() const
bool isKeyOf(const DILocation *RHS) const
bool isKeyOf(const DIObjCProperty *RHS) const
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
A single uniqued string.
Definition: Metadata.h:604
MDString * getRawIncludePath() const
unsigned getLine() const
bool isKeyOf(const DILocalVariable *RHS) const
unsigned getLine() const
DenseMap< Type *, PointerType * > PointerTypes
bool operator==(uint64_t V1, const APInt &V2)
Definition: APInt.h:1961
MDNodeOpsKey(ArrayRef< Metadata *> Ops)
Metadata * getRawType() const
Metadata * getRawScope() const
unsigned getNumOperands() const
Return number of MDNode operands.
Definition: Metadata.h:1075
Map-like storage for metadata attachments.
KeyTy(const ArrayRef< Type *> &E, bool P)
StringMap< ConstantDataSequential * > CDSConstants
Optional< DenseMap< const MDString *, DICompositeType * > > DITypeMap
MDString * getRawName() const
Root of the metadata hierarchy.
Definition: Metadata.h:58
unsigned getLine() const
MDString * getRawGetterName() const
MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Discriminator)
Metadata * getRawScope() const
StringSet SectionStrings
Stable collection of section strings.
bool empty() const
empty - Check if the array is empty.
Definition: ArrayRef.h:144
IntegerType * Int32Ty
static unsigned getHashValue(const KeyTy &Key)
Basic type, like &#39;int&#39; or &#39;float&#39;.
MDNodeKeyImpl(unsigned Flags, uint8_t CC, Metadata *TypeArray)
bool isKeyOf(const DIExpression *RHS) const