From bd0cafd545ff1c2d0cf8c4e4057c14e98467d710 Mon Sep 17 00:00:00 2001 From: yury Date: Thu, 12 Jul 2007 21:55:34 +0000 Subject: [PATCH] * fixed ARM stackframe optimization when float registers are used. git-svn-id: trunk@8032 - --- compiler/arm/cgcpu.pas | 12 ++++++------ compiler/arm/cpupi.pas | 4 +++- compiler/psub.pas | 3 --- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/compiler/arm/cgcpu.pas b/compiler/arm/cgcpu.pas index 114a7411a1..72e7b6a87c 100644 --- a/compiler/arm/cgcpu.pas +++ b/compiler/arm/cgcpu.pas @@ -1304,15 +1304,15 @@ unit cgcpu; if firstfloatreg<>RS_NO then begin reference_reset(ref); - if tarmprocinfo(current_procinfo).floatregstart<=-1023 then + if tg.direction*tarmprocinfo(current_procinfo).floatregstart>=1023 then begin a_load_const_reg(list,OS_ADDR,-tarmprocinfo(current_procinfo).floatregstart,NR_R12); - list.concat(taicpu.op_reg_reg_reg(A_SUB,NR_R12,NR_FRAME_POINTER_REG,NR_R12)); + list.concat(taicpu.op_reg_reg_reg(A_SUB,NR_R12,current_procinfo.framepointer,NR_R12)); ref.base:=NR_R12; end else begin - ref.base:=NR_FRAME_POINTER_REG; + ref.base:=current_procinfo.framepointer; ref.offset:=tarmprocinfo(current_procinfo).floatregstart; end; list.concat(taicpu.op_reg_const_ref(A_SFM,newreg(R_FPUREGISTER,firstfloatreg,R_SUBWHOLE), @@ -1347,15 +1347,15 @@ unit cgcpu; if firstfloatreg<>RS_NO then begin reference_reset(ref); - if tarmprocinfo(current_procinfo).floatregstart<=-1023 then + if tg.direction*tarmprocinfo(current_procinfo).floatregstart>=1023 then begin a_load_const_reg(list,OS_ADDR,-tarmprocinfo(current_procinfo).floatregstart,NR_R12); - list.concat(taicpu.op_reg_reg_reg(A_SUB,NR_R12,NR_FRAME_POINTER_REG,NR_R12)); + list.concat(taicpu.op_reg_reg_reg(A_SUB,NR_R12,current_procinfo.framepointer,NR_R12)); ref.base:=NR_R12; end else begin - ref.base:=NR_FRAME_POINTER_REG; + ref.base:=current_procinfo.framepointer; ref.offset:=tarmprocinfo(current_procinfo).floatregstart; end; list.concat(taicpu.op_reg_const_ref(A_LFM,newreg(R_FPUREGISTER,firstfloatreg,R_SUBWHOLE), diff --git a/compiler/arm/cpupi.pas b/compiler/arm/cpupi.pas index f8ac1c2240..ef02d5063a 100644 --- a/compiler/arm/cpupi.pas +++ b/compiler/arm/cpupi.pas @@ -91,7 +91,9 @@ unit cpupi; floatsavesize:=0; floatsavesize:=align(floatsavesize,max(current_settings.alignment.localalignmin,4)); result:=Align(tg.direction*tg.lasttemp,max(current_settings.alignment.localalignmin,4))+maxpushedparasize+floatsavesize; - floatregstart:=-result+maxpushedparasize; + floatregstart:=tg.direction*result+maxpushedparasize; + if tg.direction=1 then + dec(floatregstart,floatsavesize); end; diff --git a/compiler/psub.pas b/compiler/psub.pas index 39fb1a6032..3ab9f90cef 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -846,9 +846,6 @@ implementation ((flags*[pi_has_assembler_block,pi_uses_exceptions,pi_is_assembler, pi_needs_implicit_finally,pi_has_implicit_finally,pi_has_stackparameter, pi_needs_stackframe])=[]) - {$ifdef arm} - and ((cs_fp_emulation in current_settings.moduleswitches) or not (pi_uses_fpu in flags)) - {$endif arm} ) then begin