mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 07:09:09 +02:00
Rerun peephole optimizers on the whole block
Up until now if a peephole optimizer matched we've only restarted from the current instruction. This patch restarts optimizations on the whole block if the previous run had at least one match. As this can take considerable time this will only be enabled if -O3 or higher is specified. git-svn-id: trunk@26640 -
This commit is contained in:
parent
4fa8998541
commit
81517fdf70
@ -1306,7 +1306,10 @@ Unit AoptObj;
|
||||
procedure TAOptObj.PeepHoleOptPass1;
|
||||
var
|
||||
p,hp1,hp2 : tai;
|
||||
stoploop:boolean;
|
||||
begin
|
||||
repeat
|
||||
stoploop:=true;
|
||||
p := BlockStart;
|
||||
ClearUsedRegs;
|
||||
while (p <> BlockEnd) Do
|
||||
@ -1321,6 +1324,7 @@ Unit AoptObj;
|
||||
{$endif DEBUG_OPTALLOC}
|
||||
if PeepHoleOptPass1Cpu(p) then
|
||||
begin
|
||||
stoploop:=false;
|
||||
UpdateUsedRegs(p);
|
||||
continue;
|
||||
end;
|
||||
@ -1355,6 +1359,7 @@ Unit AoptObj;
|
||||
{$endif SPARC or MIPS }
|
||||
asml.remove(hp1);
|
||||
hp1.free;
|
||||
stoploop:=false;
|
||||
end
|
||||
else
|
||||
hp2:=hp1;
|
||||
@ -1377,6 +1382,7 @@ Unit AoptObj;
|
||||
asml.remove(p);
|
||||
p.free;
|
||||
p:=hp2;
|
||||
stoploop:=false;
|
||||
continue;
|
||||
end
|
||||
else if assigned(hp1) then
|
||||
@ -1407,6 +1413,7 @@ Unit AoptObj;
|
||||
{$endif SPARC or MIPS}
|
||||
asml.remove(hp1);
|
||||
hp1.free;
|
||||
stoploop:=false;
|
||||
GetFinalDestination(taicpu(p),0);
|
||||
end
|
||||
else
|
||||
@ -1430,6 +1437,7 @@ Unit AoptObj;
|
||||
UpdateUsedRegs(p);
|
||||
p:=tai(p.next);
|
||||
end;
|
||||
until stoploop or not(cs_opt_level3 in current_settings.optimizerswitches);
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user