From 965f8f75d3f402b6b830281f8d979f81820b3f87 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Thu, 9 Jan 2014 10:36:04 -0500
Subject: [PATCH 110/159] FIXME: convert nonlocal_goto_handler_labels to
 rtx_expr_list

---
 gcc/cfgbuild.c  |  9 +++++----
 gcc/cfgrtl.c    |  6 +++---
 gcc/dwarf2cfi.c | 16 +++++++++-------
 gcc/function.h  |  2 +-
 gcc/reload1.c   |  9 ++++-----
 gcc/rtl.h       |  2 +-
 gcc/rtlanal.c   | 12 ++++++------
 7 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index a49659b..b6af84b 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -219,7 +219,6 @@ make_edges (basic_block min, basic_block max, int update_p)
   FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
     {
       rtx_base_insn insn;
-      rtx x;
       enum rtx_code code;
       edge e;
       edge_iterator ei;
@@ -290,7 +289,7 @@ make_edges (basic_block min, basic_block max, int update_p)
 	     everything on the forced_labels list.  */
 	  else if (computed_jump_p (insn))
 	    {
-	      for (x = forced_labels; x; x = XEXP (x, 1))
+	      for (rtx x = forced_labels; x; x = XEXP (x, 1))
 		make_label_edge (edge_cache, bb, XEXP (x, 0), EDGE_ABNORMAL);
 	    }
 
@@ -343,8 +342,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_expr_list x = nonlocal_goto_handler_labels;
+		       x;
+		       x = x->next ())
+		    make_label_edge (edge_cache, bb, x->element (),
 				     EDGE_ABNORMAL | EDGE_ABNORMAL_CALL);
 		}
 
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index c6c4ec4..ec8b278 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -4234,7 +4234,7 @@ cfg_layout_duplicate_bb (basic_block bb)
 void
 cfg_layout_initialize (unsigned int flags)
 {
-  rtx x;
+  rtx_expr_list x;
   basic_block bb;
 
   /* Once bb reordering is complete, cfg layout mode should not be re-entered.
@@ -4253,9 +4253,9 @@ cfg_layout_initialize (unsigned int flags)
   record_effective_endpoints ();
 
   /* Make sure that the targets of non local gotos are marked.  */
-  for (x = nonlocal_goto_handler_labels; x; x = XEXP (x, 1))
+  for (x = nonlocal_goto_handler_labels; x; x = x->next ())
     {
-      bb = BLOCK_FOR_INSN (XEXP (x, 0));
+      bb = BLOCK_FOR_INSN (x->element ());
       bb->flags |= BB_NON_LOCAL_GOTO_TARGET;
     }
 
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 8a417c3..8d74631 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -2268,11 +2268,11 @@ maybe_record_trace_start_abnormal (rtx start, rtx origin)
 static void
 create_trace_edges (rtx insn)
 {
-  rtx tmp, lab;
   int i, n;
 
   if (JUMP_P (insn))
     {
+      rtx tmp;
       rtx_jump_table_data table;
       if (find_reg_note (insn, REG_NON_LOCAL_GOTO, NULL_RTX))
 	return;
@@ -2288,13 +2288,13 @@ create_trace_edges (rtx insn)
 	  n = GET_NUM_ELEM (vec);
 	  for (i = 0; i < n; ++i)
 	    {
-	      lab = XEXP (RTVEC_ELT (vec, i), 0);
+	      rtx lab = XEXP (RTVEC_ELT (vec, i), 0);
 	      maybe_record_trace_start (lab, insn);
 	    }
 	}
       else if (computed_jump_p (insn))
 	{
-	  for (lab = forced_labels; lab; lab = XEXP (lab, 1))
+	  for (rtx lab = forced_labels; lab; lab = XEXP (lab, 1))
 	    maybe_record_trace_start (XEXP (lab, 0), insn);
 	}
       else if (returnjump_p (insn))
@@ -2304,13 +2304,13 @@ create_trace_edges (rtx insn)
 	  n = ASM_OPERANDS_LABEL_LENGTH (tmp);
 	  for (i = 0; i < n; ++i)
 	    {
-	      lab = XEXP (ASM_OPERANDS_LABEL (tmp, i), 0);
+	      rtx lab = XEXP (ASM_OPERANDS_LABEL (tmp, i), 0);
 	      maybe_record_trace_start (lab, insn);
 	    }
 	}
       else
 	{
-	  lab = JUMP_LABEL (insn);
+	  rtx lab = JUMP_LABEL (insn);
 	  gcc_assert (lab != NULL);
 	  maybe_record_trace_start (lab, insn);
 	}
@@ -2323,8 +2323,10 @@ create_trace_edges (rtx insn)
 
       /* Process non-local goto edges.  */
       if (can_nonlocal_goto (insn))
-	for (lab = nonlocal_goto_handler_labels; lab; lab = XEXP (lab, 1))
-	  maybe_record_trace_start_abnormal (XEXP (lab, 0), insn);
+	for (rtx_expr_list lab = nonlocal_goto_handler_labels;
+	     lab;
+	     lab = lab->next ())
+	  maybe_record_trace_start_abnormal (lab->element (), insn);
     }
   else if (rtx_sequence seq = PATTERN (insn)->dyn_cast_rtx_sequence ())
     {
diff --git a/gcc/function.h b/gcc/function.h
index b8e1ee5..90adffb 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -266,7 +266,7 @@ struct GTY(()) rtl_data {
 
   /* List (chain of EXPR_LIST) of labels heading the current handlers for
      nonlocal gotos.  */
-  rtx x_nonlocal_goto_handler_labels;
+  rtx_expr_list x_nonlocal_goto_handler_labels;
 
   /* Label that will go on function epilogue.
      Jumping to this label serves as a "return" instruction
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 1434a93..ec41b70 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -3898,16 +3898,15 @@ set_initial_eh_label_offset (rtx label)
 static void
 set_initial_label_offsets (void)
 {
-  rtx x;
   memset (offsets_known_at, 0, num_labels);
 
-  for (x = forced_labels; x; x = XEXP (x, 1))
+  for (rtx x = forced_labels; x; x = XEXP (x, 1))
     if (XEXP (x, 0))
       set_label_offsets (XEXP (x, 0), NULL_RTX_BASE_INSN, 1);
 
-  for (x = nonlocal_goto_handler_labels; x; x = XEXP (x, 1))
-    if (XEXP (x, 0))
-      set_label_offsets (XEXP (x, 0), NULL_RTX_BASE_INSN, 1);
+  for (rtx_expr_list x = nonlocal_goto_handler_labels; x; x = x->next ())
+    if (x->element ())
+      set_label_offsets (x->element (), NULL_RTX_BASE_INSN, 1);
 
   for_each_eh_label (set_initial_eh_label_offset);
 }
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 2cf4c2c..7fcd2e9 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2569,7 +2569,7 @@ extern unsigned hash_rtx_cb (const_rtx, enum machine_mode, int *, int *,
 extern rtx regno_use_in (unsigned int, rtx);
 extern int auto_inc_p (const_rtx);
 extern int in_expr_list_p (const_rtx, const_rtx);
-extern void remove_node_from_expr_list (const_rtx, rtx *);
+extern void remove_node_from_expr_list (const_rtx, rtx_expr_list *);
 extern int loc_mentioned_in_p (rtx *, const_rtx);
 extern rtx_base_insn find_first_parameter_load (rtx_call_insn, rtx);
 extern bool keep_with_call_p (const_rtx);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 7e3ef05..c69633a 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -2110,26 +2110,26 @@ in_expr_list_p (const_rtx listp, const_rtx node)
    A simple equality test is used to determine if NODE matches.  */
 
 void
-remove_node_from_expr_list (const_rtx node, rtx *listp)
+remove_node_from_expr_list (const_rtx node, rtx_expr_list *listp)
 {
-  rtx temp = *listp;
+  rtx_expr_list temp = *listp;
   rtx prev = NULL_RTX;
 
   while (temp)
     {
-      if (node == XEXP (temp, 0))
+      if (node == temp->element ())
 	{
 	  /* Splice the node out of the list.  */
 	  if (prev)
-	    XEXP (prev, 1) = XEXP (temp, 1);
+	    XEXP (prev, 1) = temp->next ();
 	  else
-	    *listp = XEXP (temp, 1);
+	    *listp = temp->next ();
 
 	  return;
 	}
 
       prev = temp;
-      temp = XEXP (temp, 1);
+      temp = temp->next ();
     }
 }
 
-- 
1.7.11.7

