OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / auto-inc-dec.c
index 830fc5e..04c91a2 100644 (file)
@@ -1,5 +1,5 @@
 /* Discovery of auto-inc and auto-dec instructions.
-   Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
 
 This file is part of GCC.
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "output.h"
 #include "function.h"
 #include "except.h"
+#include "diagnostic-core.h"
 #include "toplev.h"
 #include "recog.h"
 #include "expr.h"
@@ -470,7 +471,7 @@ attempt_change (rtx new_addr, rtx inc_reg)
      passes are for.  The two cases where we have an inc insn will be
      handled mov free.  */
 
-  basic_block bb = BASIC_BLOCK (BLOCK_NUM (mem_insn.insn));
+  basic_block bb = BLOCK_FOR_INSN (mem_insn.insn);
   rtx mov_insn = NULL;
   int regno;
   rtx mem = *mem_insn.mem_loc;
@@ -746,7 +747,7 @@ get_next_ref (int regno, basic_block bb, rtx *next_array)
   rtx insn = next_array[regno];
 
   /* Lazy about cleaning out the next_arrays.  */
-  if (insn && BASIC_BLOCK (BLOCK_NUM (insn)) != bb)
+  if (insn && BLOCK_FOR_INSN (insn) != bb)
     {
       next_array[regno] = NULL;
       insn = NULL;
@@ -969,7 +970,7 @@ static bool
 find_inc (bool first_try)
 {
   rtx insn;
-  basic_block bb = BASIC_BLOCK (BLOCK_NUM (mem_insn.insn));
+  basic_block bb = BLOCK_FOR_INSN (mem_insn.insn);
   rtx other_insn;
   df_ref *def_rec;
 
@@ -986,7 +987,7 @@ find_inc (bool first_try)
 
   /* Find the next use that is an inc.  */
   insn = get_next_ref (REGNO (mem_insn.reg0),
-                      BASIC_BLOCK (BLOCK_NUM (mem_insn.insn)),
+                      BLOCK_FOR_INSN (mem_insn.insn),
                       reg_next_inc_use);
   if (!insn)
     return false;
@@ -1042,7 +1043,7 @@ find_inc (bool first_try)
       /* Make sure that there is no insn that assigns to inc_insn.res
         between the mem_insn and the inc_insn.  */
       rtx other_insn = get_next_ref (REGNO (inc_insn.reg_res),
-                                    BASIC_BLOCK (BLOCK_NUM (mem_insn.insn)),
+                                    BLOCK_FOR_INSN (mem_insn.insn),
                                     reg_next_def);
       if (other_insn != inc_insn.insn)
        {
@@ -1053,7 +1054,7 @@ find_inc (bool first_try)
        }
 
       other_insn = get_next_ref (REGNO (inc_insn.reg_res),
-                                BASIC_BLOCK (BLOCK_NUM (mem_insn.insn)),
+                                BLOCK_FOR_INSN (mem_insn.insn),
                                 reg_next_use);
       if (other_insn
          && (other_insn != inc_insn.insn)
@@ -1068,7 +1069,7 @@ find_inc (bool first_try)
       /* For the post_add to work, the result_reg of the inc must not be
         used in the mem insn since this will become the new index
         register.  */
-      if (count_occurrences (PATTERN (mem_insn.insn), inc_insn.reg_res, 1) != 0)
+      if (reg_overlap_mentioned_p (inc_insn.reg_res, PATTERN (mem_insn.insn)))
        {
          if (dump_file)
            fprintf (dump_file, "base reg replacement failure.\n");