Răsfoiți Sursa

* some newra optimizations (eliminate lots of moves between registers)

Jonas Maebe 22 ani în urmă
părinte
comite
11e98e7d73
2 a modificat fișierele cu 28 adăugiri și 10 ștergeri
  1. 11 2
      compiler/powerpc/aasmcpu.pas
  2. 17 8
      compiler/powerpc/cgcpu.pas

+ 11 - 2
compiler/powerpc/aasmcpu.pas

@@ -425,7 +425,13 @@ uses cutils,rgobj;
 
     function taicpu.is_move:boolean;
       begin
-        is_move := opcode = A_MR;
+        is_move := (opcode = A_MR) or
+                   (opcode = A_EXTSB) or
+                   (opcode = A_EXTSH) or
+                   ((opcode = A_RLWINM) and
+                    (oper[3].val = 0) and
+                    (oper[5].val = 31) and
+                    (oper[4].val in [31-8+1,31-16+1]));
       end;
 
 
@@ -717,7 +723,10 @@ uses cutils,rgobj;
 end.
 {
   $Log$
-  Revision 1.14  2003-08-17 16:53:19  jonas
+  Revision 1.15  2003-08-18 21:27:00  jonas
+    * some newra optimizations (eliminate lots of moves between registers)
+
+  Revision 1.14  2003/08/17 16:53:19  jonas
     * fixed compilation of ppc compiler with -dnewra
 
   Revision 1.13  2003/08/11 21:18:20  peter

+ 17 - 8
compiler/powerpc/cgcpu.pas

@@ -450,6 +450,8 @@ const
 
      procedure tcgppc.a_load_reg_reg(list : taasmoutput;fromsize, tosize : tcgsize;reg1,reg2 : tregister);
 
+       var
+         instr: taicpu;
        begin
          if (reg1.enum<>R_INTREGISTER) or (reg1.number = 0) then
            internalerror(200303101);
@@ -463,19 +465,23 @@ const
            begin
              case tosize of
                OS_8:
-                 list.concat(taicpu.op_reg_reg_const_const_const(A_RLWINM,
-                   reg2,reg1,0,31-8+1,31));
+                 instr := taicpu.op_reg_reg_const_const_const(A_RLWINM,
+                   reg2,reg1,0,31-8+1,31);
                OS_S8:
-                 list.concat(taicpu.op_reg_reg(A_EXTSB,reg2,reg1));
+                 instr := taicpu.op_reg_reg(A_EXTSB,reg2,reg1);
                OS_16:
-                 list.concat(taicpu.op_reg_reg_const_const_const(A_RLWINM,
-                   reg2,reg1,0,31-16+1,31));
+                 instr := taicpu.op_reg_reg_const_const_const(A_RLWINM,
+                   reg2,reg1,0,31-16+1,31);
                OS_S16:
-                 list.concat(taicpu.op_reg_reg(A_EXTSH,reg2,reg1));
+                 instr := taicpu.op_reg_reg(A_EXTSH,reg2,reg1);
                OS_32,OS_S32:
-                 list.concat(taicpu.op_reg_reg(A_MR,reg2,reg1));
+                 instr := taicpu.op_reg_reg(A_MR,reg2,reg1);
                else internalerror(2002090901);
              end;
+             list.concat(instr);
+{$ifdef newra}
+             rg.add_move_instruction(instr);
+{$endif newra}
            end;
        end;
 
@@ -2655,7 +2661,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.121  2003-08-18 11:50:55  olle
+  Revision 1.122  2003-08-18 21:27:00  jonas
+    * some newra optimizations (eliminate lots of moves between registers)
+
+  Revision 1.121  2003/08/18 11:50:55  olle
     + cleaning up in proc entry and exit, now calc_stack_frame always is used.
 
   Revision 1.120  2003/08/17 16:59:20  jonas