Browse Source

* r6498 for ppc64

git-svn-id: trunk@6502 -
Jonas Maebe 18 years ago
parent
commit
9c9684b3a3
2 changed files with 12 additions and 4 deletions
  1. 4 2
      compiler/powerpc64/cgcpu.pas
  2. 8 2
      compiler/powerpc64/cpupi.pas

+ 4 - 2
compiler/powerpc64/cgcpu.pas

@@ -1451,7 +1451,8 @@ begin
   end;
 
   { create stack frame }
-  if (not nostackframe) and (localsize > 0) then begin
+  if (not nostackframe) and (localsize > 0) and
+     tppcprocinfo(current_procinfo).needstackframe then begin
     if (localsize <= high(smallint)) then begin
       reference_reset_base(href, NR_STACK_POINTER_REG, -localsize);
       a_load_store(list, A_STDU, NR_STACK_POINTER_REG, href);
@@ -1580,7 +1581,8 @@ begin
   { CR register not supported }
 
   { restore stack pointer }
-  if (not nostackframe) and (localsize > 0) then begin
+  if (not nostackframe) and (localsize > 0) and
+    tppcprocinfo(current_procinfo).needstackframe then begin
     if (localsize <= high(smallint)) then begin
       list.concat(taicpu.op_reg_reg_const(A_ADDI, NR_STACK_POINTER_REG, NR_STACK_POINTER_REG, localsize));
     end else begin

+ 8 - 2
compiler/powerpc64/cpupi.pas

@@ -33,6 +33,8 @@ uses
 
 type
   tppcprocinfo = class(tcgprocinfo)
+    needstackframe: boolean;
+
     { offset where the frame pointer from the outer procedure is stored. }
     parent_framepointer_offset: longint;
     constructor create(aparent: tprocinfo); override;
@@ -100,9 +102,13 @@ begin
     if (pi_do_call in flags) or (tg.lasttemp <> tg.firsttemp) or
       (result > RED_ZONE_SIZE) {or (cs_profile in init_settings.moduleswitches)} then begin
       result := align(result + tg.lasttemp, ELF_STACK_ALIGN);
-    end;
-  end else
+      needstackframe:=true;
+    end else
+      needstackframe:=false;
+  end else begin
     result := align(tg.lasttemp, ELF_STACK_ALIGN);
+    needstackframe:=result<>0;
+  end;
 end;
 
 begin