Pārlūkot izejas kodu

* fixed spilling for several ppc instructions which only read registers
+ added support for registers in references that get changed (load/store
with update)

Jonas Maebe 20 gadi atpakaļ
vecāks
revīzija
6c38093871
3 mainītis faili ar 41 papildinājumiem un 10 dzēšanām
  1. 13 1
      compiler/aasmtai.pas
  2. 20 6
      compiler/powerpc/aasmcpu.pas
  3. 8 3
      compiler/rgobj.pas

+ 13 - 1
compiler/aasmtai.pas

@@ -549,6 +549,7 @@ interface
           { register allocator }
           function is_same_reg_move(regtype: Tregistertype):boolean;virtual;
           function spilling_get_operation_type(opnr: longint): topertype;virtual;
+          function spilling_get_operation_type_ref(opnr: longint; reg: tregister): topertype;virtual;
        end;
        tai_cpu_class = class of tai_cpu_abstract;
 
@@ -2054,6 +2055,12 @@ implementation
       end;
 
 
+    function tai_cpu_abstract.spilling_get_operation_type_ref(opnr: longint; reg: tregister): topertype;
+      begin
+        result := operand_read;
+      end;
+
+
     constructor tai_cpu_abstract.ppuload(t:taitype;ppufile:tcompilerppufile);
       var
         i : integer;
@@ -2242,7 +2249,12 @@ begin
 end.
 {
   $Log$
-  Revision 1.95  2005-02-14 17:13:06  peter
+  Revision 1.96  2005-02-18 23:37:51  jonas
+    * fixed spilling for several ppc instructions which only read registers
+    + added support for registers in references that get changed (load/store
+      with update)
+
+  Revision 1.95  2005/02/14 17:13:06  peter
     * truncate log
 
   Revision 1.94  2005/02/06 00:05:56  florian

+ 20 - 6
compiler/powerpc/aasmcpu.pas

@@ -85,6 +85,7 @@ uses
 
          { register spilling code }
          function spilling_get_operation_type(opnr: aint): topertype;override;
+         function spilling_get_operation_type_ref(opnr: aint; reg: tregister): topertype;override;
       end;
 
       tai_align = class(tai_align_abstract)
@@ -373,11 +374,9 @@ uses cutils;
       begin
         result := operand_read;
         case opcode of
-          A_STB,A_STBX,A_STH,A_STHX,A_STW,A_STWX,A_STBU,A_STBUX,A_STHU,A_STHUX,A_STWU,A_STWUX:
-            begin
-              if opnr = 1 then
-                result := operand_write;
-            end;
+            A_STMW,A_LMW:
+              internalerror(2005021805);
+            A_STBU, A_STBUX, A_STHU, A_STHUX, A_STWU, A_STWUX, A_STFSU, A_STFSUX, A_STFDU, A_STFDUX, A_STB, A_STBX, A_STH, A_STHX, A_STW, A_STWX, A_STFS, A_STFSX, A_STFD, A_STFDX, A_STFIWX, A_STHBRX, A_STWBRX, A_STWCX_, A_CMP, A_CMPI, A_CMPL, A_CMPLI, A_DCBA, A_DCBI, A_DCBST, A_DCBT, A_DCBTST, A_DCBZ, A_ECOWX, A_FCMPO, A_FCMPU, A_MTMSR, A_TLBIE, A_TW, A_TWI, A_CMPWI, A_CMPW, A_CMPLWI, A_CMPLW, A_MT, A_MTLR, A_MTCTR:;
           else
             if opnr = 0 then
               result := operand_write;
@@ -385,6 +384,16 @@ uses cutils;
       end;
 
 
+    function taicpu.spilling_get_operation_type_ref(opnr: aint; reg: tregister): topertype;
+      begin
+        result := operand_read;
+        case opcode of
+          A_STBU, A_STBUX, A_STHU, A_STHUX, A_STWU, A_STWUX, A_STFSU, A_STFSUX, A_STFDU, A_STFDUX:
+            if (oper[opnr]^.ref^.base = reg) then
+              result := operand_readwrite;
+        end;
+      end;
+
     function spilling_create_load(const ref:treference;r:tregister): tai;
       begin
         result:=taicpu.op_reg_ref(A_LWZ,r,ref);
@@ -413,7 +422,12 @@ begin
 end.
 {
   $Log$
-  Revision 1.30  2005-02-14 17:13:10  peter
+  Revision 1.31  2005-02-18 23:37:51  jonas
+    * fixed spilling for several ppc instructions which only read registers
+    + added support for registers in references that get changed (load/store
+      with update)
+
+  Revision 1.30  2005/02/14 17:13:10  peter
     * truncate log
 
 }

+ 8 - 3
compiler/rgobj.pas

@@ -1834,9 +1834,9 @@ unit rgobj;
                     with ref^ do
                       begin
                         if (base <> NR_NO) then
-                          addreginfo(base,operand_read);
+                          addreginfo(base,instr.spilling_get_operation_type_ref(counter,base));
                         if (index <> NR_NO) then
-                          addreginfo(index,operand_read);
+                          addreginfo(index,instr.spilling_get_operation_type_ref(counter,index));
                       end;
                 end;
 {$ifdef ARM}
@@ -2006,7 +2006,12 @@ unit rgobj;
 end.
 {
   $Log$
-  Revision 1.153  2005-02-14 17:13:07  peter
+  Revision 1.154  2005-02-18 23:37:51  jonas
+    * fixed spilling for several ppc instructions which only read registers
+    + added support for registers in references that get changed (load/store
+      with update)
+
+  Revision 1.153  2005/02/14 17:13:07  peter
     * truncate log
 
 }