re PR debug/66691 (ICE on valid code at -O3 with -g enabled in simplify_subreg, at...
[gcc.git] / gcc / cfgbuild.c
index dd6ed7a00e126d4d34dc5e005a25116f346dfb7a..43c0b3a125d365a24e4c10a1891c1816cfa8a812 100644 (file)
@@ -1,5 +1,5 @@
 /* Control flow graph building code for GNU compiler.
-   Copyright (C) 1987-2014 Free Software Foundation, Inc.
+   Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -22,14 +22,30 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "alias.h"
+#include "symtab.h"
 #include "tree.h"
 #include "rtl.h"
 #include "hard-reg-set.h"
+#include "predict.h"
+#include "function.h"
+#include "dominance.h"
+#include "cfg.h"
+#include "cfgrtl.h"
+#include "cfganal.h"
+#include "cfgbuild.h"
 #include "basic-block.h"
 #include "regs.h"
 #include "flags.h"
-#include "function.h"
 #include "except.h"
+#include "insn-config.h"
+#include "expmed.h"
+#include "dojump.h"
+#include "explow.h"
+#include "calls.h"
+#include "emit-rtl.h"
+#include "varasm.h"
+#include "stmt.h"
 #include "expr.h"
 #include "diagnostic-core.h"
 #include "timevar.h"
@@ -44,7 +60,7 @@ static void compute_outgoing_frequencies (basic_block);
    block.  */
 
 bool
-inside_basic_block_p (const_rtx insn)
+inside_basic_block_p (const rtx_insn *insn)
 {
   switch (GET_CODE (insn))
     {
@@ -73,7 +89,7 @@ inside_basic_block_p (const_rtx insn)
    the basic block.  */
 
 bool
-control_flow_insn_p (const_rtx insn)
+control_flow_insn_p (const rtx_insn *insn)
 {
   switch (GET_CODE (insn))
     {
@@ -152,7 +168,7 @@ rtl_make_eh_edge (sbitmap edge_cache, basic_block src, rtx insn)
 
   if (lp)
     {
-      rtx label = lp->landing_pad;
+      rtx_insn *label = lp->landing_pad;
 
       /* During initial rtl generation, use the post_landing_pad.  */
       if (label == NULL)
@@ -219,7 +235,6 @@ make_edges (basic_block min, basic_block max, int update_p)
   FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
     {
       rtx_insn *insn;
-      rtx x;
       enum rtx_code code;
       edge e;
       edge_iterator ei;
@@ -278,15 +293,15 @@ make_edges (basic_block min, basic_block max, int update_p)
                  && GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
                  && GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF)
                make_label_edge (edge_cache, bb,
-                                XEXP (XEXP (SET_SRC (tmp), 2), 0), 0);
+                                LABEL_REF_LABEL (XEXP (SET_SRC (tmp), 2)), 0);
            }
 
          /* If this is a computed jump, then mark it as reaching
             everything on the forced_labels list.  */
          else if (computed_jump_p (insn))
            {
-             for (x = forced_labels; x; x = XEXP (x, 1))
-               make_label_edge (edge_cache, bb, XEXP (x, 0), EDGE_ABNORMAL);
+             for (rtx_insn_list *x = forced_labels; x; x = x->next ())
+               make_label_edge (edge_cache, bb, x->insn (), EDGE_ABNORMAL);
            }
 
          /* Returns create an exit out.  */
@@ -338,8 +353,10 @@ make_edges (basic_block min, basic_block max, int update_p)
                     taken, then only calls to those functions or to other
                     nested functions that use them could possibly do
                     nonlocal gotos.  */
-                 for (x = nonlocal_goto_handler_labels; x; x = XEXP (x, 1))
-                   make_label_edge (edge_cache, bb, XEXP (x, 0),
+                 for (rtx_insn_list *x = nonlocal_goto_handler_labels;
+                      x;
+                      x = x->next ())
+                   make_label_edge (edge_cache, bb, x->insn (),
                                     EDGE_ABNORMAL | EDGE_ABNORMAL_CALL);
                }
 
@@ -414,7 +431,7 @@ purge_dead_tablejump_edges (basic_block bb, rtx_jump_table_data *table)
        && SET_DEST (tmp) == pc_rtx
        && GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
        && GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF)
-    mark_tablejump_edge (XEXP (XEXP (SET_SRC (tmp), 2), 0));
+    mark_tablejump_edge (LABEL_REF_LABEL (XEXP (SET_SRC (tmp), 2)));
 
   for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
     {