mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 00:46:02 +02:00
* New UpdateUsedRegsBetween utility subroutine
This commit is contained in:
parent
95e5eeb226
commit
9ee672f9eb
@ -274,6 +274,10 @@ Unit AoptObj;
|
|||||||
Procedure UpdateUsedRegs(p : Tai);
|
Procedure UpdateUsedRegs(p : Tai);
|
||||||
class procedure UpdateUsedRegs(var Regs: TAllUsedRegs; p: Tai); static;
|
class procedure UpdateUsedRegs(var Regs: TAllUsedRegs; p: Tai); static;
|
||||||
|
|
||||||
|
{ UpdateUsedRegsBetween updates the given TUsedRegs from p1 to p2 exclusive, calling GetNextInstruction
|
||||||
|
to move between instructions and sending p1.Next to UpdateUsedRegs }
|
||||||
|
class procedure UpdateUsedRegsBetween(var Regs: TAllUsedRegs; p1, p2: Tai); static;
|
||||||
|
|
||||||
{ If UpdateUsedRegsAndOptimize has read ahead, the result is one before
|
{ If UpdateUsedRegsAndOptimize has read ahead, the result is one before
|
||||||
the next valid entry (so "p.Next" returns what's expected). If no
|
the next valid entry (so "p.Next" returns what's expected). If no
|
||||||
reading ahead happened, then the result is equal to p. }
|
reading ahead happened, then the result is equal to p. }
|
||||||
@ -1118,6 +1122,21 @@ Unit AoptObj;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
class procedure TAOptObj.UpdateUsedRegsBetween(var Regs: TAllUsedRegs; p1, p2: Tai); static;
|
||||||
|
var
|
||||||
|
i : TRegisterType;
|
||||||
|
begin
|
||||||
|
while (p1 <> p2) do
|
||||||
|
begin
|
||||||
|
for i:=low(TRegisterType) to high(TRegisterType) do
|
||||||
|
Regs[i].Update(tai(p1.Next));
|
||||||
|
|
||||||
|
if not GetNextInstruction(p1, p1) then
|
||||||
|
InternalError(2022010701);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TAOptObj.CopyUsedRegs(var dest: TAllUsedRegs): boolean;
|
function TAOptObj.CopyUsedRegs(var dest: TAllUsedRegs): boolean;
|
||||||
var
|
var
|
||||||
i : TRegisterType;
|
i : TRegisterType;
|
||||||
|
Loading…
Reference in New Issue
Block a user