]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
emit-rtl.c (reset_insn_used_flags): New function.
authorSteven Bosscher <steven@gcc.gnu.org>
Thu, 18 Apr 2013 08:28:10 +0000 (08:28 +0000)
committerSteven Bosscher <steven@gcc.gnu.org>
Thu, 18 Apr 2013 08:28:10 +0000 (08:28 +0000)
* emit-rtl.c (reset_insn_used_flags): New function.
(reset_all_used_flags): Use it.
(verify_insn_sharing): New function.
(verify_rtl_sharing): Fix verification for SEQUENCEs.

From-SVN: r198053

gcc/ChangeLog
gcc/emit-rtl.c

index fd7d6efc8fa3d7eabfc9fe72289408eba9fe6bd6..21e5dbce7d445855070243170ac1a03a1d07b07a 100644 (file)
@@ -1,3 +1,10 @@
+2013-04-18  Steven Bosscher  <steven@gcc.gnu.org>
+
+       * emit-rtl.c (reset_insn_used_flags): New function.
+       (reset_all_used_flags): Use it.
+       (verify_insn_sharing): New function.
+       (verify_rtl_sharing): Fix verification for SEQUENCEs.
+
 2013-04-18  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/56984
        (pass_rtl_unroll_and_peel_loops): Same.
        (pass_rtl_doloop): Same.
 
-2013-04-16  Greta Yorsh  <Greta.Yorsh at arm.com>
+2013-04-16  Greta Yorsh  <Greta.Yorsh@arm.com>
 
        * config/arm/arm.c (emit_multi_reg_push): New declaration
        for an existing function.
index a7cdf843fd9e3cef54ba1fa67af37b736beb8461..538b1ec8aac179db48d502cf87a1bd3ba45aebf4 100644 (file)
@@ -2596,6 +2596,18 @@ verify_rtx_sharing (rtx orig, rtx insn)
   return;
 }
 
+/* Reset used-flags for INSN.  */
+
+static void
+reset_insn_used_flags (rtx insn)
+{
+  gcc_assert (INSN_P (insn));
+  reset_used_flags (PATTERN (insn));
+  reset_used_flags (REG_NOTES (insn));
+  if (CALL_P (insn))
+    reset_used_flags (CALL_INSN_FUNCTION_USAGE (insn));
+}
+
 /* Go through all the RTL insn bodies and clear all the USED bits.  */
 
 static void
@@ -2606,28 +2618,30 @@ reset_all_used_flags (void)
   for (p = get_insns (); p; p = NEXT_INSN (p))
     if (INSN_P (p))
       {
-       reset_used_flags (PATTERN (p));
-       reset_used_flags (REG_NOTES (p));
-       if (CALL_P (p))
-         reset_used_flags (CALL_INSN_FUNCTION_USAGE (p));
-       if (GET_CODE (PATTERN (p)) == SEQUENCE)
+       rtx pat = PATTERN (p);
+       if (GET_CODE (pat) != SEQUENCE)
+         reset_insn_used_flags (p);
+       else
          {
-           int i;
-           rtx q, sequence = PATTERN (p);
-
-           for (i = 0; i < XVECLEN (sequence, 0); i++)
-             {
-               q = XVECEXP (sequence, 0, i);
-               gcc_assert (INSN_P (q));
-               reset_used_flags (PATTERN (q));
-               reset_used_flags (REG_NOTES (q));
-               if (CALL_P (q))
-                 reset_used_flags (CALL_INSN_FUNCTION_USAGE (q));
-             }
+           gcc_assert (REG_NOTES (p) == NULL);
+           for (int i = 0; i < XVECLEN (pat, 0); i++)
+             reset_insn_used_flags (XVECEXP (pat, 0, i));
          }
       }
 }
 
+/* Verify sharing in INSN.  */
+
+static void
+verify_insn_sharing (rtx insn)
+{
+  gcc_assert (INSN_P (insn));
+  reset_used_flags (PATTERN (insn));
+  reset_used_flags (REG_NOTES (insn));
+  if (CALL_P (insn))
+    reset_used_flags (CALL_INSN_FUNCTION_USAGE (insn));
+}
+
 /* Go through all the RTL insn bodies and check that there is no unexpected
    sharing in between the subexpressions.  */
 
@@ -2643,10 +2657,12 @@ verify_rtl_sharing (void)
   for (p = get_insns (); p; p = NEXT_INSN (p))
     if (INSN_P (p))
       {
-       verify_rtx_sharing (PATTERN (p), p);
-       verify_rtx_sharing (REG_NOTES (p), p);
-       if (CALL_P (p))
-         verify_rtx_sharing (CALL_INSN_FUNCTION_USAGE (p), p);
+       rtx pat = PATTERN (p);
+       if (GET_CODE (pat) != SEQUENCE)
+         verify_insn_sharing (p);
+       else
+         for (int i = 0; i < XVECLEN (pat, 0); i++)
+           verify_insn_sharing (XVECEXP (pat, 0, i));
       }
 
   reset_all_used_flags ();