Privatize the ConstantArray table.

llvm-svn: 76639
diff --git a/llvm/lib/VMCore/LLVMContextImpl.h b/llvm/lib/VMCore/LLVMContextImpl.h
index e2c2537..03f0e7b 100644
--- a/llvm/lib/VMCore/LLVMContextImpl.h
+++ b/llvm/lib/VMCore/LLVMContextImpl.h
@@ -30,7 +30,7 @@
 
 template<class ValType, class TypeClass, class ConstantClass,
          bool HasLargeKey = false  /*true for arrays and structs*/ >
-class ContextValueMap;
+class ValueMap;
 
 namespace llvm {
 template<class ValType>
@@ -111,7 +111,11 @@
   
   FoldingSet<MDNode> MDNodeSet;
   
-  ContextValueMap<char, Type, ConstantAggregateZero> *AggZeroConstants;
+  ValueMap<char, Type, ConstantAggregateZero> *AggZeroConstants;
+  
+  typedef ValueMap<std::vector<Constant*>, ArrayType, 
+    ConstantArray, true /*largekey*/> ArrayConstantsTy;
+  ArrayConstantsTy *ArrayConstants;
   
   LLVMContext &Context;
   ConstantInt *TheTrueVal;
@@ -135,6 +139,9 @@
   
   ConstantAggregateZero *getConstantAggregateZero(const Type *Ty);
   
+  Constant *getConstantArray(const ArrayType *Ty,
+                             const std::vector<Constant*> &V);
+  
   ConstantInt *getTrue() {
     if (TheTrueVal)
       return TheTrueVal;
@@ -152,6 +159,12 @@
   void erase(MDString *M);
   void erase(MDNode *M);
   void erase(ConstantAggregateZero *Z);
+  void erase(ConstantArray *C);
+  
+  // RAUW helpers
+  
+  Constant *replaceUsesOfWithOnConstant(ConstantArray *CA, Value *From,
+                                             Value *To, Use *U);
 };
 
 }