Browse Source

* Disable range check for m68k/aoptcpu unit
* Add missing change of var parameter p to next instruction
in TryToOptimizeMove method after instruction removal.

git-svn-id: trunk@40324 -

pierre 6 years ago
parent
commit
2761448f44
1 changed files with 7 additions and 0 deletions
  1. 7 0
      compiler/m68k/aoptcpu.pas

+ 7 - 0
compiler/m68k/aoptcpu.pas

@@ -49,6 +49,9 @@ unit aoptcpu;
     uses
     uses
       cutils, aasmcpu, cgutils, globals, verbose, cpuinfo, itcpugas;
       cutils, aasmcpu, cgutils, globals, verbose, cpuinfo, itcpugas;
 
 
+{ Range check must be disabled explicitly as conversions between signed and unsigned
+  32-bit values are done without explicit typecasts }
+{$R-}
 
 
     function opname(var p: tai): string;
     function opname(var p: tai): string;
       begin
       begin
@@ -163,8 +166,10 @@ unit aoptcpu;
                     if MatchOperand(taicpu(p).oper[0]^,taicpu(p).oper[1]^) then
                     if MatchOperand(taicpu(p).oper[0]^,taicpu(p).oper[1]^) then
                       begin
                       begin
                         DebugMsg('Optimizer: '+opstr+' + '+opstr+' removed',p);
                         DebugMsg('Optimizer: '+opstr+' + '+opstr+' removed',p);
+			GetNextInstruction(p,next);
                         asml.remove(p);
                         asml.remove(p);
                         p.free;
                         p.free;
+			p:=next;
                       end
                       end
                     else
                     else
                       DebugMsg('Optimizer: '+opstr+' + '+opstr+' to '+opstr+' #1',p)
                       DebugMsg('Optimizer: '+opstr+' + '+opstr+' to '+opstr+' #1',p)
@@ -266,8 +271,10 @@ unit aoptcpu;
                    (taicpu(p).oper[0]^.ref^.offset = 0) then
                    (taicpu(p).oper[0]^.ref^.offset = 0) then
                   begin
                   begin
                     DebugMsg('Optimizer: LEA 0(Ax),Ax removed',p);
                     DebugMsg('Optimizer: LEA 0(Ax),Ax removed',p);
+		    GetNextInstruction(p,next);
                     asml.remove(p);
                     asml.remove(p);
                     p.free;
                     p.free;
+		    p:=next;
                     result:=true;
                     result:=true;
                   end;
                   end;
               { Address register sub/add can be replaced with ADDQ/SUBQ or LEA if the value is in the
               { Address register sub/add can be replaced with ADDQ/SUBQ or LEA if the value is in the