Browse Source

* use r11 as a normal register if no frame pointer is needed

git-svn-id: trunk@21834 -
florian 13 years ago
parent
commit
95732625cc
1 changed files with 10 additions and 3 deletions
  1. 10 3
      compiler/arm/cgcpu.pas

+ 10 - 3
compiler/arm/cgcpu.pas

@@ -211,9 +211,16 @@ unit cgcpu;
         inherited init_register_allocators;
         inherited init_register_allocators;
         { currently, we always save R14, so we can use it }
         { currently, we always save R14, so we can use it }
         if (target_info.system<>system_arm_darwin) then
         if (target_info.system<>system_arm_darwin) then
-          rg[R_INTREGISTER]:=trgintcpu.create(R_INTREGISTER,R_SUBWHOLE,
-              [RS_R0,RS_R1,RS_R2,RS_R3,RS_R12,RS_R4,RS_R5,RS_R6,RS_R7,RS_R8,
-               RS_R9,RS_R10,RS_R14],first_int_imreg,[])
+            begin
+              if assigned(current_procinfo) and (current_procinfo.framepointer<>NR_R11) then
+                rg[R_INTREGISTER]:=trgintcpu.create(R_INTREGISTER,R_SUBWHOLE,
+                    [RS_R0,RS_R1,RS_R2,RS_R3,RS_R12,RS_R4,RS_R5,RS_R6,RS_R7,RS_R8,
+                     RS_R9,RS_R10,RS_R11,RS_R14],first_int_imreg,[])
+              else
+                rg[R_INTREGISTER]:=trgintcpu.create(R_INTREGISTER,R_SUBWHOLE,
+                    [RS_R0,RS_R1,RS_R2,RS_R3,RS_R12,RS_R4,RS_R5,RS_R6,RS_R7,RS_R8,
+                     RS_R9,RS_R10,RS_R14],first_int_imreg,[])
+            end
         else
         else
           { r7 is not available on Darwin, it's used as frame pointer (always,
           { r7 is not available on Darwin, it's used as frame pointer (always,
             for backtrace support -- also in gcc/clang -> R11 can be used).
             for backtrace support -- also in gcc/clang -> R11 can be used).