mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 17:49:27 +02:00
* factored out releasing an unused return value into
release_unused_return_value_cpu(), so it can be cleanly overridden by cpu-specific code git-svn-id: branches/jvmbackend@18322 -
This commit is contained in:
parent
817ebe5d8d
commit
b837694207
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -656,6 +656,7 @@ compiler/x86/hlcgx86.pas svneol=native#text/plain
|
||||
compiler/x86/itcpugas.pas svneol=native#text/plain
|
||||
compiler/x86/itx86int.pas svneol=native#text/plain
|
||||
compiler/x86/nx86add.pas svneol=native#text/plain
|
||||
compiler/x86/nx86cal.pas svneol=native#text/plain
|
||||
compiler/x86/nx86cnv.pas svneol=native#text/plain
|
||||
compiler/x86/nx86con.pas svneol=native#text/plain
|
||||
compiler/x86/nx86inl.pas svneol=native#text/plain
|
||||
|
@ -28,10 +28,10 @@ interface
|
||||
{ $define AnsiStrRef}
|
||||
|
||||
uses
|
||||
ncgcal;
|
||||
nx86cal;
|
||||
|
||||
type
|
||||
ti386callnode = class(tcgcallnode)
|
||||
ti386callnode = class(tx86callnode)
|
||||
protected
|
||||
procedure pop_parasize(pop_size:longint);override;
|
||||
procedure extra_interrupt_code;override;
|
||||
|
@ -75,6 +75,11 @@ interface
|
||||
can work with it. This routine decides what the most appropriate
|
||||
tlocation is and sets self.location based on that. }
|
||||
procedure set_result_location(realresdef: tstoreddef);virtual;
|
||||
|
||||
{ if an unused return value is in another location than a
|
||||
LOC_REFERENCE, this method will be called to perform the necessary
|
||||
cleanups. By default it does not do anything }
|
||||
procedure release_unused_return_value_cpu;virtual;
|
||||
public
|
||||
procedure pass_generate_code;override;
|
||||
destructor destroy;override;
|
||||
@ -309,6 +314,12 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
procedure tcgcallnode.release_unused_return_value_cpu;
|
||||
begin
|
||||
{ do nothing }
|
||||
end;
|
||||
|
||||
|
||||
procedure tcgcallnode.pop_parasize(pop_size:longint);
|
||||
begin
|
||||
end;
|
||||
@ -431,14 +442,8 @@ implementation
|
||||
cg.g_finalize(current_asmdata.CurrAsmList,resultdef,location.reference);
|
||||
tg.ungetiftemp(current_asmdata.CurrAsmList,location.reference);
|
||||
end;
|
||||
{$ifdef x86}
|
||||
LOC_FPUREGISTER :
|
||||
begin
|
||||
{ release FPU stack }
|
||||
emit_reg(A_FSTP,S_NO,NR_FPU_RESULT_REG);
|
||||
tcgx86(cg).dec_fpu_stack;
|
||||
end;
|
||||
{$endif x86}
|
||||
else
|
||||
release_unused_return_value_cpu;
|
||||
end;
|
||||
if (retloc.intsize<>0) then
|
||||
paramanager.freecgpara(current_asmdata.CurrAsmList,retloc);
|
||||
|
67
compiler/x86/nx86cal.pas
Normal file
67
compiler/x86/nx86cal.pas
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
Copyright (c) 1998-2002 by Florian Klaempfl
|
||||
|
||||
Common x86 support for call nodes
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
****************************************************************************
|
||||
}
|
||||
unit nx86cal;
|
||||
|
||||
{$i fpcdefs.inc}
|
||||
|
||||
interface
|
||||
|
||||
{ $define AnsiStrRef}
|
||||
|
||||
uses
|
||||
ncgcal;
|
||||
|
||||
type
|
||||
|
||||
{ tx86callnode }
|
||||
|
||||
tx86callnode = class(tcgcallnode)
|
||||
protected
|
||||
procedure release_unused_return_value_cpu;override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
cgobj,
|
||||
cgbase,cpubase,cgx86,cga;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
TX86CALLNODE
|
||||
*****************************************************************************}
|
||||
|
||||
procedure tx86callnode.release_unused_return_value_cpu;
|
||||
begin
|
||||
case location.loc of
|
||||
LOC_FPUREGISTER :
|
||||
begin
|
||||
{ release FPU stack }
|
||||
emit_reg(A_FSTP,S_NO,NR_FPU_RESULT_REG);
|
||||
tcgx86(cg).dec_fpu_stack;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
@ -27,10 +27,10 @@ interface
|
||||
|
||||
uses
|
||||
symdef,
|
||||
ncal,ncgcal;
|
||||
ncal,nx86cal;
|
||||
|
||||
type
|
||||
tx8664callnode = class(tcgcallnode)
|
||||
tx8664callnode = class(tx86callnode)
|
||||
protected
|
||||
procedure extra_call_code;override;
|
||||
procedure set_result_location(realresdef: tstoreddef);override;
|
||||
|
Loading…
Reference in New Issue
Block a user