- const Type *VoidTy;
- const Type *LabelTy;
- const Type *FloatTy;
- const Type *DoubleTy;
- const Type *MetadataTy;
- const Type *X86_FP80Ty;
- const Type *FP128Ty;
- const Type *PPC_FP128Ty;
-
- const IntegerType *Int1Ty;
- const IntegerType *Int8Ty;
- const IntegerType *Int16Ty;
- const IntegerType *Int32Ty;
- const IntegerType *Int64Ty;
-
- LLVMContextImpl(LLVMContext &C) : TheTrueVal(0), TheFalseVal(0),
- VoidTy(new Type(C, Type::VoidTyID)),
- LabelTy(new Type(C, Type::LabelTyID)),
- FloatTy(new Type(C, Type::FloatTyID)),
- DoubleTy(new Type(C, Type::DoubleTyID)),
- MetadataTy(new Type(C, Type::MetadataTyID)),
- X86_FP80Ty(new Type(C, Type::X86_FP80TyID)),
- FP128Ty(new Type(C, Type::FP128TyID)),
- PPC_FP128Ty(new Type(C, Type::PPC_FP128TyID)),
- Int1Ty(new IntegerType(C, 1)),
- Int8Ty(new IntegerType(C, 8)),
- Int16Ty(new IntegerType(C, 16)),
- Int32Ty(new IntegerType(C, 32)),
- Int64Ty(new IntegerType(C, 64)) { }
-
- ~LLVMContextImpl() {
- // In principle, we should delete the member types here. However,
- // this causes destruction order issues with the types in the TypeMaps.
- // For now, just leak this, which is at least not a regression from the
- // previous behavior, though still undesirable.
-#if 0
- delete VoidTy;
- delete LabelTy;
- delete FloatTy;
- delete DoubleTy;
- delete MetadataTy;
- delete X86_FP80Ty;
- delete FP128Ty;
- delete PPC_FP128Ty;
-
- delete Int1Ty;
- delete Int8Ty;
- delete Int16Ty;
- delete Int32Ty;
- delete Int64Ty;
-#endif
- }
+ /// CustomMDKindNames - Map to hold the metadata string to ID mapping.
+ StringMap<unsigned> CustomMDKindNames;
+
+ typedef std::pair<unsigned, TrackingVH<MDNode> > MDPairTy;
+ typedef SmallVector<MDPairTy, 2> MDMapTy;
+
+ /// MetadataStore - Collection of per-instruction metadata used in this
+ /// context.
+ DenseMap<const Instruction *, MDMapTy> MetadataStore;
+
+ /// ScopeRecordIdx - This is the index in ScopeRecords for an MDNode scope
+ /// entry with no "inlined at" element.
+ DenseMap<MDNode*, int> ScopeRecordIdx;
+
+ /// ScopeRecords - These are the actual mdnodes (in a value handle) for an
+ /// index. The ValueHandle ensures that ScopeRecordIdx stays up to date if
+ /// the MDNode is RAUW'd.
+ std::vector<DebugRecVH> ScopeRecords;
+
+ /// ScopeInlinedAtIdx - This is the index in ScopeInlinedAtRecords for an
+ /// scope/inlined-at pair.
+ DenseMap<std::pair<MDNode*, MDNode*>, int> ScopeInlinedAtIdx;
+
+ /// ScopeInlinedAtRecords - These are the actual mdnodes (in value handles)
+ /// for an index. The ValueHandle ensures that ScopeINlinedAtIdx stays up
+ /// to date.
+ std::vector<std::pair<DebugRecVH, DebugRecVH> > ScopeInlinedAtRecords;
+
+ int getOrAddScopeRecordIdxEntry(MDNode *N, int ExistingIdx);
+ int getOrAddScopeInlinedAtIdxEntry(MDNode *Scope, MDNode *IA,int ExistingIdx);
+
+ LLVMContextImpl(LLVMContext &C);
+ ~LLVMContextImpl();