* src/z80/gen.c (gencjneshort): Fixed
authormichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 12 Oct 2001 01:18:11 +0000 (01:18 +0000)
committermichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 12 Oct 2001 01:18:11 +0000 (01:18 +0000)
* src/z80/ralloc.c (packRegsForHLUse): Added pack into HL for cast then ipush.

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1389 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/z80/gen.c
src/z80/peeph-z80.def
src/z80/peeph.def
src/z80/ralloc.c

index 57841260de581df349f101bed4170a3be8fc3fa8..7fef267823c434a790e215b8ce0cb6a129bc3ebc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-10-11  Michael Hope  <michaelh@juju.net.nz>
+
+       * src/z80/gen.c (gencjneshort): Fixed
+
+       * src/z80/ralloc.c (packRegsForHLUse): Added pack into HL for cast then ipush.
+
 2001-10-09  Michael Hope  <michaelh@juju.net.nz>
 
        * support/regression/tests/bug-469671.c: Added.
index 642b3a3a0529fdf084d85b42b5e3904b12d50d04..6bffec3cca9439c1da0ba5f1bc9f4dd5b056551b 100644 (file)
 enum 
 {
   /* Set to enable debugging trace statements in the output assembly code. */
-  DISABLE_DEBUG = 0,
+  DISABLE_DEBUG = 0
 };
 
 static char *_z80_return[] =
@@ -3733,11 +3733,9 @@ gencjneshort (operand * left, operand * right, symbol * lbl)
          emit2 ("ld a,%s", aopGet (AOP (left), offset, FALSE));
          if (size > 1)
            {
-             size--;
-             offset++;
-             while (size--)
+             while (--size)
                {
-                 emit2 ("or a,%s", aopGet (AOP (left), offset, FALSE));
+                 emit2 ("or a,%s", aopGet (AOP (left), ++offset, FALSE));
                }
            }
          else
index 90336ddebac53678c64eb8e2e62ddb88fe80d46b..76fe8cddcaaa51acb48d9214604d291e34bd122b 100644 (file)
@@ -3,7 +3,23 @@ replace restart {
        bit     %3,a
        jp      %4,%5
 } by {
-        ; Rule 100: Removed redundent load
        bit     %3,%1(%2)
        jp      %4,%5
 }
+replace {
+       ld      %1,%2)
+       ld      a,%2)
+} by {
+        ld      %1,%2)
+        ld      a,%1
+}
+replace {
+       ld      %1),a
+       xor     a,a
+       or      a,%1)
+       jp      z,%2
+} by {
+        ld      %1),a
+        or      a,a
+       jp      z,%2
+}
index a743e5576ecd8a6bc90134d40554583f673c272b..6b144b3335974cc161c48e045ec79b8a987a258c 100644 (file)
@@ -6,7 +6,7 @@ replace restart {
 replace restart {
        ld %1,%1
 } by {
-       ; Rule 1: Removed redundent load
+        ; Removed redundent load
 }
 replace restart {
        xor a,a
@@ -22,7 +22,6 @@ replace restart {
        cp a,#0x00
        jp nz,%1
 } by {
-        ; Rule 3: Changed cp #0 to or
        or      a,a
        jp      nz,%1
 }
@@ -33,7 +32,6 @@ replace restart {
        jp      %3
 %2:
 } by {
-       ; Rule 4: Changed jp order
        jp      z,%2
 %1:
        jp      %3
@@ -44,7 +42,6 @@ replace restart {
        jp      %2
 %1:
 } by {
-       ; Rule 5: Changed jump logic
        jp      z,%2
 %1:
 }
@@ -53,7 +50,6 @@ replace restart {
        jp      %2
 %1:
 } by {
-       ; Rule 6: Changed jump logic
        jp      nz,%2
 %1:
 }
@@ -61,14 +57,12 @@ replace restart {
        or      a,%1
        or      a,a
 } by {
-       ; Rule 7: Removed redundent or
        or      a,%1
 }
 replace restart {
        or      a,%1)
         or      a,a
 } by {
-       ; Rule 8: Removed redundent or for (ix)
        or      a,%1)
 }
 replace restart {
index ac7fe0e7ecb8f5af7af98b7a5f373154cf97ea7f..fbd12bec46e631359a8ddcac65a735eb0a81bd0d 100644 (file)
@@ -2035,6 +2035,8 @@ packRegsForHLUse (iCode * ic)
   if (ic->next != uic)
     return;
 
+  if (ic->op == CAST && uic->op == IPUSH)
+    goto hluse;
   if (ic->op == ADDRESS_OF && uic->op == IPUSH)
     goto hluse;
   if (ic->op == CALL && ic->parmBytes == 0 && (uic->op == '-' || uic->op == '+'))