* fix RegInInstruction

+ introduce generic RegModifiedByInstruction

git-svn-id: trunk@20472 -
This commit is contained in:
florian 2012-03-04 20:21:14 +00:00
parent f33ee60c2e
commit 8278271b4e

View File

@ -53,6 +53,8 @@ unit aoptbase;
{ returns true if register Reg is used in the reference Ref }
Function RegInRef(Reg: TRegister; Const Ref: TReference): Boolean;
function RegModifiedByInstruction(Reg: TRegister; p1: tai): boolean;virtual;
{ returns true if the references are completely equal }
{Function RefsEqual(Const R1, R2: TReference): Boolean;}
@ -113,11 +115,11 @@ unit aoptbase;
Begin
TmpResult := False;
Count := 0;
If (p1.typ = ait_instruction) Then
If (p1.typ = ait_instruction) and assigned(TInstr(p1).oper[0]) Then
Repeat
TmpResult := RegInOp(Reg, PInstr(p1)^.oper[Count]^);
TmpResult := RegInOp(Reg, TInstr(p1).oper[Count]^);
Inc(Count)
Until (Count = MaxOps) or TmpResult;
Until (TInstr(p1).oper[Count]=nil) or (Count = MaxOps) or TmpResult;
RegInInstruction := TmpResult
End;
@ -141,6 +143,11 @@ unit aoptbase;
{$endif RefsHaveIndexReg}
End;
Function TAOptBase.RegModifiedByInstruction(Reg: TRegister; p1: tai): Boolean;
Begin
Result:=true;
End;
function labelCanBeSkipped(p: tai_label): boolean;
begin
labelCanBeSkipped := not(p.labsym.is_used) or (p.labsym.labeltype<>alt_jump);