mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 20:29:33 +02:00
* arm: Fixed "RegInInstruction" and "RegModifiedByInstruction" not handling the flags properly
This commit is contained in:
parent
38d2f3d58c
commit
29916bc6f6
compiler/arm
@ -2418,7 +2418,24 @@ Implementation
|
||||
(getsupreg(taicpu(p1).oper[0]^.reg)+1=getsupreg(reg)) then
|
||||
Result:=true
|
||||
else
|
||||
Result:=inherited RegInInstruction(Reg, p1);
|
||||
begin
|
||||
if SuperRegistersEqual(Reg, NR_DEFAULTFLAGS) then
|
||||
begin
|
||||
{ Conditional instruction reads CPSR register }
|
||||
if (taicpu(p1).condition <> C_None) then
|
||||
Exit(True);
|
||||
|
||||
{ Comparison instructions (and procedural jump) }
|
||||
if (taicpu(p1).opcode in [A_BL, A_CMP, A_CMN, A_TST, A_TEQ]) then
|
||||
Exit(True);
|
||||
|
||||
{ Instruction sets CPSR register due to S suffix (floating-point
|
||||
instructios won't raise false positives) }
|
||||
if (taicpu(p1).oppostfix = PF_S) then
|
||||
Exit(True)
|
||||
end;
|
||||
Result:=inherited RegInInstruction(Reg, p1);
|
||||
end;
|
||||
end;
|
||||
|
||||
const
|
||||
|
@ -119,6 +119,24 @@ Implementation
|
||||
i : Longint;
|
||||
begin
|
||||
result:=false;
|
||||
if (p1.typ <> ait_instruction) then
|
||||
Exit;
|
||||
|
||||
if SuperRegistersEqual(Reg, NR_DEFAULTFLAGS) then
|
||||
begin
|
||||
{ Comparison instructions (and procedural jump) }
|
||||
if (taicpu(p1).opcode in [A_BL, A_CMP, A_CMN, A_TST, A_TEQ]) then
|
||||
Exit(True);
|
||||
|
||||
{ Instruction sets CPSR register due to S suffix (floating-point
|
||||
instructios won't raise false positives) }
|
||||
if (taicpu(p1).oppostfix = PF_S) then
|
||||
Exit(True);
|
||||
|
||||
{ Everything else (conditional instructions only read CPSR) }
|
||||
Exit;
|
||||
end;
|
||||
|
||||
case taicpu(p1).opcode of
|
||||
A_LDR:
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user