Ver Fonte

* taicpu.is_same_reg_move() now gets a regtype parameter so it only
removes moves of that particular register type. This is necessary so
we don't remove the live_start instruction of a register before it
has been processed

Jonas Maebe há 21 anos atrás
pai
commit
71202a141d

+ 8 - 2
compiler/aasmtai.pas

@@ -495,7 +495,7 @@ interface
           procedure loadreg(opidx:longint;r:tregister);
           procedure loadoper(opidx:longint;o:toper);
           procedure clearop(opidx:longint);
-          function is_same_reg_move:boolean;virtual;abstract;
+          function is_same_reg_move(regtype: Tregistertype):boolean;virtual;abstract;
           { register allocator }
           function spilling_create_load(const ref:treference;r:tregister): tai;virtual;abstract;
           function spilling_create_store(r:tregister; const ref:treference): tai;virtual;abstract;
@@ -1974,7 +1974,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.70  2004-02-08 20:15:42  jonas
+  Revision 1.71  2004-02-08 23:10:21  jonas
+    * taicpu.is_same_reg_move() now gets a regtype parameter so it only
+      removes moves of that particular register type. This is necessary so
+      we don't remove the live_start instruction of a register before it
+      has been processed
+
+  Revision 1.70  2004/02/08 20:15:42  jonas
     - removed taicpu.is_reg_move because it's not used anymore
     + support tracking fpu register moves by rgobj for the ppc
 

+ 11 - 4
compiler/arm/aasmcpu.pas

@@ -68,7 +68,7 @@ uses
          constructor op_reg_sym_ofs(op : tasmop;_op1 : tregister;_op2:tasmsymbol;_op2ofs : longint);
          constructor op_sym_ofs_ref(op : tasmop;_op1 : tasmsymbol;_op1ofs:longint;const _op2 : treference);
 
-         function is_same_reg_move: boolean; override;
+         function is_same_reg_move(regtype: Tregistertype):boolean; override;
 
          { register spilling code }
          function spilling_create_load(const ref:treference;r:tregister): tai;override;
@@ -293,10 +293,11 @@ implementation
 
 { ****************************** newra stuff *************************** }
 
-    function taicpu.is_same_reg_move: boolean;
+    function taicpu.is_same_reg_move(regtype: Tregistertype):boolean;
       begin
         { allow the register allocator to remove unnecessary moves }
-        result:=((opcode=A_MOV) or (opcode=A_MVF)) and
+        result:=((opcode=A_MOV) and (regtype = R_INTREGISTER)) or
+                ((opcode=A_MVF) and (regtype = R_FPUREGISTER)) and
                 (condition=C_None) and
                 (ops=2) and
                 (oper[0]^.typ=top_reg) and
@@ -421,7 +422,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.26  2004-02-08 20:15:42  jonas
+  Revision 1.27  2004-02-08 23:10:21  jonas
+    * taicpu.is_same_reg_move() now gets a regtype parameter so it only
+      removes moves of that particular register type. This is necessary so
+      we don't remove the live_start instruction of a register before it
+      has been processed
+
+  Revision 1.26  2004/02/08 20:15:42  jonas
     - removed taicpu.is_reg_move because it's not used anymore
     + support tracking fpu register moves by rgobj for the ppc
 

+ 13 - 4
compiler/powerpc/aasmcpu.pas

@@ -81,7 +81,7 @@ uses
          procedure loadbool(opidx:longint;_b:boolean);
 
 
-         function is_same_reg_move: boolean; override;
+         function is_same_reg_move(regtype: Tregistertype):boolean; override;
 
          { register spilling code }
          function spilling_get_operation_type(opnr: longint): topertype;override;
@@ -356,10 +356,13 @@ uses cutils,rgobj;
 
 { ****************************** newra stuff *************************** }
 
-    function taicpu.is_same_reg_move: boolean;
+    function taicpu.is_same_reg_move(regtype: Tregistertype):boolean;
       begin
         result :=
-          ((opcode=A_MR) or (opcode = A_FMR)) and
+          (((opcode=A_MR) and
+            (regtype = R_INTREGISTER)) or
+           ((opcode = A_FMR) and
+            (regtype = R_FPUREGISTER))) and
           { these opcodes can only have registers as operands }
           (oper[0]^.reg=oper[1]^.reg);
       end;
@@ -405,7 +408,13 @@ uses cutils,rgobj;
 end.
 {
   $Log$
-  Revision 1.24  2004-02-08 20:15:42  jonas
+  Revision 1.25  2004-02-08 23:10:21  jonas
+    * taicpu.is_same_reg_move() now gets a regtype parameter so it only
+      removes moves of that particular register type. This is necessary so
+      we don't remove the live_start instruction of a register before it
+      has been processed
+
+  Revision 1.24  2004/02/08 20:15:42  jonas
     - removed taicpu.is_reg_move because it's not used anymore
     + support tracking fpu register moves by rgobj for the ppc
 

+ 8 - 2
compiler/rgobj.pas

@@ -1626,7 +1626,7 @@ implementation
   
                     { Maybe the operation can be removed when
                       it is a move and both arguments are the same }
-                    if is_same_reg_move then
+                    if is_same_reg_move(regtype) then
                       begin
                         q:=Tai(p.next);
                         list.remove(p);
@@ -2001,7 +2001,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.119  2004-02-08 14:26:28  daniel
+  Revision 1.120  2004-02-08 23:10:21  jonas
+    * taicpu.is_same_reg_move() now gets a regtype parameter so it only
+      removes moves of that particular register type. This is necessary so
+      we don't remove the live_start instruction of a register before it
+      has been processed
+
+  Revision 1.119  2004/02/08 14:26:28  daniel
     * Register allocator speed boost
 
   Revision 1.118  2004/02/07 23:28:34  daniel

+ 11 - 4
compiler/sparc/aasmcpu.pas

@@ -61,7 +61,7 @@ uses
          constructor op_sym_ofs(op : tasmop;_op1 : tasmsymbol;_op1ofs:longint);
 
          { register allocation }
-         function is_same_reg_move:boolean;override;
+         function is_same_reg_move(regtype: Tregistertype):boolean;override;
 
          { register spilling code }
          function spilling_get_operation_type(opnr: longint): topertype;override;
@@ -214,9 +214,10 @@ implementation
       end;
 
 
-    function taicpu.is_same_reg_move:boolean;
+    function taicpu.is_same_reg_move(regtype: Tregistertype):boolean;
       begin
-        result:=((opcode=A_MOV) or (opcode=A_FMOVS)) and
+        result:=((opcode=A_MOV) and (regtype = R_INTREGISTER)) or
+                ((opcode=A_FMOVS) and (regtype = R_FPUREGISTER)) and
                 (ops=2) and
                 (oper[0]^.typ=top_reg) and
                 (oper[1]^.typ=top_reg) and
@@ -296,7 +297,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.42  2004-02-08 20:15:43  jonas
+  Revision 1.43  2004-02-08 23:10:21  jonas
+    * taicpu.is_same_reg_move() now gets a regtype parameter so it only
+      removes moves of that particular register type. This is necessary so
+      we don't remove the live_start instruction of a register before it
+      has been processed
+
+  Revision 1.42  2004/02/08 20:15:43  jonas
     - removed taicpu.is_reg_move because it's not used anymore
     + support tracking fpu register moves by rgobj for the ppc
 

+ 11 - 4
compiler/x86/aasmcpu.pas

@@ -200,7 +200,7 @@ interface
          function  Pass1(offset:longint):longint;virtual;
          procedure Pass2(sec:TAsmObjectdata);virtual;
          procedure SetOperandOrder(order:TOperandOrder);
-         function is_same_reg_move:boolean;override;
+         function is_same_reg_move(regtype: Tregistertype):boolean;override;
       protected
          procedure ppuloadoper(ppufile:tcompilerppufile;var o:toper);override;
          procedure ppuwriteoper(ppufile:tcompilerppufile;const o:toper);override;
@@ -1895,9 +1895,10 @@ implementation
 {$endif NOAG386BIN}
 
 
-    function Taicpu.is_same_reg_move:boolean;
+    function taicpu.is_same_reg_move(regtype: Tregistertype):boolean;
       begin
-        result:=(ops=2) and
+        result:=(regtype = R_INTREGISTER) and
+                (ops=2) and
                 (oper[0]^.typ=top_reg) and
                 (oper[1]^.typ=top_reg) and
                 (oper[0]^.reg=oper[1]^.reg) and
@@ -1954,7 +1955,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.49  2004-02-08 20:15:43  jonas
+  Revision 1.50  2004-02-08 23:10:21  jonas
+    * taicpu.is_same_reg_move() now gets a regtype parameter so it only
+      removes moves of that particular register type. This is necessary so
+      we don't remove the live_start instruction of a register before it
+      has been processed
+
+  Revision 1.49  2004/02/08 20:15:43  jonas
     - removed taicpu.is_reg_move because it's not used anymore
     + support tracking fpu register moves by rgobj for the ppc