mirror of
https://github.com/cc65/cc65.git
synced 2025-01-16 13:31:16 +00:00
Just keep Lhs loads in OptStackOps and leave them to OptUnusedLoads,
whilst Rhs loads must be removed for OptStackOps to work right. Fixed Issue #167 as well as similar issues with tosshift.
This commit is contained in:
parent
1c2edc5434
commit
a7a8426a90
@ -792,10 +792,6 @@ static unsigned Opt_toseqax_tosneax (StackOpData* D, const char* BoolTransformer
|
|||||||
X = NewCodeEntry (OP65_CMP, LoadA->AM, LoadA->Arg, 0, D->OpEntry->LI);
|
X = NewCodeEntry (OP65_CMP, LoadA->AM, LoadA->Arg, 0, D->OpEntry->LI);
|
||||||
InsertEntry (D, X, D->IP++);
|
InsertEntry (D, X, D->IP++);
|
||||||
|
|
||||||
/* Lhs load entries can be removed */
|
|
||||||
D->Lhs.X.Flags |= LI_REMOVE;
|
|
||||||
D->Lhs.A.Flags |= LI_REMOVE;
|
|
||||||
|
|
||||||
} else if ((D->Rhs.A.Flags & (LI_DIRECT | LI_RELOAD_Y)) == LI_DIRECT &&
|
} else if ((D->Rhs.A.Flags & (LI_DIRECT | LI_RELOAD_Y)) == LI_DIRECT &&
|
||||||
(D->Rhs.X.Flags & (LI_DIRECT | LI_RELOAD_Y)) == LI_DIRECT) {
|
(D->Rhs.X.Flags & (LI_DIRECT | LI_RELOAD_Y)) == LI_DIRECT) {
|
||||||
|
|
||||||
@ -816,9 +812,13 @@ static unsigned Opt_toseqax_tosneax (StackOpData* D, const char* BoolTransformer
|
|||||||
X = NewCodeEntry (OP65_CMP, LoadA->AM, LoadA->Arg, 0, D->OpEntry->LI);
|
X = NewCodeEntry (OP65_CMP, LoadA->AM, LoadA->Arg, 0, D->OpEntry->LI);
|
||||||
InsertEntry (D, X, D->IP++);
|
InsertEntry (D, X, D->IP++);
|
||||||
|
|
||||||
/* Rhs load entries can be removed */
|
/* Rhs load entries must be removed if they are placed after the push */
|
||||||
|
if (D->Rhs.X.LoadIndex > D->PushIndex) {
|
||||||
D->Rhs.X.Flags |= LI_REMOVE;
|
D->Rhs.X.Flags |= LI_REMOVE;
|
||||||
|
}
|
||||||
|
if (D->Rhs.A.LoadIndex > D->PushIndex) {
|
||||||
D->Rhs.A.Flags |= LI_REMOVE;
|
D->Rhs.A.Flags |= LI_REMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
} else if ((D->Rhs.A.Flags & LI_DIRECT) != 0 &&
|
} else if ((D->Rhs.A.Flags & LI_DIRECT) != 0 &&
|
||||||
(D->Rhs.X.Flags & LI_DIRECT) != 0) {
|
(D->Rhs.X.Flags & LI_DIRECT) != 0) {
|
||||||
@ -898,10 +898,6 @@ static unsigned Opt_tosshift (StackOpData* D, const char* Name)
|
|||||||
X = NewCodeEntry (OP65_LDX, LoadX->AM, LoadX->Arg, 0, D->OpEntry->LI);
|
X = NewCodeEntry (OP65_LDX, LoadX->AM, LoadX->Arg, 0, D->OpEntry->LI);
|
||||||
InsertEntry (D, X, D->IP++);
|
InsertEntry (D, X, D->IP++);
|
||||||
|
|
||||||
/* Lhs load entries can be removed */
|
|
||||||
D->Lhs.X.Flags |= LI_REMOVE;
|
|
||||||
D->Lhs.A.Flags |= LI_REMOVE;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* Save lhs into zeropage and reload later */
|
/* Save lhs into zeropage and reload later */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user