Browse Source

* fixes reference handling for arm thumb and ldrh, not perfect yet

git-svn-id: trunk@28568 -
florian 11 years ago
parent
commit
8a7c16327c
1 changed files with 13 additions and 2 deletions
  1. 13 2
      compiler/arm/cgcpu.pas

+ 13 - 2
compiler/arm/cgcpu.pas

@@ -4074,8 +4074,19 @@ unit cgcpu;
              ((op=A_LDRB) and (oppostfix=PF_None))) and
              ((op=A_LDRB) and (oppostfix=PF_None))) and
             ((ref.base=NR_STACK_POINTER_REG) or
             ((ref.base=NR_STACK_POINTER_REG) or
              (ref.index=NR_STACK_POINTER_REG) or
              (ref.index=NR_STACK_POINTER_REG) or
-             (abs(ref.offset)>31))
-            ) then
+             (abs(ref.offset)>31)
+            )
+           ) or
+           { LDRH limitations }
+           (
+            (((op=A_LDR) and (oppostfix=PF_H)) or
+             ((op=A_LDRH) and (oppostfix=PF_None))) and
+            ((ref.base=NR_STACK_POINTER_REG) or
+             (ref.index=NR_STACK_POINTER_REG) or
+             (abs(ref.offset)>62) or
+             ((abs(ref.offset) mod 2)<>0)
+            )
+           ) then
           begin
           begin
             tmpreg:=getintregister(list,OS_ADDR);
             tmpreg:=getintregister(list,OS_ADDR);
             a_loadaddr_ref_reg(list,ref,tmpreg);
             a_loadaddr_ref_reg(list,ref,tmpreg);