summaryrefslogtreecommitdiff
path: root/lib/VMCore/Type.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-08-05 00:15:12 +0000
committerOwen Anderson <resistor@mac.com>2009-08-05 00:15:12 +0000
commit84e99f3c2543eb47262a0e79b04a3834bc50a468 (patch)
treea6ecf18f5d16554b19cec24385be366086494841 /lib/VMCore/Type.cpp
parente55fef36a93badf6c4925ea2455a1ca6b361357e (diff)
downloadllvm-84e99f3c2543eb47262a0e79b04a3834bc50a468.tar.gz
llvm-84e99f3c2543eb47262a0e79b04a3834bc50a468.tar.bz2
llvm-84e99f3c2543eb47262a0e79b04a3834bc50a468.tar.xz
Privatize the PointerType factory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78130 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Type.cpp')
-rw-r--r--lib/VMCore/Type.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 610036ef0d..22d95ed199 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -901,8 +901,6 @@ bool StructType::isValidElementType(const Type *ElemTy) {
// Pointer Type Factory...
//
-static ManagedStatic<TypeMap<PointerValType, PointerType> > PointerTypes;
-
PointerType *PointerType::get(const Type *ValueType, unsigned AddressSpace) {
assert(ValueType && "Can't get a pointer to <null> type!");
assert(ValueType != Type::VoidTy &&
@@ -912,12 +910,14 @@ PointerType *PointerType::get(const Type *ValueType, unsigned AddressSpace) {
PointerType *PT = 0;
+ LLVMContextImpl *pImpl = ValueType->getContext().pImpl;
+
sys::SmartScopedLock<true> L(*TypeMapLock);
- PT = PointerTypes->get(PVT);
+ PT = pImpl->PointerTypes.get(PVT);
if (!PT) {
// Value not found. Derive a new type!
- PointerTypes->add(PVT, PT = new PointerType(ValueType, AddressSpace));
+ pImpl->PointerTypes.add(PVT, PT = new PointerType(ValueType, AddressSpace));
}
#ifdef DEBUG_MERGE_TYPES
DOUT << "Derived new type: " << *PT << "\n";
@@ -1158,11 +1158,13 @@ void StructType::typeBecameConcrete(const DerivedType *AbsTy) {
//
void PointerType::refineAbstractType(const DerivedType *OldType,
const Type *NewType) {
- PointerTypes->RefineAbstractType(this, OldType, NewType);
+ LLVMContextImpl *pImpl = OldType->getContext().pImpl;
+ pImpl->PointerTypes.RefineAbstractType(this, OldType, NewType);
}
void PointerType::typeBecameConcrete(const DerivedType *AbsTy) {
- PointerTypes->TypeBecameConcrete(this, AbsTy);
+ LLVMContextImpl *pImpl = AbsTy->getContext().pImpl;
+ pImpl->PointerTypes.TypeBecameConcrete(this, AbsTy);
}
bool SequentialType::indexValid(const Value *V) const {