mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 14:29:21 +02:00
* further look ahead for temp. deallocation for FstpFldFstp2Fstp and FstpFld2<Nop>
This commit is contained in:
parent
ef53f9bc25
commit
4778973492
@ -338,6 +338,12 @@ 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;
|
||||||
|
|
||||||
|
{ Returns the next ait_tempalloc object with allocation=false
|
||||||
|
for Offset which is found in the block of Tai's starting with StartPai
|
||||||
|
and ending with the next "real" instruction. If none is found, it returns
|
||||||
|
nil }
|
||||||
|
class function FindTempDeAlloc(Offset: ASizeInt; StartPai: Tai): tai_tempalloc;
|
||||||
|
|
||||||
{ removes p from asml, updates registers and replaces it by a valid value, if this is the case true is returned }
|
{ 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 : tai): boolean;
|
function RemoveCurrentP(var p : tai): boolean;
|
||||||
|
|
||||||
@ -1358,6 +1364,32 @@ Unit AoptObj;
|
|||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
|
class function TAOptObj.FindTempDeAlloc(Offset: ASizeInt; StartPai: Tai): tai_tempalloc;
|
||||||
|
Begin
|
||||||
|
Result:=nil;
|
||||||
|
Repeat
|
||||||
|
While Assigned(StartPai) And
|
||||||
|
((StartPai.typ in (SkipInstr - [ait_tempalloc])) Or
|
||||||
|
((StartPai.typ = ait_label) and
|
||||||
|
Not(Tai_Label(StartPai).labsym.Is_Used))) Do
|
||||||
|
StartPai := Tai(StartPai.Next);
|
||||||
|
If Assigned(StartPai) And
|
||||||
|
(StartPai.typ = ait_tempalloc) Then
|
||||||
|
Begin
|
||||||
|
if not(tai_tempalloc(StartPai).allocation) and
|
||||||
|
(tai_tempalloc(StartPai).temppos = Offset) then
|
||||||
|
begin
|
||||||
|
Result:=tai_tempalloc(StartPai);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
StartPai := Tai(StartPai.Next);
|
||||||
|
End
|
||||||
|
else
|
||||||
|
exit;
|
||||||
|
Until false;
|
||||||
|
End;
|
||||||
|
|
||||||
|
|
||||||
{ allocates register reg between (and including) instructions p1 and p2
|
{ allocates register reg between (and including) instructions p1 and p2
|
||||||
the type of p1 and p2 must not be in SkipInstr }
|
the type of p1 and p2 must not be in SkipInstr }
|
||||||
procedure TAOptObj.AllocRegBetween(reg: tregister; p1, p2: tai; var initialusedregs: TAllUsedRegs);
|
procedure TAOptObj.AllocRegBetween(reg: tregister; p1, p2: tai; var initialusedregs: TAllUsedRegs);
|
||||||
|
@ -7106,10 +7106,9 @@ unit aoptx86;
|
|||||||
fld <temp>
|
fld <temp>
|
||||||
<dealloc> <temp>
|
<dealloc> <temp>
|
||||||
}
|
}
|
||||||
(SetAndTest(tai(hp1.next),hp2) and (hp2.typ = ait_tempalloc) and
|
((taicpu(p).oper[0]^.ref^.base = current_procinfo.FramePointer) and
|
||||||
(tai_tempalloc(hp2).allocation=false) and
|
|
||||||
(taicpu(p).oper[0]^.ref^.base = current_procinfo.FramePointer) and
|
|
||||||
(taicpu(p).oper[0]^.ref^.index = NR_NO) and
|
(taicpu(p).oper[0]^.ref^.index = NR_NO) and
|
||||||
|
SetAndTest(FindTempDeAlloc(taicpu(p).oper[0]^.ref^.offset,tai(hp1.next)),hp2) and
|
||||||
(tai_tempalloc(hp2).temppos=taicpu(p).oper[0]^.ref^.offset) and
|
(tai_tempalloc(hp2).temppos=taicpu(p).oper[0]^.ref^.offset) and
|
||||||
(((taicpu(p).opsize=S_FX) and (tai_tempalloc(hp2).tempsize=16)) or
|
(((taicpu(p).opsize=S_FX) and (tai_tempalloc(hp2).tempsize=16)) or
|
||||||
((taicpu(p).opsize in [S_IQ,S_FL]) and (tai_tempalloc(hp2).tempsize=8)) or
|
((taicpu(p).opsize in [S_IQ,S_FL]) and (tai_tempalloc(hp2).tempsize=8)) or
|
||||||
@ -7136,10 +7135,9 @@ unit aoptx86;
|
|||||||
(taicpu(p).opcode=taicpu(hp2).opcode) and
|
(taicpu(p).opcode=taicpu(hp2).opcode) and
|
||||||
(taicpu(p).opsize=taicpu(hp2).opsize) then
|
(taicpu(p).opsize=taicpu(hp2).opsize) then
|
||||||
begin
|
begin
|
||||||
if SetAndTest(tai(hp2.next),hp3) and (hp3.typ = ait_tempalloc) and
|
if (taicpu(p).oper[0]^.ref^.base = current_procinfo.FramePointer) and
|
||||||
(tai_tempalloc(hp3).allocation=false) and
|
|
||||||
(taicpu(p).oper[0]^.ref^.base = current_procinfo.FramePointer) and
|
|
||||||
(taicpu(p).oper[0]^.ref^.index = NR_NO) and
|
(taicpu(p).oper[0]^.ref^.index = NR_NO) and
|
||||||
|
SetAndTest(FindTempDeAlloc(taicpu(p).oper[0]^.ref^.offset,tai(hp2.next)),hp3) and
|
||||||
MatchOperand(taicpu(p).oper[0]^,taicpu(hp1).oper[0]^) and
|
MatchOperand(taicpu(p).oper[0]^,taicpu(hp1).oper[0]^) and
|
||||||
(tai_tempalloc(hp3).temppos=taicpu(p).oper[0]^.ref^.offset) and
|
(tai_tempalloc(hp3).temppos=taicpu(p).oper[0]^.ref^.offset) and
|
||||||
(((taicpu(p).opsize=S_FX) and (tai_tempalloc(hp3).tempsize=16)) or
|
(((taicpu(p).opsize=S_FX) and (tai_tempalloc(hp3).tempsize=16)) or
|
||||||
|
Loading…
Reference in New Issue
Block a user