OSDN Git Service

* tree-ssa-alias.c (compute_memory_partitions): Use
[pf3gnuchains/gcc-fork.git] / gcc / recog.c
index b12541e..5692f4e 100644 (file)
@@ -7,7 +7,7 @@ This file is part of GCC.
 
 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
 
 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
+Software Foundation; either version 3, or (at your option) any later
 version.
 
 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
 version.
 
 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -16,9 +16,8 @@ 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
 for more details.
 
 You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.  */
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 
 
 #include "config.h"
 
 
 #include "config.h"
@@ -166,6 +165,7 @@ typedef struct change_t
   int old_code;
   rtx *loc;
   rtx old;
   int old_code;
   rtx *loc;
   rtx old;
+  bool unshare;
 } change_t;
 
 static change_t *changes;
 } change_t;
 
 static change_t *changes;
@@ -191,8 +191,8 @@ static int num_changes = 0;
    is not valid for the machine, suppress the change and return zero.
    Otherwise, perform the change and return 1.  */
 
    is not valid for the machine, suppress the change and return zero.
    Otherwise, perform the change and return 1.  */
 
-int
-validate_change (rtx object, rtx *loc, rtx new, int in_group)
+static bool
+validate_change_1 (rtx object, rtx *loc, rtx new, bool in_group, bool unshare)
 {
   rtx old = *loc;
 
 {
   rtx old = *loc;
 
@@ -219,6 +219,7 @@ validate_change (rtx object, rtx *loc, rtx new, int in_group)
   changes[num_changes].object = object;
   changes[num_changes].loc = loc;
   changes[num_changes].old = old;
   changes[num_changes].object = object;
   changes[num_changes].loc = loc;
   changes[num_changes].old = old;
+  changes[num_changes].unshare = unshare;
 
   if (object && !MEM_P (object))
     {
 
   if (object && !MEM_P (object))
     {
@@ -239,6 +240,25 @@ validate_change (rtx object, rtx *loc, rtx new, int in_group)
     return apply_change_group ();
 }
 
     return apply_change_group ();
 }
 
+/* Wrapper for validate_change_1 without the UNSHARE argument defaulting
+   UNSHARE to false.  */
+
+bool
+validate_change (rtx object, rtx *loc, rtx new, bool in_group)
+{
+  return validate_change_1 (object, loc, new, in_group, false);
+}
+
+/* Wrapper for validate_change_1 without the UNSHARE argument defaulting
+   UNSHARE to true.  */
+
+bool
+validate_unshare_change (rtx object, rtx *loc, rtx new, bool in_group)
+{
+  return validate_change_1 (object, loc, new, in_group, true);
+}
+
+
 /* Keep X canonicalized if some changes have made it non-canonical; only
    modifies the operands of X, not (for example) its code.  Simplifications
    are not the job of this routine.
 /* Keep X canonicalized if some changes have made it non-canonical; only
    modifies the operands of X, not (for example) its code.  Simplifications
    are not the job of this routine.
@@ -414,14 +434,27 @@ void
 confirm_change_group (void)
 {
   int i;
 confirm_change_group (void)
 {
   int i;
+  rtx last_object = NULL;
 
   for (i = 0; i < num_changes; i++)
     {
       rtx object = changes[i].object;
 
   for (i = 0; i < num_changes; i++)
     {
       rtx object = changes[i].object;
-      if (object && INSN_P (object))
-       df_insn_rescan (object);
+
+      if (changes[i].unshare)
+       *changes[i].loc = copy_rtx (*changes[i].loc);
+
+      /* Avoid unnecesary rescaning when multiple changes to same instruction
+         are made.  */
+      if (object)
+       {
+         if (object != last_object && last_object && INSN_P (last_object))
+           df_insn_rescan (last_object);
+         last_object = object;
+       }
     }
 
     }
 
+  if (last_object && INSN_P (last_object))
+    df_insn_rescan (last_object);
   num_changes = 0;
 }
 
   num_changes = 0;
 }
 
@@ -504,7 +537,7 @@ validate_replace_rtx_1 (rtx *loc, rtx from, rtx to, rtx object)
       || (GET_CODE (x) == GET_CODE (from) && GET_MODE (x) == GET_MODE (from)
          && rtx_equal_p (x, from)))
     {
       || (GET_CODE (x) == GET_CODE (from) && GET_MODE (x) == GET_MODE (from)
          && rtx_equal_p (x, from)))
     {
-      validate_change (object, loc, to, 1);
+      validate_unshare_change (object, loc, to, 1);
       return;
     }
 
       return;
     }
 
@@ -1246,7 +1279,7 @@ comparison_operator (rtx op, enum machine_mode mode)
    Otherwise return -1.  */
 
 int
    Otherwise return -1.  */
 
 int
-asm_noperands (rtx body)
+asm_noperands (const_rtx body)
 {
   switch (GET_CODE (body))
     {
 {
   switch (GET_CODE (body))
     {