diff options
author | Owen Anderson <resistor@mac.com> | 2009-08-05 18:13:27 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-08-05 18:13:27 +0000 |
commit | ab90b28adcd802c4d4eaa29d49549a371b93b355 (patch) | |
tree | b86aa6ff4801e88cf30fd677eea652bc71ddba5a /lib/VMCore/Type.cpp | |
parent | 7f285c8024308107ada6fef05d38a5b7969a6e64 (diff) | |
download | external_llvm-ab90b28adcd802c4d4eaa29d49549a371b93b355.zip external_llvm-ab90b28adcd802c4d4eaa29d49549a371b93b355.tar.gz external_llvm-ab90b28adcd802c4d4eaa29d49549a371b93b355.tar.bz2 |
Privatize the FunctionType table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78221 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Type.cpp')
-rw-r--r-- | lib/VMCore/Type.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 22d95ed..61549f8 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -748,9 +748,6 @@ APInt IntegerType::getMask() const { return APInt::getAllOnesValue(getBitWidth()); } -// Define the actual map itself now... -static ManagedStatic<TypeMap<FunctionValType, FunctionType> > FunctionTypes; - FunctionValType FunctionValType::get(const FunctionType *FT) { // Build up a FunctionValType std::vector<const Type *> ParamTypes; @@ -768,14 +765,16 @@ FunctionType *FunctionType::get(const Type *ReturnType, FunctionValType VT(ReturnType, Params, isVarArg); FunctionType *FT = 0; + LLVMContextImpl *pImpl = ReturnType->getContext().pImpl; + sys::SmartScopedLock<true> L(*TypeMapLock); - FT = FunctionTypes->get(VT); + FT = pImpl->FunctionTypes.get(VT); if (!FT) { FT = (FunctionType*) operator new(sizeof(FunctionType) + sizeof(PATypeHandle)*(Params.size()+1)); new (FT) FunctionType(ReturnType, Params, isVarArg); - FunctionTypes->add(VT, FT); + pImpl->FunctionTypes.add(VT, FT); } #ifdef DEBUG_MERGE_TYPES @@ -1101,11 +1100,13 @@ void DerivedType::notifyUsesThatTypeBecameConcrete() { // void FunctionType::refineAbstractType(const DerivedType *OldType, const Type *NewType) { - FunctionTypes->RefineAbstractType(this, OldType, NewType); + LLVMContextImpl *pImpl = OldType->getContext().pImpl; + pImpl->FunctionTypes.RefineAbstractType(this, OldType, NewType); } void FunctionType::typeBecameConcrete(const DerivedType *AbsTy) { - FunctionTypes->TypeBecameConcrete(this, AbsTy); + LLVMContextImpl *pImpl = AbsTy->getContext().pImpl; + pImpl->FunctionTypes.TypeBecameConcrete(this, AbsTy); } |