+ AVR PeepHoleOptPass1Cpu makes use of TAOptObj.RemoveCurrentP to track register usage properly

git-svn-id: trunk@38489 -
This commit is contained in:
florian 2018-03-10 21:53:50 +00:00
parent ae950956af
commit 61660375ce

View File

@ -345,10 +345,7 @@ Implementation
DebugMsg('Peephole LdiMov/Cp2Ldi/Cpi performed', p); DebugMsg('Peephole LdiMov/Cp2Ldi/Cpi performed', p);
GetNextInstruction(p,hp1); RemoveCurrentP(taicpu(p));
asml.Remove(p);
p.Free;
p:=hp1;
end; end;
ReleaseUsedRegs(TmpUsedRegs); ReleaseUsedRegs(TmpUsedRegs);
end; end;
@ -540,14 +537,7 @@ Implementation
begin begin
DebugMsg('Redundant Andi removed', p); DebugMsg('Redundant Andi removed', p);
GetNextInstruction(p,hp1); result:=RemoveCurrentP(taicpu(p));
AsmL.Remove(p);
p.free;
p:=hp1;
result:=true;
end; end;
end; end;
A_ADD: A_ADD:
@ -558,12 +548,7 @@ Implementation
begin begin
DebugMsg('Peephole AddAdc2Add performed', p); DebugMsg('Peephole AddAdc2Add performed', p);
taicpu(hp1).opcode:=A_ADD; result:=RemoveCurrentP(taicpu(p));
asml.Remove(p);
p.Free;
p:=hp1;
result:=true;
end; end;
end; end;
A_SUB: A_SUB:
@ -576,10 +561,7 @@ Implementation
taicpu(hp1).opcode:=A_SUB; taicpu(hp1).opcode:=A_SUB;
asml.Remove(p); result:=RemoveCurrentP(taicpu(p));
p.Free;
p:=hp1;
result:=true;
end; end;
end; end;
A_CLR: A_CLR:
@ -602,10 +584,7 @@ Implementation
begin begin
DebugMsg('Peephole ClrMov2Mov performed', p); DebugMsg('Peephole ClrMov2Mov performed', p);
asml.Remove(p); result:=RemoveCurrentP(taicpu(p));
p.Free;
p:=hp1;
result:=true;
end end
{ turn { turn
clr rX clr rX
@ -642,12 +621,7 @@ Implementation
dealloc.Free; dealloc.Free;
end; end;
GetNextInstruction(p,hp1); result:=RemoveCurrentP(taicpu(p));
asml.Remove(p);
p.free;
p:=hp1;
result:=true;
end; end;
end; end;
A_PUSH: A_PUSH:
@ -771,13 +745,8 @@ Implementation
GetNextInstruction(p,hp1) and GetNextInstruction(p,hp1) and
not(MatchInstruction(hp1,[A_CALL,A_RCALL])) then not(MatchInstruction(hp1,[A_CALL,A_RCALL])) then
begin begin
GetNextInstruction(p,hp1);
DebugMsg('Peephole Mov2Nop performed', p); DebugMsg('Peephole Mov2Nop performed', p);
UpdateUsedRegs(tai(p.Next)); result:=RemoveCurrentP(taicpu(p));
asml.Remove(p);
p.Free;
p:=hp1;
result:=true;
ReleaseUsedRegs(TmpUsedRegs); ReleaseUsedRegs(TmpUsedRegs);
exit; exit;
end; end;
@ -821,11 +790,8 @@ Implementation
dealloc.Free; dealloc.Free;
end; end;
GetNextInstruction(p,hp1);
asml.Remove(p); result:=RemoveCurrentP(taicpu(p));
p.free;
p:=hp1;
result:=true;
end end
{ remove { remove
mov reg0,reg0 mov reg0,reg0
@ -837,11 +803,7 @@ Implementation
begin begin
DebugMsg('Peephole RedundantMov performed', p); DebugMsg('Peephole RedundantMov performed', p);
GetNextInstruction(p,hp1); result:=RemoveCurrentP(taicpu(p));
asml.remove(p);
p.free;
p:=hp1;
result:=true;
end end
{ {
Turn Turn
@ -889,16 +851,10 @@ Implementation
dealloc.Free; dealloc.Free;
end; end;
GetNextInstruction(p,hp1);
asml.remove(p);
p.free;
asml.remove(hp2); asml.remove(hp2);
hp2.free; hp2.free;
p:=hp1; result:=RemoveCurrentP(taicpu(p));
result:=true;
end end
{ {
Turn Turn
@ -941,16 +897,10 @@ Implementation
dealloc.Free; dealloc.Free;
end; end;
GetNextInstruction(p,hp1); result:=RemoveCurrentP(taicpu(p));
asml.remove(p);
p.free;
asml.remove(hp2); asml.remove(hp2);
hp2.free; hp2.free;
p:=hp1;
result:=true;
end end
{ fold { fold
mov reg2,reg0 mov reg2,reg0
@ -1000,11 +950,9 @@ Implementation
begin begin
DebugMsg('Peephole MovMov2Mov performed', p); DebugMsg('Peephole MovMov2Mov performed', p);
asml.remove(p); result:=RemoveCurrentP(taicpu(p));
p.free;
p:=hp1;
GetNextInstruction(hp1,hp1); GetNextInstruction(hp1,hp1);
result:=true;
if not assigned(hp1) then if not assigned(hp1) then
break; break;
end; end;