Implement support for intrinsics returning struct types

(such as llvm.*.with.overflow)
This commit is contained in:
Frits van Bommel
2009-02-26 22:47:06 +01:00
parent 693e796893
commit 4f51adc810
3 changed files with 77 additions and 14 deletions

View File

@@ -70,23 +70,33 @@ const llvm::FunctionType* DtoFunctionType(Type* type, const LLType* thistype, co
else
{
assert(rt);
if (gABI->returnInArg(rt))
if (f->linkage == LINKintrinsic)
{
rettype = getPtrToType(DtoType(rt));
actualRettype = LLType::VoidTy;
f->retInPtr = retinptr = true;
// Intrinsics don't care about ABI
Logger::cout() << "Intrinsic returning " << rt->toChars() << '\n';
actualRettype = rettype = DtoType(rt);
Logger::cout() << " (LLVM type: " << *rettype << ")\n";
}
else
{
rettype = DtoType(rt);
// do abi specific transformations
actualRettype = gABI->getRetType(f, rettype);
}
if (gABI->returnInArg(rt))
{
rettype = getPtrToType(DtoType(rt));
actualRettype = LLType::VoidTy;
f->retInPtr = retinptr = true;
}
else
{
rettype = DtoType(rt);
// do abi specific transformations
actualRettype = gABI->getRetType(f, rettype);
}
// FIXME: should probably be part of the abi
if (unsigned ea = DtoShouldExtend(rt))
{
f->retAttrs |= ea;
// FIXME: should probably be part of the abi
if (unsigned ea = DtoShouldExtend(rt))
{
f->retAttrs |= ea;
}
}
}