mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 16:29:24 +02:00
* simplified RegInInstruction() and fixed range errors
git-svn-id: trunk@25950 -
This commit is contained in:
parent
98a230d20f
commit
3c7ad95f7d
@ -117,17 +117,16 @@ unit aoptbase;
|
|||||||
|
|
||||||
|
|
||||||
Function TAOptBase.RegInInstruction(Reg: TRegister; p1: tai): Boolean;
|
Function TAOptBase.RegInInstruction(Reg: TRegister; p1: tai): Boolean;
|
||||||
Var Count: AWord;
|
Var
|
||||||
TmpResult: Boolean;
|
Count: longint;
|
||||||
Begin
|
Begin
|
||||||
TmpResult := False;
|
result:=false;
|
||||||
Count := 0;
|
if p1.typ<>ait_instruction then
|
||||||
If (p1.typ = ait_instruction) and assigned(TInstr(p1).oper[0]) Then
|
exit;
|
||||||
Repeat
|
for Count:=0 to TInstr(p1).ops-1 do
|
||||||
TmpResult := RegInOp(Reg, TInstr(p1).oper[Count]^);
|
if RegInOp(Reg, TInstr(p1).oper[Count]^) then
|
||||||
Inc(Count)
|
exit(true);
|
||||||
Until (TInstr(p1).oper[Count]=nil) or (Count = MaxOps) or TmpResult;
|
result:=false;
|
||||||
RegInInstruction := TmpResult
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user