瀏覽代碼

* spilling of doubles on sparc fixed

florian 21 年之前
父節點
當前提交
e9bb27df36
共有 5 個文件被更改,包括 56 次插入20 次删除
  1. 9 3
      compiler/m68k/aasmcpu.pas
  2. 4 4
      compiler/m68k/cpubase.pas
  3. 24 10
      compiler/rgobj.pas
  4. 5 2
      compiler/sparc/aasmcpu.pas
  5. 14 1
      compiler/sparc/rgcpu.pas

+ 9 - 3
compiler/m68k/aasmcpu.pas

@@ -39,7 +39,7 @@ const
   O_MOV_DEST = 1;
   O_MOV_DEST = 1;
 type
 type
 
 
-  taicpu = class(taicpu_abstract)
+  taicpu = class(tai_cpu_abstract)
      opsize : topsize;
      opsize : topsize;
      constructor op_none(op : tasmop;_size : topsize);
      constructor op_none(op : tasmop;_size : topsize);
 
 
@@ -96,7 +96,10 @@ type
   procedure DoneAsm;
   procedure DoneAsm;
 
 
 
 
-implementation
+  implementation
+
+    uses
+      globtype;
 
 
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -426,7 +429,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
     * register numbers for address registers fixed
 
 
   Revision 1.10  2004/01/30 12:17:18  florian
   Revision 1.10  2004/01/30 12:17:18  florian

+ 4 - 4
compiler/m68k/cpubase.pas

@@ -32,9 +32,6 @@ unit cpubase;
     globtype,
     globtype,
     strings,cutils,cclasses,aasmbase,cpuinfo,cgbase;
     strings,cutils,cclasses,aasmbase,cpuinfo,cgbase;
 
 
-    uses
-      strings,cutils,cclasses,aasmbase,cpuinfo,cgbase;
-
 {*****************************************************************************
 {*****************************************************************************
                                 Assembler Opcodes
                                 Assembler Opcodes
 *****************************************************************************}
 *****************************************************************************}
@@ -518,7 +515,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
     * dwarf branch merged
 
 
   Revision 1.28  2004/05/06 22:01:54  florian
   Revision 1.28  2004/05/06 22:01:54  florian

+ 24 - 10
compiler/rgobj.pas

@@ -166,6 +166,7 @@ unit rgobj;
       Preginfo=^TReginfo;
       Preginfo=^TReginfo;
 
 
       tspillreginfo = record
       tspillreginfo = record
+        spillreg : tregister;
         orgreg : tsuperregister;
         orgreg : tsuperregister;
         tempreg : tregister;
         tempreg : tregister;
         regread,regwritten, mustbespilled: boolean;
         regread,regwritten, mustbespilled: boolean;
@@ -227,6 +228,7 @@ unit rgobj;
         procedure ungetregisterinline(list:Taasmoutput;position:Tai;r:Tregister);
         procedure ungetregisterinline(list:Taasmoutput;position:Tai;r:Tregister);
         procedure add_constraints(reg:Tregister);virtual;
         procedure add_constraints(reg:Tregister);virtual;
 
 
+        function get_spill_subreg(r : tregister) : tsubregister;virtual;
         procedure do_spill_read(list:Taasmoutput;instr:Taicpu;
         procedure do_spill_read(list:Taasmoutput;instr:Taicpu;
                                 pos:Tai;regidx:word;
                                 pos:Tai;regidx:word;
                                 const spilltemplist:Tspill_temp_list;
                                 const spilltemplist:Tspill_temp_list;
@@ -1879,6 +1881,12 @@ unit rgobj;
     end;
     end;
 
 
 
 
+    function trgobj.get_spill_subreg(r : tregister) : tsubregister;
+      begin
+        result:=defaultsub;
+      end;
+
+
     function trgobj.instr_spill_register(list:Taasmoutput;
     function trgobj.instr_spill_register(list:Taasmoutput;
                                          instr:taicpu;
                                          instr:taicpu;
                                          const r:Tsuperregisterset;
                                          const r:Tsuperregisterset;
@@ -1889,22 +1897,25 @@ unit rgobj;
         regs: tspillregsinfo;
         regs: tspillregsinfo;
         spilled: boolean;
         spilled: boolean;
 
 
-      procedure addreginfo(reg: tsuperregister; operation: topertype);
+      procedure addreginfo(reg: tregister; operation: topertype);
         var
         var
           i, tmpindex: longint;
           i, tmpindex: longint;
+          supreg : tsuperregister;
         begin
         begin
           tmpindex := regindex;
           tmpindex := regindex;
+          supreg:=getsupreg(reg);
           // did we already encounter this register?
           // did we already encounter this register?
           for i := 0 to pred(regindex) do
           for i := 0 to pred(regindex) do
-            if (regs[i].orgreg = reg) then
+            if (regs[i].orgreg = supreg) then
               begin
               begin
                 tmpindex := i;
                 tmpindex := i;
                 break;
                 break;
               end;
               end;
           if tmpindex > high(regs) then
           if tmpindex > high(regs) then
             internalerror(2003120301);
             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
             begin
               // add/update info on this register
               // add/update info on this register
               regs[tmpindex].mustbespilled := true;
               regs[tmpindex].mustbespilled := true;
@@ -1958,7 +1969,7 @@ unit rgobj;
               top_reg:
               top_reg:
                 begin
                 begin
                   if (getregtype(reg) = regtype) then
                   if (getregtype(reg) = regtype) then
-                    addreginfo(getsupreg(reg),instr.spilling_get_operation_type(counter));
+                    addreginfo(reg,instr.spilling_get_operation_type(counter));
                 end;
                 end;
               top_ref:
               top_ref:
                 begin
                 begin
@@ -1966,9 +1977,9 @@ unit rgobj;
                     with ref^ do
                     with ref^ do
                       begin
                       begin
                         if (base <> NR_NO) then
                         if (base <> NR_NO) then
-                          addreginfo(getsupreg(base),operand_read);
+                          addreginfo(base,operand_read);
                         if (index <> NR_NO) then
                         if (index <> NR_NO) then
-                          addreginfo(getsupreg(index),operand_read);
+                          addreginfo(index,operand_read);
                       end;
                       end;
                 end;
                 end;
 {$ifdef ARM}
 {$ifdef ARM}
@@ -1993,7 +2004,7 @@ unit rgobj;
               if mustbespilled then
               if mustbespilled then
                 begin
                 begin
                   pos:=get_insert_pos(Tai(instr.previous),regs[0].orgreg,regs[1].orgreg,regs[2].orgreg);
                   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 regread then
                     if regwritten then
                     if regwritten then
                       do_spill_readwritten(list,instr,pos,counter,spilltemplist,regs)
                       do_spill_readwritten(list,instr,pos,counter,spilltemplist,regs)
@@ -2034,7 +2045,10 @@ unit rgobj;
 end.
 end.
 {
 {
   $Log$
   $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
     * dwarf branch merged
 
 
   Revision 1.126  2004/05/22 23:34:28  peter
   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
     - list field removed of the tnode class because it's not used currently
       and can cause hard-to-find bugs
       and can cause hard-to-find bugs
 
 
-}
+}

+ 5 - 2
compiler/sparc/aasmcpu.pas

@@ -234,7 +234,7 @@ implementation
       begin
       begin
         result:=(
         result:=(
                  ((opcode=A_MOV) and (regtype = R_INTREGISTER)) or
                  ((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
                 ) and
                 (ops=2) and
                 (ops=2) and
                 (oper[0]^.typ=top_reg) and
                 (oper[0]^.typ=top_reg) and
@@ -311,7 +311,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * dwarf branch merged
 
 
   Revision 1.47.2.5  2004/06/03 19:23:41  florian
   Revision 1.47.2.5  2004/06/03 19:23:41  florian

+ 14 - 1
compiler/sparc/rgcpu.pas

@@ -35,6 +35,7 @@ unit rgcpu;
     type
     type
       trgcpu=class(trgobj)
       trgcpu=class(trgobj)
         procedure add_constraints(reg:tregister);override;
         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;
         procedure do_spill_read(list : taasmoutput;instr : taicpu;pos: tai; regidx: word;
          const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);override;
          const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);override;
         procedure do_spill_written(list : taasmoutput;instr : taicpu;pos: tai; regidx: word;
         procedure do_spill_written(list : taasmoutput;instr : taicpu;pos: tai; regidx: word;
@@ -70,6 +71,15 @@ implementation
       end;
       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;
     procedure trgcpu.do_spill_read(list : taasmoutput;instr : taicpu;pos: tai; regidx: word;
      const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);
      const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);
       var
       var
@@ -225,7 +235,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
     * dwarf branch merged
 
 
   Revision 1.20.2.4  2004/06/13 20:38:38  florian
   Revision 1.20.2.4  2004/06/13 20:38:38  florian