OSDN Git Service

* config/mips/mips.c (save_restore_insns): Don't mark any register
[pf3gnuchains/gcc-fork.git] / gcc / reload1.c
index d405b10..c405981 100644 (file)
@@ -2,22 +2,22 @@
    Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
    1999, 2000, 2001 Free Software Foundation, Inc.
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
 
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the 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, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+along with GCC; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.  */
 
 #include "config.h"
 #include "system.h"
@@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA.  */
 #include "flags.h"
 #include "function.h"
 #include "expr.h"
+#include "optabs.h"
 #include "regs.h"
 #include "basic-block.h"
 #include "reload.h"
@@ -41,10 +42,6 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "except.h"
 
-#if !defined PREFERRED_STACK_BOUNDARY && defined STACK_BOUNDARY
-#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
-#endif
-
 /* This file contains the reload pass of the compiler, which is
    run after register allocation has been done.  It checks that
    each insn is valid (operands required to be in registers really
@@ -762,7 +759,8 @@ reload (first, global)
     {
       rtx set = single_set (insn);
 
-      if (GET_CODE (insn) == CALL && find_reg_note (insn, REG_SETJMP, NULL))
+      if (GET_CODE (insn) == CALL_INSN
+         && find_reg_note (insn, REG_SETJMP, NULL))
        for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
          if (! call_used_regs[i])
            regs_ever_live[i] = 1;
@@ -784,12 +782,10 @@ reload (first, global)
                {
                  if (GET_CODE (x) == MEM)
                    {
-                     /* If the operand is a PLUS, the MEM may be shared,
-                        so make sure we have an unshared copy here.  */
-                     if (GET_CODE (XEXP (x, 0)) == PLUS)
-                       x = copy_rtx (x);
-
-                     reg_equiv_memory_loc[i] = x;
+                     /* Always unshare the equivalence, so we can
+                        substitute into this insn without touching the
+                        equivalence. */
+                     reg_equiv_memory_loc[i] = copy_rtx (x);
                    }
                  else if (function_invariant_p (x))
                    {
@@ -7290,7 +7286,7 @@ emit_reload_insns (chain)
                     necessarily checked exactly in the code that moves
                     notes, so just check both locations.  */
                  rtx note = find_regno_note (insn, REG_DEAD, src_regno);
-                 if (! note)
+                 if (! note && store_insn)
                    note = find_regno_note (store_insn, REG_DEAD, src_regno);
                  while (nr-- > 0)
                    {
@@ -9070,7 +9066,7 @@ static int reg_set_luid[FIRST_PSEUDO_REGISTER];
    reg_offset[n] in mode reg_mode[n] .
    If reg_base_reg[n] is non-negative, register n has been set to the
    sum of reg_offset[n] and the value of register reg_base_reg[n]
-   before reg_set_luid[n], calculated in mode reg_mode[n] . */
+   before reg_set_luid[n], calculated in mode reg_mode[n] .  */
 static HOST_WIDE_INT reg_offset[FIRST_PSEUDO_REGISTER];
 static int reg_base_reg[FIRST_PSEUDO_REGISTER];
 static enum machine_mode reg_mode[FIRST_PSEUDO_REGISTER];
@@ -9304,7 +9300,7 @@ move2add_note_store (dst, set, data)
   if (GET_CODE (dst) == MEM)
     {
       dst = XEXP (dst, 0);
-      if (GET_CODE (dst) == PRE_INC || GET_CODE (dst) == POST_DEC
+      if (GET_CODE (dst) == PRE_INC || GET_CODE (dst) == POST_INC
          || GET_CODE (dst) == PRE_DEC || GET_CODE (dst) == POST_DEC)
        reg_set_luid[REGNO (XEXP (dst, 0))] = 0;
       return;
@@ -9501,7 +9497,7 @@ fixup_abnormal_edges ()
        }
       if (e && GET_CODE (bb->end) != CALL_INSN && !can_throw_internal (bb->end))
        {
-         rtx insn = bb->end;
+         rtx insn = bb->end, stop = NEXT_INSN (bb->end);
          rtx next;
          for (e = bb->succ; e; e = e->succ_next)
            if (e->flags & EDGE_FALLTHRU)
@@ -9517,11 +9513,14 @@ fixup_abnormal_edges ()
          bb->end = insn;
          inserted = true;
          insn = NEXT_INSN (insn);
-         while (insn && GET_CODE (insn) == INSN)
+         while (insn && insn != stop)
            {
              next = NEXT_INSN (insn);
-             insert_insn_on_edge (PATTERN (insn), e);
-             flow_delete_insn (insn);
+             if (INSN_P (insn))
+               {
+                 insert_insn_on_edge (PATTERN (insn), e);
+                 flow_delete_insn (insn);
+               }
              insn = next;
            }
        }