mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-05 17:43:35 +03:00
Cache result of DtoFunctionType.
This commit is contained in:
parent
62137ca489
commit
5f520fccf9
2 changed files with 16 additions and 5 deletions
|
@ -50,6 +50,9 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype,
|
|||
assert(type->ty == Tfunction);
|
||||
TypeFunction* f = static_cast<TypeFunction*>(type);
|
||||
|
||||
// Return cached type if available
|
||||
if (irFty.funcType) return irFty.funcType;
|
||||
|
||||
TargetABI* abi = (f->linkage == LINKintrinsic ? TargetABI::getIntrinsic() : gABI);
|
||||
// Tell the ABI we're resolving a new function type
|
||||
abi->newFunctionType(f);
|
||||
|
@ -283,11 +286,11 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype,
|
|||
std::reverse(argtypes.begin() + beg, argtypes.end());
|
||||
}
|
||||
|
||||
LLFunctionType* functype = LLFunctionType::get(irFty.ret->ltype, argtypes, irFty.c_vararg);
|
||||
irFty.funcType = LLFunctionType::get(irFty.ret->ltype, argtypes, irFty.c_vararg);
|
||||
|
||||
Logger::cout() << "Final function type: " << *functype << "\n";
|
||||
Logger::cout() << "Final function type: " << *irFty.funcType << "\n";
|
||||
|
||||
return functype;
|
||||
return irFty.funcType;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue