浏览代码

* TARMAsmOptimizer.RemoveSuperfluousMove should not mess with PC

git-svn-id: trunk@44842 -
florian 5 年之前
父节点
当前提交
db19900eb1
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      compiler/armgen/aoptarm.pas

+ 3 - 1
compiler/armgen/aoptarm.pas

@@ -200,10 +200,12 @@ Implementation
         { the destination register of the mov might not be used beween p and movp }
         { the destination register of the mov might not be used beween p and movp }
         not(RegUsedBetween(taicpu(movp).oper[0]^.reg,p,movp)) and
         not(RegUsedBetween(taicpu(movp).oper[0]^.reg,p,movp)) and
 {$ifdef ARM}
 {$ifdef ARM}
+        { PC should be changed only by moves }
+        (taicpu(movp).oper[0]^.reg<>NR_PC) and
         { cb[n]z are thumb instructions which require specific registers, with no wide forms }
         { cb[n]z are thumb instructions which require specific registers, with no wide forms }
         (taicpu(p).opcode<>A_CBZ) and
         (taicpu(p).opcode<>A_CBZ) and
         (taicpu(p).opcode<>A_CBNZ) and
         (taicpu(p).opcode<>A_CBNZ) and
-        {There is a special requirement for MUL and MLA, oper[0] and oper[1] are not allowed to be the same}
+        { There is a special requirement for MUL and MLA, oper[0] and oper[1] are not allowed to be the same }
         not (
         not (
           (taicpu(p).opcode in [A_MLA, A_MUL]) and
           (taicpu(p).opcode in [A_MLA, A_MUL]) and
           (taicpu(p).oper[1]^.reg = taicpu(movp).oper[0]^.reg) and
           (taicpu(p).oper[1]^.reg = taicpu(movp).oper[0]^.reg) and