PR c++/68795: fix uninitialized close_paren_loc in cp_parser_postfix_expression
[gcc.git] / gcc / cfgcleanup.c
index 17cf023561b453fdd1d7f71e99f28fd069575ffa..6e92d4cdde221265fa603a2621bef62e05e81ef5 100644 (file)
@@ -1,5 +1,5 @@
 /* Control flow optimization code for GNU compiler.
-   Copyright (C) 1987-2015 Free Software Foundation, Inc.
+   Copyright (C) 1987-2016 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -32,53 +32,23 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
+#include "backend.h"
+#include "target.h"
 #include "rtl.h"
-#include "hash-set.h"
-#include "machmode.h"
-#include "vec.h"
-#include "double-int.h"
-#include "input.h"
-#include "alias.h"
-#include "symtab.h"
-#include "wide-int.h"
-#include "inchash.h"
 #include "tree.h"
-#include "hard-reg-set.h"
-#include "regs.h"
+#include "cfghooks.h"
+#include "df.h"
+#include "tm_p.h"
 #include "insn-config.h"
-#include "flags.h"
-#include "recog.h"
-#include "diagnostic-core.h"
+#include "emit-rtl.h"
 #include "cselib.h"
 #include "params.h"
-#include "tm_p.h"
-#include "target.h"
-#include "hashtab.h"
-#include "function.h" /* For inline functions in emit-rtl.h they need crtl.  */
-#include "emit-rtl.h"
 #include "tree-pass.h"
 #include "cfgloop.h"
-#include "function.h"
-#include "statistics.h"
-#include "real.h"
-#include "fixed-value.h"
-#include "expmed.h"
-#include "dojump.h"
-#include "explow.h"
-#include "calls.h"
-#include "varasm.h"
-#include "stmt.h"
-#include "expr.h"
-#include "dominance.h"
-#include "cfg.h"
 #include "cfgrtl.h"
 #include "cfganal.h"
 #include "cfgbuild.h"
 #include "cfgcleanup.h"
-#include "predict.h"
-#include "basic-block.h"
-#include "df.h"
 #include "dce.h"
 #include "dbgcnt.h"
 #include "rtl-iter.h"
@@ -190,7 +160,8 @@ try_simplify_condjump (basic_block cbranch_block)
     return false;
 
   /* Invert the conditional branch.  */
-  if (!invert_jump (cbranch_insn, block_label (jump_dest_block), 0))
+  if (!invert_jump (as_a <rtx_jump_insn *> (cbranch_insn),
+                   block_label (jump_dest_block), 0))
     return false;
 
   if (dump_file)
@@ -222,23 +193,15 @@ try_simplify_condjump (basic_block cbranch_block)
 static bool
 mark_effect (rtx exp, regset nonequal)
 {
-  int regno;
   rtx dest;
   switch (GET_CODE (exp))
     {
       /* In case we do clobber the register, mark it as equal, as we know the
         value is dead so it don't have to match.  */
     case CLOBBER:
-      if (REG_P (XEXP (exp, 0)))
-       {
-         dest = XEXP (exp, 0);
-         regno = REGNO (dest);
-         if (HARD_REGISTER_NUM_P (regno))
-           bitmap_clear_range (nonequal, regno,
-                               hard_regno_nregs[regno][GET_MODE (dest)]);
-         else
-           bitmap_clear_bit (nonequal, regno);
-       }
+      dest = XEXP (exp, 0);
+      if (REG_P (dest))
+       bitmap_clear_range (nonequal, REGNO (dest), REG_NREGS (dest));
       return false;
 
     case SET:
@@ -249,12 +212,7 @@ mark_effect (rtx exp, regset nonequal)
        return false;
       if (!REG_P (dest))
        return true;
-      regno = REGNO (dest);
-      if (HARD_REGISTER_NUM_P (regno))
-       bitmap_set_range (nonequal, regno,
-                         hard_regno_nregs[regno][GET_MODE (dest)]);
-      else
-       bitmap_set_bit (nonequal, regno);
+      bitmap_set_range (nonequal, REGNO (dest), REG_NREGS (dest));
       return false;
 
     default:
@@ -272,16 +230,10 @@ mentions_nonequal_regs (const_rtx x, regset nonequal)
       const_rtx x = *iter;
       if (REG_P (x))
        {
-         unsigned int regno = REGNO (x);
-         if (REGNO_REG_SET_P (nonequal, regno))
-           return true;
-         if (regno < FIRST_PSEUDO_REGISTER)
-           {
-             int n = hard_regno_nregs[regno][GET_MODE (x)];
-             while (--n > 0)
-               if (REGNO_REG_SET_P (nonequal, regno + n))
-                 return true;
-           }
+         unsigned int end_regno = END_REGNO (x);
+         for (unsigned int regno = REGNO (x); regno < end_regno; ++regno)
+           if (REGNO_REG_SET_P (nonequal, regno))
+             return true;
        }
     }
   return false;
@@ -1032,7 +984,7 @@ equal_different_set_p (rtx p1, rtx s1, rtx p2, rtx s2)
           ? rtx_renumbered_equal_p (e1, e2) : rtx_equal_p (e1, e2))
         continue;
 
-        return false;
+      return false;
     }
 
   return true;
@@ -1456,12 +1408,11 @@ flow_find_cross_jump (basic_block bb1, basic_block bb2, rtx_insn **f1,
       i2 = PREV_INSN (i2);
     }
 
-#if HAVE_cc0
   /* Don't allow the insn after a compare to be shared by
      cross-jumping unless the compare is also shared.  */
-  if (ninsns && reg_mentioned_p (cc0_rtx, last1) && ! sets_cc0_p (last1))
+  if (HAVE_cc0 && ninsns && reg_mentioned_p (cc0_rtx, last1)
+      && ! sets_cc0_p (last1))
     last1 = afterlast1, last2 = afterlast2, last_dir = afterlast_dir, ninsns--;
-#endif
 
   /* Include preceding notes and labels in the cross-jump.  One,
      this may bring us to the head of the blocks as requested above.
@@ -1579,12 +1530,11 @@ flow_find_head_matching_sequence (basic_block bb1, basic_block bb2, rtx_insn **f
       i2 = NEXT_INSN (i2);
     }
 
-#if HAVE_cc0
   /* Don't allow a compare to be shared by cross-jumping unless the insn
      after the compare is also shared.  */
-  if (ninsns && reg_mentioned_p (cc0_rtx, last1) && sets_cc0_p (last1))
+  if (HAVE_cc0 && ninsns && reg_mentioned_p (cc0_rtx, last1)
+      && sets_cc0_p (last1))
     last1 = beforelast1, last2 = beforelast2, ninsns--;
-#endif
 
   if (ninsns)
     {
@@ -2041,7 +1991,7 @@ try_crossjump_to_edge (int mode, edge e1, edge e2,
      If we have tablejumps in the end of SRC1 and SRC2
      they have been already compared for equivalence in outgoing_edges_match ()
      so replace the references to TABLE1 by references to TABLE2.  */
-    {
+  {
       rtx label1, label2;
       rtx_jump_table_data *table1, *table2;
 
@@ -2061,7 +2011,7 @@ try_crossjump_to_edge (int mode, edge e1, edge e2,
                replace_label_in_insn (insn, label1, label2, true);
            }
        }
-    }
+  }
 
   /* Avoid splitting if possible.  We must always split when SRC2 has
      EH predecessor edges, or we may end up with basic blocks with both
@@ -2370,11 +2320,9 @@ try_head_merge_bb (basic_block bb)
   cond = get_condition (jump, &move_before, true, false);
   if (cond == NULL_RTX)
     {
-#if HAVE_cc0
-      if (reg_mentioned_p (cc0_rtx, jump))
+      if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, jump))
        move_before = prev_nonnote_nondebug_insn (jump);
       else
-#endif
        move_before = jump;
     }
 
@@ -2539,11 +2487,9 @@ try_head_merge_bb (basic_block bb)
       cond = get_condition (jump, &move_before, true, false);
       if (cond == NULL_RTX)
        {
-#if HAVE_cc0
-         if (reg_mentioned_p (cc0_rtx, jump))
+         if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, jump))
            move_before = prev_nonnote_nondebug_insn (jump);
          else
-#endif
            move_before = jump;
        }
     }
@@ -2562,12 +2508,10 @@ try_head_merge_bb (basic_block bb)
          /* Try again, using a different insertion point.  */
          move_before = jump;
 
-#if HAVE_cc0
          /* Don't try moving before a cc0 user, as that may invalidate
             the cc0.  */
-         if (reg_mentioned_p (cc0_rtx, jump))
+         if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, jump))
            break;
-#endif
 
          continue;
        }
@@ -2622,12 +2566,10 @@ try_head_merge_bb (basic_block bb)
          /* For the unmerged insns, try a different insertion point.  */
          move_before = jump;
 
-#if HAVE_cc0
          /* Don't try moving before a cc0 user, as that may invalidate
             the cc0.  */
-         if (reg_mentioned_p (cc0_rtx, jump))
+         if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, jump))
            break;
-#endif
 
          for (ix = 0; ix < nedges; ix++)
            currptr[ix] = headptr[ix] = nextptr[ix];
@@ -2918,11 +2860,8 @@ try_optimize_cfg (int mode)
                  to detect and fix during edge forwarding, and in some cases
                  is only visible after newly unreachable blocks are deleted,
                  which will be done in fixup_partitions.  */
-              fixup_partitions ();
-
-#ifdef ENABLE_CHECKING
-              verify_flow_info ();
-#endif
+             fixup_partitions ();
+             checking_verify_flow_info ();
             }
 
          changed_overall |= changed;