diff --git a/compiler/powerpc/cgcpu.pas b/compiler/powerpc/cgcpu.pas index 05a0bb08fb..2d770f4f92 100644 --- a/compiler/powerpc/cgcpu.pas +++ b/compiler/powerpc/cgcpu.pas @@ -1,4 +1,4 @@ - { +{ Copyright (c) 1998-2002 by Florian Klaempfl This unit implements the code generator for the PowerPC @@ -1055,6 +1055,7 @@ const *) if (not nostackframe) and + tppcprocinfo(current_procinfo).needstackframe and (localsize <> 0) then begin if (localsize <= high(smallint)) then @@ -1118,6 +1119,7 @@ const { is translated into a move, which is then registered with the register } { allocator, causing a crash } if (not nostackframe) and + tppcprocinfo(current_procinfo).needstackframe and (localsize <> 0) then a_op_const_reg(list,OP_ADD,OS_ADDR,localsize,NR_R1); diff --git a/compiler/powerpc/cpupi.pas b/compiler/powerpc/cpupi.pas index a06a4d8ead..4d1a5a5811 100644 --- a/compiler/powerpc/cpupi.pas +++ b/compiler/powerpc/cpupi.pas @@ -34,6 +34,8 @@ unit cpupi; 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; @@ -167,11 +169,17 @@ unit cpupi; ((32-first_save_int_reg)*4+(32-first_save_fpu_reg)*8 <= 220)) or ((target_info.abi = abi_powerpc_sysv) and (first_save_int_reg + first_save_fpu_reg = 64))) then - { don't allocate a stack frame } - result := (32-first_save_int_reg)*4+(32-first_save_fpu_reg)*8 + begin + { don't allocate a stack frame } + result := (32-first_save_int_reg)*4+(32-first_save_fpu_reg)*8; + needstackframe := false; + end else - result := (32-first_save_int_reg)*4+(32-first_save_fpu_reg)*8+tg.lasttemp; - result := align(result,16); + begin + result := (32-first_save_int_reg)*4+(32-first_save_fpu_reg)*8+tg.lasttemp; + result := align(result,16); + needstackframe := result<>0; + end; end else result := align(tg.lasttemp,16);