summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-08-05 18:13:27 +0000
committerOwen Anderson <resistor@mac.com>2009-08-05 18:13:27 +0000
commit4b5c761af2221e17c2a9d9ae16a02f8d3ecb7b49 (patch)
tree5a5147e95a85489bb7bfa522e1c9733b2e33a3e7 /llvm/lib
parent13937d8236d327d7ad1b8403a56cdbe433ef71bf (diff)
downloadbcm5719-llvm-4b5c761af2221e17c2a9d9ae16a02f8d3ecb7b49.tar.gz
bcm5719-llvm-4b5c761af2221e17c2a9d9ae16a02f8d3ecb7b49.zip
Privatize the FunctionType table.
llvm-svn: 78221
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/LLVMContextImpl.h1
-rw-r--r--llvm/lib/VMCore/Type.cpp15
2 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/VMCore/LLVMContextImpl.h b/llvm/lib/VMCore/LLVMContextImpl.h
index 993b155d409..3ce1234adfa 100644
--- a/llvm/lib/VMCore/LLVMContextImpl.h
+++ b/llvm/lib/VMCore/LLVMContextImpl.h
@@ -131,6 +131,7 @@ struct LLVMContextImpl {
TypeMap<ArrayValType, ArrayType> ArrayTypes;
TypeMap<VectorValType, VectorType> VectorTypes;
TypeMap<PointerValType, PointerType> PointerTypes;
+ TypeMap<FunctionValType, FunctionType> FunctionTypes;
LLVMContextImpl() : TheTrueVal(0), TheFalseVal(0) { }
};
diff --git a/llvm/lib/VMCore/Type.cpp b/llvm/lib/VMCore/Type.cpp
index 22d95ed1996..61549f8850c 100644
--- a/llvm/lib/VMCore/Type.cpp
+++ b/llvm/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);
}
OpenPOWER on IntegriCloud