Really cache function types and anonymous struct types.

llvm-svn: 135042
This commit is contained in:
Jay Foad 2011-07-13 10:39:49 +00:00
parent 57aa636794
commit e732a7d62a
1 changed files with 5 additions and 0 deletions

View File

@ -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;
}