]> git.sur5r.net Git - cc65/commitdiff
Fixed another problem with OptStackOps: Load tracking will not work across
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 4 Sep 2009 19:54:29 +0000 (19:54 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 4 Sep 2009 19:54:29 +0000 (19:54 +0000)
branches - if we find a label, just forget all information we had before.

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

src/cc65/coptstop.c

index a7f6e80ebcb2eb5ce61df53efc1b38e98b6c0950..2f1bf5e6727c87ff19ee4235669ff69161f76d3a 100644 (file)
@@ -312,7 +312,7 @@ static void TrackLoads (LoadInfo* LI, CodeEntry* E, int I)
 
 
 /*****************************************************************************/
-/*                                         Helpers                                  */
+/*                                         Helpers                                  */
 /*****************************************************************************/
 
 
@@ -1779,6 +1779,12 @@ unsigned OptStackOps (CodeSeg* S)
                 /* While searching, track register load insns, so we can tell
                  * what is in a register once pushax is encountered.
                  */
+                if (CE_HasLabel (E)) {
+                    /* Currently we don't track across branches */
+                    InvalidateLoadRegInfo (&Data.Lhs.A);
+                    InvalidateLoadRegInfo (&Data.Lhs.X);
+                    InvalidateLoadRegInfo (&Data.Lhs.Y);
+                }
                 if (CE_IsCallTo (E, "pushax")) {
                     Data.PushIndex = I;
                     State = FoundPush;
@@ -1793,6 +1799,12 @@ unsigned OptStackOps (CodeSeg* S)
                  * follow and in the meantime, track zeropage usage and check
                  * for code that will disable us from translating the sequence.
                  */
+                if (CE_HasLabel (E)) {
+                    /* Currently we don't track across branches */
+                    InvalidateLoadRegInfo (&Data.Rhs.A);
+                    InvalidateLoadRegInfo (&Data.Rhs.X);
+                    InvalidateLoadRegInfo (&Data.Rhs.Y);
+                }
                 if (E->OPC == OP65_JSR) {
 
                     /* Subroutine call: Check if this is one of the functions,