From 9c9684b3a35709238e0b03d92b38afd7bb6ab685 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Thu, 15 Feb 2007 21:12:44 +0000 Subject: [PATCH] * r6498 for ppc64 git-svn-id: trunk@6502 - --- compiler/powerpc64/cgcpu.pas | 6 ++++-- compiler/powerpc64/cpupi.pas | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/compiler/powerpc64/cgcpu.pas b/compiler/powerpc64/cgcpu.pas index 42125b91ae..14284f1a16 100644 --- a/compiler/powerpc64/cgcpu.pas +++ b/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 diff --git a/compiler/powerpc64/cpupi.pas b/compiler/powerpc64/cpupi.pas index dca4419085..4f69165287 100644 --- a/compiler/powerpc64/cpupi.pas +++ b/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