OSDN Git Service

2010-04-26 Jack Howarth <howarth@bromo.med.uc.edu>
[pf3gnuchains/gcc-fork.git] / gcc / postreload.c
index cf165ec..6b8f186 100644 (file)
@@ -1,7 +1,7 @@
 /* Perform simple optimizations to clean up the result of reload.
    Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
-   1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-   Free Software Foundation, Inc.
+   1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+   2010 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -40,7 +40,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "recog.h"
 #include "output.h"
 #include "cselib.h"
-#include "real.h"
 #include "toplev.h"
 #include "except.h"
 #include "tree.h"
@@ -198,7 +197,7 @@ reload_cse_regs_1 (rtx first)
   rtx insn;
   rtx testreg = gen_rtx_REG (VOIDmode, -1);
 
-  cselib_init (true);
+  cselib_init (CSELIB_RECORD_MEMORY);
   init_alias_analysis ();
 
   for (insn = first; insn; insn = NEXT_INSN (insn))
@@ -407,7 +406,6 @@ reload_cse_simplify_operands (rtx insn, rtx testreg)
       cselib_val *v;
       struct elt_loc_list *l;
       rtx op;
-      enum machine_mode mode;
 
       CLEAR_HARD_REG_SET (equiv_regs[i]);
 
@@ -420,11 +418,10 @@ reload_cse_simplify_operands (rtx insn, rtx testreg)
        continue;
 
       op = recog_data.operand[i];
-      mode = GET_MODE (op);
 #ifdef LOAD_EXTEND_OP
       if (MEM_P (op)
-         && GET_MODE_BITSIZE (mode) < BITS_PER_WORD
-         && LOAD_EXTEND_OP (mode) != UNKNOWN)
+         && GET_MODE_BITSIZE (GET_MODE (op)) < BITS_PER_WORD
+         && LOAD_EXTEND_OP (GET_MODE (op)) != UNKNOWN)
        {
          rtx set = single_set (insn);
 
@@ -457,7 +454,7 @@ reload_cse_simplify_operands (rtx insn, rtx testreg)
                   && SET_DEST (set) == recog_data.operand[1-i])
            {
              validate_change (insn, recog_data.operand_loc[i],
-                              gen_rtx_fmt_e (LOAD_EXTEND_OP (mode),
+                              gen_rtx_fmt_e (LOAD_EXTEND_OP (GET_MODE (op)),
                                              word_mode, op),
                               1);
              validate_change (insn, recog_data.operand_loc[1-i],
@@ -794,7 +791,7 @@ reload_combine (void)
         ... (MEM (PLUS (REGZ) (REGY)))... .
 
         First, check that we have (set (REGX) (PLUS (REGX) (REGY)))
-        and that we know all uses of REGX before it dies.  
+        and that we know all uses of REGX before it dies.
         Also, explicitly check that REGX != REGY; our life information
         does not yet show whether REGY changes in this insn.  */
       set = single_set (insn);
@@ -886,6 +883,19 @@ reload_combine (void)
 
              if (apply_change_group ())
                {
+                 /* For every new use of REG_SUM, we have to record the use
+                    of BASE therein, i.e. operand 1.  */
+                 for (i = reg_state[regno].use_index;
+                      i < RELOAD_COMBINE_MAX_USES; i++)
+                   reload_combine_note_use
+                     (&XEXP (*reg_state[regno].reg_use[i].usep, 1),
+                      reg_state[regno].reg_use[i].insn);
+
+                 if (reg_state[REGNO (base)].use_ruid
+                     > reg_state[regno].use_ruid)
+                   reg_state[REGNO (base)].use_ruid
+                     = reg_state[regno].use_ruid;
+
                  /* Delete the reg-reg addition.  */
                  delete_insn (insn);