comparison gen/toir.c @ 27:92408a3a2bac trunk

[svn r31] * Fixed returning through hidden pointer was unable to report back the return value * Fixed removed some litter instructions sometimes produced by constructor calls
author lindquist
date Thu, 04 Oct 2007 11:39:53 +0200
parents 99737f94abfb
children 1c80c18f3c82
comparison
equal deleted inserted replaced
26:99737f94abfb 27:92408a3a2bac
974 974
975 Logger::cout() << "Calling: " << *funcval->getType() << '\n'; 975 Logger::cout() << "Calling: " << *funcval->getType() << '\n';
976 976
977 // call the function 977 // call the function
978 llvm::CallInst* call = new llvm::CallInst(funcval, llargs.begin(), llargs.end(), varname, p->scopebb()); 978 llvm::CallInst* call = new llvm::CallInst(funcval, llargs.begin(), llargs.end(), varname, p->scopebb());
979 e->val = call; 979 if (retinptr)
980 e->mem = llargs[0];
981 else
982 e->val = call;
980 983
981 // set calling convention 984 // set calling convention
982 if ((fn->funcdecl && (fn->funcdecl->llvmInternal != LLVMintrinsic)) || delegateCall) 985 if ((fn->funcdecl && (fn->funcdecl->llvmInternal != LLVMintrinsic)) || delegateCall)
983 call->setCallingConv(LLVM_DtoCallingConv(dlink)); 986 call->setCallingConv(LLVM_DtoCallingConv(dlink));
984 else if (fn->callconv != (unsigned)-1) 987 else if (fn->callconv != (unsigned)-1)
1810 for (size_t i=0; i<arguments->dim; ++i) 1813 for (size_t i=0; i<arguments->dim; ++i)
1811 { 1814 {
1812 Expression* ex = (Expression*)arguments->data[i]; 1815 Expression* ex = (Expression*)arguments->data[i];
1813 Logger::println("arg=%s", ex->toChars()); 1816 Logger::println("arg=%s", ex->toChars());
1814 elem* exe = ex->toElem(p); 1817 elem* exe = ex->toElem(p);
1815 assert(exe->getValue()); 1818 llvm::Value* v = exe->getValue();
1816 ctorargs.push_back(exe->getValue()); 1819 assert(v);
1820 ctorargs.push_back(v);
1817 delete exe; 1821 delete exe;
1818 } 1822 }
1819 assert(member); 1823 assert(member);
1820 assert(member->llvmValue); 1824 assert(member->llvmValue);
1821 new llvm::CallInst(member->llvmValue, ctorargs.begin(), ctorargs.end(), "", p->scopebb()); 1825 e->mem = new llvm::CallInst(member->llvmValue, ctorargs.begin(), ctorargs.end(), "tmp", p->scopebb());
1822 } 1826 }
1823 } 1827 }
1824 else if (newtype->ty == Tstruct) { 1828 else if (newtype->ty == Tstruct) {
1825 TypeStruct* ts = (TypeStruct*)newtype; 1829 TypeStruct* ts = (TypeStruct*)newtype;
1826 if (ts->isZeroInit()) { 1830 if (ts->isZeroInit()) {