From ed950491a88405d36bf80b6c41c27762e32b5336 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 30 Jul 2002 20:50:43 +0000 Subject: [PATCH] * the code generator knows now if parameters are in registers --- compiler/cgobj.pas | 11 +++++++++-- compiler/ncginl.pas | 11 +++++++---- compiler/paramgr.pas | 26 ++++++++++++++++++++++++-- compiler/pass_2.pas | 12 ++++++++++-- compiler/powerpc/cgcpu.pas | 11 +++++------ compiler/powerpc/cpupara.pas | 23 ++++++++++++++++++++--- 6 files changed, 75 insertions(+), 19 deletions(-) diff --git a/compiler/cgobj.pas b/compiler/cgobj.pas index 83918744d0..89f6b0d197 100644 --- a/compiler/cgobj.pas +++ b/compiler/cgobj.pas @@ -652,7 +652,11 @@ unit cgobj; LOC_CONSTANT: a_load_const_reg(list,loc.size,loc.value,reg); else - internalerror(200109092); + begin + writeln(ord(loc.loc)); + runerror(216); + internalerror(200109092); + end; end; end; @@ -1396,7 +1400,10 @@ finalization end. { $Log$ - Revision 1.40 2002-07-29 21:16:02 florian + Revision 1.41 2002-07-30 20:50:43 florian + * the code generator knows now if parameters are in registers + + Revision 1.40 2002/07/29 21:16:02 florian * some more ppc fixes Revision 1.39 2002/07/28 15:56:00 jonas diff --git a/compiler/ncginl.pas b/compiler/ncginl.pas index 5877d6d1d4..0474ddc1e3 100644 --- a/compiler/ncginl.pas +++ b/compiler/ncginl.pas @@ -106,8 +106,8 @@ implementation second_TypeInfo; end; in_assigned_x : - begin - second_Assigned; + begin +// second_Assigned; end; in_include_x_y, in_exclude_x_y: @@ -583,7 +583,10 @@ end. { $Log$ - Revision 1.6 2002-07-29 21:23:42 florian + Revision 1.7 2002-07-30 20:50:43 florian + * the code generator knows now if parameters are in registers + + Revision 1.6 2002/07/29 21:23:42 florian * more fixes for the ppc + wrappers for the tcnvnode.first_* stuff introduced @@ -601,4 +604,4 @@ end. Revision 1.1 2002/07/24 04:07:49 carl + first revision (incomplete) -} \ No newline at end of file +} diff --git a/compiler/paramgr.pas b/compiler/paramgr.pas index fb0911a9b2..3746e943a3 100644 --- a/compiler/paramgr.pas +++ b/compiler/paramgr.pas @@ -56,6 +56,8 @@ unit paramgr; } end; + procedure setparalocs(p : tprocdef); + var paralocdummy : tparalocation; paramanager : tparamanager; @@ -64,7 +66,7 @@ unit paramgr; uses cpuinfo, - symconst,symbase, + symconst,symbase,symsym, defbase; { true if the return value is in accumulator (EAX for i386), D0 for 68k } @@ -129,13 +131,33 @@ unit paramgr; end; end; + procedure setparalocs(p : tprocdef); + + var + hp : tparaitem; + + begin + hp:=tparaitem(p.para.first); + while assigned(hp) do + begin + if (hp.paraloc.loc in [LOC_REGISTER,LOC_FPUREGISTER]) and + { if the parameter isn't regable, we've to work with the local copy } + (vo_regable in tvarsym(hp.parasym).varoptions) then + tvarsym(hp.parasym).reg:=hp.paraloc.register; + hp:=tparaitem(hp.next); + end; + end; + finalization paramanager.free; end. { $Log$ - Revision 1.5 2002-07-26 21:15:39 florian + Revision 1.6 2002-07-30 20:50:43 florian + * the code generator knows now if parameters are in registers + + Revision 1.5 2002/07/26 21:15:39 florian * rewrote the system handling Revision 1.4 2002/07/20 11:57:55 florian diff --git a/compiler/pass_2.pas b/compiler/pass_2.pas index 59f87038d1..a60bf99c67 100644 --- a/compiler/pass_2.pas +++ b/compiler/pass_2.pas @@ -52,7 +52,7 @@ implementation {$endif} globtype,systems,verbose, cclasses,globals, - symconst,symbase,symtype,symsym, + symconst,symbase,symtype,symsym,paramgr, aasmbase,aasmtai, pass_1,cpubase,cgbase,regvars,nflw,rgobj; @@ -301,6 +301,11 @@ implementation end; {$endif OMITSTACKFRAME} + { assign parameter locations } +{$ifndef i386} + setparalocs(procinfo^.procdef); +{$endif i386} + { process register variable stuff (JM) } assign_regvars(p); load_regvars(procinfo^.aktentrycode,p); @@ -323,7 +328,10 @@ implementation end. { $Log$ - Revision 1.32 2002-07-19 11:41:36 daniel + Revision 1.33 2002-07-30 20:50:44 florian + * the code generator knows now if parameters are in registers + + Revision 1.32 2002/07/19 11:41:36 daniel * State tracker work * The whilen and repeatn are now completely unified into whilerepeatn. This allows the state tracker to change while nodes automatically into diff --git a/compiler/powerpc/cgcpu.pas b/compiler/powerpc/cgcpu.pas index 2deb442e65..7e8cdad97e 100644 --- a/compiler/powerpc/cgcpu.pas +++ b/compiler/powerpc/cgcpu.pas @@ -209,11 +209,7 @@ const internalerror(2002072801); end; else - begin - runerror(216); - writeln(ord(locpara.loc)); - internalerror(2002081103); - end; + internalerror(2002081103); end; if locpara.sp_fixup<>0 then internalerror(2002081104); @@ -1457,7 +1453,10 @@ begin end. { $Log$ - Revision 1.30 2002-07-29 21:23:44 florian + Revision 1.31 2002-07-30 20:50:44 florian + * the code generator knows now if parameters are in registers + + Revision 1.30 2002/07/29 21:23:44 florian * more fixes for the ppc + wrappers for the tcnvnode.first_* stuff introduced diff --git a/compiler/powerpc/cpupara.pas b/compiler/powerpc/cpupara.pas index a9a65f1aa8..491a60c7de 100644 --- a/compiler/powerpc/cpupara.pas +++ b/compiler/powerpc/cpupara.pas @@ -155,7 +155,21 @@ unit cpupara; end; LOC_FPUREGISTER: begin - if nextfloatreg<=R_F8 then + if hp.paratyp in [vs_var,vs_out] then + begin + if nextintreg<=R_8 then + begin + hp.paraloc.loc:=LOC_REGISTER; + hp.paraloc.register:=nextintreg; + inc(nextintreg); + end + else + begin + {!!!!!!!} + internalerror(2002071006); + end; + end + else if nextfloatreg<=R_F8 then begin hp.paraloc.loc:=LOC_FPUREGISTER; hp.paraloc.register:=nextfloatreg; @@ -169,7 +183,7 @@ unit cpupara; end; LOC_REFERENCE: begin - if push_addr_param(hp.paratype.def) then + if push_addr_param(hp.paratype.def) or (hp.paratyp in [vs_var,vs_out]) then begin if nextintreg<=R_8 then begin @@ -210,7 +224,10 @@ begin end. { $Log$ - Revision 1.4 2002-07-28 20:45:22 florian + Revision 1.5 2002-07-30 20:50:44 florian + * the code generator knows now if parameters are in registers + + Revision 1.4 2002/07/28 20:45:22 florian + added direct assembler reader for PowerPC Revision 1.3 2002/07/26 22:22:10 florian