Jeffrey Yasskin | 4cfb3a7 | 2010-03-21 21:17:34 +0000 | [diff] [blame] | 1 | //===-- LLVMContextImpl.h - The LLVMContextImpl opaque class ----*- C++ -*-===// |
Owen Anderson | 8e66e0b | 2009-06-30 00:48:55 +0000 | [diff] [blame] | 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 | //===----------------------------------------------------------------------===// |
Owen Anderson | 36f62e5 | 2009-06-30 17:06:46 +0000 | [diff] [blame] | 9 | // |
| 10 | // This file declares LLVMContextImpl, the opaque implementation |
| 11 | // of LLVMContext. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
Owen Anderson | 8e66e0b | 2009-06-30 00:48:55 +0000 | [diff] [blame] | 14 | |
| 15 | #ifndef LLVM_LLVMCONTEXT_IMPL_H |
| 16 | #define LLVM_LLVMCONTEXT_IMPL_H |
| 17 | |
Chris Lattner | b1ed91f | 2011-07-09 17:41:24 +0000 | [diff] [blame] | 18 | #include "llvm/LLVMContext.h" |
Owen Anderson | afd0c4c | 2009-08-04 22:41:48 +0000 | [diff] [blame] | 19 | #include "ConstantsContext.h" |
Owen Anderson | 6d549d6 | 2009-08-19 17:07:46 +0000 | [diff] [blame] | 20 | #include "LeaksContext.h" |
Owen Anderson | edb4a70 | 2009-07-24 23:12:02 +0000 | [diff] [blame] | 21 | #include "llvm/Constants.h" |
Owen Anderson | 2ad5217 | 2009-07-21 02:47:59 +0000 | [diff] [blame] | 22 | #include "llvm/DerivedTypes.h" |
Jeffrey Yasskin | cd3706c | 2010-03-21 22:08:41 +0000 | [diff] [blame] | 23 | #include "llvm/Metadata.h" |
Chris Lattner | a056697 | 2009-12-29 09:01:33 +0000 | [diff] [blame] | 24 | #include "llvm/Support/ValueHandle.h" |
Owen Anderson | c277dc4 | 2009-07-16 19:05:41 +0000 | [diff] [blame] | 25 | #include "llvm/ADT/APFloat.h" |
Owen Anderson | 20b34ac | 2009-07-16 18:04:31 +0000 | [diff] [blame] | 26 | #include "llvm/ADT/APInt.h" |
Jay Foad | c365eea | 2011-06-22 08:50:06 +0000 | [diff] [blame] | 27 | #include "llvm/ADT/ArrayRef.h" |
Owen Anderson | 20b34ac | 2009-07-16 18:04:31 +0000 | [diff] [blame] | 28 | #include "llvm/ADT/DenseMap.h" |
Owen Anderson | 4118dde | 2009-07-16 23:44:30 +0000 | [diff] [blame] | 29 | #include "llvm/ADT/FoldingSet.h" |
Jeffrey Yasskin | 28f2448 | 2009-12-17 19:55:06 +0000 | [diff] [blame] | 30 | #include "llvm/ADT/SmallPtrSet.h" |
Owen Anderson | 69ab416 | 2009-07-16 22:11:26 +0000 | [diff] [blame] | 31 | #include "llvm/ADT/StringMap.h" |
Jay Foad | 529776c | 2012-02-23 09:17:40 +0000 | [diff] [blame^] | 32 | #include "llvm/ADT/Hashing.h" |
Owen Anderson | 909f600 | 2009-07-23 23:25:33 +0000 | [diff] [blame] | 33 | #include <vector> |
Owen Anderson | 39ede7b | 2009-07-21 20:13:12 +0000 | [diff] [blame] | 34 | |
Owen Anderson | 20b34ac | 2009-07-16 18:04:31 +0000 | [diff] [blame] | 35 | namespace llvm { |
Owen Anderson | edb4a70 | 2009-07-24 23:12:02 +0000 | [diff] [blame] | 36 | |
Owen Anderson | 20b34ac | 2009-07-16 18:04:31 +0000 | [diff] [blame] | 37 | class ConstantInt; |
Owen Anderson | c277dc4 | 2009-07-16 19:05:41 +0000 | [diff] [blame] | 38 | class ConstantFP; |
Benjamin Kramer | 78c3bcb | 2009-08-11 17:45:13 +0000 | [diff] [blame] | 39 | class LLVMContext; |
Owen Anderson | 20b34ac | 2009-07-16 18:04:31 +0000 | [diff] [blame] | 40 | class Type; |
Owen Anderson | 4118dde | 2009-07-16 23:44:30 +0000 | [diff] [blame] | 41 | class Value; |
Owen Anderson | 20b34ac | 2009-07-16 18:04:31 +0000 | [diff] [blame] | 42 | |
| 43 | struct DenseMapAPIntKeyInfo { |
| 44 | struct KeyTy { |
| 45 | APInt val; |
Chris Lattner | 229907c | 2011-07-18 04:54:35 +0000 | [diff] [blame] | 46 | Type* type; |
| 47 | KeyTy(const APInt& V, Type* Ty) : val(V), type(Ty) {} |
Owen Anderson | 20b34ac | 2009-07-16 18:04:31 +0000 | [diff] [blame] | 48 | KeyTy(const KeyTy& that) : val(that.val), type(that.type) {} |
| 49 | bool operator==(const KeyTy& that) const { |
| 50 | return type == that.type && this->val == that.val; |
| 51 | } |
| 52 | bool operator!=(const KeyTy& that) const { |
| 53 | return !this->operator==(that); |
| 54 | } |
| 55 | }; |
| 56 | static inline KeyTy getEmptyKey() { return KeyTy(APInt(1,0), 0); } |
| 57 | static inline KeyTy getTombstoneKey() { return KeyTy(APInt(1,1), 0); } |
| 58 | static unsigned getHashValue(const KeyTy &Key) { |
| 59 | return DenseMapInfo<void*>::getHashValue(Key.type) ^ |
| 60 | Key.val.getHashValue(); |
| 61 | } |
| 62 | static bool isEqual(const KeyTy &LHS, const KeyTy &RHS) { |
| 63 | return LHS == RHS; |
| 64 | } |
Owen Anderson | 20b34ac | 2009-07-16 18:04:31 +0000 | [diff] [blame] | 65 | }; |
| 66 | |
Owen Anderson | c277dc4 | 2009-07-16 19:05:41 +0000 | [diff] [blame] | 67 | struct DenseMapAPFloatKeyInfo { |
| 68 | struct KeyTy { |
| 69 | APFloat val; |
| 70 | KeyTy(const APFloat& V) : val(V){} |
| 71 | KeyTy(const KeyTy& that) : val(that.val) {} |
| 72 | bool operator==(const KeyTy& that) const { |
| 73 | return this->val.bitwiseIsEqual(that.val); |
| 74 | } |
| 75 | bool operator!=(const KeyTy& that) const { |
| 76 | return !this->operator==(that); |
| 77 | } |
| 78 | }; |
| 79 | static inline KeyTy getEmptyKey() { |
| 80 | return KeyTy(APFloat(APFloat::Bogus,1)); |
| 81 | } |
| 82 | static inline KeyTy getTombstoneKey() { |
| 83 | return KeyTy(APFloat(APFloat::Bogus,2)); |
| 84 | } |
| 85 | static unsigned getHashValue(const KeyTy &Key) { |
| 86 | return Key.val.getHashValue(); |
| 87 | } |
| 88 | static bool isEqual(const KeyTy &LHS, const KeyTy &RHS) { |
| 89 | return LHS == RHS; |
| 90 | } |
Owen Anderson | c277dc4 | 2009-07-16 19:05:41 +0000 | [diff] [blame] | 91 | }; |
| 92 | |
Jay Foad | 529776c | 2012-02-23 09:17:40 +0000 | [diff] [blame^] | 93 | struct AnonStructTypeKeyInfo { |
| 94 | struct KeyTy { |
| 95 | ArrayRef<Type*> ETypes; |
| 96 | bool isPacked; |
| 97 | KeyTy(const ArrayRef<Type*>& E, bool P) : |
| 98 | ETypes(E), isPacked(P) {} |
| 99 | KeyTy(const KeyTy& that) : |
| 100 | ETypes(that.ETypes), isPacked(that.isPacked) {} |
| 101 | KeyTy(const StructType* ST) : |
| 102 | ETypes(ArrayRef<Type*>(ST->element_begin(), ST->element_end())), |
| 103 | isPacked(ST->isPacked()) {} |
| 104 | bool operator==(const KeyTy& that) const { |
| 105 | if (isPacked != that.isPacked) |
| 106 | return false; |
| 107 | if (ETypes != that.ETypes) |
| 108 | return false; |
| 109 | return true; |
| 110 | } |
| 111 | bool operator!=(const KeyTy& that) const { |
| 112 | return !this->operator==(that); |
| 113 | } |
| 114 | }; |
| 115 | static inline StructType* getEmptyKey() { |
| 116 | return DenseMapInfo<StructType*>::getEmptyKey(); |
| 117 | } |
| 118 | static inline StructType* getTombstoneKey() { |
| 119 | return DenseMapInfo<StructType*>::getTombstoneKey(); |
| 120 | } |
| 121 | static unsigned getHashValue(const KeyTy& Key) { |
| 122 | GeneralHash Hash; |
| 123 | Hash.add(Key.ETypes); |
| 124 | Hash.add(Key.isPacked); |
| 125 | return Hash.finish(); |
| 126 | } |
| 127 | static unsigned getHashValue(const StructType *ST) { |
| 128 | return getHashValue(KeyTy(ST)); |
| 129 | } |
| 130 | static bool isEqual(const KeyTy& LHS, const StructType *RHS) { |
| 131 | if (RHS == getEmptyKey() || RHS == getTombstoneKey()) |
| 132 | return false; |
| 133 | return LHS == KeyTy(RHS); |
| 134 | } |
| 135 | static bool isEqual(const StructType *LHS, const StructType *RHS) { |
| 136 | return LHS == RHS; |
| 137 | } |
| 138 | }; |
| 139 | |
| 140 | struct FunctionTypeKeyInfo { |
| 141 | struct KeyTy { |
| 142 | const Type *ReturnType; |
| 143 | ArrayRef<Type*> Params; |
| 144 | bool isVarArg; |
| 145 | KeyTy(const Type* R, const ArrayRef<Type*>& P, bool V) : |
| 146 | ReturnType(R), Params(P), isVarArg(V) {} |
| 147 | KeyTy(const KeyTy& that) : |
| 148 | ReturnType(that.ReturnType), |
| 149 | Params(that.Params), |
| 150 | isVarArg(that.isVarArg) {} |
| 151 | KeyTy(const FunctionType* FT) : |
| 152 | ReturnType(FT->getReturnType()), |
| 153 | Params(ArrayRef<Type*>(FT->param_begin(), FT->param_end())), |
| 154 | isVarArg(FT->isVarArg()) {} |
| 155 | bool operator==(const KeyTy& that) const { |
| 156 | if (ReturnType != that.ReturnType) |
| 157 | return false; |
| 158 | if (isVarArg != that.isVarArg) |
| 159 | return false; |
| 160 | if (Params != that.Params) |
| 161 | return false; |
| 162 | return true; |
| 163 | } |
| 164 | bool operator!=(const KeyTy& that) const { |
| 165 | return !this->operator==(that); |
| 166 | } |
| 167 | }; |
| 168 | static inline FunctionType* getEmptyKey() { |
| 169 | return DenseMapInfo<FunctionType*>::getEmptyKey(); |
| 170 | } |
| 171 | static inline FunctionType* getTombstoneKey() { |
| 172 | return DenseMapInfo<FunctionType*>::getTombstoneKey(); |
| 173 | } |
| 174 | static unsigned getHashValue(const KeyTy& Key) { |
| 175 | GeneralHash Hash; |
| 176 | Hash.add(Key.ReturnType); |
| 177 | Hash.add(Key.Params); |
| 178 | Hash.add(Key.isVarArg); |
| 179 | return Hash.finish(); |
| 180 | } |
| 181 | static unsigned getHashValue(const FunctionType *FT) { |
| 182 | return getHashValue(KeyTy(FT)); |
| 183 | } |
| 184 | static bool isEqual(const KeyTy& LHS, const FunctionType *RHS) { |
| 185 | if (RHS == getEmptyKey() || RHS == getTombstoneKey()) |
| 186 | return false; |
| 187 | return LHS == KeyTy(RHS); |
| 188 | } |
| 189 | static bool isEqual(const FunctionType *LHS, const FunctionType *RHS) { |
| 190 | return LHS == RHS; |
| 191 | } |
| 192 | }; |
| 193 | |
Chris Lattner | 8cb2aeb | 2010-04-01 00:37:44 +0000 | [diff] [blame] | 194 | /// DebugRecVH - This is a CallbackVH used to keep the Scope -> index maps |
| 195 | /// up to date as MDNodes mutate. This class is implemented in DebugLoc.cpp. |
| 196 | class DebugRecVH : public CallbackVH { |
| 197 | /// Ctx - This is the LLVM Context being referenced. |
| 198 | LLVMContextImpl *Ctx; |
| 199 | |
| 200 | /// Idx - The index into either ScopeRecordIdx or ScopeInlinedAtRecords that |
| 201 | /// this reference lives in. If this is zero, then it represents a |
| 202 | /// non-canonical entry that has no DenseMap value. This can happen due to |
| 203 | /// RAUW. |
| 204 | int Idx; |
| 205 | public: |
| 206 | DebugRecVH(MDNode *n, LLVMContextImpl *ctx, int idx) |
| 207 | : CallbackVH(n), Ctx(ctx), Idx(idx) {} |
| 208 | |
| 209 | MDNode *get() const { |
| 210 | return cast_or_null<MDNode>(getValPtr()); |
| 211 | } |
| 212 | |
| 213 | virtual void deleted(); |
| 214 | virtual void allUsesReplacedWith(Value *VNew); |
| 215 | }; |
| 216 | |
Benjamin Kramer | 78c3bcb | 2009-08-11 17:45:13 +0000 | [diff] [blame] | 217 | class LLVMContextImpl { |
| 218 | public: |
Owen Anderson | 8e89e41 | 2010-09-08 18:03:32 +0000 | [diff] [blame] | 219 | /// OwnedModules - The set of modules instantiated in this context, and which |
| 220 | /// will be automatically deleted if this context is deleted. |
| 221 | SmallPtrSet<Module*, 4> OwnedModules; |
| 222 | |
Chris Lattner | b0e3608 | 2010-11-17 08:13:01 +0000 | [diff] [blame] | 223 | LLVMContext::InlineAsmDiagHandlerTy InlineAsmDiagHandler; |
| 224 | void *InlineAsmDiagContext; |
Chris Lattner | 60955d4 | 2010-04-06 00:44:45 +0000 | [diff] [blame] | 225 | |
Owen Anderson | 20b34ac | 2009-07-16 18:04:31 +0000 | [diff] [blame] | 226 | typedef DenseMap<DenseMapAPIntKeyInfo::KeyTy, ConstantInt*, |
Owen Anderson | afd0c4c | 2009-08-04 22:41:48 +0000 | [diff] [blame] | 227 | DenseMapAPIntKeyInfo> IntMapTy; |
Owen Anderson | 20b34ac | 2009-07-16 18:04:31 +0000 | [diff] [blame] | 228 | IntMapTy IntConstants; |
| 229 | |
Owen Anderson | c277dc4 | 2009-07-16 19:05:41 +0000 | [diff] [blame] | 230 | typedef DenseMap<DenseMapAPFloatKeyInfo::KeyTy, ConstantFP*, |
Owen Anderson | afd0c4c | 2009-08-04 22:41:48 +0000 | [diff] [blame] | 231 | DenseMapAPFloatKeyInfo> FPMapTy; |
Owen Anderson | c277dc4 | 2009-07-16 19:05:41 +0000 | [diff] [blame] | 232 | FPMapTy FPConstants; |
| 233 | |
Owen Anderson | 69ab416 | 2009-07-16 22:11:26 +0000 | [diff] [blame] | 234 | StringMap<MDString*> MDStringCache; |
| 235 | |
Devang Patel | f718832 | 2009-09-03 01:39:20 +0000 | [diff] [blame] | 236 | FoldingSet<MDNode> MDNodeSet; |
Jeffrey Yasskin | 2cc2476 | 2010-03-13 01:26:15 +0000 | [diff] [blame] | 237 | // MDNodes may be uniqued or not uniqued. When they're not uniqued, they |
| 238 | // aren't in the MDNodeSet, but they're still shared between objects, so no |
| 239 | // one object can destroy them. This set allows us to at least destroy them |
| 240 | // on Context destruction. |
| 241 | SmallPtrSet<MDNode*, 1> NonUniquedMDNodes; |
Devang Patel | f718832 | 2009-09-03 01:39:20 +0000 | [diff] [blame] | 242 | |
Chris Lattner | c7f9fd4 | 2012-01-23 15:20:12 +0000 | [diff] [blame] | 243 | DenseMap<Type*, ConstantAggregateZero*> CAZConstants; |
Owen Anderson | 13234f8 | 2009-08-10 18:16:08 +0000 | [diff] [blame] | 244 | |
Talin | 46e9b44 | 2012-02-05 20:54:10 +0000 | [diff] [blame] | 245 | typedef ConstantAggrUniqueMap<ArrayType, ConstantArray> ArrayConstantsTy; |
Owen Anderson | edb4a70 | 2009-07-24 23:12:02 +0000 | [diff] [blame] | 246 | ArrayConstantsTy ArrayConstants; |
Owen Anderson | 39ede7b | 2009-07-21 20:13:12 +0000 | [diff] [blame] | 247 | |
Talin | 46e9b44 | 2012-02-05 20:54:10 +0000 | [diff] [blame] | 248 | typedef ConstantAggrUniqueMap<StructType, ConstantStruct> StructConstantsTy; |
Owen Anderson | edb4a70 | 2009-07-24 23:12:02 +0000 | [diff] [blame] | 249 | StructConstantsTy StructConstants; |
Owen Anderson | 909f600 | 2009-07-23 23:25:33 +0000 | [diff] [blame] | 250 | |
Talin | 46e9b44 | 2012-02-05 20:54:10 +0000 | [diff] [blame] | 251 | typedef ConstantAggrUniqueMap<VectorType, ConstantVector> VectorConstantsTy; |
Owen Anderson | edb4a70 | 2009-07-24 23:12:02 +0000 | [diff] [blame] | 252 | VectorConstantsTy VectorConstants; |
Owen Anderson | 0348a13 | 2009-07-24 00:36:24 +0000 | [diff] [blame] | 253 | |
Chris Lattner | c7f9fd4 | 2012-01-23 15:20:12 +0000 | [diff] [blame] | 254 | DenseMap<PointerType*, ConstantPointerNull*> CPNConstants; |
| 255 | |
| 256 | DenseMap<Type*, UndefValue*> UVConstants; |
Owen Anderson | c8c3026 | 2009-07-31 22:45:43 +0000 | [diff] [blame] | 257 | |
Chris Lattner | 3756b91 | 2012-01-23 22:57:10 +0000 | [diff] [blame] | 258 | StringMap<ConstantDataSequential*> CDSConstants; |
| 259 | |
| 260 | |
Chris Lattner | 31b132c | 2009-10-28 00:01:44 +0000 | [diff] [blame] | 261 | DenseMap<std::pair<Function*, BasicBlock*> , BlockAddress*> BlockAddresses; |
Jay Foad | c365eea | 2011-06-22 08:50:06 +0000 | [diff] [blame] | 262 | ConstantUniqueMap<ExprMapKeyType, const ExprMapKeyType&, Type, ConstantExpr> |
| 263 | ExprConstants; |
Jeffrey Yasskin | ade270e | 2010-03-21 20:37:19 +0000 | [diff] [blame] | 264 | |
Jay Foad | c365eea | 2011-06-22 08:50:06 +0000 | [diff] [blame] | 265 | ConstantUniqueMap<InlineAsmKeyType, const InlineAsmKeyType&, PointerType, |
| 266 | InlineAsm> InlineAsms; |
Owen Anderson | 1584a29 | 2009-08-04 20:25:11 +0000 | [diff] [blame] | 267 | |
Owen Anderson | 2ad5217 | 2009-07-21 02:47:59 +0000 | [diff] [blame] | 268 | ConstantInt *TheTrueVal; |
| 269 | ConstantInt *TheFalseVal; |
| 270 | |
Owen Anderson | 6d549d6 | 2009-08-19 17:07:46 +0000 | [diff] [blame] | 271 | LeakDetectorImpl<Value> LLVMObjects; |
| 272 | |
Dan Gohman | 97d2cb8 | 2009-08-25 16:00:35 +0000 | [diff] [blame] | 273 | // Basic type instances. |
Dan Gohman | 518cda4 | 2011-12-17 00:04:22 +0000 | [diff] [blame] | 274 | Type VoidTy, LabelTy, HalfTy, FloatTy, DoubleTy, MetadataTy; |
Chris Lattner | b1ed91f | 2011-07-09 17:41:24 +0000 | [diff] [blame] | 275 | Type X86_FP80Ty, FP128Ty, PPC_FP128Ty, X86_MMXTy; |
| 276 | IntegerType Int1Ty, Int8Ty, Int16Ty, Int32Ty, Int64Ty; |
Dan Gohman | 97d2cb8 | 2009-08-25 16:00:35 +0000 | [diff] [blame] | 277 | |
Chris Lattner | 07bd69c | 2011-07-15 05:49:15 +0000 | [diff] [blame] | 278 | |
| 279 | /// TypeAllocator - All dynamically allocated types are allocated from this. |
| 280 | /// They live forever until the context is torn down. |
| 281 | BumpPtrAllocator TypeAllocator; |
| 282 | |
Chris Lattner | b1ed91f | 2011-07-09 17:41:24 +0000 | [diff] [blame] | 283 | DenseMap<unsigned, IntegerType*> IntegerTypes; |
| 284 | |
Jay Foad | 529776c | 2012-02-23 09:17:40 +0000 | [diff] [blame^] | 285 | typedef DenseMap<FunctionType*, bool, FunctionTypeKeyInfo> FunctionTypeMap; |
| 286 | FunctionTypeMap FunctionTypes; |
| 287 | typedef DenseMap<StructType*, bool, AnonStructTypeKeyInfo> StructTypeMap; |
| 288 | StructTypeMap AnonStructTypes; |
Chris Lattner | b1ed91f | 2011-07-09 17:41:24 +0000 | [diff] [blame] | 289 | StringMap<StructType*> NamedStructTypes; |
| 290 | unsigned NamedStructTypesUniqueID; |
| 291 | |
| 292 | DenseMap<std::pair<Type *, uint64_t>, ArrayType*> ArrayTypes; |
| 293 | DenseMap<std::pair<Type *, unsigned>, VectorType*> VectorTypes; |
| 294 | DenseMap<Type*, PointerType*> PointerTypes; // Pointers in AddrSpace = 0 |
| 295 | DenseMap<std::pair<Type*, unsigned>, PointerType*> ASPointerTypes; |
Jeffrey Yasskin | c660b23 | 2010-02-11 06:41:30 +0000 | [diff] [blame] | 296 | |
Jeffrey Yasskin | 28f2448 | 2009-12-17 19:55:06 +0000 | [diff] [blame] | 297 | |
Owen Anderson | e8f2185 | 2009-08-18 18:28:58 +0000 | [diff] [blame] | 298 | /// ValueHandles - This map keeps track of all of the value handles that are |
| 299 | /// watching a Value*. The Value::HasValueHandle bit is used to know |
| 300 | // whether or not a value has an entry in this map. |
| 301 | typedef DenseMap<Value*, ValueHandleBase*> ValueHandlesTy; |
| 302 | ValueHandlesTy ValueHandles; |
| 303 | |
Chris Lattner | a056697 | 2009-12-29 09:01:33 +0000 | [diff] [blame] | 304 | /// CustomMDKindNames - Map to hold the metadata string to ID mapping. |
| 305 | StringMap<unsigned> CustomMDKindNames; |
| 306 | |
| 307 | typedef std::pair<unsigned, TrackingVH<MDNode> > MDPairTy; |
| 308 | typedef SmallVector<MDPairTy, 2> MDMapTy; |
| 309 | |
| 310 | /// MetadataStore - Collection of per-instruction metadata used in this |
| 311 | /// context. |
| 312 | DenseMap<const Instruction *, MDMapTy> MetadataStore; |
| 313 | |
Chris Lattner | 8cb2aeb | 2010-04-01 00:37:44 +0000 | [diff] [blame] | 314 | /// ScopeRecordIdx - This is the index in ScopeRecords for an MDNode scope |
| 315 | /// entry with no "inlined at" element. |
| 316 | DenseMap<MDNode*, int> ScopeRecordIdx; |
| 317 | |
| 318 | /// ScopeRecords - These are the actual mdnodes (in a value handle) for an |
| 319 | /// index. The ValueHandle ensures that ScopeRecordIdx stays up to date if |
| 320 | /// the MDNode is RAUW'd. |
| 321 | std::vector<DebugRecVH> ScopeRecords; |
| 322 | |
| 323 | /// ScopeInlinedAtIdx - This is the index in ScopeInlinedAtRecords for an |
| 324 | /// scope/inlined-at pair. |
| 325 | DenseMap<std::pair<MDNode*, MDNode*>, int> ScopeInlinedAtIdx; |
| 326 | |
| 327 | /// ScopeInlinedAtRecords - These are the actual mdnodes (in value handles) |
| 328 | /// for an index. The ValueHandle ensures that ScopeINlinedAtIdx stays up |
| 329 | /// to date. |
| 330 | std::vector<std::pair<DebugRecVH, DebugRecVH> > ScopeInlinedAtRecords; |
| 331 | |
| 332 | int getOrAddScopeRecordIdxEntry(MDNode *N, int ExistingIdx); |
| 333 | int getOrAddScopeInlinedAtIdxEntry(MDNode *Scope, MDNode *IA,int ExistingIdx); |
| 334 | |
Jeffrey Yasskin | 4cfb3a7 | 2010-03-21 21:17:34 +0000 | [diff] [blame] | 335 | LLVMContextImpl(LLVMContext &C); |
| 336 | ~LLVMContextImpl(); |
Owen Anderson | 8e66e0b | 2009-06-30 00:48:55 +0000 | [diff] [blame] | 337 | }; |
| 338 | |
| 339 | } |
| 340 | |
Owen Anderson | 36f62e5 | 2009-06-30 17:06:46 +0000 | [diff] [blame] | 341 | #endif |