Преглед изворни кода

* constantified hardcoded minimum stackframe size required by the (powerpc64/linux) ABI

git-svn-id: trunk@8567 -
tom_at_work пре 18 година
родитељ
комит
73b88f4d46
3 измењених фајлова са 7 додато и 5 уклоњено
  1. 2 3
      compiler/powerpc64/cgcpu.pas
  2. 3 0
      compiler/powerpc64/cpubase.pas
  3. 2 2
      compiler/powerpc64/cpupi.pas

+ 2 - 3
compiler/powerpc64/cgcpu.pas

@@ -1897,18 +1897,17 @@ begin
   mtlr r0
   blr
 
-  TODO: put "112" magic constant (minimum stack frame size on ppc64)  into constant
   }
   list.concat(taicpu.op_reg(A_MFLR, NR_R0));
   reference_reset_base(href, NR_STACK_POINTER_REG, 16);
   list.concat(taicpu.op_reg_ref(A_STD, NR_R0, href));
-  reference_reset_base(href, NR_STACK_POINTER_REG, -112);
+  reference_reset_base(href, NR_STACK_POINTER_REG, -MINIMUM_STACKFRAME_SIZE);
   list.concat(taicpu.op_reg_ref(A_STDU, NR_STACK_POINTER_REG, href));
 
   list.concat(taicpu.op_sym(A_BL, current_asmdata.RefAsmSymbol(externalname)));
   list.concat(taicpu.op_none(A_NOP));
 
-  list.concat(taicpu.op_reg_reg_const(A_ADDI, NR_STACK_POINTER_REG, NR_STACK_POINTER_REG, 112));
+  list.concat(taicpu.op_reg_reg_const(A_ADDI, NR_STACK_POINTER_REG, NR_STACK_POINTER_REG, MINIMUM_STACKFRAME_SIZE));
 
   reference_reset_base(href, NR_STACK_POINTER_REG, LA_LR_ELF);
   list.concat(taicpu.op_reg_ref(A_LD, NR_R0, href));

+ 3 - 0
compiler/powerpc64/cpubase.pas

@@ -378,6 +378,9 @@ const
   { the size of the "red zone" which must not be changed by asynchronous calls
    in the stack frame and can be used for storing temps }
   RED_ZONE_SIZE = 288;
+  
+  { minimum size of the stack frame if one exists }
+  MINIMUM_STACKFRAME_SIZE = 112;
 
   {*****************************************************************************
                                     Helpers

+ 2 - 2
compiler/powerpc64/cpupi.pas

@@ -74,8 +74,8 @@ begin
     { the ABI specification says that it is required to always allocate space for 8 * 8 bytes
       for registers R3-R10 and stack header if there's a stack frame, but GCC doesn't do that,
       so we don't that too. Uncomment the next three lines if this is required }
-    if (cs_profile in init_settings.moduleswitches) and (ofs < 112) then begin
-      ofs := 112;
+    if (cs_profile in init_settings.moduleswitches) and (ofs < MINIMUM_STACKFRAME_SIZE) then begin
+      ofs := MINIMUM_STACKFRAME_SIZE;
     end;
     tg.setfirsttemp(ofs);
   end else begin