Pārlūkot izejas kodu

* patch by Jeppe Johansen to avoid corruption of frame/stack pointer by pre/post indexed operations, resolves #19679

git-svn-id: trunk@18234 -
florian 14 gadi atpakaļ
vecāks
revīzija
d6ad7721e6
1 mainītis faili ar 23 papildinājumiem un 0 dzēšanām
  1. 23 0
      compiler/arm/rgcpu.pas

+ 23 - 0
compiler/arm/rgcpu.pas

@@ -62,6 +62,8 @@ unit rgcpu;
       procinfo;
 
     procedure trgintcputhumb2.add_cpu_interferences(p: tai);
+      var
+        r : tregister;
       begin
         if p.typ=ait_instruction then
           begin
@@ -95,6 +97,27 @@ unit rgcpu;
                         end;
                     end;
                 end;
+              A_LDRB,
+              A_STRB,
+              A_STR,
+              A_LDR,
+              A_LDRH,
+              A_STRH,
+              A_LDRSB,
+              A_LDRSH,
+              A_LDRD,
+              A_STRD:
+                { don't mix up the framepointer and stackpointer with pre/post indexed operations }
+                if (taicpu(p).oper[1]^.typ=top_ref) and
+                  (taicpu(p).oper[1]^.ref^.addressmode in [AM_PREINDEXED,AM_POSTINDEXED]) then
+                  begin
+                    add_edge(getsupreg(taicpu(p).oper[1]^.ref^.base),getsupreg(current_procinfo.framepointer));
+                    { FIXME: temp variable r is needed here to avoid Internal error 20060521 }
+                    {        while compiling the compiler. }
+                    r:=NR_STACK_POINTER_REG;
+                    if current_procinfo.framepointer<>r then
+                      add_edge(getsupreg(taicpu(p).oper[1]^.ref^.base),getsupreg(r));
+                  end;
             end;
           end;
       end;