[llvm-commits] [llvm] r78125 - in /llvm/trunk/lib/VMCore: LLVMContextImpl.h Type.cpp
Owen Anderson
resistor at mac.com
Tue Aug 4 16:47:57 PDT 2009
Author: resistor
Date: Tue Aug 4 18:47:44 2009
New Revision: 78125
URL: http://llvm.org/viewvc/llvm-project?rev=78125&view=rev
Log:
Privatize the VectorType uniquing.
Modified:
llvm/trunk/lib/VMCore/LLVMContextImpl.h
llvm/trunk/lib/VMCore/Type.cpp
Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=78125&r1=78124&r2=78125&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original)
+++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Tue Aug 4 18:47:44 2009
@@ -129,6 +129,7 @@
ConstantInt *TheFalseVal;
TypeMap<ArrayValType, ArrayType> ArrayTypes;
+ TypeMap<VectorValType, VectorType> VectorTypes;
LLVMContextImpl() : TheTrueVal(0), TheFalseVal(0) { }
};
Modified: llvm/trunk/lib/VMCore/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=78125&r1=78124&r2=78125&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Type.cpp (original)
+++ llvm/trunk/lib/VMCore/Type.cpp Tue Aug 4 18:47:44 2009
@@ -818,19 +818,19 @@
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 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
More information about the llvm-commits
mailing list