]> git.sur5r.net Git - cc65/commitdiff
Fixed problems with OptPrecalc. It removed insns because it results were known
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 4 Sep 2009 15:44:48 +0000 (15:44 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 4 Sep 2009 15:44:48 +0000 (15:44 +0000)
- but the insns generate a carry which may be needed later.

git-svn-id: svn://svn.cc65.org/cc65/trunk@4115 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/coptind.c

index 63351677a44d24add188ecf4ade44c475dfad685..076e8fb73958e2b17d1de895a450d4c660d70c60 100644 (file)
@@ -1059,7 +1059,7 @@ unsigned OptDupLoads (CodeSeg* S)
                           In->RegX == In->RegA       &&
                           E->AM != AM65_ABSY         &&
                           E->AM != AM65_ZPY) {
-                   /* Use the A register instead */
+                   /* Use the A register instead */
                            CE_ReplaceOPC (E, OP65_STA);
                }
                break;
@@ -1112,7 +1112,7 @@ unsigned OptDupLoads (CodeSeg* S)
                            !CE_UseLoadFlags (N)) {
                    /* Value is identical and not followed by a branch */
                    Delete = 1;
-               }
+               }
                break;
 
            case OP65_TAY:
@@ -1880,9 +1880,7 @@ unsigned OptPrecalc (CodeSeg* S)
                 }
                 break;
 
-            case OP65_ASL:
             case OP65_EOR:
-            case OP65_LSR:
                 if (RegValIsKnown (Out->RegA)) {
                     /* Accu op zp with known contents */
                     Arg = MakeHexArg (Out->RegA);
@@ -1901,9 +1899,6 @@ unsigned OptPrecalc (CodeSeg* S)
                     /* 0-0 or 0+0 -> remove */
                     CS_DelEntry (S, I);
                     ++Changes;
-                } else if (RegValIsKnown (Out->RegA)) {
-                    /* Accu op zp with known contents */
-                    Arg = MakeHexArg (Out->RegA);
                 }
                 break;