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