summaryrefslogtreecommitdiff
path: root/lib/VMCore/Type.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2011-07-13 10:39:49 +0000
committerJay Foad <jay.foad@gmail.com>2011-07-13 10:39:49 +0000
commit75f67e0d8daa6201675d7bdec86e7e4f995f969f (patch)
treed67b6c9494a7ac9543ba7499164eb00f8ed4213a /lib/VMCore/Type.cpp
parentfc6d3a49867cd38954dc40936a88f1907252c6d2 (diff)
downloadllvm-75f67e0d8daa6201675d7bdec86e7e4f995f969f.tar.gz
llvm-75f67e0d8daa6201675d7bdec86e7e4f995f969f.tar.bz2
llvm-75f67e0d8daa6201675d7bdec86e7e4f995f969f.tar.xz
Really cache function types and anonymous struct types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135042 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Type.cpp')
-rw-r--r--lib/VMCore/Type.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index dc5053acc2..67fad98324 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -343,6 +343,8 @@ FunctionType *FunctionType::get(const Type *ReturnType,
FT = (FunctionType*) operator new(sizeof(FunctionType) +
sizeof(Type*)*(Params.size()+1));
new (FT) FunctionType(ReturnType, Params, isVarArg);
+
+ ReturnType->getContext().pImpl->FunctionTypes[Key] = FT;
}
return FT;
@@ -393,6 +395,9 @@ StructType *StructType::get(LLVMContext &Context, ArrayRef<Type*> ETypes,
ST = new StructType(Context);
ST->setSubclassData(SCDB_IsAnonymous); // Anonymous struct.
ST->setBody(ETypes, isPacked);
+
+ Context.pImpl->AnonStructTypes[Key] = ST;
+
return ST;
}