patch by J. Gareth Moreton: GetNextInstructionUsingReg drops out earlier, second part of #37526

git-svn-id: trunk@46976 -
This commit is contained in:
florian 2020-09-27 21:05:43 +00:00
parent eec51afadd
commit bb92fbafa0

View File

@ -170,18 +170,26 @@ Implementation
function TARMAsmOptimizer.GetNextInstructionUsingReg(Current: tai;
Out Next: tai; reg: TRegister): Boolean;
var
gniResult: Boolean;
begin
Next:=Current;
Result := False;
repeat
Result:=GetNextInstruction(Next,Next);
until not (Result) or
not(cs_opt_level3 in current_settings.optimizerswitches) or
(Next.typ<>ait_instruction) or
RegInInstruction(reg,Next) or
is_calljmp(taicpu(Next).opcode)
gniResult:=GetNextInstruction(Next,Next);
if gniResult and RegInInstruction(reg,Next) then
{ Found something }
Exit(True);
until not gniResult or
not(cs_opt_level3 in current_settings.optimizerswitches) or
(Next.typ<>ait_instruction) or
is_calljmp(taicpu(Next).opcode)
{$ifdef ARM}
or RegModifiedByInstruction(NR_PC,Next);
or RegModifiedByInstruction(NR_PC,Next)
{$endif ARM}
;
end;