Mercurial > projects > ldc
comparison gen/asmstmt.cpp @ 954:e048e36bc155
Added support for using a temporary to implement emulated ABI return from inline asm, could be easier to use, but I think this will do. It's so extremely target dependent in any case that doing a completely generic approach seems hard.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Sat, 14 Feb 2009 15:25:48 +0100 |
parents | 03d7c4aac654 |
children | 7e669954db7d |
comparison
equal
deleted
inserted
replaced
953:5fa3e0ea06e9 | 954:e048e36bc155 |
---|---|
627 { | 627 { |
628 in_c += a->in_c; | 628 in_c += a->in_c; |
629 } | 629 } |
630 remap_inargs(a->code, inn+a->out.size(), asmIdx); | 630 remap_inargs(a->code, inn+a->out.size(), asmIdx); |
631 if (!code.empty()) | 631 if (!code.empty()) |
632 code += " ; "; | 632 code += "\n\t"; |
633 code += a->code; | 633 code += a->code; |
634 } | 634 } |
635 asmblock->s.clear(); | 635 asmblock->s.clear(); |
636 | 636 |
637 // append inputs | 637 // append inputs |
669 | 669 |
670 std::vector<LLValue*> args; | 670 std::vector<LLValue*> args; |
671 args.insert(args.end(), outargs.begin(), outargs.end()); | 671 args.insert(args.end(), outargs.begin(), outargs.end()); |
672 args.insert(args.end(), inargs.begin(), inargs.end()); | 672 args.insert(args.end(), inargs.begin(), inargs.end()); |
673 llvm::CallInst* call = p->ir->CreateCall(ia, args.begin(), args.end(), ""); | 673 llvm::CallInst* call = p->ir->CreateCall(ia, args.begin(), args.end(), ""); |
674 | |
675 // capture abi return value | |
674 if (useabiret) | 676 if (useabiret) |
675 { | 677 { |
678 if (p->asmBlock->retemu) | |
679 p->asmBlock->asmBlock->abiret = DtoLoad(p->asmBlock->asmBlock->abiret); | |
680 else | |
676 p->asmBlock->asmBlock->abiret = call; | 681 p->asmBlock->asmBlock->abiret = call; |
677 } | 682 } |
678 | 683 |
679 p->asmBlock = NULL; | 684 p->asmBlock = NULL; |
680 Logger::println("END ASM"); | 685 Logger::println("END ASM"); |