Browse Source

* patch by Nico Erfurth: Check for register reloading in RegUsedAfterInstruction on ARM
This slightly changes the semantics of RegUsedAfterInstruction.
We now check if the `current value` of the register will be used later.
It will do `the right thing` for all the normal use cases.

git-svn-id: trunk@21519 -

florian 13 years ago
parent
commit
5b02a7cb9b
1 changed files with 7 additions and 4 deletions
  1. 7 4
      compiler/arm/aoptcpu.pas

+ 7 - 4
compiler/arm/aoptcpu.pas

@@ -190,10 +190,13 @@ Implementation
     begin
       AllUsedRegs[getregtype(reg)].Update(tai(p.Next));
       RegUsedAfterInstruction :=
-        (AllUsedRegs[getregtype(reg)].IsUsed(reg)) and
-           (not(getNextInstruction(p,p)) or
-            instructionLoadsFromReg(reg,p) or
-            not(regLoadedWithNewValue(reg,p)));
+        AllUsedRegs[getregtype(reg)].IsUsed(reg) and
+        not(regLoadedWithNewValue(reg,p)) and
+        (
+          not(GetNextInstruction(p,p)) or
+          instructionLoadsFromReg(reg,p) or
+          not(regLoadedWithNewValue(reg,p))
+        );
     end;
 
   procedure TCpuAsmOptimizer.RemoveSuperfluousMove(const p: tai; movp: tai; const optimizer: string);