From e9bb27df36767019bf490c4917b3a687b15a87d3 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 20 Jun 2004 08:47:33 +0000 Subject: [PATCH] * spilling of doubles on sparc fixed --- compiler/m68k/aasmcpu.pas | 12 +++++++++--- compiler/m68k/cpubase.pas | 8 ++++---- compiler/rgobj.pas | 34 ++++++++++++++++++++++++---------- compiler/sparc/aasmcpu.pas | 7 +++++-- compiler/sparc/rgcpu.pas | 15 ++++++++++++++- 5 files changed, 56 insertions(+), 20 deletions(-) diff --git a/compiler/m68k/aasmcpu.pas b/compiler/m68k/aasmcpu.pas index 5f7f7e2bc5..7a57f6efa2 100644 --- a/compiler/m68k/aasmcpu.pas +++ b/compiler/m68k/aasmcpu.pas @@ -39,7 +39,7 @@ const O_MOV_DEST = 1; type - taicpu = class(taicpu_abstract) + taicpu = class(tai_cpu_abstract) opsize : topsize; constructor op_none(op : tasmop;_size : topsize); @@ -96,7 +96,10 @@ type procedure DoneAsm; -implementation + implementation + + uses + globtype; {***************************************************************************** @@ -426,7 +429,10 @@ implementation end. { $Log$ - Revision 1.11 2004-05-06 22:01:54 florian + Revision 1.12 2004-06-20 08:47:33 florian + * spilling of doubles on sparc fixed + + Revision 1.11 2004/05/06 22:01:54 florian * register numbers for address registers fixed Revision 1.10 2004/01/30 12:17:18 florian diff --git a/compiler/m68k/cpubase.pas b/compiler/m68k/cpubase.pas index 26ad781b01..ab5a9183a1 100644 --- a/compiler/m68k/cpubase.pas +++ b/compiler/m68k/cpubase.pas @@ -32,9 +32,6 @@ unit cpubase; globtype, strings,cutils,cclasses,aasmbase,cpuinfo,cgbase; - uses - strings,cutils,cclasses,aasmbase,cpuinfo,cgbase; - {***************************************************************************** Assembler Opcodes *****************************************************************************} @@ -518,7 +515,10 @@ implementation end. { $Log$ - Revision 1.29 2004-06-16 20:07:10 florian + Revision 1.30 2004-06-20 08:47:33 florian + * spilling of doubles on sparc fixed + + Revision 1.29 2004/06/16 20:07:10 florian * dwarf branch merged Revision 1.28 2004/05/06 22:01:54 florian diff --git a/compiler/rgobj.pas b/compiler/rgobj.pas index 4f09301fb7..4c9e24b44d 100644 --- a/compiler/rgobj.pas +++ b/compiler/rgobj.pas @@ -166,6 +166,7 @@ unit rgobj; Preginfo=^TReginfo; tspillreginfo = record + spillreg : tregister; orgreg : tsuperregister; tempreg : tregister; regread,regwritten, mustbespilled: boolean; @@ -227,6 +228,7 @@ unit rgobj; procedure ungetregisterinline(list:Taasmoutput;position:Tai;r:Tregister); procedure add_constraints(reg:Tregister);virtual; + function get_spill_subreg(r : tregister) : tsubregister;virtual; procedure do_spill_read(list:Taasmoutput;instr:Taicpu; pos:Tai;regidx:word; const spilltemplist:Tspill_temp_list; @@ -1879,6 +1881,12 @@ unit rgobj; end; + function trgobj.get_spill_subreg(r : tregister) : tsubregister; + begin + result:=defaultsub; + end; + + function trgobj.instr_spill_register(list:Taasmoutput; instr:taicpu; const r:Tsuperregisterset; @@ -1889,22 +1897,25 @@ unit rgobj; regs: tspillregsinfo; spilled: boolean; - procedure addreginfo(reg: tsuperregister; operation: topertype); + procedure addreginfo(reg: tregister; operation: topertype); var i, tmpindex: longint; + supreg : tsuperregister; begin tmpindex := regindex; + supreg:=getsupreg(reg); // did we already encounter this register? for i := 0 to pred(regindex) do - if (regs[i].orgreg = reg) then + if (regs[i].orgreg = supreg) then begin tmpindex := i; break; end; if tmpindex > high(regs) then internalerror(2003120301); - regs[tmpindex].orgreg := reg; - if supregset_in(r,reg) then + regs[tmpindex].orgreg := supreg; + regs[tmpindex].spillreg:=reg; + if supregset_in(r,supreg) then begin // add/update info on this register regs[tmpindex].mustbespilled := true; @@ -1958,7 +1969,7 @@ unit rgobj; top_reg: begin if (getregtype(reg) = regtype) then - addreginfo(getsupreg(reg),instr.spilling_get_operation_type(counter)); + addreginfo(reg,instr.spilling_get_operation_type(counter)); end; top_ref: begin @@ -1966,9 +1977,9 @@ unit rgobj; with ref^ do begin if (base <> NR_NO) then - addreginfo(getsupreg(base),operand_read); + addreginfo(base,operand_read); if (index <> NR_NO) then - addreginfo(getsupreg(index),operand_read); + addreginfo(index,operand_read); end; end; {$ifdef ARM} @@ -1993,7 +2004,7 @@ unit rgobj; if mustbespilled then begin pos:=get_insert_pos(Tai(instr.previous),regs[0].orgreg,regs[1].orgreg,regs[2].orgreg); - getregisterinline(list,pos,defaultsub,tempreg); + getregisterinline(list,pos,get_spill_subreg(regs[counter].spillreg),tempreg); if regread then if regwritten then do_spill_readwritten(list,instr,pos,counter,spilltemplist,regs) @@ -2034,7 +2045,10 @@ unit rgobj; end. { $Log$ - Revision 1.127 2004-06-16 20:07:09 florian + Revision 1.128 2004-06-20 08:47:33 florian + * spilling of doubles on sparc fixed + + Revision 1.127 2004/06/16 20:07:09 florian * dwarf branch merged Revision 1.126 2004/05/22 23:34:28 peter @@ -2584,4 +2598,4 @@ end. - list field removed of the tnode class because it's not used currently and can cause hard-to-find bugs -} \ No newline at end of file +} diff --git a/compiler/sparc/aasmcpu.pas b/compiler/sparc/aasmcpu.pas index 69742e00e3..d16eb5c487 100644 --- a/compiler/sparc/aasmcpu.pas +++ b/compiler/sparc/aasmcpu.pas @@ -234,7 +234,7 @@ implementation begin result:=( ((opcode=A_MOV) and (regtype = R_INTREGISTER)) or - ((opcode=A_FMOVS) and (regtype = R_FPUREGISTER)) + ((regtype = R_FPUREGISTER) and (opcode in [A_FMOVS,A_FMOVD])) ) and (ops=2) and (oper[0]^.typ=top_reg) and @@ -311,7 +311,10 @@ begin end. { $Log$ - Revision 1.48 2004-06-16 20:07:10 florian + Revision 1.49 2004-06-20 08:47:33 florian + * spilling of doubles on sparc fixed + + Revision 1.48 2004/06/16 20:07:10 florian * dwarf branch merged Revision 1.47.2.5 2004/06/03 19:23:41 florian diff --git a/compiler/sparc/rgcpu.pas b/compiler/sparc/rgcpu.pas index 036e620286..a4ab2a1843 100644 --- a/compiler/sparc/rgcpu.pas +++ b/compiler/sparc/rgcpu.pas @@ -35,6 +35,7 @@ unit rgcpu; type trgcpu=class(trgobj) procedure add_constraints(reg:tregister);override; + function get_spill_subreg(r : tregister) : tsubregister;override; procedure do_spill_read(list : taasmoutput;instr : taicpu;pos: tai; regidx: word; const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);override; procedure do_spill_written(list : taasmoutput;instr : taicpu;pos: tai; regidx: word; @@ -70,6 +71,15 @@ implementation end; + function trgcpu.get_spill_subreg(r : tregister) : tsubregister; + begin + if getregtype(r)=R_FPUREGISTER then + result:=getsubreg(r) + else + result:=defaultsub; + end; + + procedure trgcpu.do_spill_read(list : taasmoutput;instr : taicpu;pos: tai; regidx: word; const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo); var @@ -225,7 +235,10 @@ implementation end. { $Log$ - Revision 1.21 2004-06-16 20:07:11 florian + Revision 1.22 2004-06-20 08:47:33 florian + * spilling of doubles on sparc fixed + + Revision 1.21 2004/06/16 20:07:11 florian * dwarf branch merged Revision 1.20.2.4 2004/06/13 20:38:38 florian