From 36a32e153d193b5c341fe0d08360e37aa3069bf9 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 7 Apr 2013 21:29:12 +0000 Subject: [PATCH] + arm thumb: tarmloadparentfpnode moves the stack pointer to a different register to avoid illegal instruction encodings git-svn-id: trunk@24201 - --- compiler/arm/narmmem.pas | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/compiler/arm/narmmem.pas b/compiler/arm/narmmem.pas index 908ef3504d..999f6e919f 100644 --- a/compiler/arm/narmmem.pas +++ b/compiler/arm/narmmem.pas @@ -30,6 +30,11 @@ interface cgbase,cpubase,nmem,ncgmem; type + tarmloadparentfpnode = class(tcgloadparentfpnode) + procedure pass_generate_code; override; + end; + + tarmvecnode = class(tcgvecnode) procedure update_reference_reg_mul(maybe_const_reg: tregister; l: aint);override; end; @@ -38,7 +43,28 @@ implementation uses cutils,verbose,globals,aasmdata,aasmcpu,cgobj, - cpuinfo; + cpuinfo, + cgutils, + procinfo; + +{***************************************************************************** + TARMLOADPARENTFPNODE +*****************************************************************************} + + procedure tarmloadparentfpnode.pass_generate_code; + begin + { normally, we cannot use the stack pointer as normal register on arm thumb } + if (current_settings.cputype in cpu_thumb) and + (getsupreg(current_procinfo.framepointer) in [RS_R8..RS_R15]) and + (current_procinfo.procdef.parast.symtablelevel=parentpd.parast.symtablelevel) then + begin + location_reset(location,LOC_REGISTER,OS_ADDR); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,current_procinfo.framepointer,location.register); + end + else + inherited pass_generate_code; + end; {***************************************************************************** TARMVECNODE @@ -84,4 +110,5 @@ implementation begin cvecnode:=tarmvecnode; + cloadparentfpnode:=tarmloadparentfpnode; end.