mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-26 08:49:17 +02:00
+ TAOptObj.*PeepHoleOpts* check if p is really assigned
+ TAOptObj.RemoveCurrentP git-svn-id: trunk@38488 -
This commit is contained in:
parent
63ffb02b34
commit
ae950956af
@ -326,6 +326,9 @@ Unit AoptObj;
|
|||||||
reloaded with a new value or it is deallocated afterwards }
|
reloaded with a new value or it is deallocated afterwards }
|
||||||
function RegEndOfLife(reg: TRegister;p: taicpu): boolean;
|
function RegEndOfLife(reg: TRegister;p: taicpu): boolean;
|
||||||
|
|
||||||
|
{ removes p from asml, updates registers and replaces it by a valid value, if this is the case true is returned }
|
||||||
|
function RemoveCurrentP(var p : taicpu): boolean;
|
||||||
|
|
||||||
{ traces sucessive jumps to their final destination and sets it, e.g.
|
{ traces sucessive jumps to their final destination and sets it, e.g.
|
||||||
je l1 je l3
|
je l1 je l3
|
||||||
<code> <code>
|
<code> <code>
|
||||||
@ -1286,6 +1289,20 @@ Unit AoptObj;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TAOptObj.RemoveCurrentP(var p : taicpu) : boolean;
|
||||||
|
var
|
||||||
|
hp1 : tai;
|
||||||
|
begin
|
||||||
|
result:=GetNextInstruction(p,hp1);
|
||||||
|
{ p will be removed, update used register as we continue
|
||||||
|
with the next instruction after p }
|
||||||
|
UpdateUsedRegs(tai(p.Next));
|
||||||
|
AsmL.Remove(p);
|
||||||
|
p.Free;
|
||||||
|
p:=taicpu(hp1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function FindAnyLabel(hp: tai; var l: tasmlabel): Boolean;
|
function FindAnyLabel(hp: tai; var l: tasmlabel): Boolean;
|
||||||
begin
|
begin
|
||||||
FindAnyLabel := false;
|
FindAnyLabel := false;
|
||||||
@ -1477,10 +1494,13 @@ Unit AoptObj;
|
|||||||
UpdateUsedRegs(tai(p.next));
|
UpdateUsedRegs(tai(p.next));
|
||||||
if PrePeepHoleOptsCpu(p) then
|
if PrePeepHoleOptsCpu(p) then
|
||||||
continue;
|
continue;
|
||||||
|
if assigned(p) then
|
||||||
|
begin
|
||||||
UpdateUsedRegs(p);
|
UpdateUsedRegs(p);
|
||||||
p:=tai(p.next);
|
p:=tai(p.next);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TAOptObj.PeepHoleOptPass1;
|
procedure TAOptObj.PeepHoleOptPass1;
|
||||||
@ -1633,9 +1653,12 @@ Unit AoptObj;
|
|||||||
end; { if is_jmp }
|
end; { if is_jmp }
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
if assigned(p) then
|
||||||
|
begin
|
||||||
UpdateUsedRegs(p);
|
UpdateUsedRegs(p);
|
||||||
p:=tai(p.next);
|
p:=tai(p.next);
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
until stoploop or not(cs_opt_level3 in current_settings.optimizerswitches);
|
until stoploop or not(cs_opt_level3 in current_settings.optimizerswitches);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1651,10 +1674,13 @@ Unit AoptObj;
|
|||||||
UpdateUsedRegs(tai(p.next));
|
UpdateUsedRegs(tai(p.next));
|
||||||
if PeepHoleOptPass2Cpu(p) then
|
if PeepHoleOptPass2Cpu(p) then
|
||||||
continue;
|
continue;
|
||||||
|
if assigned(p) then
|
||||||
|
begin
|
||||||
UpdateUsedRegs(p);
|
UpdateUsedRegs(p);
|
||||||
p:=tai(p.next);
|
p:=tai(p.next);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TAOptObj.PostPeepHoleOpts;
|
procedure TAOptObj.PostPeepHoleOpts;
|
||||||
@ -1668,10 +1694,13 @@ Unit AoptObj;
|
|||||||
UpdateUsedRegs(tai(p.next));
|
UpdateUsedRegs(tai(p.next));
|
||||||
if PostPeepHoleOptsCpu(p) then
|
if PostPeepHoleOptsCpu(p) then
|
||||||
continue;
|
continue;
|
||||||
|
if assigned(p) then
|
||||||
|
begin
|
||||||
UpdateUsedRegs(p);
|
UpdateUsedRegs(p);
|
||||||
p:=tai(p.next);
|
p:=tai(p.next);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TAOptObj.PrePeepHoleOptsCpu(var p : tai) : boolean;
|
function TAOptObj.PrePeepHoleOptsCpu(var p : tai) : boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user