Mercurial > projects > ldc
diff gen/tocall.cpp @ 1001:7a0238db1962
Implement support for intrinsics returning struct types
(such as llvm.*.with.overflow)
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Thu, 26 Feb 2009 22:47:06 +0100 |
parents | 2667e3a145be |
children | 8c73ff5f69e0 |
line wrap: on
line diff
--- a/gen/tocall.cpp Thu Feb 26 18:43:25 2009 +0100 +++ b/gen/tocall.cpp Thu Feb 26 22:47:06 2009 +0100 @@ -464,8 +464,22 @@ // 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)