[PATCH 8/9] ENABLE_CHECKING refactoring: target-specific parts
authorMikhail Maltsev <maltsevm@gmail.com>
Fri, 30 Oct 2015 04:08:15 +0000 (04:08 +0000)
committerJeff Law <law@gcc.gnu.org>
Fri, 30 Oct 2015 04:08:15 +0000 (22:08 -0600)
* config/alpha/alpha.c (alpha_function_arg): Use gcc_checking_assert,
flag_checking and/or CHECKING_P to eliminate conditional compilation
on ENABLE_CHECKING.
* config/arm/arm.c (arm_unwind_emit_sequence): Likewise.
* config/bfin/bfin.c (hwloop_optimize): Likewise.
* config/i386/i386.c (ix86_print_operand_address): Likewise.
(output_387_binary_op): Likewise.
* config/ia64/ia64.c (ia64_sched_init, bundling): Likewise.
* config/m68k/m68k.c (m68k_sched_md_init_global): Likewise.
* config/rs6000/rs6000.c (htm_expand_builtin, rs6000_emit_prologue):
Likewise.
* config/rs6000/rs6000.h: Likewise.
* config/visium/visium.c (visium_setup_incoming_varargs): Likewise.

From-SVN: r229567

gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/config/arm/arm.c
gcc/config/bfin/bfin.c
gcc/config/i386/i386.c
gcc/config/ia64/ia64.c
gcc/config/m68k/m68k.c
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.h
gcc/config/visium/visium.c

index c9250b658ab56cc2f7f0d043db3dc1e394497573..934711b183b10085ef96fac8f5658dc4c9549b7d 100644 (file)
@@ -1,3 +1,19 @@
+2015-10-29  Mikhail Maltsev  <maltsevm@gmail.com>
+
+       * config/alpha/alpha.c (alpha_function_arg): Use gcc_checking_assert,
+       flag_checking and/or CHECKING_P to eliminate conditional compilation
+       on ENABLE_CHECKING.
+       * config/arm/arm.c (arm_unwind_emit_sequence): Likewise.
+       * config/bfin/bfin.c (hwloop_optimize): Likewise.
+       * config/i386/i386.c (ix86_print_operand_address): Likewise.
+       (output_387_binary_op): Likewise.
+       * config/ia64/ia64.c (ia64_sched_init, bundling): Likewise.
+       * config/m68k/m68k.c (m68k_sched_md_init_global): Likewise.
+       * config/rs6000/rs6000.c (htm_expand_builtin, rs6000_emit_prologue):
+       Likewise.
+       * config/rs6000/rs6000.h: Likewise.
+       * config/visium/visium.c (visium_setup_incoming_varargs): Likewise.
+
 2015-10-29  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        * config/sh/sh.opt (mfdpic): Add missing period.
index d22bf67e52b568770bce819e083c322e22ca4b2d..11da372fce7509da92c5ccf32b37324094338c45 100644 (file)
@@ -5558,11 +5558,9 @@ alpha_function_arg (cumulative_args_t cum_v, machine_mode mode,
     basereg = 16;
   else
     {
-#ifdef ENABLE_CHECKING
       /* With alpha_split_complex_arg, we shouldn't see any raw complex
         values here.  */
-      gcc_assert (!COMPLEX_MODE_P (mode));
-#endif
+      gcc_checking_assert (!COMPLEX_MODE_P (mode));
 
       /* Set up defaults for FP operands passed in FP registers, and
         integral operands passed in integer registers.  */
index a598c84392d6626bd5d0e85210be7036082e9a71..7c72a81ece0beaca3e531e24a9697ee7a6216fc3 100644 (file)
@@ -26857,20 +26857,21 @@ arm_unwind_emit_sequence (FILE * asm_out_file, rtx p)
       else
        asm_fprintf (asm_out_file, "%r", reg);
 
-#ifdef ENABLE_CHECKING
-      /* Check that the addresses are consecutive.  */
-      e = XEXP (SET_DEST (e), 0);
-      if (GET_CODE (e) == PLUS)
-       gcc_assert (REG_P (XEXP (e, 0))
-                   && REGNO (XEXP (e, 0)) == SP_REGNUM
-                   && CONST_INT_P (XEXP (e, 1))
-                   && offset == INTVAL (XEXP (e, 1)));
-      else
-       gcc_assert (i == 1
-                   && REG_P (e)
-                   && REGNO (e) == SP_REGNUM);
-      offset += reg_size;
-#endif
+      if (flag_checking)
+       {
+         /* Check that the addresses are consecutive.  */
+         e = XEXP (SET_DEST (e), 0);
+         if (GET_CODE (e) == PLUS)
+           gcc_assert (REG_P (XEXP (e, 0))
+                       && REGNO (XEXP (e, 0)) == SP_REGNUM
+                       && CONST_INT_P (XEXP (e, 1))
+                       && offset == INTVAL (XEXP (e, 1)));
+         else
+           gcc_assert (i == 1
+                       && REG_P (e)
+                       && REGNO (e) == SP_REGNUM);
+         offset += reg_size;
+       }
     }
   fprintf (asm_out_file, "}\n");
   if (padfirst)
index 7334a52075cc08b539e52c65fdf8f577eda097ce..6a5f90a7f1e5592ec5fffc88de420b95998bb168 100644 (file)
@@ -3792,8 +3792,7 @@ hwloop_optimize (hwloop_info loop)
       edge e;
       edge_iterator ei;
 
-#ifdef ENABLE_CHECKING
-      if (loop->head != loop->incoming_dest)
+      if (flag_checking && loop->head != loop->incoming_dest)
        {
          /* We aren't entering the loop at the top.  Since we've established
             that the loop is entered only at one point, this means there
@@ -3803,7 +3802,6 @@ hwloop_optimize (hwloop_info loop)
          FOR_EACH_EDGE (e, ei, loop->head->preds)
            gcc_assert (!(e->flags & EDGE_FALLTHRU));
        }
-#endif
 
       emit_insn_before (seq, BB_HEAD (loop->head));
       seq = emit_label_before (gen_label_rtx (), seq);
index 8476677f1c17ada54b41c3af84a825d11f5240c8..913dc00e02c65eefead3e7a5efd267083ab927a5 100644 (file)
@@ -17348,22 +17348,23 @@ ix86_print_operand_address (FILE *file, rtx addr)
       /* Print SImode register names to force addr32 prefix.  */
       if (SImode_address_operand (addr, VOIDmode))
        {
-#ifdef ENABLE_CHECKING
-         gcc_assert (TARGET_64BIT);
-         switch (GET_CODE (addr))
+         if (flag_checking)
            {
-           case SUBREG:
-             gcc_assert (GET_MODE (addr) == SImode);
-             gcc_assert (GET_MODE (SUBREG_REG (addr)) == DImode);
-             break;
-           case ZERO_EXTEND:
-           case AND:
-             gcc_assert (GET_MODE (addr) == DImode);
-             break;
-           default:
-             gcc_unreachable ();
+             gcc_assert (TARGET_64BIT);
+             switch (GET_CODE (addr))
+               {
+               case SUBREG:
+                 gcc_assert (GET_MODE (addr) == SImode);
+                 gcc_assert (GET_MODE (SUBREG_REG (addr)) == DImode);
+                 break;
+               case ZERO_EXTEND:
+               case AND:
+                 gcc_assert (GET_MODE (addr) == DImode);
+                 break;
+               default:
+                 gcc_unreachable ();
+               }
            }
-#endif
          gcc_assert (!code);
          code = 'k';
        }
@@ -17620,10 +17621,10 @@ output_387_binary_op (rtx insn, rtx *operands)
   const char *ssep;
   int is_sse = SSE_REG_P (operands[0]) || SSE_REG_P (operands[1]) || SSE_REG_P (operands[2]);
 
-#ifdef ENABLE_CHECKING
   /* Even if we do not want to check the inputs, this documents input
      constraints.  Which helps in understanding the following code.  */
-  if (STACK_REG_P (operands[0])
+  if (flag_checking
+      && STACK_REG_P (operands[0])
       && ((REG_P (operands[1])
           && REGNO (operands[0]) == REGNO (operands[1])
           && (STACK_REG_P (operands[2]) || MEM_P (operands[2])))
@@ -17633,8 +17634,7 @@ output_387_binary_op (rtx insn, rtx *operands)
       && (STACK_TOP_P (operands[1]) || STACK_TOP_P (operands[2])))
     ; /* ok */
   else
-    gcc_assert (is_sse);
-#endif
+    gcc_checking_assert (is_sse);
 
   switch (GET_CODE (operands[3]))
     {
index 879113895f3df8e2f6d138464e47e83c52d4d943..d92af1770827ecc952e162d0cde5c5cf9020318e 100644 (file)
@@ -6125,7 +6125,7 @@ struct reg_write_state
 
 /* Cumulative info for the current instruction group.  */
 struct reg_write_state rws_sum[NUM_REGS];
-#ifdef ENABLE_CHECKING
+#if CHECKING_P
 /* Bitmap whether a register has been written in the current insn.  */
 HARD_REG_ELT_TYPE rws_insn[(NUM_REGS + HOST_BITS_PER_WIDEST_FAST_INT - 1)
                           / HOST_BITS_PER_WIDEST_FAST_INT];
@@ -7293,15 +7293,13 @@ ia64_sched_init (FILE *dump ATTRIBUTE_UNUSED,
                 int sched_verbose ATTRIBUTE_UNUSED,
                 int max_ready ATTRIBUTE_UNUSED)
 {
-#ifdef ENABLE_CHECKING
-  rtx_insn *insn;
-
-  if (!sel_sched_p () && reload_completed)
-    for (insn = NEXT_INSN (current_sched_info->prev_head);
-        insn != current_sched_info->next_tail;
-        insn = NEXT_INSN (insn))
-      gcc_assert (!SCHED_GROUP_P (insn));
-#endif
+  if (flag_checking && !sel_sched_p () && reload_completed)
+    {
+      for (rtx_insn *insn = NEXT_INSN (current_sched_info->prev_head);
+          insn != current_sched_info->next_tail;
+          insn = NEXT_INSN (insn))
+       gcc_assert (!SCHED_GROUP_P (insn));
+    }
   last_scheduled_insn = NULL;
   init_insn_group_barriers ();
 
@@ -9299,54 +9297,52 @@ bundling (FILE *dump, int verbose, rtx_insn *prev_head_insn, rtx_insn *tail)
        }
     }
 
-#ifdef ENABLE_CHECKING
-  {
-    /* Assert right calculation of middle_bundle_stops.  */
-    int num = best_state->middle_bundle_stops;
-    bool start_bundle = true, end_bundle = false;
-
-    for (insn = NEXT_INSN (prev_head_insn);
-        insn && insn != tail;
-        insn = NEXT_INSN (insn))
-      {
-       if (!INSN_P (insn))
-         continue;
-       if (recog_memoized (insn) == CODE_FOR_bundle_selector)
-         start_bundle = true;
-       else
-         {
-           rtx_insn *next_insn;
-
-           for (next_insn = NEXT_INSN (insn);
-                next_insn && next_insn != tail;
-                next_insn = NEXT_INSN (next_insn))
-             if (INSN_P (next_insn)
-                 && (ia64_safe_itanium_class (next_insn)
-                     != ITANIUM_CLASS_IGNORE
-                     || recog_memoized (next_insn)
-                     == CODE_FOR_bundle_selector)
-                 && GET_CODE (PATTERN (next_insn)) != USE
-                 && GET_CODE (PATTERN (next_insn)) != CLOBBER)
-               break;
+  if (flag_checking)
+    {
+      /* Assert right calculation of middle_bundle_stops.  */
+      int num = best_state->middle_bundle_stops;
+      bool start_bundle = true, end_bundle = false;
 
-           end_bundle = next_insn == NULL_RTX
-            || next_insn == tail
-            || (INSN_P (next_insn)
-                && recog_memoized (next_insn)
-                == CODE_FOR_bundle_selector);
-           if (recog_memoized (insn) == CODE_FOR_insn_group_barrier
-               && !start_bundle && !end_bundle
-               && next_insn
-               && !unknown_for_bundling_p (next_insn))
-             num--;
-
-           start_bundle = false;
-         }
-      }
+      for (insn = NEXT_INSN (prev_head_insn);
+          insn && insn != tail;
+          insn = NEXT_INSN (insn))
+       {
+         if (!INSN_P (insn))
+           continue;
+         if (recog_memoized (insn) == CODE_FOR_bundle_selector)
+           start_bundle = true;
+         else
+           {
+             rtx_insn *next_insn;
+
+             for (next_insn = NEXT_INSN (insn);
+                  next_insn && next_insn != tail;
+                  next_insn = NEXT_INSN (next_insn))
+               if (INSN_P (next_insn)
+                   && (ia64_safe_itanium_class (next_insn)
+                       != ITANIUM_CLASS_IGNORE
+                       || recog_memoized (next_insn)
+                       == CODE_FOR_bundle_selector)
+                   && GET_CODE (PATTERN (next_insn)) != USE
+                   && GET_CODE (PATTERN (next_insn)) != CLOBBER)
+                 break;
+
+             end_bundle = next_insn == NULL_RTX
+               || next_insn == tail
+               || (INSN_P (next_insn)
+                   && recog_memoized (next_insn) == CODE_FOR_bundle_selector);
+             if (recog_memoized (insn) == CODE_FOR_insn_group_barrier
+                 && !start_bundle && !end_bundle
+                 && next_insn
+                 && !unknown_for_bundling_p (next_insn))
+               num--;
+
+             start_bundle = false;
+           }
+       }
 
-    gcc_assert (num == 0);
-  }
-#endif
+      gcc_assert (num == 0);
+    }
 
   free (index_to_bundle_states);
   finish_bundle_state_table ();
index bfc19f30eb496da156251ede36d20c1ac2c5f7a0..37b1af2db3aef9534c2ee0b93f68f477b178738e 100644 (file)
@@ -6118,28 +6118,27 @@ m68k_sched_md_init_global (FILE *sched_dump ATTRIBUTE_UNUSED,
                           int sched_verbose ATTRIBUTE_UNUSED,
                           int n_insns ATTRIBUTE_UNUSED)
 {
-#ifdef ENABLE_CHECKING
   /* Check that all instructions have DFA reservations and
      that all instructions can be issued from a clean state.  */
-  {
-    rtx_insn *insn;
-    state_t state;
+  if (flag_checking)
+    {
+      rtx_insn *insn;
+      state_t state;
 
-    state = alloca (state_size ());
+      state = alloca (state_size ());
 
-    for (insn = get_insns (); insn != NULL; insn = NEXT_INSN (insn))
-      {
-       if (INSN_P (insn) && recog_memoized (insn) >= 0)
-         {
-           gcc_assert (insn_has_dfa_reservation_p (insn));
+      for (insn = get_insns (); insn != NULL; insn = NEXT_INSN (insn))
+       {
+         if (INSN_P (insn) && recog_memoized (insn) >= 0)
+           {
+             gcc_assert (insn_has_dfa_reservation_p (insn));
 
-           state_reset (state);
-           if (state_transition (state, insn) >= 0)
-             gcc_unreachable ();
-         }
-      }
-  }
-#endif
+             state_reset (state);
+             if (state_transition (state, insn) >= 0)
+               gcc_unreachable ();
+           }
+       }
+    }
 
   /* Setup target cpu.  */
 
index bbdd1425eebb6da6675a746618e1eefd26b77a2a..53b86afd83f0b8384bd90e04bf4599a36181a8c2 100644 (file)
@@ -12906,15 +12906,13 @@ htm_expand_builtin (tree exp, rtx target, bool * expandedp)
          case HTM_BUILTIN_TENDALL:  /* Alias for: tend. 1  */
          case HTM_BUILTIN_TRESUME:  /* Alias for: tsr. 1  */
            op[nopnds++] = GEN_INT (1);
-#ifdef ENABLE_CHECKING
-           attr |= RS6000_BTC_UNARY;
-#endif
+           if (flag_checking)
+             attr |= RS6000_BTC_UNARY;
            break;
          case HTM_BUILTIN_TSUSPEND: /* Alias for: tsr. 0  */
            op[nopnds++] = GEN_INT (0);
-#ifdef ENABLE_CHECKING
-           attr |= RS6000_BTC_UNARY;
-#endif
+           if (flag_checking)
+             attr |= RS6000_BTC_UNARY;
            break;
          default:
            break;
@@ -12935,21 +12933,23 @@ htm_expand_builtin (tree exp, rtx target, bool * expandedp)
            op[nopnds++] = cr;
          }
 
-#ifdef ENABLE_CHECKING
-       int expected_nopnds = 0;
-       if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_UNARY)
-         expected_nopnds = 1;
-       else if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_BINARY)
-         expected_nopnds = 2;
-       else if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_TERNARY)
-         expected_nopnds = 3;
-       if (!(attr & RS6000_BTC_VOID))
-         expected_nopnds += 1;
-       if (uses_spr)
-         expected_nopnds += 2;
+       if (flag_checking)
+         {
+           int expected_nopnds = 0;
+           if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_UNARY)
+             expected_nopnds = 1;
+           else if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_BINARY)
+             expected_nopnds = 2;
+           else if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_TERNARY)
+             expected_nopnds = 3;
+           if (!(attr & RS6000_BTC_VOID))
+             expected_nopnds += 1;
+           if (uses_spr)
+             expected_nopnds += 2;
 
-       gcc_assert (nopnds == expected_nopnds && nopnds <= MAX_HTM_OPERANDS);
-#endif
+           gcc_assert (nopnds == expected_nopnds
+                       && nopnds <= MAX_HTM_OPERANDS);
+         }
 
        switch (nopnds)
          {
@@ -24325,7 +24325,7 @@ rs6000_emit_prologue (void)
      prior to it, when r12 is not used here for other purposes.  */
   rtx_insn *sp_adjust = 0;
 
-#ifdef ENABLE_CHECKING
+#if CHECKING_P
   /* Track and check usage of r0, r11, r12.  */
   int reg_inuse = using_static_chain_p ? 1 << 11 : 0;
 #define START_USE(R) do \
index cad1551a15cc97696699aadc81543c545e09914f..02da097227bcb4eaeebe4a8f5d890c17a7d690f1 100644 (file)
@@ -1479,15 +1479,10 @@ enum reg_class
 
 extern enum reg_class rs6000_regno_regclass[FIRST_PSEUDO_REGISTER];
 
-#if ENABLE_CHECKING
 #define REGNO_REG_CLASS(REGNO)                                                 \
-  (gcc_assert (IN_RANGE ((REGNO), 0, FIRST_PSEUDO_REGISTER-1)),                \
+  (gcc_checking_assert (IN_RANGE ((REGNO), 0, FIRST_PSEUDO_REGISTER-1)),\
    rs6000_regno_regclass[(REGNO)])
 
-#else
-#define REGNO_REG_CLASS(REGNO) rs6000_regno_regclass[(REGNO)]
-#endif
-
 /* Register classes for various constraints that are based on the target
    switches.  */
 enum r6000_reg_class_enum {
index 5e7b944ec74b78ab0e4e08dfdfeb1031432fa15b..d1b580ebc44d5ffb86ce1b7eb480f1aa9199dfa9 100644 (file)
@@ -1338,7 +1338,7 @@ visium_setup_incoming_varargs (cumulative_args_t pcum_v,
   local_args_so_far.p = &local_copy;
   locargs = get_cumulative_args (pcum_v);
 
-#ifdef ENABLE_CHECKING
+#if CHECKING_P
   local_args_so_far.magic = CUMULATIVE_ARGS_MAGIC;
 #endif