mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-04-30 07:21:30 +02:00
Implement support for intrinsics returning struct types
(such as llvm.*.with.overflow)
This commit is contained in:
@@ -464,8 +464,22 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
||||
// get return value
|
||||
LLValue* retllval = (retinptr) ? args[0] : call->get();
|
||||
|
||||
// do abi specific return value fixups
|
||||
retllval = gABI->getRet(tf, retllval);
|
||||
if (tf->linkage == LINKintrinsic)
|
||||
{
|
||||
// Ignore ABI for intrinsics
|
||||
Type* rettype = tf->next;
|
||||
if (rettype->ty == Tstruct) {
|
||||
// LDC assumes structs are in memory, so put it there.
|
||||
LLValue* mem = DtoAlloca(retllval->getType());
|
||||
DtoStore(retllval, mem);
|
||||
retllval = mem;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// do abi specific return value fixups
|
||||
retllval = gABI->getRet(tf, retllval);
|
||||
}
|
||||
|
||||
// repaint the type if necessary
|
||||
if (resulttype)
|
||||
|
||||
Reference in New Issue
Block a user