From a3170ea715363004f3cf690d53931bdef5daf765 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sat, 9 Sep 2017 20:17:42 -0500 Subject: [PATCH] Do a few more native code peephole optimizations. Patch from Kelvin Sherlock. --- Native.pas | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Native.pas b/Native.pas index b033cd2..c89a9a7 100644 --- a/Native.pas +++ b/Native.pas @@ -1422,6 +1422,19 @@ var Remove(ns+1); end; {if} + m_eor_imm: + if npeep[ns+1].opcode = m_eor_imm then begin + operand := operand ! npeep[ns+1].operand; + Remove(ns+1); + end; {if} + + m_ora_imm: + if npeep[ns+1].opcode = m_ora_imm then begin + operand := operand | npeep[ns+1].operand; + Remove(ns+1); + end; {if} + + m_asl_a: if npeep[ns+1].opcode = m_tay then if npeep[ns+2].opcode = m_iny then @@ -1725,6 +1738,16 @@ var Remove(ns); end; {if} + { kws } + { stz $xx, stz $xx } + m_stz_abs, m_stz_absX, m_stz_dir, m_stz_dirX: + if npeep[ns].opcode = npeep[ns+1].opcode then begin + if npeep[ns].operand = npeep[ns+1].operand then begin + Remove(ns+1) + end; {if} + + end; {if} + otherwise: ; end; {case}