Browse Source

* x86: Refactor of a DeepMOVOpt call to make use of a while loop and aoc_ForceNewIteration to increase compiler speed and efficiency.

J. Gareth "Curious Kit" Moreton 3 years ago
parent
commit
43bdd8c07e
1 changed files with 6 additions and 0 deletions
  1. 6 0
      compiler/x86/aoptx86.pas

+ 6 - 0
compiler/x86/aoptx86.pas

@@ -3252,10 +3252,13 @@ unit aoptx86;
               GetNextInstruction_p := GetNextInstruction(p, hp1);
 
             if GetNextInstruction_p and (hp1.typ = ait_instruction) then
+              while True do
               begin
                 if (taicpu(hp1).opcode = A_AND) and
                   MatchOpType(taicpu(hp1),top_const,top_reg) then
                   begin
+                    { A change has occurred, just not in p }
+                    Include(OptsToCheck, aoc_ForceNewIteration);
                     if MatchOperand(taicpu(hp1).oper[1]^, p_TargetReg) then
                       begin
                         case taicpu(p).opsize of
@@ -3512,6 +3515,8 @@ unit aoptx86;
                             Result := True;
                             Exit;
 
+                            { Go through DeepMOVOpt again (jump to "while True do") }
+                            Continue;
                           end;
                       end;
                   end;
@@ -4300,6 +4305,7 @@ unit aoptx86;
                         Include(OptsToCheck, aoc_ForceNewIteration);
                       end;
                   end;
+                Break;
               end;
           end;