Browse Source

* adjust the reg. allocations of the target register in RemoveSuperfluousMove

git-svn-id: trunk@22194 -
florian 13 years ago
parent
commit
a92ca7c456
1 changed files with 12 additions and 0 deletions
  1. 12 0
      compiler/arm/aoptcpu.pas

+ 12 - 0
compiler/arm/aoptcpu.pas

@@ -315,6 +315,18 @@ Implementation
               else
               else
                 asml.InsertAfter(dealloc,p);
                 asml.InsertAfter(dealloc,p);
 
 
+              { try to move the allocation of the target register }
+              GetLastInstruction(movp,hp1);
+              alloc:=FindRegAlloc(taicpu(movp).oper[0]^.reg,tai(hp1.Next));
+              if assigned(alloc) then
+                begin
+                  asml.Remove(alloc);
+                  asml.InsertBefore(alloc,p);
+                  { adjust used regs }
+                  IncludeRegInUsedRegs(taicpu(movp).oper[0]^.reg,UsedRegs);
+                end;
+
+              { finally get rid of the mov }
               taicpu(p).loadreg(0,taicpu(movp).oper[0]^.reg);
               taicpu(p).loadreg(0,taicpu(movp).oper[0]^.reg);
               asml.remove(movp);
               asml.remove(movp);
               movp.free;
               movp.free;