Owen Anderson | 3fb4aab | 2009-08-23 04:24:24 +0000 | [diff] [blame] | 1 | //===-- ConstantsContext.h - Constants-related Context Interals -----------===// |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +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 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines various helper methods and classes used by |
| 11 | // LLVMContextImpl for creating and managing constants. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_CONSTANTSCONTEXT_H |
| 16 | #define LLVM_CONSTANTSCONTEXT_H |
| 17 | |
| 18 | #include "llvm/Instructions.h" |
| 19 | #include "llvm/Operator.h" |
David Greene | 338a903 | 2010-01-05 01:34:26 +0000 | [diff] [blame] | 20 | #include "llvm/Support/Debug.h" |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 21 | #include "llvm/Support/ErrorHandling.h" |
Chris Lattner | 34822f6 | 2009-08-23 04:44:11 +0000 | [diff] [blame] | 22 | #include "llvm/Support/raw_ostream.h" |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 23 | #include <map> |
| 24 | |
| 25 | namespace llvm { |
| 26 | template<class ValType> |
| 27 | struct ConstantTraits; |
| 28 | |
| 29 | /// UnaryConstantExpr - This class is private to Constants.cpp, and is used |
| 30 | /// behind the scenes to implement unary constant exprs. |
| 31 | class UnaryConstantExpr : public ConstantExpr { |
| 32 | void *operator new(size_t, unsigned); // DO NOT IMPLEMENT |
| 33 | public: |
| 34 | // allocate space for exactly one operand |
| 35 | void *operator new(size_t s) { |
| 36 | return User::operator new(s, 1); |
| 37 | } |
| 38 | UnaryConstantExpr(unsigned Opcode, Constant *C, const Type *Ty) |
| 39 | : ConstantExpr(Ty, Opcode, &Op<0>(), 1) { |
| 40 | Op<0>() = C; |
| 41 | } |
| 42 | DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); |
| 43 | }; |
| 44 | |
| 45 | /// BinaryConstantExpr - This class is private to Constants.cpp, and is used |
| 46 | /// behind the scenes to implement binary constant exprs. |
| 47 | class BinaryConstantExpr : public ConstantExpr { |
| 48 | void *operator new(size_t, unsigned); // DO NOT IMPLEMENT |
| 49 | public: |
| 50 | // allocate space for exactly two operands |
| 51 | void *operator new(size_t s) { |
| 52 | return User::operator new(s, 2); |
| 53 | } |
Dan Gohman | 1b84908 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 54 | BinaryConstantExpr(unsigned Opcode, Constant *C1, Constant *C2, |
| 55 | unsigned Flags) |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 56 | : ConstantExpr(C1->getType(), Opcode, &Op<0>(), 2) { |
| 57 | Op<0>() = C1; |
| 58 | Op<1>() = C2; |
Dan Gohman | 1b84908 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 59 | SubclassOptionalData = Flags; |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 60 | } |
| 61 | /// Transparently provide more efficient getOperand methods. |
| 62 | DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); |
| 63 | }; |
| 64 | |
| 65 | /// SelectConstantExpr - This class is private to Constants.cpp, and is used |
| 66 | /// behind the scenes to implement select constant exprs. |
| 67 | class SelectConstantExpr : public ConstantExpr { |
| 68 | void *operator new(size_t, unsigned); // DO NOT IMPLEMENT |
| 69 | public: |
| 70 | // allocate space for exactly three operands |
| 71 | void *operator new(size_t s) { |
| 72 | return User::operator new(s, 3); |
| 73 | } |
| 74 | SelectConstantExpr(Constant *C1, Constant *C2, Constant *C3) |
| 75 | : ConstantExpr(C2->getType(), Instruction::Select, &Op<0>(), 3) { |
| 76 | Op<0>() = C1; |
| 77 | Op<1>() = C2; |
| 78 | Op<2>() = C3; |
| 79 | } |
| 80 | /// Transparently provide more efficient getOperand methods. |
| 81 | DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); |
| 82 | }; |
| 83 | |
| 84 | /// ExtractElementConstantExpr - This class is private to |
| 85 | /// Constants.cpp, and is used behind the scenes to implement |
| 86 | /// extractelement constant exprs. |
| 87 | class ExtractElementConstantExpr : public ConstantExpr { |
| 88 | void *operator new(size_t, unsigned); // DO NOT IMPLEMENT |
| 89 | public: |
| 90 | // allocate space for exactly two operands |
| 91 | void *operator new(size_t s) { |
| 92 | return User::operator new(s, 2); |
| 93 | } |
| 94 | ExtractElementConstantExpr(Constant *C1, Constant *C2) |
| 95 | : ConstantExpr(cast<VectorType>(C1->getType())->getElementType(), |
| 96 | Instruction::ExtractElement, &Op<0>(), 2) { |
| 97 | Op<0>() = C1; |
| 98 | Op<1>() = C2; |
| 99 | } |
| 100 | /// Transparently provide more efficient getOperand methods. |
| 101 | DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); |
| 102 | }; |
| 103 | |
| 104 | /// InsertElementConstantExpr - This class is private to |
| 105 | /// Constants.cpp, and is used behind the scenes to implement |
| 106 | /// insertelement constant exprs. |
| 107 | class InsertElementConstantExpr : public ConstantExpr { |
| 108 | void *operator new(size_t, unsigned); // DO NOT IMPLEMENT |
| 109 | public: |
| 110 | // allocate space for exactly three operands |
| 111 | void *operator new(size_t s) { |
| 112 | return User::operator new(s, 3); |
| 113 | } |
| 114 | InsertElementConstantExpr(Constant *C1, Constant *C2, Constant *C3) |
| 115 | : ConstantExpr(C1->getType(), Instruction::InsertElement, |
| 116 | &Op<0>(), 3) { |
| 117 | Op<0>() = C1; |
| 118 | Op<1>() = C2; |
| 119 | Op<2>() = C3; |
| 120 | } |
| 121 | /// Transparently provide more efficient getOperand methods. |
| 122 | DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); |
| 123 | }; |
| 124 | |
| 125 | /// ShuffleVectorConstantExpr - This class is private to |
| 126 | /// Constants.cpp, and is used behind the scenes to implement |
| 127 | /// shufflevector constant exprs. |
| 128 | class ShuffleVectorConstantExpr : public ConstantExpr { |
| 129 | void *operator new(size_t, unsigned); // DO NOT IMPLEMENT |
| 130 | public: |
| 131 | // allocate space for exactly three operands |
| 132 | void *operator new(size_t s) { |
| 133 | return User::operator new(s, 3); |
| 134 | } |
| 135 | ShuffleVectorConstantExpr(Constant *C1, Constant *C2, Constant *C3) |
| 136 | : ConstantExpr(VectorType::get( |
| 137 | cast<VectorType>(C1->getType())->getElementType(), |
| 138 | cast<VectorType>(C3->getType())->getNumElements()), |
| 139 | Instruction::ShuffleVector, |
| 140 | &Op<0>(), 3) { |
| 141 | Op<0>() = C1; |
| 142 | Op<1>() = C2; |
| 143 | Op<2>() = C3; |
| 144 | } |
| 145 | /// Transparently provide more efficient getOperand methods. |
| 146 | DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); |
| 147 | }; |
| 148 | |
| 149 | /// ExtractValueConstantExpr - This class is private to |
| 150 | /// Constants.cpp, and is used behind the scenes to implement |
| 151 | /// extractvalue constant exprs. |
| 152 | class ExtractValueConstantExpr : public ConstantExpr { |
| 153 | void *operator new(size_t, unsigned); // DO NOT IMPLEMENT |
| 154 | public: |
| 155 | // allocate space for exactly one operand |
| 156 | void *operator new(size_t s) { |
| 157 | return User::operator new(s, 1); |
| 158 | } |
| 159 | ExtractValueConstantExpr(Constant *Agg, |
| 160 | const SmallVector<unsigned, 4> &IdxList, |
| 161 | const Type *DestTy) |
| 162 | : ConstantExpr(DestTy, Instruction::ExtractValue, &Op<0>(), 1), |
| 163 | Indices(IdxList) { |
| 164 | Op<0>() = Agg; |
| 165 | } |
| 166 | |
| 167 | /// Indices - These identify which value to extract. |
| 168 | const SmallVector<unsigned, 4> Indices; |
| 169 | |
| 170 | /// Transparently provide more efficient getOperand methods. |
| 171 | DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); |
| 172 | }; |
| 173 | |
| 174 | /// InsertValueConstantExpr - This class is private to |
| 175 | /// Constants.cpp, and is used behind the scenes to implement |
| 176 | /// insertvalue constant exprs. |
| 177 | class InsertValueConstantExpr : public ConstantExpr { |
| 178 | void *operator new(size_t, unsigned); // DO NOT IMPLEMENT |
| 179 | public: |
| 180 | // allocate space for exactly one operand |
| 181 | void *operator new(size_t s) { |
| 182 | return User::operator new(s, 2); |
| 183 | } |
| 184 | InsertValueConstantExpr(Constant *Agg, Constant *Val, |
| 185 | const SmallVector<unsigned, 4> &IdxList, |
| 186 | const Type *DestTy) |
| 187 | : ConstantExpr(DestTy, Instruction::InsertValue, &Op<0>(), 2), |
| 188 | Indices(IdxList) { |
| 189 | Op<0>() = Agg; |
| 190 | Op<1>() = Val; |
| 191 | } |
| 192 | |
| 193 | /// Indices - These identify the position for the insertion. |
| 194 | const SmallVector<unsigned, 4> Indices; |
| 195 | |
| 196 | /// Transparently provide more efficient getOperand methods. |
| 197 | DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); |
| 198 | }; |
| 199 | |
| 200 | |
| 201 | /// GetElementPtrConstantExpr - This class is private to Constants.cpp, and is |
| 202 | /// used behind the scenes to implement getelementpr constant exprs. |
| 203 | class GetElementPtrConstantExpr : public ConstantExpr { |
| 204 | GetElementPtrConstantExpr(Constant *C, const std::vector<Constant*> &IdxList, |
| 205 | const Type *DestTy); |
| 206 | public: |
| 207 | static GetElementPtrConstantExpr *Create(Constant *C, |
| 208 | const std::vector<Constant*>&IdxList, |
Dan Gohman | 1b84908 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 209 | const Type *DestTy, |
| 210 | unsigned Flags) { |
| 211 | GetElementPtrConstantExpr *Result = |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 212 | new(IdxList.size() + 1) GetElementPtrConstantExpr(C, IdxList, DestTy); |
Dan Gohman | 1b84908 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 213 | Result->SubclassOptionalData = Flags; |
| 214 | return Result; |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 215 | } |
| 216 | /// Transparently provide more efficient getOperand methods. |
| 217 | DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); |
| 218 | }; |
| 219 | |
| 220 | // CompareConstantExpr - This class is private to Constants.cpp, and is used |
| 221 | // behind the scenes to implement ICmp and FCmp constant expressions. This is |
| 222 | // needed in order to store the predicate value for these instructions. |
| 223 | struct CompareConstantExpr : public ConstantExpr { |
| 224 | void *operator new(size_t, unsigned); // DO NOT IMPLEMENT |
| 225 | // allocate space for exactly two operands |
| 226 | void *operator new(size_t s) { |
| 227 | return User::operator new(s, 2); |
| 228 | } |
| 229 | unsigned short predicate; |
| 230 | CompareConstantExpr(const Type *ty, Instruction::OtherOps opc, |
| 231 | unsigned short pred, Constant* LHS, Constant* RHS) |
| 232 | : ConstantExpr(ty, opc, &Op<0>(), 2), predicate(pred) { |
| 233 | Op<0>() = LHS; |
| 234 | Op<1>() = RHS; |
| 235 | } |
| 236 | /// Transparently provide more efficient getOperand methods. |
| 237 | DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); |
| 238 | }; |
| 239 | |
| 240 | template <> |
Duncan Sands | 0f5bbb5 | 2009-09-06 08:55:57 +0000 | [diff] [blame] | 241 | struct OperandTraits<UnaryConstantExpr> : public FixedNumOperandTraits<1> { |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 242 | }; |
| 243 | DEFINE_TRANSPARENT_OPERAND_ACCESSORS(UnaryConstantExpr, Value) |
| 244 | |
| 245 | template <> |
Duncan Sands | 0f5bbb5 | 2009-09-06 08:55:57 +0000 | [diff] [blame] | 246 | struct OperandTraits<BinaryConstantExpr> : public FixedNumOperandTraits<2> { |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 247 | }; |
| 248 | DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BinaryConstantExpr, Value) |
| 249 | |
| 250 | template <> |
Duncan Sands | 0f5bbb5 | 2009-09-06 08:55:57 +0000 | [diff] [blame] | 251 | struct OperandTraits<SelectConstantExpr> : public FixedNumOperandTraits<3> { |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 252 | }; |
| 253 | DEFINE_TRANSPARENT_OPERAND_ACCESSORS(SelectConstantExpr, Value) |
| 254 | |
| 255 | template <> |
Duncan Sands | 0f5bbb5 | 2009-09-06 08:55:57 +0000 | [diff] [blame] | 256 | struct OperandTraits<ExtractElementConstantExpr> : public FixedNumOperandTraits<2> { |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 257 | }; |
| 258 | DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ExtractElementConstantExpr, Value) |
| 259 | |
| 260 | template <> |
Duncan Sands | 0f5bbb5 | 2009-09-06 08:55:57 +0000 | [diff] [blame] | 261 | struct OperandTraits<InsertElementConstantExpr> : public FixedNumOperandTraits<3> { |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 262 | }; |
| 263 | DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InsertElementConstantExpr, Value) |
| 264 | |
| 265 | template <> |
Duncan Sands | 0f5bbb5 | 2009-09-06 08:55:57 +0000 | [diff] [blame] | 266 | struct OperandTraits<ShuffleVectorConstantExpr> : public FixedNumOperandTraits<3> { |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 267 | }; |
| 268 | DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ShuffleVectorConstantExpr, Value) |
| 269 | |
| 270 | template <> |
Duncan Sands | 0f5bbb5 | 2009-09-06 08:55:57 +0000 | [diff] [blame] | 271 | struct OperandTraits<ExtractValueConstantExpr> : public FixedNumOperandTraits<1> { |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 272 | }; |
| 273 | DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ExtractValueConstantExpr, Value) |
| 274 | |
| 275 | template <> |
Duncan Sands | 0f5bbb5 | 2009-09-06 08:55:57 +0000 | [diff] [blame] | 276 | struct OperandTraits<InsertValueConstantExpr> : public FixedNumOperandTraits<2> { |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 277 | }; |
| 278 | DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InsertValueConstantExpr, Value) |
| 279 | |
| 280 | template <> |
Duncan Sands | 0f5bbb5 | 2009-09-06 08:55:57 +0000 | [diff] [blame] | 281 | struct OperandTraits<GetElementPtrConstantExpr> : public VariadicOperandTraits<1> { |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 282 | }; |
| 283 | |
| 284 | DEFINE_TRANSPARENT_OPERAND_ACCESSORS(GetElementPtrConstantExpr, Value) |
| 285 | |
| 286 | |
| 287 | template <> |
Duncan Sands | 0f5bbb5 | 2009-09-06 08:55:57 +0000 | [diff] [blame] | 288 | struct OperandTraits<CompareConstantExpr> : public FixedNumOperandTraits<2> { |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 289 | }; |
| 290 | DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CompareConstantExpr, Value) |
| 291 | |
| 292 | struct ExprMapKeyType { |
| 293 | typedef SmallVector<unsigned, 4> IndexList; |
| 294 | |
| 295 | ExprMapKeyType(unsigned opc, |
| 296 | const std::vector<Constant*> &ops, |
Dan Gohman | 1b84908 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 297 | unsigned short flags = 0, |
| 298 | unsigned short optionalflags = 0, |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 299 | const IndexList &inds = IndexList()) |
Dan Gohman | 1b84908 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 300 | : opcode(opc), subclassoptionaldata(optionalflags), subclassdata(flags), |
| 301 | operands(ops), indices(inds) {} |
| 302 | uint8_t opcode; |
| 303 | uint8_t subclassoptionaldata; |
| 304 | uint16_t subclassdata; |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 305 | std::vector<Constant*> operands; |
| 306 | IndexList indices; |
| 307 | bool operator==(const ExprMapKeyType& that) const { |
| 308 | return this->opcode == that.opcode && |
Dan Gohman | 1b84908 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 309 | this->subclassdata == that.subclassdata && |
| 310 | this->subclassoptionaldata == that.subclassoptionaldata && |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 311 | this->operands == that.operands && |
| 312 | this->indices == that.indices; |
| 313 | } |
| 314 | bool operator<(const ExprMapKeyType & that) const { |
Dan Gohman | 1b84908 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 315 | if (this->opcode != that.opcode) return this->opcode < that.opcode; |
| 316 | if (this->operands != that.operands) return this->operands < that.operands; |
| 317 | if (this->subclassdata != that.subclassdata) |
| 318 | return this->subclassdata < that.subclassdata; |
| 319 | if (this->subclassoptionaldata != that.subclassoptionaldata) |
| 320 | return this->subclassoptionaldata < that.subclassoptionaldata; |
| 321 | if (this->indices != that.indices) return this->indices < that.indices; |
| 322 | return false; |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 323 | } |
| 324 | |
| 325 | bool operator!=(const ExprMapKeyType& that) const { |
| 326 | return !(*this == that); |
| 327 | } |
| 328 | }; |
| 329 | |
| 330 | // The number of operands for each ConstantCreator::create method is |
| 331 | // determined by the ConstantTraits template. |
| 332 | // ConstantCreator - A class that is used to create constants by |
Jeffrey Yasskin | f6ee7be | 2009-10-27 23:45:55 +0000 | [diff] [blame] | 333 | // ConstantUniqueMap*. This class should be partially specialized if there is |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 334 | // something strange that needs to be done to interface to the ctor for the |
| 335 | // constant. |
| 336 | // |
| 337 | template<typename T, typename Alloc> |
| 338 | struct ConstantTraits< std::vector<T, Alloc> > { |
| 339 | static unsigned uses(const std::vector<T, Alloc>& v) { |
| 340 | return v.size(); |
| 341 | } |
| 342 | }; |
| 343 | |
| 344 | template<class ConstantClass, class TypeClass, class ValType> |
| 345 | struct ConstantCreator { |
| 346 | static ConstantClass *create(const TypeClass *Ty, const ValType &V) { |
| 347 | return new(ConstantTraits<ValType>::uses(V)) ConstantClass(Ty, V); |
| 348 | } |
| 349 | }; |
| 350 | |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 351 | template<class ConstantClass> |
| 352 | struct ConstantKeyData { |
| 353 | typedef void ValType; |
| 354 | static ValType getValType(ConstantClass *C) { |
| 355 | llvm_unreachable("Unknown Constant type!"); |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 356 | } |
| 357 | }; |
| 358 | |
| 359 | template<> |
| 360 | struct ConstantCreator<ConstantExpr, Type, ExprMapKeyType> { |
| 361 | static ConstantExpr *create(const Type *Ty, const ExprMapKeyType &V, |
| 362 | unsigned short pred = 0) { |
| 363 | if (Instruction::isCast(V.opcode)) |
| 364 | return new UnaryConstantExpr(V.opcode, V.operands[0], Ty); |
| 365 | if ((V.opcode >= Instruction::BinaryOpsBegin && |
| 366 | V.opcode < Instruction::BinaryOpsEnd)) |
Dan Gohman | 1b84908 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 367 | return new BinaryConstantExpr(V.opcode, V.operands[0], V.operands[1], |
| 368 | V.subclassoptionaldata); |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 369 | if (V.opcode == Instruction::Select) |
| 370 | return new SelectConstantExpr(V.operands[0], V.operands[1], |
| 371 | V.operands[2]); |
| 372 | if (V.opcode == Instruction::ExtractElement) |
| 373 | return new ExtractElementConstantExpr(V.operands[0], V.operands[1]); |
| 374 | if (V.opcode == Instruction::InsertElement) |
| 375 | return new InsertElementConstantExpr(V.operands[0], V.operands[1], |
| 376 | V.operands[2]); |
| 377 | if (V.opcode == Instruction::ShuffleVector) |
| 378 | return new ShuffleVectorConstantExpr(V.operands[0], V.operands[1], |
| 379 | V.operands[2]); |
| 380 | if (V.opcode == Instruction::InsertValue) |
| 381 | return new InsertValueConstantExpr(V.operands[0], V.operands[1], |
| 382 | V.indices, Ty); |
| 383 | if (V.opcode == Instruction::ExtractValue) |
| 384 | return new ExtractValueConstantExpr(V.operands[0], V.indices, Ty); |
| 385 | if (V.opcode == Instruction::GetElementPtr) { |
| 386 | std::vector<Constant*> IdxList(V.operands.begin()+1, V.operands.end()); |
Dan Gohman | 1b84908 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 387 | return GetElementPtrConstantExpr::Create(V.operands[0], IdxList, Ty, |
| 388 | V.subclassoptionaldata); |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 389 | } |
| 390 | |
| 391 | // The compare instructions are weird. We have to encode the predicate |
| 392 | // value and it is combined with the instruction opcode by multiplying |
| 393 | // the opcode by one hundred. We must decode this to get the predicate. |
| 394 | if (V.opcode == Instruction::ICmp) |
Dan Gohman | 1b84908 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 395 | return new CompareConstantExpr(Ty, Instruction::ICmp, V.subclassdata, |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 396 | V.operands[0], V.operands[1]); |
| 397 | if (V.opcode == Instruction::FCmp) |
Dan Gohman | 1b84908 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 398 | return new CompareConstantExpr(Ty, Instruction::FCmp, V.subclassdata, |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 399 | V.operands[0], V.operands[1]); |
| 400 | llvm_unreachable("Invalid ConstantExpr!"); |
| 401 | return 0; |
| 402 | } |
| 403 | }; |
| 404 | |
| 405 | template<> |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 406 | struct ConstantKeyData<ConstantExpr> { |
| 407 | typedef ExprMapKeyType ValType; |
| 408 | static ValType getValType(ConstantExpr *CE) { |
| 409 | std::vector<Constant*> Operands; |
| 410 | Operands.reserve(CE->getNumOperands()); |
| 411 | for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) |
| 412 | Operands.push_back(cast<Constant>(CE->getOperand(i))); |
| 413 | return ExprMapKeyType(CE->getOpcode(), Operands, |
| 414 | CE->isCompare() ? CE->getPredicate() : 0, |
| 415 | CE->getRawSubclassOptionalData(), |
| 416 | CE->hasIndices() ? |
| 417 | CE->getIndices() : SmallVector<unsigned, 4>()); |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 418 | } |
| 419 | }; |
| 420 | |
| 421 | // ConstantAggregateZero does not take extra "value" argument... |
| 422 | template<class ValType> |
| 423 | struct ConstantCreator<ConstantAggregateZero, Type, ValType> { |
| 424 | static ConstantAggregateZero *create(const Type *Ty, const ValType &V){ |
| 425 | return new ConstantAggregateZero(Ty); |
| 426 | } |
| 427 | }; |
| 428 | |
| 429 | template<> |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 430 | struct ConstantKeyData<ConstantVector> { |
| 431 | typedef std::vector<Constant*> ValType; |
| 432 | static ValType getValType(ConstantVector *CP) { |
| 433 | std::vector<Constant*> Elements; |
| 434 | Elements.reserve(CP->getNumOperands()); |
| 435 | for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) |
| 436 | Elements.push_back(CP->getOperand(i)); |
| 437 | return Elements; |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 438 | } |
| 439 | }; |
| 440 | |
| 441 | template<> |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 442 | struct ConstantKeyData<ConstantAggregateZero> { |
| 443 | typedef char ValType; |
| 444 | static ValType getValType(ConstantAggregateZero *C) { |
| 445 | return 0; |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 446 | } |
| 447 | }; |
| 448 | |
| 449 | template<> |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 450 | struct ConstantKeyData<ConstantArray> { |
| 451 | typedef std::vector<Constant*> ValType; |
| 452 | static ValType getValType(ConstantArray *CA) { |
| 453 | std::vector<Constant*> Elements; |
| 454 | Elements.reserve(CA->getNumOperands()); |
| 455 | for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) |
| 456 | Elements.push_back(cast<Constant>(CA->getOperand(i))); |
| 457 | return Elements; |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 458 | } |
| 459 | }; |
| 460 | |
| 461 | template<> |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 462 | struct ConstantKeyData<ConstantStruct> { |
| 463 | typedef std::vector<Constant*> ValType; |
| 464 | static ValType getValType(ConstantStruct *CS) { |
| 465 | std::vector<Constant*> Elements; |
| 466 | Elements.reserve(CS->getNumOperands()); |
| 467 | for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) |
| 468 | Elements.push_back(cast<Constant>(CS->getOperand(i))); |
| 469 | return Elements; |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 470 | } |
| 471 | }; |
| 472 | |
| 473 | // ConstantPointerNull does not take extra "value" argument... |
| 474 | template<class ValType> |
| 475 | struct ConstantCreator<ConstantPointerNull, PointerType, ValType> { |
| 476 | static ConstantPointerNull *create(const PointerType *Ty, const ValType &V){ |
| 477 | return new ConstantPointerNull(Ty); |
| 478 | } |
| 479 | }; |
| 480 | |
| 481 | template<> |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 482 | struct ConstantKeyData<ConstantPointerNull> { |
| 483 | typedef char ValType; |
| 484 | static ValType getValType(ConstantPointerNull *C) { |
| 485 | return 0; |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 486 | } |
| 487 | }; |
| 488 | |
| 489 | // UndefValue does not take extra "value" argument... |
| 490 | template<class ValType> |
| 491 | struct ConstantCreator<UndefValue, Type, ValType> { |
| 492 | static UndefValue *create(const Type *Ty, const ValType &V) { |
| 493 | return new UndefValue(Ty); |
| 494 | } |
| 495 | }; |
| 496 | |
| 497 | template<> |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 498 | struct ConstantKeyData<UndefValue> { |
| 499 | typedef char ValType; |
| 500 | static ValType getValType(UndefValue *C) { |
| 501 | return 0; |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 502 | } |
| 503 | }; |
| 504 | |
| 505 | template<class ValType, class TypeClass, class ConstantClass, |
| 506 | bool HasLargeKey = false /*true for arrays and structs*/ > |
Jeffrey Yasskin | f6ee7be | 2009-10-27 23:45:55 +0000 | [diff] [blame] | 507 | class ConstantUniqueMap : public AbstractTypeUser { |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 508 | public: |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 509 | typedef std::pair<const TypeClass*, ValType> MapKey; |
| 510 | typedef std::map<MapKey, ConstantClass *> MapTy; |
| 511 | typedef std::map<ConstantClass *, typename MapTy::iterator> InverseMapTy; |
| 512 | typedef std::map<const DerivedType*, typename MapTy::iterator> |
| 513 | AbstractTypeMapTy; |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 514 | private: |
| 515 | /// Map - This is the main map from the element descriptor to the Constants. |
| 516 | /// This is the primary way we avoid creating two of the same shape |
| 517 | /// constant. |
| 518 | MapTy Map; |
| 519 | |
| 520 | /// InverseMap - If "HasLargeKey" is true, this contains an inverse mapping |
| 521 | /// from the constants to their element in Map. This is important for |
| 522 | /// removal of constants from the array, which would otherwise have to scan |
| 523 | /// through the map with very large keys. |
| 524 | InverseMapTy InverseMap; |
| 525 | |
| 526 | /// AbstractTypeMap - Map for abstract type constants. |
| 527 | /// |
| 528 | AbstractTypeMapTy AbstractTypeMap; |
| 529 | |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 530 | public: |
Devang Patel | c5aa8c6 | 2009-08-11 06:31:57 +0000 | [diff] [blame] | 531 | typename MapTy::iterator map_begin() { return Map.begin(); } |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 532 | typename MapTy::iterator map_end() { return Map.end(); } |
Torok Edwin | d18e668 | 2009-08-31 16:14:59 +0000 | [diff] [blame] | 533 | |
| 534 | void freeConstants() { |
| 535 | for (typename MapTy::iterator I=Map.begin(), E=Map.end(); |
| 536 | I != E; ++I) { |
| 537 | if (I->second->use_empty()) |
| 538 | delete I->second; |
| 539 | } |
| 540 | } |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 541 | |
| 542 | /// InsertOrGetItem - Return an iterator for the specified element. |
| 543 | /// If the element exists in the map, the returned iterator points to the |
| 544 | /// entry and Exists=true. If not, the iterator points to the newly |
| 545 | /// inserted entry and returns Exists=false. Newly inserted entries have |
| 546 | /// I->second == 0, and should be filled in. |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 547 | typename MapTy::iterator InsertOrGetItem(std::pair<MapKey, ConstantClass *> |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 548 | &InsertVal, |
| 549 | bool &Exists) { |
| 550 | std::pair<typename MapTy::iterator, bool> IP = Map.insert(InsertVal); |
| 551 | Exists = !IP.second; |
| 552 | return IP.first; |
| 553 | } |
| 554 | |
| 555 | private: |
| 556 | typename MapTy::iterator FindExistingElement(ConstantClass *CP) { |
| 557 | if (HasLargeKey) { |
| 558 | typename InverseMapTy::iterator IMI = InverseMap.find(CP); |
| 559 | assert(IMI != InverseMap.end() && IMI->second != Map.end() && |
| 560 | IMI->second->second == CP && |
| 561 | "InverseMap corrupt!"); |
| 562 | return IMI->second; |
| 563 | } |
| 564 | |
| 565 | typename MapTy::iterator I = |
| 566 | Map.find(MapKey(static_cast<const TypeClass*>(CP->getRawType()), |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 567 | ConstantKeyData<ConstantClass>::getValType(CP))); |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 568 | if (I == Map.end() || I->second != CP) { |
| 569 | // FIXME: This should not use a linear scan. If this gets to be a |
| 570 | // performance problem, someone should look at this. |
| 571 | for (I = Map.begin(); I != Map.end() && I->second != CP; ++I) |
| 572 | /* empty */; |
| 573 | } |
| 574 | return I; |
| 575 | } |
| 576 | |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 577 | void AddAbstractTypeUser(const Type *Ty, typename MapTy::iterator I) { |
| 578 | // If the type of the constant is abstract, make sure that an entry |
| 579 | // exists for it in the AbstractTypeMap. |
| 580 | if (Ty->isAbstract()) { |
| 581 | const DerivedType *DTy = static_cast<const DerivedType *>(Ty); |
| 582 | typename AbstractTypeMapTy::iterator TI = AbstractTypeMap.find(DTy); |
| 583 | |
| 584 | if (TI == AbstractTypeMap.end()) { |
| 585 | // Add ourselves to the ATU list of the type. |
| 586 | cast<DerivedType>(DTy)->addAbstractTypeUser(this); |
| 587 | |
| 588 | AbstractTypeMap.insert(TI, std::make_pair(DTy, I)); |
| 589 | } |
| 590 | } |
| 591 | } |
| 592 | |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 593 | ConstantClass* Create(const TypeClass *Ty, const ValType &V, |
| 594 | typename MapTy::iterator I) { |
| 595 | ConstantClass* Result = |
| 596 | ConstantCreator<ConstantClass,TypeClass,ValType>::create(Ty, V); |
| 597 | |
| 598 | assert(Result->getType() == Ty && "Type specified is not correct!"); |
| 599 | I = Map.insert(I, std::make_pair(MapKey(Ty, V), Result)); |
| 600 | |
| 601 | if (HasLargeKey) // Remember the reverse mapping if needed. |
| 602 | InverseMap.insert(std::make_pair(Result, I)); |
| 603 | |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 604 | AddAbstractTypeUser(Ty, I); |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 605 | |
| 606 | return Result; |
| 607 | } |
| 608 | public: |
| 609 | |
| 610 | /// getOrCreate - Return the specified constant from the map, creating it if |
| 611 | /// necessary. |
| 612 | ConstantClass *getOrCreate(const TypeClass *Ty, const ValType &V) { |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 613 | MapKey Lookup(Ty, V); |
| 614 | ConstantClass* Result = 0; |
| 615 | |
| 616 | typename MapTy::iterator I = Map.find(Lookup); |
| 617 | // Is it in the map? |
| 618 | if (I != Map.end()) |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 619 | Result = I->second; |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 620 | |
| 621 | if (!Result) { |
| 622 | // If no preexisting value, create one now... |
| 623 | Result = Create(Ty, V, I); |
| 624 | } |
| 625 | |
| 626 | return Result; |
| 627 | } |
| 628 | |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 629 | void UpdateAbstractTypeMap(const DerivedType *Ty, |
| 630 | typename MapTy::iterator I) { |
| 631 | assert(AbstractTypeMap.count(Ty) && |
| 632 | "Abstract type not in AbstractTypeMap?"); |
| 633 | typename MapTy::iterator &ATMEntryIt = AbstractTypeMap[Ty]; |
| 634 | if (ATMEntryIt == I) { |
| 635 | // Yes, we are removing the representative entry for this type. |
| 636 | // See if there are any other entries of the same type. |
| 637 | typename MapTy::iterator TmpIt = ATMEntryIt; |
| 638 | |
| 639 | // First check the entry before this one... |
| 640 | if (TmpIt != Map.begin()) { |
| 641 | --TmpIt; |
| 642 | if (TmpIt->first.first != Ty) // Not the same type, move back... |
| 643 | ++TmpIt; |
| 644 | } |
| 645 | |
| 646 | // If we didn't find the same type, try to move forward... |
| 647 | if (TmpIt == ATMEntryIt) { |
| 648 | ++TmpIt; |
| 649 | if (TmpIt == Map.end() || TmpIt->first.first != Ty) |
| 650 | --TmpIt; // No entry afterwards with the same type |
| 651 | } |
| 652 | |
| 653 | // If there is another entry in the map of the same abstract type, |
| 654 | // update the AbstractTypeMap entry now. |
| 655 | if (TmpIt != ATMEntryIt) { |
| 656 | ATMEntryIt = TmpIt; |
| 657 | } else { |
| 658 | // Otherwise, we are removing the last instance of this type |
| 659 | // from the table. Remove from the ATM, and from user list. |
| 660 | cast<DerivedType>(Ty)->removeAbstractTypeUser(this); |
| 661 | AbstractTypeMap.erase(Ty); |
| 662 | } |
| 663 | } |
| 664 | } |
| 665 | |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 666 | void remove(ConstantClass *CP) { |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 667 | typename MapTy::iterator I = FindExistingElement(CP); |
| 668 | assert(I != Map.end() && "Constant not found in constant table!"); |
| 669 | assert(I->second == CP && "Didn't find correct element?"); |
| 670 | |
| 671 | if (HasLargeKey) // Remember the reverse mapping if needed. |
| 672 | InverseMap.erase(CP); |
| 673 | |
| 674 | // Now that we found the entry, make sure this isn't the entry that |
| 675 | // the AbstractTypeMap points to. |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 676 | const TypeClass *Ty = I->first.first; |
| 677 | if (Ty->isAbstract()) |
| 678 | UpdateAbstractTypeMap(static_cast<const DerivedType *>(Ty), I); |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 679 | |
| 680 | Map.erase(I); |
| 681 | } |
| 682 | |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 683 | /// MoveConstantToNewSlot - If we are about to change C to be the element |
| 684 | /// specified by I, update our internal data structures to reflect this |
| 685 | /// fact. |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 686 | void MoveConstantToNewSlot(ConstantClass *C, typename MapTy::iterator I) { |
| 687 | // First, remove the old location of the specified constant in the map. |
| 688 | typename MapTy::iterator OldI = FindExistingElement(C); |
| 689 | assert(OldI != Map.end() && "Constant not found in constant table!"); |
| 690 | assert(OldI->second == C && "Didn't find correct element?"); |
| 691 | |
| 692 | // If this constant is the representative element for its abstract type, |
| 693 | // update the AbstractTypeMap so that the representative element is I. |
| 694 | if (C->getType()->isAbstract()) { |
| 695 | typename AbstractTypeMapTy::iterator ATI = |
| 696 | AbstractTypeMap.find(C->getType()); |
| 697 | assert(ATI != AbstractTypeMap.end() && |
| 698 | "Abstract type not in AbstractTypeMap?"); |
| 699 | if (ATI->second == OldI) |
| 700 | ATI->second = I; |
| 701 | } |
| 702 | |
| 703 | // Remove the old entry from the map. |
| 704 | Map.erase(OldI); |
| 705 | |
| 706 | // Update the inverse map so that we know that this constant is now |
| 707 | // located at descriptor I. |
| 708 | if (HasLargeKey) { |
| 709 | assert(I->second == C && "Bad inversemap entry!"); |
| 710 | InverseMap[C] = I; |
| 711 | } |
| 712 | } |
| 713 | |
| 714 | void refineAbstractType(const DerivedType *OldTy, const Type *NewTy) { |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 715 | typename AbstractTypeMapTy::iterator I = AbstractTypeMap.find(OldTy); |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 716 | |
| 717 | assert(I != AbstractTypeMap.end() && |
| 718 | "Abstract type not in AbstractTypeMap?"); |
| 719 | |
| 720 | // Convert a constant at a time until the last one is gone. The last one |
| 721 | // leaving will remove() itself, causing the AbstractTypeMapEntry to be |
| 722 | // eliminated eventually. |
| 723 | do { |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 724 | ConstantClass *C = I->second->second; |
| 725 | MapKey Key(cast<TypeClass>(NewTy), |
| 726 | ConstantKeyData<ConstantClass>::getValType(C)); |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 727 | |
Dan Gohman | e4532f3 | 2009-09-15 15:58:07 +0000 | [diff] [blame] | 728 | std::pair<typename MapTy::iterator, bool> IP = |
| 729 | Map.insert(std::make_pair(Key, C)); |
| 730 | if (IP.second) { |
| 731 | // The map didn't previously have an appropriate constant in the |
| 732 | // new type. |
| 733 | |
| 734 | // Remove the old entry. |
| 735 | typename MapTy::iterator OldI = |
| 736 | Map.find(MapKey(cast<TypeClass>(OldTy), IP.first->first.second)); |
| 737 | assert(OldI != Map.end() && "Constant not in map!"); |
| 738 | UpdateAbstractTypeMap(OldTy, OldI); |
| 739 | Map.erase(OldI); |
| 740 | |
| 741 | // Set the constant's type. This is done in place! |
| 742 | setType(C, NewTy); |
| 743 | |
| 744 | // Update the inverse map so that we know that this constant is now |
| 745 | // located at descriptor I. |
| 746 | if (HasLargeKey) |
| 747 | InverseMap[C] = IP.first; |
| 748 | |
| 749 | AddAbstractTypeUser(NewTy, IP.first); |
| 750 | } else { |
| 751 | // The map already had an appropriate constant in the new type, so |
| 752 | // there's no longer a need for the old constant. |
| 753 | C->uncheckedReplaceAllUsesWith(IP.first->second); |
| 754 | C->destroyConstant(); // This constant is now dead, destroy it. |
| 755 | } |
| 756 | I = AbstractTypeMap.find(OldTy); |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 757 | } while (I != AbstractTypeMap.end()); |
| 758 | } |
| 759 | |
| 760 | // If the type became concrete without being refined to any other existing |
| 761 | // type, we just remove ourselves from the ATU list. |
| 762 | void typeBecameConcrete(const DerivedType *AbsTy) { |
| 763 | AbsTy->removeAbstractTypeUser(this); |
| 764 | } |
| 765 | |
| 766 | void dump() const { |
David Greene | 338a903 | 2010-01-05 01:34:26 +0000 | [diff] [blame] | 767 | DEBUG(dbgs() << "Constant.cpp: ConstantUniqueMap\n"); |
Owen Anderson | 9b67698 | 2009-08-04 22:55:26 +0000 | [diff] [blame] | 768 | } |
| 769 | }; |
| 770 | |
| 771 | } |
| 772 | |
| 773 | #endif |