1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-12-25 21:29:25 +00:00

Z80: Analyse LD A,I and LD A,R correctly in the optimizer

This commit is contained in:
Karol Stasiak 2019-06-05 11:33:34 +02:00
parent b3bb9bb063
commit 77b3628dde
2 changed files with 4 additions and 0 deletions

View File

@ -218,6 +218,8 @@ object CoarseFlowAnalyzer {
currentStatus = currentStatus.setRegister(t, SingleStatus(value.toInt)) currentStatus = currentStatus.setRegister(t, SingleStatus(value.toInt))
case ZLine0(LD_16, TwoRegisters(ZRegister.HL, ZRegister.IMM_16), xx) => case ZLine0(LD_16, TwoRegisters(ZRegister.HL, ZRegister.IMM_16), xx) =>
currentStatus = currentStatus.setHL(SingleStatus(xx)) currentStatus = currentStatus.setHL(SingleStatus(xx))
case ZLine0(LD, TwoRegisters(ZRegister.A, ZRegister.I | ZRegister.R), _) =>
currentStatus = currentStatus.copy(a = AnyStatus, zf = AnyStatus, sf = AnyStatus, pf = AnyStatus, hf = AnyStatus, nf = AnyStatus)
case ZLine0(LD, TwoRegisters(t, ZRegister.IMM_8), NumericConstant(value, _)) => case ZLine0(LD, TwoRegisters(t, ZRegister.IMM_8), NumericConstant(value, _)) =>
currentStatus = currentStatus.setRegister(t, SingleStatus(value.toInt)) currentStatus = currentStatus.setRegister(t, SingleStatus(value.toInt))
case ZLine0(LD, TwoRegistersOffset(t, ZRegister.IMM_8, o), NumericConstant(value, _)) => case ZLine0(LD, TwoRegistersOffset(t, ZRegister.IMM_8, o), NumericConstant(value, _)) =>

View File

@ -241,6 +241,8 @@ object ReverseFlowAnalyzer {
currentImportance = currentImportance.copy(a = Unimportant) currentImportance = currentImportance.copy(a = Unimportant)
case ZLine0(DISCARD_F, _, _) => case ZLine0(DISCARD_F, _, _) =>
currentImportance = currentImportance.copy(cf = Unimportant, zf = Unimportant, sf = Unimportant, pf = Unimportant, hf = Unimportant, nf = Unimportant) currentImportance = currentImportance.copy(cf = Unimportant, zf = Unimportant, sf = Unimportant, pf = Unimportant, hf = Unimportant, nf = Unimportant)
case ZLine0(LD, TwoRegisters(ZRegister.A, ZRegister.I | ZRegister.R), _) =>
currentImportance = currentImportance.copy(a = Unimportant, pf = Unimportant)
case ZLine0(LD, TwoRegistersOffset(t, s, o), _) => case ZLine0(LD, TwoRegistersOffset(t, s, o), _) =>
currentImportance = currentImportance.butWritesRegister(t, o).butReadsRegister(s, o) currentImportance = currentImportance.butWritesRegister(t, o).butReadsRegister(s, o)
case ZLine0(LD | LD_16, TwoRegisters(t, s), _) => case ZLine0(LD | LD_16, TwoRegisters(t, s), _) =>