aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-08-04 23:47:44 +0000
committerOwen Anderson <resistor@mac.com>2009-08-04 23:47:44 +0000
commit9eb5c93d34b7de9bd4387481c5048d3b13085712 (patch)
treea8cbd508c205e89323db342c751d025b1a566b44 /lib/VMCore
parent020e9ab052c42c308223eb85f9eff739874ee4a2 (diff)
downloadexternal_llvm-9eb5c93d34b7de9bd4387481c5048d3b13085712.zip
external_llvm-9eb5c93d34b7de9bd4387481c5048d3b13085712.tar.gz
external_llvm-9eb5c93d34b7de9bd4387481c5048d3b13085712.tar.bz2
Privatize the VectorType uniquing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78125 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/LLVMContextImpl.h1
-rw-r--r--lib/VMCore/Type.cpp14
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/VMCore/LLVMContextImpl.h b/lib/VMCore/LLVMContextImpl.h
index 5e027cb..a92b571 100644
--- a/lib/VMCore/LLVMContextImpl.h
+++ b/lib/VMCore/LLVMContextImpl.h
@@ -129,6 +129,7 @@ struct LLVMContextImpl {
ConstantInt *TheFalseVal;
TypeMap<ArrayValType, ArrayType> ArrayTypes;
+ TypeMap<VectorValType, VectorType> VectorTypes;
LLVMContextImpl() : TheTrueVal(0), TheFalseVal(0) { }
};
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 3c1a67f..610036e 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -818,19 +818,19 @@ bool ArrayType::isValidElementType(const Type *ElemTy) {
return true;
}
-static ManagedStatic<TypeMap<VectorValType, VectorType> > VectorTypes;
-
VectorType *VectorType::get(const Type *ElementType, unsigned NumElements) {
assert(ElementType && "Can't get vector of <null> types!");
VectorValType PVT(ElementType, NumElements);
VectorType *PT = 0;
+ LLVMContextImpl *pImpl = ElementType->getContext().pImpl;
+
sys::SmartScopedLock<true> L(*TypeMapLock);
- PT = VectorTypes->get(PVT);
+ PT = pImpl->VectorTypes.get(PVT);
if (!PT) {
- VectorTypes->add(PVT, PT = new VectorType(ElementType, NumElements));
+ pImpl->VectorTypes.add(PVT, PT = new VectorType(ElementType, NumElements));
}
#ifdef DEBUG_MERGE_TYPES
DOUT << "Derived new type: " << *PT << "\n";
@@ -1130,11 +1130,13 @@ void ArrayType::typeBecameConcrete(const DerivedType *AbsTy) {
//
void VectorType::refineAbstractType(const DerivedType *OldType,
const Type *NewType) {
- VectorTypes->RefineAbstractType(this, OldType, NewType);
+ LLVMContextImpl *pImpl = OldType->getContext().pImpl;
+ pImpl->VectorTypes.RefineAbstractType(this, OldType, NewType);
}
void VectorType::typeBecameConcrete(const DerivedType *AbsTy) {
- VectorTypes->TypeBecameConcrete(this, AbsTy);
+ LLVMContextImpl *pImpl = AbsTy->getContext().pImpl;
+ pImpl->VectorTypes.TypeBecameConcrete(this, AbsTy);
}
// refineAbstractType - Called when a contained type is found to be more