From cf823b06514b909a94a8183a00c43347cf9c6a5c Mon Sep 17 00:00:00 2001 From: jonas Date: Wed, 11 Jul 2012 08:25:58 +0000 Subject: * let thlcg.a_call_name() return the tcgpara representing the function result location (NR_FUNCTION_RESULT_REG is not valid on all platforms) o this requires passing the forced function result type (if any) to this method o a generic, basic thlcg.a_call_name() is now available that sets the function result location; can be called by descendants * the availability under all circumstances of the correct function return type enables g_call_system_proc() on the JVM platform to now determine by itself how many stack slots are removed by the call -> do so, instead of manually counting them (or forgetting to do so and messing up the maximum evaluation stack height calculations) git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@21862 3ad0048d-3df7-0310-abae-a5850022a9f2 --- compiler/mips/hlcgcpu.pas | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'compiler/mips/hlcgcpu.pas') diff --git a/compiler/mips/hlcgcpu.pas b/compiler/mips/hlcgcpu.pas index ad03bee126..a0f243538c 100644 --- a/compiler/mips/hlcgcpu.pas +++ b/compiler/mips/hlcgcpu.pas @@ -32,12 +32,12 @@ uses globtype, aasmbase, aasmdata, cgbase, cgutils, - symdef, - hlcgobj, hlcg2ll; + symtype,symdef, + parabase, hlcgobj, hlcg2ll; type - thlcg2mips = class(thlcg2ll) - procedure a_call_name(list: TAsmList; pd: tprocdef; const s: TSymStr; weak: boolean);override; + thlcgmips = class(thlcg2ll) + function a_call_name(list: TAsmList; pd: tprocdef; const s: TSymStr; forceresdef: tdef; weak: boolean): tcgpara; override; procedure a_call_reg(list : TAsmList;pd : tabstractprocdef;reg : tregister);override; procedure a_call_ref(list : TAsmList;pd : tabstractprocdef;const ref : treference);override; end; @@ -53,7 +53,7 @@ implementation cpubase, cgcpu; - procedure thlcg2mips.a_call_name(list: TAsmList; pd: tprocdef; const s: TSymStr; weak: boolean); + function thlcgmips.a_call_name(list: TAsmList; pd: tprocdef; const s: TSymStr; forceresdef: tdef; weak: boolean): tcgpara; var ref : treference; begin @@ -73,9 +73,11 @@ implementation end else cg.a_call_name(list,s,weak); + { the default implementation only determines the result location } + result:=inherited; end; - procedure thlcg2mips.a_call_reg(list: TAsmList; pd: tabstractprocdef; reg: tregister); + procedure thlcgmips.a_call_reg(list: TAsmList; pd: tabstractprocdef; reg: tregister); begin if (pd.proccalloption=pocall_cdecl) and (reg<>NR_PIC_FUNC) then begin @@ -88,7 +90,7 @@ implementation cg.a_call_reg(list,reg); end; - procedure thlcg2mips.a_call_ref(list: TAsmList; pd: tabstractprocdef; const ref: treference); + procedure thlcgmips.a_call_ref(list: TAsmList; pd: tabstractprocdef; const ref: treference); begin if pd.proccalloption =pocall_cdecl then begin @@ -103,7 +105,7 @@ implementation procedure create_hlcodegen; begin - hlcg:=thlcg2mips.create; + hlcg:=thlcgmips.create; create_codegen; end; -- cgit v1.2.1