The loop code will access the stackpointer directly

git-svn-id: svn://svn.cc65.org/cc65/trunk@3106 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2004-06-06 10:52:32 +00:00
parent 651c6e5cbf
commit eb388aa237
4 changed files with 14 additions and 14 deletions

View File

@@ -6,7 +6,7 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 1998-2003 Ullrich von Bassewitz */ /* (C) 1998-2004 Ullrich von Bassewitz */
/* R<>merstra<72>e 52 */ /* R<>merstra<72>e 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
@@ -39,7 +39,8 @@
/* cc65 */ /* cc65 */
#include "error.h" #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. */ /* Create and add a new loop descriptor. */
{ {
/* Allocate a new struct */ /* Allocate a new struct */
LoopDesc* L = xmalloc (sizeof (LoopDesc)); LoopDesc* L = xmalloc (sizeof (LoopDesc));
/* Fill in the data */ /* Fill in the data */
L->StackPtr = SP; L->StackPtr = StackPtr;
L->BreakLabel = BreakLabel; L->BreakLabel = BreakLabel;
L->ContinueLabel = ContinueLabel; L->ContinueLabel = ContinueLabel;

View 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<72>e 52 */ /* R<>merstra<72>e 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* 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. */ /* Create and add a new loop descriptor. */
LoopDesc* CurrentLoop (void); LoopDesc* CurrentLoop (void);

View File

@@ -202,7 +202,7 @@ static void DoStatement (void)
NextToken (); NextToken ();
/* Add the loop to the loop stack */ /* Add the loop to the loop stack */
AddLoop (StackPtr, BreakLabel, ContinueLabel); AddLoop (BreakLabel, ContinueLabel);
/* Define the loop label */ /* Define the loop label */
g_defcodelabel (LoopLabel); 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 /* Add the loop to the loop stack. In case of a while loop, the loop head
* label is used for continue statements. * label is used for continue statements.
*/ */
AddLoop (StackPtr, BreakLabel, LoopLabel); AddLoop (BreakLabel, LoopLabel);
/* Define the head label */ /* Define the head label */
g_defcodelabel (LoopLabel); 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 /* Add the loop to the loop stack. A continue jumps to the start of the
* the increment condition. * the increment condition.
*/ */
AddLoop (StackPtr, BreakLabel, IncLabel); AddLoop (BreakLabel, IncLabel);
/* Skip the opening paren */ /* Skip the opening paren */
ConsumeLParen (); ConsumeLParen ();
@@ -602,7 +602,7 @@ int Statement (int* PendingToken)
ExprLoad (CF_NONE, &Expr); ExprLoad (CF_NONE, &Expr);
} }
/* If the statement didn't generate code, and is not of type /* 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)) { if (GetCodePos () == Start && !IsTypeVoid (Expr.Type)) {
Warning ("Statement has no effect"); Warning ("Statement has no effect");

View File

@@ -50,7 +50,6 @@
#include "global.h" #include "global.h"
#include "loop.h" #include "loop.h"
#include "scanner.h" #include "scanner.h"
#include "stackptr.h"
#include "stmt.h" #include "stmt.h"
#include "swstmt.h" #include "swstmt.h"
@@ -126,7 +125,7 @@ void SwitchStatement (void)
ExitLabel = GetLocalLabel (); ExitLabel = GetLocalLabel ();
/* Create a loop so we may use break. */ /* Create a loop so we may use break. */
AddLoop (StackPtr, ExitLabel, 0); AddLoop (ExitLabel, 0);
/* Create the collection for the case node tree */ /* Create the collection for the case node tree */
Nodes = NewCollection (); Nodes = NewCollection ();