[llvm-commits] [llvm] r78221 - in /llvm/trunk/lib/VMCore: LLVMContextImpl.h Type.cpp
Owen Anderson
resistor at mac.com
Wed Aug 5 11:13:28 PDT 2009
Author: resistor
Date: Wed Aug 5 13:13:27 2009
New Revision: 78221
URL: http://llvm.org/viewvc/llvm-project?rev=78221&view=rev
Log:
Privatize the FunctionType table.
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=78221&r1=78220&r2=78221&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original)
+++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Wed Aug 5 13:13:27 2009
@@ -131,6 +131,7 @@
TypeMap<ArrayValType, ArrayType> ArrayTypes;
TypeMap<VectorValType, VectorType> VectorTypes;
TypeMap<PointerValType, PointerType> PointerTypes;
+ TypeMap<FunctionValType, FunctionType> FunctionTypes;
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=78221&r1=78220&r2=78221&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Type.cpp (original)
+++ llvm/trunk/lib/VMCore/Type.cpp Wed Aug 5 13:13:27 2009
@@ -748,9 +748,6 @@
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 @@
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 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);
}
More information about the llvm-commits
mailing list