Fix bug 706781
authorkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 11 Apr 2003 19:29:35 +0000 (19:29 +0000)
committerkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 11 Apr 2003 19:29:35 +0000 (19:29 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2508 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/ds390/gen.c
src/ds390/peeph.def

index cf42d9fa8df2ee7cecb582bc49265dbee2b10503..8d16daee4c894ea118efcef009f251ab2cf21fbe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-04-11 kevin Vigor <kevin@vigor.nu>
+
+       * ds390/gen.c ds390/peeph.def: fix bug 706781
+
 2003-04-11  Borut Razem <borut.razem@siol.net>
 
        * support/Util/dbuf.c, support/Util/dbuf.h: update to version 1.1.1 - re-added C++ stuff to make it still more portable
index d417b07fc9afe1de751f7ed6112b74f7b547de3f..d4a79b53236193c7f5fb1e170c4408a755f27514 100644 (file)
@@ -3812,11 +3812,21 @@ bool aopOp3(iCode * ic)
 //            AOP_IS_DPTRn(IC_LEFT(ic)) ? "true" : "false",
 //            AOP_IS_DPTRn(IC_RIGHT(ic)) ? "true" : "false",
 //            AOP_IS_DPTRn(IC_RESULT(ic)) ? "true" : "false");
-//      );      
-
+//      );
     
-    // Right uses DPTR unless left or result is an AOP_STR.
-    aopOp (IC_RIGHT(ic),ic,FALSE, AOP_IS_STR(IC_LEFT(ic)) || AOP_IS_STR(IC_RESULT(ic)));
+    // Right uses DPTR unless left or result is an AOP_STR; however,
+    // if right is an AOP_STR, it must use DPTR regardless.
+    if ((AOP_IS_STR(IC_LEFT(ic)) || AOP_IS_STR(IC_RESULT(ic)))
+     && !AOP_IS_STR(IC_RIGHT(ic)))
+    {
+       useDp2 = TRUE;
+    }
+    else
+    {
+       useDp2 = FALSE;
+    }
+       
+    aopOp (IC_RIGHT(ic),ic,FALSE, useDp2);
     
     // if the right used DPTR, left MUST use DPTR2.
     // if the right used DPTR2, left MUST use DPTR.
index abf84ab6eff57ee341ab51f307b633a0af2137e9..11f42204a07b3ecf03eab5aeffeed332bd9f62f8 100644 (file)
@@ -1575,6 +1575,13 @@ replace {
         mov   dptr,%1
 }
 
+replace {
+        push  acc
+        pop   acc
+} by {
+        ; Peephole 202b   removed redundant push pop
+}
+
 replace {
         mov  r%1,_spx
         lcall %2