]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
fwprop.c (try_fwprop_subst): Use validate_unshare_change.
authorJan Hubicka <jh@suse.cz>
Wed, 27 Jun 2007 01:21:13 +0000 (03:21 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 27 Jun 2007 01:21:13 +0000 (01:21 +0000)
* fwprop.c (try_fwprop_subst): Use validate_unshare_change.
* postreload.c (reload_cse_simplify_set): Instead of copying the rtx
early use validate_unshare_change.
(reload_combine): Likewise.
* recog.c (change_t): New field unshare.
(validate_change_1): Rename from validate_change; add argument unshare.
(validate_change): Turn into wrapper of validate_change_1; update
prototype for bools.
(validate_unshare_change): New.
(confirm_change_group): Unshare changes if asked for; avoid unnecesary
calls of df_insn_rescan.
* recog.h (validate_change): Replace ints by bools.
(validate_unshare_change): Declare.

From-SVN: r126050

gcc/ChangeLog
gcc/fwprop.c
gcc/postreload.c
gcc/recog.c
gcc/recog.h

index c41854abab63eaa01f3ea0a084b63e7a1dbd3502..321298c46f5ba9a7f986520310177452a0604d76 100644 (file)
@@ -1,3 +1,19 @@
+2007-06-26  Jan Hubicka  <jh@suse.cz>
+
+       * fwprop.c (try_fwprop_subst): Use validate_unshare_change.
+       * postreload.c (reload_cse_simplify_set): Instead of copying the rtx
+       early use validate_unshare_change.
+       (reload_combine): Likewise.
+       * recog.c (change_t): New field unshare.
+       (validate_change_1): Rename from validate_change; add argument unshare.
+       (validate_change): Turn into wrapper of validate_change_1; update
+       prototype for bools.
+       (validate_unshare_change): New.
+       (confirm_change_group): Unshare changes if asked for; avoid unnecesary
+       calls of df_insn_rescan.
+       * recog.h (validate_change): Replace ints by bools.
+       (validate_unshare_change): Declare.
+
 2007-06-26  Kenneth Zadeck <zadeck@naturalbridge.com>
 
         * tree.def (VEC_WIDEN_MULT_LO_EXPR): Corrected string name.
index a3c8bc1eddec0b367996f13323e52ca38033f3f5..3722811737e6a42d7ef304baffdbfcb4d540fe08 100644 (file)
@@ -686,7 +686,7 @@ try_fwprop_subst (struct df_ref *use, rtx *loc, rtx new, rtx def_insn, bool set_
       fprintf (dump_file, "\n");
     }
 
-  if (validate_change (insn, loc, new, false))
+  if (validate_unshare_change (insn, loc, new, false))
     {
       num_changes++;
       if (dump_file)
index 3894efaec8f03caf6498f60c443035d7a8f77a3d..16dec228b517ffa7140d704f6446c57aac3d5e08 100644 (file)
@@ -345,7 +345,7 @@ reload_cse_simplify_set (rtx set, rtx insn)
            }
 #endif
 
-         validate_change (insn, &SET_SRC (set), copy_rtx (this_rtx), 1);
+         validate_unshare_change (insn, &SET_SRC (set), this_rtx, 1);
          old_cost = this_cost, did_change = 1;
        }
     }
@@ -881,11 +881,11 @@ reload_combine (void)
                 with REG_SUM.  */
              for (i = reg_state[regno].use_index;
                   i < RELOAD_COMBINE_MAX_USES; i++)
-               validate_change (reg_state[regno].reg_use[i].insn,
-                                reg_state[regno].reg_use[i].usep,
-                                /* Each change must have its own
-                                   replacement.  */
-                                copy_rtx (reg_sum), 1);
+               validate_unshare_change (reg_state[regno].reg_use[i].insn,
+                                        reg_state[regno].reg_use[i].usep,
+                                        /* Each change must have its own
+                                           replacement.  */
+                                        reg_sum, 1);
 
              if (apply_change_group ())
                {
index b12541edb996a4981d7367f4cf4365ee444d4e61..497188d0676e7c3a3e75b357b94d5325685130a3 100644 (file)
@@ -166,6 +166,7 @@ typedef struct change_t
   int old_code;
   rtx *loc;
   rtx old;
+  bool unshare;
 } change_t;
 
 static change_t *changes;
@@ -191,8 +192,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.  */
 
-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;
 
@@ -219,6 +220,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].unshare = unshare;
 
   if (object && !MEM_P (object))
     {
@@ -239,6 +241,25 @@ validate_change (rtx object, rtx *loc, rtx new, int in_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.
@@ -414,14 +435,27 @@ void
 confirm_change_group (void)
 {
   int i;
+  rtx last_object = NULL;
 
   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;
 }
 
index cf52cd3f0f098a4ffeda58d8f84b563639d26f46..f1b993a9313f3ba851b8509eddb2881b19ebd8b8 100644 (file)
@@ -73,7 +73,8 @@ extern void init_recog (void);
 extern void init_recog_no_volatile (void);
 extern int check_asm_operands (rtx);
 extern int asm_operand_ok (rtx, const char *);
-extern int validate_change (rtx, rtx *, rtx, int);
+extern bool validate_change (rtx, rtx *, rtx, bool);
+extern bool validate_unshare_change (rtx, rtx *, rtx, bool);
 extern bool canonicalize_change_group (rtx insn, rtx x);
 extern int insn_invalid_p (rtx);
 extern int verify_changes (int);