mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 15:39:26 +01:00
* moved ARM/x86 ifdef'ed code from ncgcal to virtual methods
git-svn-id: trunk@24179 -
This commit is contained in:
parent
3a03586ca9
commit
8b8a786823
@ -38,8 +38,8 @@ implementation
|
||||
uses
|
||||
verbose,globtype,globals,aasmdata,
|
||||
symconst,
|
||||
cgbase,cpuinfo,
|
||||
ncgutil,
|
||||
cgbase,cgutils,cpuinfo,
|
||||
ncgutil,tgobj,
|
||||
systems;
|
||||
|
||||
procedure tarmcallnode.set_result_location(realresdef: tstoreddef);
|
||||
@ -64,6 +64,13 @@ implementation
|
||||
internalerror(2010053008);
|
||||
end
|
||||
end
|
||||
else if (resultdef.typ=floatdef) and
|
||||
(location.loc=LOC_REGISTER) and
|
||||
(current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) then
|
||||
begin
|
||||
location_reset_ref(location,LOC_REFERENCE,location.size,resultdef.alignment);
|
||||
tg.gethltemp(current_asmdata.CurrAsmList,resultdef,resultdef.size,tt_normal,location.reference);
|
||||
end
|
||||
else
|
||||
inherited;
|
||||
end;
|
||||
|
||||
@ -103,9 +103,6 @@ implementation
|
||||
cgbase,pass_2,
|
||||
aasmbase,aasmtai,aasmdata,
|
||||
nbas,nmem,nld,ncnv,nutils,
|
||||
{$ifdef x86}
|
||||
cga,cgx86,aasmcpu,
|
||||
{$endif x86}
|
||||
ncgutil,
|
||||
cgobj,tgobj,hlcgobj,
|
||||
procinfo,
|
||||
@ -477,42 +474,21 @@ implementation
|
||||
else
|
||||
realresdef:=tstoreddef(typedef);
|
||||
|
||||
{$ifdef x86}
|
||||
if (retloc.location^.loc=LOC_FPUREGISTER) then
|
||||
begin
|
||||
tcgx86(cg).inc_fpu_stack;
|
||||
location_reset(location,LOC_FPUREGISTER,retloc.location^.size);
|
||||
location.register:=retloc.location^.register;
|
||||
end
|
||||
else
|
||||
{$endif x86}
|
||||
begin
|
||||
{ get a tlocation that can hold the return value that's currently in
|
||||
the the return value's tcgpara }
|
||||
set_result_location(realresdef);
|
||||
{ get a tlocation that can hold the return value that's currently in
|
||||
the return value's tcgpara }
|
||||
set_result_location(realresdef);
|
||||
|
||||
{ Do not move the physical register to a virtual one in case
|
||||
the return value is not used, because if the virtual one is
|
||||
then mapped to the same register as the physical one, we will
|
||||
end up with two deallocs of this register (one inserted here,
|
||||
one inserted by the register allocator), which unbalances the
|
||||
register allocation information. The return register(s) will
|
||||
be freed by location_free() in release_unused_return_value
|
||||
(mantis #13536). }
|
||||
if (cnf_return_value_used in callnodeflags) or
|
||||
assigned(funcretnode) then
|
||||
begin
|
||||
hlcg.gen_load_cgpara_loc(current_asmdata.CurrAsmList,realresdef,retloc,location,false);
|
||||
{$ifdef arm}
|
||||
if (resultdef.typ=floatdef) and
|
||||
(location.loc=LOC_REGISTER) and
|
||||
(current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) then
|
||||
begin
|
||||
hlcg.location_force_mem(current_asmdata.CurrAsmList,location,resultdef);
|
||||
end;
|
||||
{$endif arm}
|
||||
end;
|
||||
end;
|
||||
{ Do not move the physical register to a virtual one in case
|
||||
the return value is not used, because if the virtual one is
|
||||
then mapped to the same register as the physical one, we will
|
||||
end up with two deallocs of this register (one inserted here,
|
||||
one inserted by the register allocator), which unbalances the
|
||||
register allocation information. The return register(s) will
|
||||
be freed by location_free() in release_unused_return_value
|
||||
(mantis #13536). }
|
||||
if (cnf_return_value_used in callnodeflags) or
|
||||
assigned(funcretnode) then
|
||||
hlcg.gen_load_cgpara_loc(current_asmdata.CurrAsmList,realresdef,retloc,location,false);
|
||||
|
||||
{ copy value to the final location if this was already provided to the
|
||||
callnode. This must be done after the call node, because the location can
|
||||
|
||||
@ -28,6 +28,7 @@ interface
|
||||
{ $define AnsiStrRef}
|
||||
|
||||
uses
|
||||
symdef,
|
||||
ncgcal;
|
||||
|
||||
type
|
||||
@ -37,6 +38,7 @@ interface
|
||||
tx86callnode = class(tcgcallnode)
|
||||
protected
|
||||
procedure do_release_unused_return_value;override;
|
||||
procedure set_result_location(realresdef: tstoreddef);override;
|
||||
end;
|
||||
|
||||
|
||||
@ -44,7 +46,7 @@ implementation
|
||||
|
||||
uses
|
||||
cgobj,
|
||||
cgbase,cpubase,cgx86,cga;
|
||||
cgbase,cgutils,cpubase,cgx86,cga;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
@ -66,4 +68,17 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
procedure tx86callnode.set_result_location(realresdef: tstoreddef);
|
||||
begin
|
||||
if (retloc.location^.loc=LOC_FPUREGISTER) then
|
||||
begin
|
||||
tcgx86(cg).inc_fpu_stack;
|
||||
location_reset(location,LOC_FPUREGISTER,retloc.location^.size);
|
||||
location.register:=retloc.location^.register;
|
||||
end
|
||||
else
|
||||
inherited set_result_location(realresdef);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user