diff gen/tocall.cpp @ 1042:45af482e3832

Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 04 Mar 2009 17:24:25 +0100
parents 3ead5c40b7d6
children 6bb04dbee21f
line wrap: on
line diff
--- a/gen/tocall.cpp	Wed Mar 04 16:13:16 2009 +0100
+++ b/gen/tocall.cpp	Wed Mar 04 17:24:25 2009 +0100
@@ -380,13 +380,12 @@
             Argument* fnarg = Argument::getNth(tf->parameters, i);
             assert(fnarg);
             DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]);
-            LLValue* arg = argval->getRVal();
+
+            // give the ABI a say
+            LLValue* arg = tf->fty->putParam(argval->getType(), i, argval);
 
             int j = tf->fty->reverseParams ? beg + n - i - 1 : beg + i;
 
-            // give the ABI a say
-            arg = tf->fty->putParam(argval->getType(), i, arg);
-
             // parameter type mismatch, this is hard to get rid of
             if (arg->getType() != callableTy->getParamType(j))
             {
@@ -483,7 +482,8 @@
     else if (!retinptr)
     {
         // do abi specific return value fixups
-        retllval = tf->fty->getRet(tf->next, retllval);
+        DImValue dretval(tf->next, retllval);
+        retllval = tf->fty->getRet(tf->next, &dretval);
     }
 
     // repaint the type if necessary