]> git.sur5r.net Git - cc65/commitdiff
The loop code will access the stackpointer directly
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 6 Jun 2004 10:52:32 +0000 (10:52 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 6 Jun 2004 10:52:32 +0000 (10:52 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3106 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/loop.c
src/cc65/loop.h
src/cc65/stmt.c
src/cc65/swstmt.c

index d41b3f4a67a79b3146b9840fca72c60b5e519511..f2925e0cb0614debac98da719cb374b166f6e278 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2003 Ullrich von Bassewitz                                       */
+/* (C) 1998-2004 Ullrich von Bassewitz                                       */
 /*               Römerstraße 52                                              */
 /*               D-70794 Filderstadt                                         */
 /* EMail:        uz@cc65.org                                                 */
@@ -39,7 +39,8 @@
 
 /* cc65 */
 #include "error.h"
-#include "loop.h"
+#include "loop.h" 
+#include "stackptr.h"
 
 
 
@@ -60,14 +61,14 @@ static LoopDesc* LoopStack = 0;
 
 
 
-LoopDesc* AddLoop (unsigned SP, unsigned BreakLabel, unsigned ContinueLabel)
+LoopDesc* AddLoop (unsigned BreakLabel, unsigned ContinueLabel)
 /* Create and add a new loop descriptor. */
 {
     /* Allocate a new struct */
     LoopDesc* L = xmalloc (sizeof (LoopDesc));
 
     /* Fill in the data */
-    L->StackPtr                = SP;
+    L->StackPtr                = StackPtr;
     L->BreakLabel       = BreakLabel;
     L->ContinueLabel           = ContinueLabel;
 
index 81889cf5b07f7e1eb04d5da6787af7b281212d1c..c8660fb69997f62ce1ca5e72ef0413c87a440f14 100644 (file)
@@ -1,12 +1,12 @@
 /*****************************************************************************/
 /*                                                                           */
-/*                                 loop.h                                   */
+/*                                 loop.h                                   */
 /*                                                                           */
-/*                             Loop management                              */
+/*                             Loop management                              */
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2003 Ullrich von Bassewitz                                       */
+/* (C) 1998-2004 Ullrich von Bassewitz                                       */
 /*               Römerstraße 52                                              */
 /*               D-70794 Filderstadt                                         */
 /* EMail:        uz@cc65.org                                                 */
@@ -60,7 +60,7 @@ struct LoopDesc {
 
 
 
-LoopDesc* AddLoop (unsigned SP, unsigned BreakLabel, unsigned ContinueLabel);
+LoopDesc* AddLoop (unsigned BreakLabel, unsigned ContinueLabel);
 /* Create and add a new loop descriptor. */
 
 LoopDesc* CurrentLoop (void);
index 44a98072d86c5ee1143323a168e6cec2d0283545..f82feec394f6c55efb6ddc55229b74cb957eb87f 100644 (file)
@@ -202,7 +202,7 @@ static void DoStatement (void)
     NextToken ();
 
     /* Add the loop to the loop stack */
-    AddLoop (StackPtr, BreakLabel, ContinueLabel);
+    AddLoop (BreakLabel, ContinueLabel);
 
     /* Define the loop label */
     g_defcodelabel (LoopLabel);
@@ -242,7 +242,7 @@ static void WhileStatement (void)
     /* Add the loop to the loop stack. In case of a while loop, the loop head
      * label is used for continue statements.
      */
-    AddLoop (StackPtr, BreakLabel, LoopLabel);
+    AddLoop (BreakLabel, LoopLabel);
 
     /* Define the head label */
     g_defcodelabel (LoopLabel);
@@ -393,7 +393,7 @@ static void ForStatement (void)
     /* Add the loop to the loop stack. A continue jumps to the start of the
      * the increment condition.
      */
-    AddLoop (StackPtr, BreakLabel, IncLabel);
+    AddLoop (BreakLabel, IncLabel);
 
     /* Skip the opening paren */
     ConsumeLParen ();
@@ -602,7 +602,7 @@ int Statement (int* PendingToken)
                     ExprLoad (CF_NONE, &Expr);
                 }
                 /* If the statement didn't generate code, and is not of type
-                 * void, emit a warning 
+                 * void, emit a warning
                  */
                 if (GetCodePos () == Start && !IsTypeVoid (Expr.Type)) {
                     Warning ("Statement has no effect");
index dc508d7f44b49d72b881fdd562ad6447031d9959..25c82c430432bcb6be8a4e71eb36a99771faa400 100644 (file)
@@ -50,7 +50,6 @@
 #include "global.h"
 #include "loop.h"
 #include "scanner.h"
-#include "stackptr.h"
 #include "stmt.h"
 #include "swstmt.h"
 
@@ -126,7 +125,7 @@ void SwitchStatement (void)
     ExitLabel = GetLocalLabel ();
 
     /* Create a loop so we may use break. */
-    AddLoop (StackPtr, ExitLabel, 0);
+    AddLoop (ExitLabel, 0);
 
     /* Create the collection for the case node tree */
     Nodes = NewCollection ();