From 980c689d3778be9cf714bc0f446fb0d9c45ed64c Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 10 Feb 2018 22:20:04 +0000 Subject: [PATCH] + Peephole optimizer MovPush2Push git-svn-id: trunk@38195 - --- compiler/i8086/aoptcpu.pas | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/compiler/i8086/aoptcpu.pas b/compiler/i8086/aoptcpu.pas index 3c995640f7..5c3d8d8d27 100644 --- a/compiler/i8086/aoptcpu.pas +++ b/compiler/i8086/aoptcpu.pas @@ -118,6 +118,22 @@ unit aoptcpu; asml.remove(hp2); hp2.free; result:=true; + end + else if MatchInstruction(p,A_MOV,[S_W]) and + MatchOpType(taicpu(p),top_reg,top_reg) and + GetNextInstruction(p, hp1) and + MatchInstruction(hp1,A_PUSH,[S_W]) and + MatchOperand(taicpu(p).oper[1]^,taicpu(hp1).oper[0]^) and + assigned(FindRegDealloc(taicpu(hp1).oper[0]^.reg,tai(hp1.Next))) then + begin + DebugMsg('Peephole optimizer MovPush2Push',p); + taicpu(hp1).loadreg(0,taicpu(p).oper[0]^.reg); + { take care of the register (de)allocs following p } + UpdateUsedRegs(tai(p.next)); + asml.remove(p); + p.free; + p:=hp1; + result:=true; end; end; A_SUB: