diff 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
line wrap: on
line diff
--- a/gen/toir.c	Thu Oct 04 10:57:26 2007 +0200
+++ b/gen/toir.c	Thu Oct 04 11:39:53 2007 +0200
@@ -976,7 +976,10 @@
 
     // call the function
     llvm::CallInst* call = new llvm::CallInst(funcval, llargs.begin(), llargs.end(), varname, p->scopebb());
-    e->val = call;
+    if (retinptr)
+        e->mem = llargs[0];
+    else
+        e->val = call;
 
     // set calling convention
     if ((fn->funcdecl && (fn->funcdecl->llvmInternal != LLVMintrinsic)) || delegateCall)
@@ -1812,13 +1815,14 @@
                 Expression* ex = (Expression*)arguments->data[i];
                 Logger::println("arg=%s", ex->toChars());
                 elem* exe = ex->toElem(p);
-                assert(exe->getValue());
-                ctorargs.push_back(exe->getValue());
+                llvm::Value* v = exe->getValue();
+                assert(v);
+                ctorargs.push_back(v);
                 delete exe;
             }
             assert(member);
             assert(member->llvmValue);
-            new llvm::CallInst(member->llvmValue, ctorargs.begin(), ctorargs.end(), "", p->scopebb());
+            e->mem = new llvm::CallInst(member->llvmValue, ctorargs.begin(), ctorargs.end(), "tmp", p->scopebb());
         }
     }
     else if (newtype->ty == Tstruct) {