mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-19 04:09:20 +02:00
+ arm thumb: tarmloadparentfpnode moves the stack pointer to a different register to avoid illegal instruction encodings
git-svn-id: trunk@24201 -
This commit is contained in:
parent
e41b7b1b94
commit
36a32e153d
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user