1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-01 13:41:34 +00:00

Changd all Find*Last*InOpenRange() to return the beginning of the open range.

Fixed FindArgLastUsageInOpenRange().
This commit is contained in:
acqn 2021-03-13 14:31:23 +08:00 committed by Oliver Schmidt
parent 4376b83390
commit 0a8ca3041a
2 changed files with 11 additions and 11 deletions

View File

@ -3038,13 +3038,13 @@ int FindArgLastUsageInOpenRange (CodeSeg* S, int First, int Last, CodeEntry* E,
/* Find the last index where the arg of E might be used or changed in the range (First, Last).
** ReloadY indicates whether Y is supposed to be reloaded.
** The code block in the range must be basic without any jump backwards.
** Return the index of the found entry, or -1 if not found.
** Return the index of the found entry, or First if not found.
*/
{
LoadRegInfo LRI;
CodeEntry* X;
unsigned CheckedFlags = LI_SRC_USE | LI_SRC_CHG;
int Found = -1;
int Found = First;
CHECK (Last <= (int)CollCount (&S->Entries));
@ -3066,8 +3066,8 @@ int FindArgLastUsageInOpenRange (CodeSeg* S, int First, int Last, CodeEntry* E,
/* TODO: We don't currently check for all cases */
if ((LRI.Flags & (LI_DIRECT | LI_CHECK_ARG | LI_CHECK_Y | LI_RELOAD_Y)) == 0) {
/* Just bail out as if the src would change right away */
return 0;
/* Just bail out as if the src would change everywhere */
return First < Last ? Last - 1 : First;
}
if ((LRI.Flags & LI_CHECK_Y) != 0) {
@ -3145,11 +3145,11 @@ int FindRegLastChangeInOpenRange (CodeSeg* S, int First, int Last, unsigned what
/* Find the last possible spot where the queried ZPs, registers and/or processor
** states might be changed in the range (First, Last). The code block in the
** range must be basic without any jump backwards.
** Return the index of the found entry, or -1 if not found.
** Return the index of the found entry, or First if not found.
*/
{
CodeEntry* X;
int Found = -1;
int Found = First;
CHECK (Last <= (int)CollCount (&S->Entries));
@ -3169,11 +3169,11 @@ int FindRegLastUseInOpenRange (CodeSeg* S, int First, int Last, unsigned what)
/* Find the last possible spot where the queried ZPs, registers and/or processor
** states might be used in the range (First, Last). The code block in the range
** must be basic without any jump backwards.
** Return the index of the found entry, or -1 if not found.
** Return the index of the found entry, or First if not found.
*/
{
CodeEntry* X;
int Found = -1;
int Found = First;
CHECK (Last <= (int)CollCount (&S->Entries));

View File

@ -433,7 +433,7 @@ int FindArgLastUsageInOpenRange (CodeSeg* S, int First, int Last, CodeEntry* E,
/* Find the last index where the arg of E might be used or changed in the range (First, Last).
** ReloadY indicates whether Y is supposed to be reloaded.
** The code block in the range must be basic without any jump backwards.
** Return the index of the found entry, or -1 if not found.
** Return the index of the found entry, or First if not found.
*/
int FindRegFirstChangeInOpenRange (CodeSeg* S, int First, int Last, unsigned what);
@ -454,14 +454,14 @@ int FindRegLastChangeInOpenRange (CodeSeg* S, int First, int Last, unsigned what
/* Find the last possible spot where the queried ZPs, registers and/or processor
** states might be changed in the range (First, Last). The code block in the
** range must be basic without any jump backwards.
** Return the index of the found entry, or -1 if not found.
** Return the index of the found entry, or First if not found.
*/
int FindRegLastUseInOpenRange (CodeSeg* S, int First, int Last, unsigned what);
/* Find the last possible spot where the queried ZPs, registers and/or processor
** states might be used in the range (First, Last). The code block in the range
** must be basic without any jump backwards.
** Return the index of the found entry, or -1 if not found.
** Return the index of the found entry, or First if not found.
*/
/* End of codeoptutil.h */