Browse Source

* bail out early in MatchInstruction

florian 3 years ago
parent
commit
1e136b0cc7
1 changed files with 8 additions and 7 deletions
  1. 8 7
      compiler/x86/aoptx86.pas

+ 8 - 7
compiler/x86/aoptx86.pas

@@ -278,15 +278,16 @@ unit aoptx86;
         op : TAsmOp;
         op : TAsmOp;
       begin
       begin
         result:=false;
         result:=false;
+        if (instr.typ <> ait_instruction) or
+          ((opsize <> []) and not(taicpu(instr).opsize in opsize)) then
+          exit;
         for op in ops do
         for op in ops do
           begin
           begin
-            if (instr.typ = ait_instruction) and
-               (taicpu(instr).opcode = op) and
-               ((opsize = []) or (taicpu(instr).opsize in opsize)) then
-               begin
-                 result:=true;
-                 exit;
-               end;
+            if taicpu(instr).opcode = op then
+              begin
+                result:=true;
+                exit;
+              end;
           end;
           end;
       end;
       end;