src/mcs51/gen.c (genRet): fixed RFE 1652561: added code for bit to bit moves in retur...
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 9 Feb 2007 22:43:53 +0000 (22:43 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 9 Feb 2007 22:43:53 +0000 (22:43 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4626 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/mcs51/gen.c

index b4ef0b15c270215a5358cd736c7418e38694d15d..0183b6354e6426edbe5377a12808d39c555162f3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-02-09 Bernhard Held <bernhard AT bernhardheld.de>
+
+       * src/mcs51/gen.c (genRet): fixed RFE 1652561: added code for bit to
+       bit moves in return statement
+
 2007-02-09 Borut Razem <borut.razem AT siol.net>
 
        * src/SDCC.y: fixed bug #1159134: invalid duplicate declarations with
@@ -22,8 +27,8 @@
        * device/lib/printf_large.c (_print_format): fixed compare/assign bug, how
          can this have lived here for so many years?
        * src/SDCCicode.c (ast2iCode): return left instead of right for assignment,
-         fixes bug 1273984, see also patch 1645121, thanks Günther Jehle
-       * support/regression/tests/bug1273984.c: new, added, thanks Günther Jehle
+         fixes bug 1273984, see also patch 1645121, thanks Gnther Jehle
+       * support/regression/tests/bug1273984.c: new, added, thanks Gnther Jehle
 
 2007-02-06 Bernhard Held <bernhard AT bernhardheld.de>
 
index 8ad42509cd77e7129640bef62df50e0e93b1a52c..cfb3e44b8742fc74bd3bca1a84cf3b9c7f56b00e 100644 (file)
@@ -3983,38 +3983,42 @@ genRet (iCode * ic)
 
   if (IS_BIT(_G.currentFunc->etype))
     {
-      movc (aopGet (IC_LEFT (ic), 0, FALSE, FALSE));
-      size = 0;
+      if (AOP_TYPE (IC_LEFT (ic)) == AOP_CRY)
+        emitcode ("mov", "c,%s", AOP (IC_LEFT (ic))->aopu.aop_dir);
+      else
+        movc (aopGet (IC_LEFT (ic), 0, FALSE, FALSE));
     }
-
-  while (size--)
+  else
     {
-      char *l;
-      if (AOP_TYPE (IC_LEFT (ic)) == AOP_DPTR)
+      while (size--)
         {
-          /* #NOCHANGE */
-          l = aopGet (IC_LEFT (ic), offset++,
-                      FALSE, TRUE);
-          emitcode ("push", "%s", l);
-          pushed++;
+          char *l;
+          if (AOP_TYPE (IC_LEFT (ic)) == AOP_DPTR)
+            {
+              /* #NOCHANGE */
+              l = aopGet (IC_LEFT (ic), offset++,
+                          FALSE, TRUE);
+              emitcode ("push", "%s", l);
+              pushed++;
+            }
+          else
+            {
+              l = aopGet (IC_LEFT (ic), offset,
+                          FALSE, FALSE);
+              if (strcmp (fReturn[offset], l))
+                emitcode ("mov", "%s,%s", fReturn[offset++], l);
+            }
         }
-      else
+
+      while (pushed)
         {
-          l = aopGet (IC_LEFT (ic), offset,
-                      FALSE, FALSE);
-          if (strcmp (fReturn[offset], l))
-            emitcode ("mov", "%s,%s", fReturn[offset++], l);
+          pushed--;
+          if (strcmp (fReturn[pushed], "a"))
+            emitcode ("pop", fReturn[pushed]);
+          else
+            emitcode ("pop", "acc");
         }
     }
-
-  while (pushed)
-    {
-      pushed--;
-      if (strcmp (fReturn[pushed], "a"))
-        emitcode ("pop", fReturn[pushed]);
-      else
-        emitcode ("pop", "acc");
-    }
   freeAsmop (IC_LEFT (ic), NULL, ic, TRUE);
 
 jumpret: