From ca98b218e87b267e012bd121aa7742cdf87051bf Mon Sep 17 00:00:00 2001 From: Alex Volkov Date: Wed, 11 Mar 2026 19:17:50 -0400 Subject: [PATCH] Remove the unused (for now) predicate functions in coptstop.c to keep the compiler happy. --- src/cc65/coptstop.c | 147 -------------------------------------------- 1 file changed, 147 deletions(-) diff --git a/src/cc65/coptstop.c b/src/cc65/coptstop.c index 53cd2681a..0db8e6a16 100644 --- a/src/cc65/coptstop.c +++ b/src/cc65/coptstop.c @@ -271,51 +271,6 @@ static void ChooseTempZPLoc (StackOpData* D) -static int CanUseAny (const StackOpData* D) -/* Precondition: any operand will do when temp ZP location is available -** as fallback. -*/ -{ - return HaveUnusedTempZPLoc (D); -} - - - -static int CanUseDirectLhsOrTempZP (const StackOpData* D) -/* Precondition: Either Lhs is direct-loaded, or temp ZP location -** must be available. Used by subopts falling back on temp ZP with -** AddStoreLhsX(), AddStoreLhsA(), ReplacePushByStore(). -*/ -{ - return LhsIsDirectLoad (D) || HaveUnusedTempZPLoc (D); -} - - - -static int CanUseNonStackLhsOrTempZP (const StackOpData* D) -/* Precondition: Either Lhs is direct-loaded and not stack-relative, -** or temp ZP location must be available. Used by subopts falling -** back on temp ZP after testing !LI_RELOAD_Y. -*/ -{ - return LhsIsDirectNonStackLoad (D) || HaveUnusedTempZPLoc (D); -} - - - -static int CanUseNonStackLhsOrAny (const StackOpData* D) -/* Precondition: Either Lhs is direct-loaded and not stack-relative, -** or Rhs is direct-loaded and removable (because Lhs A/X must be in force -** at operation), or temp ZP location must be available. -** Used by subopts falling back on temp ZP after testing !LI_RELOAD_Y. -*/ -{ - return LhsIsDirectNonStackLoad (D) || RhsIsRemovable (D) || - HaveUnusedTempZPLoc (D); -} - - - static int CanUseRegVarOrTempZP (const StackOpData* D) /* Precondition: either the operand is a register (ZP) var, or a temp ** ZP location is available to store its value. @@ -326,16 +281,6 @@ static int CanUseRegVarOrTempZP (const StackOpData* D) -static int CanUseRemovableRhs (const StackOpData* D) -/* Precondition: Rhs is direct-loaded and removable (because Lhs A/X must -** be in force at operation). -*/ -{ - return RhsIsRemovable (D); -} - - - /* ### Note: This is a temporary, artificially-limited precondition reproducing ** the original (OP_RHS_REMOVE_DIRECT | OP_RHS_LOAD_DIRECT) evaluation, ** but not useful otherwise. @@ -350,16 +295,6 @@ static int CanUseRemovableRhsWithTempZP (const StackOpData* D) -static int CanUseDirectLhsOrRemovableRhs (const StackOpData* D) -/* Precondition: Either Lhs is direct-loaded, or Rhs is direct-loaded -** and removable (because Lhs A/X must be in force at operation). -*/ -{ - return LhsIsDirectLoad (D) || RhsIsRemovable (D); -} - - - /* ### Note: This is a temporary, artificially-limited precondition reproducing ** the original (OP_LR_INTERCHANGE | OP_RHS_REMOVE_DIRECT) evaluation, ** but not useful otherwise. @@ -375,41 +310,6 @@ static int CanUseDirectWithRemovableRhsAndTempZP (const StackOpData* D) -static int CanUseAnyRemovableOrTempZP (const StackOpData* D) -/* Precondition: Either Lhs is direct-loaded, or Rhs is direct-loaded -** and removable (because Lhs A/X must be in force at operation), or -** a temp ZP location is available to store the Lhs. -*/ -{ - return CanUseDirectLhsOrRemovableRhs (D) || HaveUnusedTempZPLoc (D); -} - - - -static int CanUseRegADirectLhsOrRemovableRhs (const StackOpData* D) -/* Precondition: Either Lhs reg A is direct-loaded, or entire Rhs is -** direct-loaded and removable (because Lhs A/X must be in force -** at operation). -*/ -{ - /* Note: the entire Rhs A/X must be removable, not just A. */ - return RegIsDirectLoaded (&D->Lhs.A) || RhsIsRemovable (D); -} - - - -static int CanUseRegANonStackLhsOrRemovableRhs (const StackOpData* D) -/* Precondition: Either Lhs reg A is direct-loaded and not stack-relative, -** or entire Rhs is direct-loaded removable (because Lhs A/X must be -** in force at operation). -*/ -{ - /* Note: the entire Rhs A/X must be removable, not just A. */ - return RegIsDirectNonStackLoaded (&D->Lhs.A) || RhsIsRemovable (D); -} - - - static int MustHaveTempZP (const StackOpData* D) /* Precondition: a temp ZP location must be available in all cases */ { @@ -456,17 +356,6 @@ static int WithSameXMustHaveTempZP (const StackOpData* D) -static int WithSameXCanUseRemovableRhs (const StackOpData* D) -/* Precondition: When Rhs X == Lhs X, Rhs must be direct-loaded and removable -** (because Lhs A/X must be in force at operation). -*/ -{ - /* Note: the entire Rhs A/X must be removable, not just A. */ - return SameRegXValueAtOp (D, 0) && RhsIsRemovable (D); -} - - - /* ### Note: This is a temporary, artificially-limited precondition reproducing ** the original (OP_RHS_REMOVE_DIRECT | OP_RHS_LOAD_DIRECT) evaluation ** for A-only subopts, but not useful otherwise. @@ -482,42 +371,6 @@ static int WithSameXCanUseRemovableRhsWithTempZP (const StackOpData* D) -static int WithSameXCanUseNonStackLhsOrRemovableRhs (const StackOpData* D) -/* Precondition: When Rhs X == Lhs X, either Lhs reg A is direct-loaded and not -** stack-relative, or Rhs must be direct-loaded and removable (because Lhs A/X -** must be in force at operation). -*/ -{ - return SameRegXValueAtOp (D, 0) && - CanUseRegANonStackLhsOrRemovableRhs (D); -} - - - -static int WithSameXCanUseNonStackLhsOrAny (const StackOpData* D) -/* Precondition: When Rhs X == Lhs X, either Lhs reg A is direct-loaded and not -** stack-relative, or Rhs must be direct-loaded and removable (because Lhs A/X -** must be in force at operation), or a temp ZP location is available. -*/ -{ - return SameRegXValueAtOp (D, 0) && - (CanUseRegANonStackLhsOrRemovableRhs (D) || HaveUnusedTempZPLoc (D)); -} - - - -static int WithSameXCanUseAny (const StackOpData* D) -/* Precondition: When Rhs X == Lhs X, either Lhs reg A is direct-loaded, or Rhs -** is direct-loaded and removable (because Lhs A/X must be in force at -** operation), or a temp ZP location is available to store the Lhs. -*/ -{ - return SameRegXValueAtOp (D, 0) && - (CanUseRegADirectLhsOrRemovableRhs (D) || HaveUnusedTempZPLoc (D)); -} - - - /*****************************************************************************/ /* Actual optimization functions */ /*****************************************************************************/