mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 22:48:57 +02:00
+ RegUsedBetween
git-svn-id: trunk@22182 -
This commit is contained in:
parent
4dee21c60e
commit
0c08ae8553
@ -89,6 +89,8 @@ unit aoptbase;
|
||||
{ create a paicpu Object that loads the contents of reg1 into reg2 }
|
||||
Function a_load_reg_reg(reg1, reg2: TRegister): taicpu; Virtual; Abstract;
|
||||
|
||||
{ returns true if reg is used by any instruction between p1 and p2 }
|
||||
Function RegUsedBetween(reg: TRegister; p1, p2: tai): Boolean;
|
||||
end;
|
||||
|
||||
function labelCanBeSkipped(p: tai_label): boolean;
|
||||
@ -241,6 +243,18 @@ unit aoptbase;
|
||||
End;
|
||||
|
||||
|
||||
Function TAOptBase.RegUsedBetween(reg : TRegister;p1,p2 : tai) : Boolean;
|
||||
Begin
|
||||
Result:=false;
|
||||
while assigned(p1) and assigned(p2) and GetNextInstruction(p1,p1) and (p1<>p2) do
|
||||
if RegInInstruction(reg,p1) then
|
||||
begin
|
||||
Result:=true;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ ******************* Processor dependent stuff *************************** }
|
||||
|
||||
Function TAOptBase.RegMaxSize(Reg: TRegister): TRegister;
|
||||
|
Loading…
Reference in New Issue
Block a user