ソースを参照

* TAOptObj.MakeUnconditional: Set as internal error for MIPS cpu:
MIPS conditional instructions conntain the
computation of the condition itself, so
changing the instruction to unconditional
should never be done.
* TAOptObj.OptimizeConditionalJump: Return false early if
the conditional instruction has more than one operand.

git-svn-id: trunk@45782 -

pierre 5 年 前
コミット
cca536a86a
1 ファイル変更15 行追加0 行削除
  1. 15 0
      compiler/aoptobj.pas

+ 15 - 0
compiler/aoptobj.pas

@@ -1635,6 +1635,13 @@ Unit AoptObj;
         p.ops:=2;
         p.ops:=2;
 {$endif}
 {$endif}
 {$endif not avr}
 {$endif not avr}
+{$ifdef mips}
+        { MIPS conditional instructions conntain the
+          computation of the condition itself, so
+          changing the instruction to unconditional
+          should never be done. }
+        internalerror(2020071301);
+{$endif}
       end;
       end;
 
 
 
 
@@ -1937,6 +1944,14 @@ Unit AoptObj;
         NCJLabel: TAsmLabel;
         NCJLabel: TAsmLabel;
       begin
       begin
         Result := False;
         Result := False;
+        { Do not try to optimize if the test generating the condition
+          is the same instruction, like 'bne	$v0,$zero,.Lj3' for MIPS }
+        if (taicpu(p).ops>1) or ((hp1.typ=ait_instruction) and
+            (taicpu(hp1).ops>1)) then
+           begin
+             stoploop:=false;
+             exit;
+           end;
         while (hp1 <> BlockEnd) do
         while (hp1 <> BlockEnd) do
           begin
           begin
             StripDeadLabels(hp1, hp1);
             StripDeadLabels(hp1, hp1);