mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-24 07:01:44 +02:00
* optimize TAOptObj.UpdateUsedRegs to avoid multiple passes through the asmlist
git-svn-id: trunk@21513 -
This commit is contained in:
parent
572012fad3
commit
72746e635d
@ -359,6 +359,8 @@ Unit AoptObj;
|
|||||||
}
|
}
|
||||||
Procedure TUsedRegs.Update(p: Tai);
|
Procedure TUsedRegs.Update(p: Tai);
|
||||||
Begin
|
Begin
|
||||||
|
{ this code is normally not used because updating the register allocation information is done in
|
||||||
|
TAOptObj.UpdateUsedRegs for speed reasons }
|
||||||
repeat
|
repeat
|
||||||
while assigned(p) and
|
while assigned(p) and
|
||||||
((p.typ in (SkipInstr - [ait_RegAlloc])) or
|
((p.typ in (SkipInstr - [ait_RegAlloc])) or
|
||||||
@ -825,8 +827,31 @@ Unit AoptObj;
|
|||||||
var
|
var
|
||||||
i : TRegisterType;
|
i : TRegisterType;
|
||||||
begin
|
begin
|
||||||
for i:=low(TRegisterType) to high(TRegisterType) do
|
{ this code is based on TUsedRegs.Update to avoid multiple passes through the asmlist,
|
||||||
UsedRegs[i].Update(p);
|
the code is duplicated here }
|
||||||
|
repeat
|
||||||
|
while assigned(p) and
|
||||||
|
((p.typ in (SkipInstr - [ait_RegAlloc])) or
|
||||||
|
((p.typ = ait_label) and
|
||||||
|
labelCanBeSkipped(tai_label(p))) or
|
||||||
|
((p.typ = ait_marker) and
|
||||||
|
(tai_Marker(p).Kind in [mark_AsmBlockEnd,mark_NoLineInfoStart,mark_NoLineInfoEnd]))) do
|
||||||
|
p := tai(p.next);
|
||||||
|
while assigned(p) and
|
||||||
|
(p.typ=ait_RegAlloc) Do
|
||||||
|
begin
|
||||||
|
case tai_regalloc(p).ratype of
|
||||||
|
ra_alloc :
|
||||||
|
Include(UsedRegs[getregtype(tai_regalloc(p).reg)].UsedRegs, getsupreg(tai_regalloc(p).reg));
|
||||||
|
ra_dealloc :
|
||||||
|
Exclude(UsedRegs[getregtype(tai_regalloc(p).reg)].UsedRegs, getsupreg(tai_regalloc(p).reg));
|
||||||
|
end;
|
||||||
|
p := tai(p.next);
|
||||||
|
end;
|
||||||
|
until not(assigned(p)) or
|
||||||
|
(not(p.typ in SkipInstr) and
|
||||||
|
not((p.typ = ait_label) and
|
||||||
|
labelCanBeSkipped(tai_label(p))));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user