LLVM  mainline
LLVMContextImpl.h
Go to the documentation of this file.
00001 //===-- LLVMContextImpl.h - The LLVMContextImpl opaque class ----*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  This file declares LLVMContextImpl, the opaque implementation 
00011 //  of LLVMContext.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_LIB_IR_LLVMCONTEXTIMPL_H
00016 #define LLVM_LIB_IR_LLVMCONTEXTIMPL_H
00017 
00018 #include "AttributeImpl.h"
00019 #include "ConstantsContext.h"
00020 #include "llvm/ADT/APFloat.h"
00021 #include "llvm/ADT/APInt.h"
00022 #include "llvm/ADT/ArrayRef.h"
00023 #include "llvm/ADT/DenseMap.h"
00024 #include "llvm/ADT/DenseSet.h"
00025 #include "llvm/ADT/FoldingSet.h"
00026 #include "llvm/ADT/Hashing.h"
00027 #include "llvm/ADT/SmallPtrSet.h"
00028 #include "llvm/ADT/StringMap.h"
00029 #include "llvm/IR/Constants.h"
00030 #include "llvm/IR/DebugInfoMetadata.h"
00031 #include "llvm/IR/DerivedTypes.h"
00032 #include "llvm/IR/LLVMContext.h"
00033 #include "llvm/IR/Metadata.h"
00034 #include "llvm/IR/ValueHandle.h"
00035 #include <vector>
00036 
00037 namespace llvm {
00038 
00039 class ConstantInt;
00040 class ConstantFP;
00041 class DiagnosticInfoOptimizationRemark;
00042 class DiagnosticInfoOptimizationRemarkMissed;
00043 class DiagnosticInfoOptimizationRemarkAnalysis;
00044 class GCStrategy;
00045 class LLVMContext;
00046 class Type;
00047 class Value;
00048 
00049 struct DenseMapAPIntKeyInfo {
00050   static inline APInt getEmptyKey() {
00051     APInt V(nullptr, 0);
00052     V.VAL = 0;
00053     return V;
00054   }
00055   static inline APInt getTombstoneKey() {
00056     APInt V(nullptr, 0);
00057     V.VAL = 1;
00058     return V;
00059   }
00060   static unsigned getHashValue(const APInt &Key) {
00061     return static_cast<unsigned>(hash_value(Key));
00062   }
00063   static bool isEqual(const APInt &LHS, const APInt &RHS) {
00064     return LHS.getBitWidth() == RHS.getBitWidth() && LHS == RHS;
00065   }
00066 };
00067 
00068 struct DenseMapAPFloatKeyInfo {
00069   static inline APFloat getEmptyKey() { return APFloat(APFloat::Bogus, 1); }
00070   static inline APFloat getTombstoneKey() { return APFloat(APFloat::Bogus, 2); }
00071   static unsigned getHashValue(const APFloat &Key) {
00072     return static_cast<unsigned>(hash_value(Key));
00073   }
00074   static bool isEqual(const APFloat &LHS, const APFloat &RHS) {
00075     return LHS.bitwiseIsEqual(RHS);
00076   }
00077 };
00078 
00079 struct AnonStructTypeKeyInfo {
00080   struct KeyTy {
00081     ArrayRef<Type*> ETypes;
00082     bool isPacked;
00083     KeyTy(const ArrayRef<Type*>& E, bool P) :
00084       ETypes(E), isPacked(P) {}
00085     KeyTy(const StructType *ST)
00086         : ETypes(ST->elements()), isPacked(ST->isPacked()) {}
00087     bool operator==(const KeyTy& that) const {
00088       if (isPacked != that.isPacked)
00089         return false;
00090       if (ETypes != that.ETypes)
00091         return false;
00092       return true;
00093     }
00094     bool operator!=(const KeyTy& that) const {
00095       return !this->operator==(that);
00096     }
00097   };
00098   static inline StructType* getEmptyKey() {
00099     return DenseMapInfo<StructType*>::getEmptyKey();
00100   }
00101   static inline StructType* getTombstoneKey() {
00102     return DenseMapInfo<StructType*>::getTombstoneKey();
00103   }
00104   static unsigned getHashValue(const KeyTy& Key) {
00105     return hash_combine(hash_combine_range(Key.ETypes.begin(),
00106                                            Key.ETypes.end()),
00107                         Key.isPacked);
00108   }
00109   static unsigned getHashValue(const StructType *ST) {
00110     return getHashValue(KeyTy(ST));
00111   }
00112   static bool isEqual(const KeyTy& LHS, const StructType *RHS) {
00113     if (RHS == getEmptyKey() || RHS == getTombstoneKey())
00114       return false;
00115     return LHS == KeyTy(RHS);
00116   }
00117   static bool isEqual(const StructType *LHS, const StructType *RHS) {
00118     return LHS == RHS;
00119   }
00120 };
00121 
00122 struct FunctionTypeKeyInfo {
00123   struct KeyTy {
00124     const Type *ReturnType;
00125     ArrayRef<Type*> Params;
00126     bool isVarArg;
00127     KeyTy(const Type* R, const ArrayRef<Type*>& P, bool V) :
00128       ReturnType(R), Params(P), isVarArg(V) {}
00129     KeyTy(const FunctionType *FT)
00130         : ReturnType(FT->getReturnType()), Params(FT->params()),
00131           isVarArg(FT->isVarArg()) {}
00132     bool operator==(const KeyTy& that) const {
00133       if (ReturnType != that.ReturnType)
00134         return false;
00135       if (isVarArg != that.isVarArg)
00136         return false;
00137       if (Params != that.Params)
00138         return false;
00139       return true;
00140     }
00141     bool operator!=(const KeyTy& that) const {
00142       return !this->operator==(that);
00143     }
00144   };
00145   static inline FunctionType* getEmptyKey() {
00146     return DenseMapInfo<FunctionType*>::getEmptyKey();
00147   }
00148   static inline FunctionType* getTombstoneKey() {
00149     return DenseMapInfo<FunctionType*>::getTombstoneKey();
00150   }
00151   static unsigned getHashValue(const KeyTy& Key) {
00152     return hash_combine(Key.ReturnType,
00153                         hash_combine_range(Key.Params.begin(),
00154                                            Key.Params.end()),
00155                         Key.isVarArg);
00156   }
00157   static unsigned getHashValue(const FunctionType *FT) {
00158     return getHashValue(KeyTy(FT));
00159   }
00160   static bool isEqual(const KeyTy& LHS, const FunctionType *RHS) {
00161     if (RHS == getEmptyKey() || RHS == getTombstoneKey())
00162       return false;
00163     return LHS == KeyTy(RHS);
00164   }
00165   static bool isEqual(const FunctionType *LHS, const FunctionType *RHS) {
00166     return LHS == RHS;
00167   }
00168 };
00169 
00170 /// \brief Structure for hashing arbitrary MDNode operands.
00171 class MDNodeOpsKey {
00172   ArrayRef<Metadata *> RawOps;
00173   ArrayRef<MDOperand> Ops;
00174 
00175   unsigned Hash;
00176 
00177 protected:
00178   MDNodeOpsKey(ArrayRef<Metadata *> Ops)
00179       : RawOps(Ops), Hash(calculateHash(Ops)) {}
00180 
00181   template <class NodeTy>
00182   MDNodeOpsKey(const NodeTy *N, unsigned Offset = 0)
00183       : Ops(N->op_begin() + Offset, N->op_end()), Hash(N->getHash()) {}
00184 
00185   template <class NodeTy>
00186   bool compareOps(const NodeTy *RHS, unsigned Offset = 0) const {
00187     if (getHash() != RHS->getHash())
00188       return false;
00189 
00190     assert((RawOps.empty() || Ops.empty()) && "Two sets of operands?");
00191     return RawOps.empty() ? compareOps(Ops, RHS, Offset)
00192                           : compareOps(RawOps, RHS, Offset);
00193   }
00194 
00195   static unsigned calculateHash(MDNode *N, unsigned Offset = 0);
00196 
00197 private:
00198   template <class T>
00199   static bool compareOps(ArrayRef<T> Ops, const MDNode *RHS, unsigned Offset) {
00200     if (Ops.size() != RHS->getNumOperands() - Offset)
00201       return false;
00202     return std::equal(Ops.begin(), Ops.end(), RHS->op_begin() + Offset);
00203   }
00204 
00205   static unsigned calculateHash(ArrayRef<Metadata *> Ops);
00206 
00207 public:
00208   unsigned getHash() const { return Hash; }
00209 };
00210 
00211 template <class NodeTy> struct MDNodeKeyImpl;
00212 template <class NodeTy> struct MDNodeInfo;
00213 
00214 /// \brief DenseMapInfo for MDTuple.
00215 ///
00216 /// Note that we don't need the is-function-local bit, since that's implicit in
00217 /// the operands.
00218 template <> struct MDNodeKeyImpl<MDTuple> : MDNodeOpsKey {
00219   MDNodeKeyImpl(ArrayRef<Metadata *> Ops) : MDNodeOpsKey(Ops) {}
00220   MDNodeKeyImpl(const MDTuple *N) : MDNodeOpsKey(N) {}
00221 
00222   bool isKeyOf(const MDTuple *RHS) const { return compareOps(RHS); }
00223 
00224   unsigned getHashValue() const { return getHash(); }
00225 
00226   static unsigned calculateHash(MDTuple *N) {
00227     return MDNodeOpsKey::calculateHash(N);
00228   }
00229 };
00230 
00231 /// \brief DenseMapInfo for DILocation.
00232 template <> struct MDNodeKeyImpl<DILocation> {
00233   unsigned Line;
00234   unsigned Column;
00235   Metadata *Scope;
00236   Metadata *InlinedAt;
00237 
00238   MDNodeKeyImpl(unsigned Line, unsigned Column, Metadata *Scope,
00239                 Metadata *InlinedAt)
00240       : Line(Line), Column(Column), Scope(Scope), InlinedAt(InlinedAt) {}
00241 
00242   MDNodeKeyImpl(const DILocation *L)
00243       : Line(L->getLine()), Column(L->getColumn()), Scope(L->getRawScope()),
00244         InlinedAt(L->getRawInlinedAt()) {}
00245 
00246   bool isKeyOf(const DILocation *RHS) const {
00247     return Line == RHS->getLine() && Column == RHS->getColumn() &&
00248            Scope == RHS->getRawScope() && InlinedAt == RHS->getRawInlinedAt();
00249   }
00250   unsigned getHashValue() const {
00251     return hash_combine(Line, Column, Scope, InlinedAt);
00252   }
00253 };
00254 
00255 /// \brief DenseMapInfo for GenericDINode.
00256 template <> struct MDNodeKeyImpl<GenericDINode> : MDNodeOpsKey {
00257   unsigned Tag;
00258   StringRef Header;
00259   MDNodeKeyImpl(unsigned Tag, StringRef Header, ArrayRef<Metadata *> DwarfOps)
00260       : MDNodeOpsKey(DwarfOps), Tag(Tag), Header(Header) {}
00261   MDNodeKeyImpl(const GenericDINode *N)
00262       : MDNodeOpsKey(N, 1), Tag(N->getTag()), Header(N->getHeader()) {}
00263 
00264   bool isKeyOf(const GenericDINode *RHS) const {
00265     return Tag == RHS->getTag() && Header == RHS->getHeader() &&
00266            compareOps(RHS, 1);
00267   }
00268 
00269   unsigned getHashValue() const { return hash_combine(getHash(), Tag, Header); }
00270 
00271   static unsigned calculateHash(GenericDINode *N) {
00272     return MDNodeOpsKey::calculateHash(N, 1);
00273   }
00274 };
00275 
00276 template <> struct MDNodeKeyImpl<DISubrange> {
00277   int64_t Count;
00278   int64_t LowerBound;
00279 
00280   MDNodeKeyImpl(int64_t Count, int64_t LowerBound)
00281       : Count(Count), LowerBound(LowerBound) {}
00282   MDNodeKeyImpl(const DISubrange *N)
00283       : Count(N->getCount()), LowerBound(N->getLowerBound()) {}
00284 
00285   bool isKeyOf(const DISubrange *RHS) const {
00286     return Count == RHS->getCount() && LowerBound == RHS->getLowerBound();
00287   }
00288   unsigned getHashValue() const { return hash_combine(Count, LowerBound); }
00289 };
00290 
00291 template <> struct MDNodeKeyImpl<DIEnumerator> {
00292   int64_t Value;
00293   StringRef Name;
00294 
00295   MDNodeKeyImpl(int64_t Value, StringRef Name) : Value(Value), Name(Name) {}
00296   MDNodeKeyImpl(const DIEnumerator *N)
00297       : Value(N->getValue()), Name(N->getName()) {}
00298 
00299   bool isKeyOf(const DIEnumerator *RHS) const {
00300     return Value == RHS->getValue() && Name == RHS->getName();
00301   }
00302   unsigned getHashValue() const { return hash_combine(Value, Name); }
00303 };
00304 
00305 template <> struct MDNodeKeyImpl<DIBasicType> {
00306   unsigned Tag;
00307   StringRef Name;
00308   uint64_t SizeInBits;
00309   uint64_t AlignInBits;
00310   unsigned Encoding;
00311 
00312   MDNodeKeyImpl(unsigned Tag, StringRef Name, uint64_t SizeInBits,
00313                 uint64_t AlignInBits, unsigned Encoding)
00314       : Tag(Tag), Name(Name), SizeInBits(SizeInBits), AlignInBits(AlignInBits),
00315         Encoding(Encoding) {}
00316   MDNodeKeyImpl(const DIBasicType *N)
00317       : Tag(N->getTag()), Name(N->getName()), SizeInBits(N->getSizeInBits()),
00318         AlignInBits(N->getAlignInBits()), Encoding(N->getEncoding()) {}
00319 
00320   bool isKeyOf(const DIBasicType *RHS) const {
00321     return Tag == RHS->getTag() && Name == RHS->getName() &&
00322            SizeInBits == RHS->getSizeInBits() &&
00323            AlignInBits == RHS->getAlignInBits() &&
00324            Encoding == RHS->getEncoding();
00325   }
00326   unsigned getHashValue() const {
00327     return hash_combine(Tag, Name, SizeInBits, AlignInBits, Encoding);
00328   }
00329 };
00330 
00331 template <> struct MDNodeKeyImpl<DIDerivedType> {
00332   unsigned Tag;
00333   StringRef Name;
00334   Metadata *File;
00335   unsigned Line;
00336   Metadata *Scope;
00337   Metadata *BaseType;
00338   uint64_t SizeInBits;
00339   uint64_t AlignInBits;
00340   uint64_t OffsetInBits;
00341   unsigned Flags;
00342   Metadata *ExtraData;
00343 
00344   MDNodeKeyImpl(unsigned Tag, StringRef Name, Metadata *File, unsigned Line,
00345                 Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
00346                 uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
00347                 Metadata *ExtraData)
00348       : Tag(Tag), Name(Name), File(File), Line(Line), Scope(Scope),
00349         BaseType(BaseType), SizeInBits(SizeInBits), AlignInBits(AlignInBits),
00350         OffsetInBits(OffsetInBits), Flags(Flags), ExtraData(ExtraData) {}
00351   MDNodeKeyImpl(const DIDerivedType *N)
00352       : Tag(N->getTag()), Name(N->getName()), File(N->getRawFile()),
00353         Line(N->getLine()), Scope(N->getRawScope()),
00354         BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()),
00355         AlignInBits(N->getAlignInBits()), OffsetInBits(N->getOffsetInBits()),
00356         Flags(N->getFlags()), ExtraData(N->getRawExtraData()) {}
00357 
00358   bool isKeyOf(const DIDerivedType *RHS) const {
00359     return Tag == RHS->getTag() && Name == RHS->getName() &&
00360            File == RHS->getRawFile() && Line == RHS->getLine() &&
00361            Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() &&
00362            SizeInBits == RHS->getSizeInBits() &&
00363            AlignInBits == RHS->getAlignInBits() &&
00364            OffsetInBits == RHS->getOffsetInBits() && Flags == RHS->getFlags() &&
00365            ExtraData == RHS->getRawExtraData();
00366   }
00367   unsigned getHashValue() const {
00368     return hash_combine(Tag, Name, File, Line, Scope, BaseType, SizeInBits,
00369                         AlignInBits, OffsetInBits, Flags, ExtraData);
00370   }
00371 };
00372 
00373 template <> struct MDNodeKeyImpl<DICompositeType> {
00374   unsigned Tag;
00375   StringRef Name;
00376   Metadata *File;
00377   unsigned Line;
00378   Metadata *Scope;
00379   Metadata *BaseType;
00380   uint64_t SizeInBits;
00381   uint64_t AlignInBits;
00382   uint64_t OffsetInBits;
00383   unsigned Flags;
00384   Metadata *Elements;
00385   unsigned RuntimeLang;
00386   Metadata *VTableHolder;
00387   Metadata *TemplateParams;
00388   StringRef Identifier;
00389 
00390   MDNodeKeyImpl(unsigned Tag, StringRef Name, Metadata *File, unsigned Line,
00391                 Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
00392                 uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
00393                 Metadata *Elements, unsigned RuntimeLang,
00394                 Metadata *VTableHolder, Metadata *TemplateParams,
00395                 StringRef Identifier)
00396       : Tag(Tag), Name(Name), File(File), Line(Line), Scope(Scope),
00397         BaseType(BaseType), SizeInBits(SizeInBits), AlignInBits(AlignInBits),
00398         OffsetInBits(OffsetInBits), Flags(Flags), Elements(Elements),
00399         RuntimeLang(RuntimeLang), VTableHolder(VTableHolder),
00400         TemplateParams(TemplateParams), Identifier(Identifier) {}
00401   MDNodeKeyImpl(const DICompositeType *N)
00402       : Tag(N->getTag()), Name(N->getName()), File(N->getRawFile()),
00403         Line(N->getLine()), Scope(N->getRawScope()),
00404         BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()),
00405         AlignInBits(N->getAlignInBits()), OffsetInBits(N->getOffsetInBits()),
00406         Flags(N->getFlags()), Elements(N->getRawElements()),
00407         RuntimeLang(N->getRuntimeLang()), VTableHolder(N->getRawVTableHolder()),
00408         TemplateParams(N->getRawTemplateParams()),
00409         Identifier(N->getIdentifier()) {}
00410 
00411   bool isKeyOf(const DICompositeType *RHS) const {
00412     return Tag == RHS->getTag() && Name == RHS->getName() &&
00413            File == RHS->getRawFile() && Line == RHS->getLine() &&
00414            Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() &&
00415            SizeInBits == RHS->getSizeInBits() &&
00416            AlignInBits == RHS->getAlignInBits() &&
00417            OffsetInBits == RHS->getOffsetInBits() && Flags == RHS->getFlags() &&
00418            Elements == RHS->getRawElements() &&
00419            RuntimeLang == RHS->getRuntimeLang() &&
00420            VTableHolder == RHS->getRawVTableHolder() &&
00421            TemplateParams == RHS->getRawTemplateParams() &&
00422            Identifier == RHS->getIdentifier();
00423   }
00424   unsigned getHashValue() const {
00425     return hash_combine(Tag, Name, File, Line, Scope, BaseType, SizeInBits,
00426                         AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
00427                         VTableHolder, TemplateParams, Identifier);
00428   }
00429 };
00430 
00431 template <> struct MDNodeKeyImpl<DISubroutineType> {
00432   unsigned Flags;
00433   Metadata *TypeArray;
00434 
00435   MDNodeKeyImpl(int64_t Flags, Metadata *TypeArray)
00436       : Flags(Flags), TypeArray(TypeArray) {}
00437   MDNodeKeyImpl(const DISubroutineType *N)
00438       : Flags(N->getFlags()), TypeArray(N->getRawTypeArray()) {}
00439 
00440   bool isKeyOf(const DISubroutineType *RHS) const {
00441     return Flags == RHS->getFlags() && TypeArray == RHS->getRawTypeArray();
00442   }
00443   unsigned getHashValue() const { return hash_combine(Flags, TypeArray); }
00444 };
00445 
00446 template <> struct MDNodeKeyImpl<DIFile> {
00447   StringRef Filename;
00448   StringRef Directory;
00449 
00450   MDNodeKeyImpl(StringRef Filename, StringRef Directory)
00451       : Filename(Filename), Directory(Directory) {}
00452   MDNodeKeyImpl(const DIFile *N)
00453       : Filename(N->getFilename()), Directory(N->getDirectory()) {}
00454 
00455   bool isKeyOf(const DIFile *RHS) const {
00456     return Filename == RHS->getFilename() && Directory == RHS->getDirectory();
00457   }
00458   unsigned getHashValue() const { return hash_combine(Filename, Directory); }
00459 };
00460 
00461 template <> struct MDNodeKeyImpl<DICompileUnit> {
00462   unsigned SourceLanguage;
00463   Metadata *File;
00464   StringRef Producer;
00465   bool IsOptimized;
00466   StringRef Flags;
00467   unsigned RuntimeVersion;
00468   StringRef SplitDebugFilename;
00469   unsigned EmissionKind;
00470   Metadata *EnumTypes;
00471   Metadata *RetainedTypes;
00472   Metadata *Subprograms;
00473   Metadata *GlobalVariables;
00474   Metadata *ImportedEntities;
00475   uint64_t DWOId;
00476 
00477   MDNodeKeyImpl(unsigned SourceLanguage, Metadata *File, StringRef Producer,
00478                 bool IsOptimized, StringRef Flags, unsigned RuntimeVersion,
00479                 StringRef SplitDebugFilename, unsigned EmissionKind,
00480                 Metadata *EnumTypes, Metadata *RetainedTypes,
00481                 Metadata *Subprograms, Metadata *GlobalVariables,
00482                 Metadata *ImportedEntities, uint64_t DWOId)
00483       : SourceLanguage(SourceLanguage), File(File), Producer(Producer),
00484         IsOptimized(IsOptimized), Flags(Flags), RuntimeVersion(RuntimeVersion),
00485         SplitDebugFilename(SplitDebugFilename), EmissionKind(EmissionKind),
00486         EnumTypes(EnumTypes), RetainedTypes(RetainedTypes),
00487         Subprograms(Subprograms), GlobalVariables(GlobalVariables),
00488         ImportedEntities(ImportedEntities), DWOId(DWOId) {}
00489   MDNodeKeyImpl(const DICompileUnit *N)
00490       : SourceLanguage(N->getSourceLanguage()), File(N->getRawFile()),
00491         Producer(N->getProducer()), IsOptimized(N->isOptimized()),
00492         Flags(N->getFlags()), RuntimeVersion(N->getRuntimeVersion()),
00493         SplitDebugFilename(N->getSplitDebugFilename()),
00494         EmissionKind(N->getEmissionKind()), EnumTypes(N->getRawEnumTypes()),
00495         RetainedTypes(N->getRawRetainedTypes()),
00496         Subprograms(N->getRawSubprograms()),
00497         GlobalVariables(N->getRawGlobalVariables()),
00498         ImportedEntities(N->getRawImportedEntities()), DWOId(N->getDWOId()) {}
00499 
00500   bool isKeyOf(const DICompileUnit *RHS) const {
00501     return SourceLanguage == RHS->getSourceLanguage() &&
00502            File == RHS->getRawFile() && Producer == RHS->getProducer() &&
00503            IsOptimized == RHS->isOptimized() && Flags == RHS->getFlags() &&
00504            RuntimeVersion == RHS->getRuntimeVersion() &&
00505            SplitDebugFilename == RHS->getSplitDebugFilename() &&
00506            EmissionKind == RHS->getEmissionKind() &&
00507            EnumTypes == RHS->getRawEnumTypes() &&
00508            RetainedTypes == RHS->getRawRetainedTypes() &&
00509            Subprograms == RHS->getRawSubprograms() &&
00510            GlobalVariables == RHS->getRawGlobalVariables() &&
00511            ImportedEntities == RHS->getRawImportedEntities() &&
00512            DWOId == RHS->getDWOId();
00513   }
00514   unsigned getHashValue() const {
00515     return hash_combine(SourceLanguage, File, Producer, IsOptimized, Flags,
00516                         RuntimeVersion, SplitDebugFilename, EmissionKind,
00517                         EnumTypes, RetainedTypes, Subprograms, GlobalVariables,
00518                         ImportedEntities, DWOId);
00519   }
00520 };
00521 
00522 template <> struct MDNodeKeyImpl<DISubprogram> {
00523   Metadata *Scope;
00524   StringRef Name;
00525   StringRef LinkageName;
00526   Metadata *File;
00527   unsigned Line;
00528   Metadata *Type;
00529   bool IsLocalToUnit;
00530   bool IsDefinition;
00531   unsigned ScopeLine;
00532   Metadata *ContainingType;
00533   unsigned Virtuality;
00534   unsigned VirtualIndex;
00535   unsigned Flags;
00536   bool IsOptimized;
00537   Metadata *Function;
00538   Metadata *TemplateParams;
00539   Metadata *Declaration;
00540   Metadata *Variables;
00541 
00542   MDNodeKeyImpl(Metadata *Scope, StringRef Name, StringRef LinkageName,
00543                 Metadata *File, unsigned Line, Metadata *Type,
00544                 bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
00545                 Metadata *ContainingType, unsigned Virtuality,
00546                 unsigned VirtualIndex, unsigned Flags, bool IsOptimized,
00547                 Metadata *Function, Metadata *TemplateParams,
00548                 Metadata *Declaration, Metadata *Variables)
00549       : Scope(Scope), Name(Name), LinkageName(LinkageName), File(File),
00550         Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit),
00551         IsDefinition(IsDefinition), ScopeLine(ScopeLine),
00552         ContainingType(ContainingType), Virtuality(Virtuality),
00553         VirtualIndex(VirtualIndex), Flags(Flags), IsOptimized(IsOptimized),
00554         Function(Function), TemplateParams(TemplateParams),
00555         Declaration(Declaration), Variables(Variables) {}
00556   MDNodeKeyImpl(const DISubprogram *N)
00557       : Scope(N->getRawScope()), Name(N->getName()),
00558         LinkageName(N->getLinkageName()), File(N->getRawFile()),
00559         Line(N->getLine()), Type(N->getRawType()),
00560         IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()),
00561         ScopeLine(N->getScopeLine()), ContainingType(N->getRawContainingType()),
00562         Virtuality(N->getVirtuality()), VirtualIndex(N->getVirtualIndex()),
00563         Flags(N->getFlags()), IsOptimized(N->isOptimized()),
00564         Function(N->getRawFunction()),
00565         TemplateParams(N->getRawTemplateParams()),
00566         Declaration(N->getRawDeclaration()), Variables(N->getRawVariables()) {}
00567 
00568   bool isKeyOf(const DISubprogram *RHS) const {
00569     return Scope == RHS->getRawScope() && Name == RHS->getName() &&
00570            LinkageName == RHS->getLinkageName() && File == RHS->getRawFile() &&
00571            Line == RHS->getLine() && Type == RHS->getRawType() &&
00572            IsLocalToUnit == RHS->isLocalToUnit() &&
00573            IsDefinition == RHS->isDefinition() &&
00574            ScopeLine == RHS->getScopeLine() &&
00575            ContainingType == RHS->getRawContainingType() &&
00576            Virtuality == RHS->getVirtuality() &&
00577            VirtualIndex == RHS->getVirtualIndex() && Flags == RHS->getFlags() &&
00578            IsOptimized == RHS->isOptimized() &&
00579            Function == RHS->getRawFunction() &&
00580            TemplateParams == RHS->getRawTemplateParams() &&
00581            Declaration == RHS->getRawDeclaration() &&
00582            Variables == RHS->getRawVariables();
00583   }
00584   unsigned getHashValue() const {
00585     return hash_combine(Scope, Name, LinkageName, File, Line, Type,
00586                         IsLocalToUnit, IsDefinition, ScopeLine, ContainingType,
00587                         Virtuality, VirtualIndex, Flags, IsOptimized, Function,
00588                         TemplateParams, Declaration, Variables);
00589   }
00590 };
00591 
00592 template <> struct MDNodeKeyImpl<DILexicalBlock> {
00593   Metadata *Scope;
00594   Metadata *File;
00595   unsigned Line;
00596   unsigned Column;
00597 
00598   MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Line, unsigned Column)
00599       : Scope(Scope), File(File), Line(Line), Column(Column) {}
00600   MDNodeKeyImpl(const DILexicalBlock *N)
00601       : Scope(N->getRawScope()), File(N->getRawFile()), Line(N->getLine()),
00602         Column(N->getColumn()) {}
00603 
00604   bool isKeyOf(const DILexicalBlock *RHS) const {
00605     return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
00606            Line == RHS->getLine() && Column == RHS->getColumn();
00607   }
00608   unsigned getHashValue() const {
00609     return hash_combine(Scope, File, Line, Column);
00610   }
00611 };
00612 
00613 template <> struct MDNodeKeyImpl<DILexicalBlockFile> {
00614   Metadata *Scope;
00615   Metadata *File;
00616   unsigned Discriminator;
00617 
00618   MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Discriminator)
00619       : Scope(Scope), File(File), Discriminator(Discriminator) {}
00620   MDNodeKeyImpl(const DILexicalBlockFile *N)
00621       : Scope(N->getRawScope()), File(N->getRawFile()),
00622         Discriminator(N->getDiscriminator()) {}
00623 
00624   bool isKeyOf(const DILexicalBlockFile *RHS) const {
00625     return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
00626            Discriminator == RHS->getDiscriminator();
00627   }
00628   unsigned getHashValue() const {
00629     return hash_combine(Scope, File, Discriminator);
00630   }
00631 };
00632 
00633 template <> struct MDNodeKeyImpl<DINamespace> {
00634   Metadata *Scope;
00635   Metadata *File;
00636   StringRef Name;
00637   unsigned Line;
00638 
00639   MDNodeKeyImpl(Metadata *Scope, Metadata *File, StringRef Name, unsigned Line)
00640       : Scope(Scope), File(File), Name(Name), Line(Line) {}
00641   MDNodeKeyImpl(const DINamespace *N)
00642       : Scope(N->getRawScope()), File(N->getRawFile()), Name(N->getName()),
00643         Line(N->getLine()) {}
00644 
00645   bool isKeyOf(const DINamespace *RHS) const {
00646     return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
00647            Name == RHS->getName() && Line == RHS->getLine();
00648   }
00649   unsigned getHashValue() const {
00650     return hash_combine(Scope, File, Name, Line);
00651   }
00652 };
00653 
00654 template <> struct MDNodeKeyImpl<DITemplateTypeParameter> {
00655   StringRef Name;
00656   Metadata *Type;
00657 
00658   MDNodeKeyImpl(StringRef Name, Metadata *Type) : Name(Name), Type(Type) {}
00659   MDNodeKeyImpl(const DITemplateTypeParameter *N)
00660       : Name(N->getName()), Type(N->getRawType()) {}
00661 
00662   bool isKeyOf(const DITemplateTypeParameter *RHS) const {
00663     return Name == RHS->getName() && Type == RHS->getRawType();
00664   }
00665   unsigned getHashValue() const { return hash_combine(Name, Type); }
00666 };
00667 
00668 template <> struct MDNodeKeyImpl<DITemplateValueParameter> {
00669   unsigned Tag;
00670   StringRef Name;
00671   Metadata *Type;
00672   Metadata *Value;
00673 
00674   MDNodeKeyImpl(unsigned Tag, StringRef Name, Metadata *Type, Metadata *Value)
00675       : Tag(Tag), Name(Name), Type(Type), Value(Value) {}
00676   MDNodeKeyImpl(const DITemplateValueParameter *N)
00677       : Tag(N->getTag()), Name(N->getName()), Type(N->getRawType()),
00678         Value(N->getValue()) {}
00679 
00680   bool isKeyOf(const DITemplateValueParameter *RHS) const {
00681     return Tag == RHS->getTag() && Name == RHS->getName() &&
00682            Type == RHS->getRawType() && Value == RHS->getValue();
00683   }
00684   unsigned getHashValue() const { return hash_combine(Tag, Name, Type, Value); }
00685 };
00686 
00687 template <> struct MDNodeKeyImpl<DIGlobalVariable> {
00688   Metadata *Scope;
00689   StringRef Name;
00690   StringRef LinkageName;
00691   Metadata *File;
00692   unsigned Line;
00693   Metadata *Type;
00694   bool IsLocalToUnit;
00695   bool IsDefinition;
00696   Metadata *Variable;
00697   Metadata *StaticDataMemberDeclaration;
00698 
00699   MDNodeKeyImpl(Metadata *Scope, StringRef Name, StringRef LinkageName,
00700                 Metadata *File, unsigned Line, Metadata *Type,
00701                 bool IsLocalToUnit, bool IsDefinition, Metadata *Variable,
00702                 Metadata *StaticDataMemberDeclaration)
00703       : Scope(Scope), Name(Name), LinkageName(LinkageName), File(File),
00704         Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit),
00705         IsDefinition(IsDefinition), Variable(Variable),
00706         StaticDataMemberDeclaration(StaticDataMemberDeclaration) {}
00707   MDNodeKeyImpl(const DIGlobalVariable *N)
00708       : Scope(N->getRawScope()), Name(N->getName()),
00709         LinkageName(N->getLinkageName()), File(N->getRawFile()),
00710         Line(N->getLine()), Type(N->getRawType()),
00711         IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()),
00712         Variable(N->getRawVariable()),
00713         StaticDataMemberDeclaration(N->getRawStaticDataMemberDeclaration()) {}
00714 
00715   bool isKeyOf(const DIGlobalVariable *RHS) const {
00716     return Scope == RHS->getRawScope() && Name == RHS->getName() &&
00717            LinkageName == RHS->getLinkageName() && File == RHS->getRawFile() &&
00718            Line == RHS->getLine() && Type == RHS->getRawType() &&
00719            IsLocalToUnit == RHS->isLocalToUnit() &&
00720            IsDefinition == RHS->isDefinition() &&
00721            Variable == RHS->getRawVariable() &&
00722            StaticDataMemberDeclaration ==
00723                RHS->getRawStaticDataMemberDeclaration();
00724   }
00725   unsigned getHashValue() const {
00726     return hash_combine(Scope, Name, LinkageName, File, Line, Type,
00727                         IsLocalToUnit, IsDefinition, Variable,
00728                         StaticDataMemberDeclaration);
00729   }
00730 };
00731 
00732 template <> struct MDNodeKeyImpl<DILocalVariable> {
00733   unsigned Tag;
00734   Metadata *Scope;
00735   StringRef Name;
00736   Metadata *File;
00737   unsigned Line;
00738   Metadata *Type;
00739   unsigned Arg;
00740   unsigned Flags;
00741 
00742   MDNodeKeyImpl(unsigned Tag, Metadata *Scope, StringRef Name, Metadata *File,
00743                 unsigned Line, Metadata *Type, unsigned Arg, unsigned Flags)
00744       : Tag(Tag), Scope(Scope), Name(Name), File(File), Line(Line), Type(Type),
00745         Arg(Arg), Flags(Flags) {}
00746   MDNodeKeyImpl(const DILocalVariable *N)
00747       : Tag(N->getTag()), Scope(N->getRawScope()), Name(N->getName()),
00748         File(N->getRawFile()), Line(N->getLine()), Type(N->getRawType()),
00749         Arg(N->getArg()), Flags(N->getFlags()) {}
00750 
00751   bool isKeyOf(const DILocalVariable *RHS) const {
00752     return Tag == RHS->getTag() && Scope == RHS->getRawScope() &&
00753            Name == RHS->getName() && File == RHS->getRawFile() &&
00754            Line == RHS->getLine() && Type == RHS->getRawType() &&
00755            Arg == RHS->getArg() && Flags == RHS->getFlags();
00756   }
00757   unsigned getHashValue() const {
00758     return hash_combine(Tag, Scope, Name, File, Line, Type, Arg, Flags);
00759   }
00760 };
00761 
00762 template <> struct MDNodeKeyImpl<DIExpression> {
00763   ArrayRef<uint64_t> Elements;
00764 
00765   MDNodeKeyImpl(ArrayRef<uint64_t> Elements) : Elements(Elements) {}
00766   MDNodeKeyImpl(const DIExpression *N) : Elements(N->getElements()) {}
00767 
00768   bool isKeyOf(const DIExpression *RHS) const {
00769     return Elements == RHS->getElements();
00770   }
00771   unsigned getHashValue() const {
00772     return hash_combine_range(Elements.begin(), Elements.end());
00773   }
00774 };
00775 
00776 template <> struct MDNodeKeyImpl<DIObjCProperty> {
00777   StringRef Name;
00778   Metadata *File;
00779   unsigned Line;
00780   StringRef GetterName;
00781   StringRef SetterName;
00782   unsigned Attributes;
00783   Metadata *Type;
00784 
00785   MDNodeKeyImpl(StringRef Name, Metadata *File, unsigned Line,
00786                 StringRef GetterName, StringRef SetterName, unsigned Attributes,
00787                 Metadata *Type)
00788       : Name(Name), File(File), Line(Line), GetterName(GetterName),
00789         SetterName(SetterName), Attributes(Attributes), Type(Type) {}
00790   MDNodeKeyImpl(const DIObjCProperty *N)
00791       : Name(N->getName()), File(N->getRawFile()), Line(N->getLine()),
00792         GetterName(N->getGetterName()), SetterName(N->getSetterName()),
00793         Attributes(N->getAttributes()), Type(N->getRawType()) {}
00794 
00795   bool isKeyOf(const DIObjCProperty *RHS) const {
00796     return Name == RHS->getName() && File == RHS->getRawFile() &&
00797            Line == RHS->getLine() && GetterName == RHS->getGetterName() &&
00798            SetterName == RHS->getSetterName() &&
00799            Attributes == RHS->getAttributes() && Type == RHS->getRawType();
00800   }
00801   unsigned getHashValue() const {
00802     return hash_combine(Name, File, Line, GetterName, SetterName, Attributes,
00803                         Type);
00804   }
00805 };
00806 
00807 template <> struct MDNodeKeyImpl<DIImportedEntity> {
00808   unsigned Tag;
00809   Metadata *Scope;
00810   Metadata *Entity;
00811   unsigned Line;
00812   StringRef Name;
00813 
00814   MDNodeKeyImpl(unsigned Tag, Metadata *Scope, Metadata *Entity, unsigned Line,
00815                 StringRef Name)
00816       : Tag(Tag), Scope(Scope), Entity(Entity), Line(Line), Name(Name) {}
00817   MDNodeKeyImpl(const DIImportedEntity *N)
00818       : Tag(N->getTag()), Scope(N->getRawScope()), Entity(N->getRawEntity()),
00819         Line(N->getLine()), Name(N->getName()) {}
00820 
00821   bool isKeyOf(const DIImportedEntity *RHS) const {
00822     return Tag == RHS->getTag() && Scope == RHS->getRawScope() &&
00823            Entity == RHS->getRawEntity() && Line == RHS->getLine() &&
00824            Name == RHS->getName();
00825   }
00826   unsigned getHashValue() const {
00827     return hash_combine(Tag, Scope, Entity, Line, Name);
00828   }
00829 };
00830 
00831 /// \brief DenseMapInfo for MDNode subclasses.
00832 template <class NodeTy> struct MDNodeInfo {
00833   typedef MDNodeKeyImpl<NodeTy> KeyTy;
00834   static inline NodeTy *getEmptyKey() {
00835     return DenseMapInfo<NodeTy *>::getEmptyKey();
00836   }
00837   static inline NodeTy *getTombstoneKey() {
00838     return DenseMapInfo<NodeTy *>::getTombstoneKey();
00839   }
00840   static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
00841   static unsigned getHashValue(const NodeTy *N) {
00842     return KeyTy(N).getHashValue();
00843   }
00844   static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
00845     if (RHS == getEmptyKey() || RHS == getTombstoneKey())
00846       return false;
00847     return LHS.isKeyOf(RHS);
00848   }
00849   static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
00850     return LHS == RHS;
00851   }
00852 };
00853 
00854 #define HANDLE_MDNODE_LEAF(CLASS) typedef MDNodeInfo<CLASS> CLASS##Info;
00855 #include "llvm/IR/Metadata.def"
00856 
00857 /// \brief Map-like storage for metadata attachments.
00858 class MDAttachmentMap {
00859   SmallVector<std::pair<unsigned, TrackingMDNodeRef>, 2> Attachments;
00860 
00861 public:
00862   bool empty() const { return Attachments.empty(); }
00863   size_t size() const { return Attachments.size(); }
00864 
00865   /// \brief Get a particular attachment (if any).
00866   MDNode *lookup(unsigned ID) const;
00867 
00868   /// \brief Set an attachment to a particular node.
00869   ///
00870   /// Set the \c ID attachment to \c MD, replacing the current attachment at \c
00871   /// ID (if anyway).
00872   void set(unsigned ID, MDNode &MD);
00873 
00874   /// \brief Remove an attachment.
00875   ///
00876   /// Remove the attachment at \c ID, if any.
00877   void erase(unsigned ID);
00878 
00879   /// \brief Copy out all the attachments.
00880   ///
00881   /// Copies all the current attachments into \c Result, sorting by attachment
00882   /// ID.  This function does \em not clear \c Result.
00883   void getAll(SmallVectorImpl<std::pair<unsigned, MDNode *>> &Result) const;
00884 
00885   /// \brief Erase matching attachments.
00886   ///
00887   /// Erases all attachments matching the \c shouldRemove predicate.
00888   template <class PredTy> void remove_if(PredTy shouldRemove) {
00889     Attachments.erase(
00890         std::remove_if(Attachments.begin(), Attachments.end(), shouldRemove),
00891         Attachments.end());
00892   }
00893 };
00894 
00895 class LLVMContextImpl {
00896 public:
00897   /// OwnedModules - The set of modules instantiated in this context, and which
00898   /// will be automatically deleted if this context is deleted.
00899   SmallPtrSet<Module*, 4> OwnedModules;
00900   
00901   LLVMContext::InlineAsmDiagHandlerTy InlineAsmDiagHandler;
00902   void *InlineAsmDiagContext;
00903 
00904   LLVMContext::DiagnosticHandlerTy DiagnosticHandler;
00905   void *DiagnosticContext;
00906   bool RespectDiagnosticFilters;
00907 
00908   LLVMContext::YieldCallbackTy YieldCallback;
00909   void *YieldOpaqueHandle;
00910 
00911   typedef DenseMap<APInt, ConstantInt *, DenseMapAPIntKeyInfo> IntMapTy;
00912   IntMapTy IntConstants;
00913 
00914   typedef DenseMap<APFloat, ConstantFP *, DenseMapAPFloatKeyInfo> FPMapTy;
00915   FPMapTy FPConstants;
00916 
00917   FoldingSet<AttributeImpl> AttrsSet;
00918   FoldingSet<AttributeSetImpl> AttrsLists;
00919   FoldingSet<AttributeSetNode> AttrsSetNodes;
00920 
00921   StringMap<MDString> MDStringCache;
00922   DenseMap<Value *, ValueAsMetadata *> ValuesAsMetadata;
00923   DenseMap<Metadata *, MetadataAsValue *> MetadataAsValues;
00924 
00925 #define HANDLE_MDNODE_LEAF(CLASS) DenseSet<CLASS *, CLASS##Info> CLASS##s;
00926 #include "llvm/IR/Metadata.def"
00927 
00928   // MDNodes may be uniqued or not uniqued.  When they're not uniqued, they
00929   // aren't in the MDNodeSet, but they're still shared between objects, so no
00930   // one object can destroy them.  This set allows us to at least destroy them
00931   // on Context destruction.
00932   SmallPtrSet<MDNode *, 1> DistinctMDNodes;
00933 
00934   DenseMap<Type*, ConstantAggregateZero*> CAZConstants;
00935 
00936   typedef ConstantUniqueMap<ConstantArray> ArrayConstantsTy;
00937   ArrayConstantsTy ArrayConstants;
00938   
00939   typedef ConstantUniqueMap<ConstantStruct> StructConstantsTy;
00940   StructConstantsTy StructConstants;
00941   
00942   typedef ConstantUniqueMap<ConstantVector> VectorConstantsTy;
00943   VectorConstantsTy VectorConstants;
00944   
00945   DenseMap<PointerType*, ConstantPointerNull*> CPNConstants;
00946 
00947   DenseMap<Type*, UndefValue*> UVConstants;
00948   
00949   StringMap<ConstantDataSequential*> CDSConstants;
00950 
00951   DenseMap<std::pair<const Function *, const BasicBlock *>, BlockAddress *>
00952     BlockAddresses;
00953   ConstantUniqueMap<ConstantExpr> ExprConstants;
00954 
00955   ConstantUniqueMap<InlineAsm> InlineAsms;
00956 
00957   ConstantInt *TheTrueVal;
00958   ConstantInt *TheFalseVal;
00959 
00960   // Basic type instances.
00961   Type VoidTy, LabelTy, HalfTy, FloatTy, DoubleTy, MetadataTy;
00962   Type X86_FP80Ty, FP128Ty, PPC_FP128Ty, X86_MMXTy;
00963   IntegerType Int1Ty, Int8Ty, Int16Ty, Int32Ty, Int64Ty, Int128Ty;
00964 
00965   
00966   /// TypeAllocator - All dynamically allocated types are allocated from this.
00967   /// They live forever until the context is torn down.
00968   BumpPtrAllocator TypeAllocator;
00969   
00970   DenseMap<unsigned, IntegerType*> IntegerTypes;
00971 
00972   typedef DenseSet<FunctionType *, FunctionTypeKeyInfo> FunctionTypeSet;
00973   FunctionTypeSet FunctionTypes;
00974   typedef DenseSet<StructType *, AnonStructTypeKeyInfo> StructTypeSet;
00975   StructTypeSet AnonStructTypes;
00976   StringMap<StructType*> NamedStructTypes;
00977   unsigned NamedStructTypesUniqueID;
00978     
00979   DenseMap<std::pair<Type *, uint64_t>, ArrayType*> ArrayTypes;
00980   DenseMap<std::pair<Type *, unsigned>, VectorType*> VectorTypes;
00981   DenseMap<Type*, PointerType*> PointerTypes;  // Pointers in AddrSpace = 0
00982   DenseMap<std::pair<Type*, unsigned>, PointerType*> ASPointerTypes;
00983 
00984 
00985   /// ValueHandles - This map keeps track of all of the value handles that are
00986   /// watching a Value*.  The Value::HasValueHandle bit is used to know
00987   /// whether or not a value has an entry in this map.
00988   typedef DenseMap<Value*, ValueHandleBase*> ValueHandlesTy;
00989   ValueHandlesTy ValueHandles;
00990   
00991   /// CustomMDKindNames - Map to hold the metadata string to ID mapping.
00992   StringMap<unsigned> CustomMDKindNames;
00993 
00994   /// Collection of per-instruction metadata used in this context.
00995   DenseMap<const Instruction *, MDAttachmentMap> InstructionMetadata;
00996 
00997   /// Collection of per-function metadata used in this context.
00998   DenseMap<const Function *, MDAttachmentMap> FunctionMetadata;
00999 
01000   /// DiscriminatorTable - This table maps file:line locations to an
01001   /// integer representing the next DWARF path discriminator to assign to
01002   /// instructions in different blocks at the same location.
01003   DenseMap<std::pair<const char *, unsigned>, unsigned> DiscriminatorTable;
01004 
01005   /// \brief Mapping from a function to its prefix data, which is stored as the
01006   /// operand of an unparented ReturnInst so that the prefix data has a Use.
01007   typedef DenseMap<const Function *, ReturnInst *> PrefixDataMapTy;
01008   PrefixDataMapTy PrefixDataMap;
01009 
01010   /// \brief Mapping from a function to its prologue data, which is stored as
01011   /// the operand of an unparented ReturnInst so that the prologue data has a
01012   /// Use.
01013   typedef DenseMap<const Function *, ReturnInst *> PrologueDataMapTy;
01014   PrologueDataMapTy PrologueDataMap;
01015 
01016   int getOrAddScopeRecordIdxEntry(MDNode *N, int ExistingIdx);
01017   int getOrAddScopeInlinedAtIdxEntry(MDNode *Scope, MDNode *IA,int ExistingIdx);
01018 
01019   LLVMContextImpl(LLVMContext &C);
01020   ~LLVMContextImpl();
01021 
01022   /// Destroy the ConstantArrays if they are not used.
01023   void dropTriviallyDeadConstantArrays();
01024 };
01025 
01026 }
01027 
01028 #endif