mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-19 12:09:14 +02:00
* patch by Nico Erfurth: Support A_MOV and A_MVN in RedundantMovProcess
This changes the ARM Peephole optimizer RedundantMovProcess to also recognize and modify something like the following sequence. mov r0, r1 mov r0, r0, lsl #8 this would be changed into mov r0, r1, lsl #8 git-svn-id: trunk@21506 -
This commit is contained in:
parent
4ea1d22c5a
commit
5393efb128
@ -472,11 +472,13 @@ Implementation
|
||||
GetNextInstruction(p, hp1) and
|
||||
(tai(hp1).typ = ait_instruction) and
|
||||
(taicpu(hp1).opcode in [A_ADD, A_ADC, A_RSB, A_RSC, A_SUB, A_SBC,
|
||||
A_AND, A_BIC, A_EOR, A_ORR]) and
|
||||
A_AND, A_BIC, A_EOR, A_ORR, A_MOV, A_MVN]) and
|
||||
{MOV and MVN might only have 2 ops}
|
||||
(taicpu(hp1).ops = 3) and
|
||||
(taicpu(hp1).condition in [C_NONE, taicpu(hp1).condition]) and
|
||||
MatchOperand(taicpu(p).oper[0]^, taicpu(hp1).oper[0]^.reg) and
|
||||
(taicpu(hp1).oper[1]^.typ = top_reg) and
|
||||
(taicpu(hp1).oper[2]^.typ in [top_reg, top_const]) then
|
||||
(taicpu(hp1).oper[2]^.typ in [top_reg, top_const, top_shifterop]) then
|
||||
begin
|
||||
{ When we get here we still don't know if the registers match}
|
||||
for I:=1 to 2 do
|
||||
@ -487,7 +489,7 @@ Implementation
|
||||
}
|
||||
if MatchOperand(taicpu(p).oper[0]^, taicpu(hp1).oper[I]^.reg) then
|
||||
begin
|
||||
asml.insertbefore(tai_comment.Create(strpnew('Peephole RedundantMovProcess done ')), hp1);
|
||||
asml.insertbefore(tai_comment.Create(strpnew('Peephole RedundantMovProcess done')), hp1);
|
||||
taicpu(hp1).oper[I]^.reg := taicpu(p).oper[1]^.reg;
|
||||
if p<>hp1 then
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user