OSDN Git Service

(clrstrsi): New pattern and associate anonymous pattern.
[pf3gnuchains/gcc-fork.git] / gcc / local-alloc.c
index fc5cdb4..9d941fe 100644 (file)
@@ -1,5 +1,5 @@
 /* Allocate registers within a basic block, for GNU compiler.
-   Copyright (C) 1987, 1988, 1991, 1993, 1994 Free Software Foundation, Inc.
+   Copyright (C) 1987, 88, 91, 93, 94, 1995 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -15,7 +15,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
 
 /* Allocation of hard register numbers to pseudo registers is done in
@@ -864,7 +865,7 @@ optimize_reg_copy_1 (insn, dest, src)
    In that case, we can replace all uses of DEST, starting with INSN and
    ending with the set of SRC to DEST, with SRC.  We do not do this
    optimization if a CALL_INSN is crossed unless SRC already crosses a
-   call.
+   call or if DEST dies before the copy back to SRC.
 
    It is assumed that DEST and SRC are pseudos; it is too complicated to do
    this for hard registers since the substitutions we may make might fail.  */
@@ -929,6 +930,7 @@ optimize_reg_copy_2 (insn, dest, src)
        }
 
       if (reg_set_p (src, p)
+         || find_reg_note (p, REG_DEAD, dest)
          || (GET_CODE (p) == CALL_INSN && reg_n_calls_crossed[sregno] == 0))
        break;
     }
@@ -1294,6 +1296,8 @@ block_alloc (b)
                        win = combine_regs (r1, r0, may_save_copy,
                                            insn_number, insn, 0);
                    }
+                 if (win)
+                   break;
                }
            }
 
@@ -1623,7 +1627,7 @@ qty_compare_1 (q1, q2)
    is called for quantities that have suggested hard registers.  First priority
    goes to quantities that have copy preferences, then to those that have
    normal preferences.  Within those groups, quantities with the lower
-   number of preferenes have the highest priority.  Of those, we use the same
+   number of preferences have the highest priority.  Of those, we use the same
    algorithm as above.  */
 
 static int
@@ -2032,6 +2036,12 @@ wipe_dead_reg (reg, output_p)
        }
     }
 
+  /* If this register is used in an auto-increment address, then extend its
+     life to after this insn, so that it won't get allocated together with
+     the result of this insn.  */
+  if (! output_p && find_regno_note (this_insn, REG_INC, regno))
+    output_p = 1;
+
   if (regno < FIRST_PSEUDO_REGISTER)
     {
       mark_life (regno, GET_MODE (reg), 0);