comparison 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
comparison
equal deleted inserted replaced
1000:d6895f24dc8f 1001:7a0238db1962
462 CallOrInvoke* call = gIR->CreateCallOrInvoke(callable, args.begin(), args.end(), varname); 462 CallOrInvoke* call = gIR->CreateCallOrInvoke(callable, args.begin(), args.end(), varname);
463 463
464 // get return value 464 // get return value
465 LLValue* retllval = (retinptr) ? args[0] : call->get(); 465 LLValue* retllval = (retinptr) ? args[0] : call->get();
466 466
467 // do abi specific return value fixups 467 if (tf->linkage == LINKintrinsic)
468 retllval = gABI->getRet(tf, retllval); 468 {
469 // Ignore ABI for intrinsics
470 Type* rettype = tf->next;
471 if (rettype->ty == Tstruct) {
472 // LDC assumes structs are in memory, so put it there.
473 LLValue* mem = DtoAlloca(retllval->getType());
474 DtoStore(retllval, mem);
475 retllval = mem;
476 }
477 }
478 else
479 {
480 // do abi specific return value fixups
481 retllval = gABI->getRet(tf, retllval);
482 }
469 483
470 // repaint the type if necessary 484 // repaint the type if necessary
471 if (resulttype) 485 if (resulttype)
472 { 486 {
473 Type* rbase = resulttype->toBasetype(); 487 Type* rbase = resulttype->toBasetype();