Преглед изворни кода

* remove useless mov instructions

git-svn-id: trunk@30522 -
florian пре 10 година
родитељ
комит
a4c7103033
1 измењених фајлова са 15 додато и 1 уклоњено
  1. 15 1
      compiler/avr/aoptcpu.pas

+ 15 - 1
compiler/avr/aoptcpu.pas

@@ -271,6 +271,20 @@ Implementation
                       p:=hp1;
                       result:=true;
                     end
+                  { remove
+                    mov reg0,reg0
+                  }
+                  else if (taicpu(p).ops=2) and
+                     (taicpu(p).oper[0]^.typ = top_reg) and
+                     (taicpu(p).oper[1]^.typ = top_reg) and
+                     (taicpu(p).oper[0]^.reg = taicpu(p).oper[1]^.reg) then
+                    begin
+                      GetNextInstruction(p,hp1);
+                      asml.remove(p);
+                      p.free;
+                      p:=hp1;
+                      result:=true;
+                    end
                   { fold
                     mov reg2,reg0
                     mov reg3,reg1
@@ -302,7 +316,7 @@ Implementation
                       taicpu(p).opcode:=A_MOVW;
                       asml.remove(hp1);
                       hp1.free;
-                      result := true;
+                      result:=true;
                     end;
                 end;
             end;