From 40192118ef66ef5fde39aa1cee0650b9f46f0611 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Wed, 8 Jan 2014 13:58:56 -0500
Subject: [PATCH 103/159] FIXME: various rtx->rtx_base_insn conversions made
 possible by equivalent change to result of
 DF_REF_INSN macro

---
 gcc/ddg.c            |  4 ++--
 gcc/fwprop.c         |  8 +++++---
 gcc/gcse.c           |  3 ++-
 gcc/ira.c            | 16 +++++++++-------
 gcc/loop-invariant.c |  2 +-
 gcc/loop-iv.c        |  6 +++---
 gcc/ree.c            | 24 ++++++++++++------------
 gcc/rtlanal.c        |  2 +-
 gcc/valtrack.c       |  6 +++---
 9 files changed, 38 insertions(+), 33 deletions(-)

diff --git a/gcc/ddg.c b/gcc/ddg.c
index d845451..1518b55 100644
--- a/gcc/ddg.c
+++ b/gcc/ddg.c
@@ -293,7 +293,7 @@ add_cross_iteration_register_deps (ddg_ptr g, df_ref last_def)
   int regno = DF_REF_REGNO (last_def);
   struct df_link *r_use;
   int has_use_in_bb_p = false;
-  rtx def_insn = DF_REF_INSN (last_def);
+  rtx_base_insn def_insn = DF_REF_INSN (last_def);
   ddg_node_ptr last_def_node = get_node_of_insn (g, def_insn);
   ddg_node_ptr use_node;
 #ifdef ENABLE_CHECKING
@@ -313,7 +313,7 @@ add_cross_iteration_register_deps (ddg_ptr g, df_ref last_def)
   /* Create inter-loop true dependences and anti dependences.  */
   for (r_use = DF_REF_CHAIN (last_def); r_use != NULL; r_use = r_use->next)
     {
-      rtx use_insn = DF_REF_INSN (r_use->ref);
+      rtx_base_insn use_insn = DF_REF_INSN (r_use->ref);
 
       if (BLOCK_FOR_INSN (use_insn) != g->bb)
 	continue;
diff --git a/gcc/fwprop.c b/gcc/fwprop.c
index cb1c473..7a7d35e 100644
--- a/gcc/fwprop.c
+++ b/gcc/fwprop.c
@@ -1080,7 +1080,8 @@ static bool
 forward_propagate_subreg (df_ref use, rtx def_insn, rtx def_set)
 {
   rtx use_reg = DF_REF_REG (use);
-  rtx use_insn, src;
+  rtx_base_insn use_insn;
+  rtx src;
 
   /* Only consider subregs... */
   enum machine_mode use_mode = GET_MODE (use_reg);
@@ -1227,7 +1228,7 @@ forward_propagate_asm (df_ref use, rtx def_insn, rtx def_set, rtx reg)
 static bool
 forward_propagate_and_simplify (df_ref use, rtx def_insn, rtx def_set)
 {
-  rtx use_insn = DF_REF_INSN (use);
+  rtx_base_insn use_insn = DF_REF_INSN (use);
   rtx use_set = single_set (use_insn);
   rtx src, reg, new_rtx, *loc;
   bool set_reg_equal;
@@ -1350,7 +1351,8 @@ static bool
 forward_propagate_into (df_ref use)
 {
   df_ref def;
-  rtx def_insn, def_set, use_insn;
+  rtx_base_insn def_insn, use_insn;
+  rtx def_set;
   rtx parent;
 
   if (DF_REF_FLAGS (use) & DF_REF_READ_WRITE)
diff --git a/gcc/gcse.c b/gcc/gcse.c
index e6def18..417daa4 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -2893,7 +2893,8 @@ compute_code_hoist_data (void)
 static int
 update_bb_reg_pressure (basic_block bb, rtx from)
 {
-  rtx dreg, insn;
+  rtx dreg;
+  rtx_base_insn insn;
   basic_block succ_bb;
   df_ref *op, op_ref;
   edge succ;
diff --git a/gcc/ira.c b/gcc/ira.c
index cbfe6b3..87ce645 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -4604,7 +4604,8 @@ find_moveable_pseudos (void)
       FOR_BB_INSNS (bb, insn)
 	if (NONDEBUG_INSN_P (insn))
 	  {
-	    rtx def_insn, closest_use, note;
+	    rtx_base_insn def_insn;
+	    rtx closest_use, note;
 	    df_ref *def_rec, def, use;
 	    unsigned regno;
 	    bool all_dominated, all_local;
@@ -4647,7 +4648,7 @@ find_moveable_pseudos (void)
 	    closest_use = NULL_RTX;
 	    for (; use; use = DF_REF_NEXT_REG (use))
 	      {
-		rtx insn;
+		rtx_base_insn insn;
 		if (!DF_REF_INSN_INFO (use))
 		  {
 		    all_dominated = false;
@@ -4718,7 +4719,7 @@ find_moveable_pseudos (void)
   EXECUTE_IF_SET_IN_BITMAP (&interesting, 0, i, bi)
     {
       df_ref def = DF_REG_DEF_CHAIN (i);
-      rtx def_insn = DF_REF_INSN (def);
+      rtx_base_insn def_insn = DF_REF_INSN (def);
       basic_block def_block = BLOCK_FOR_INSN (def_insn);
       bitmap def_bb_local = bb_local + def_block->index;
       bitmap def_bb_moveable = bb_moveable_reg_sets + def_block->index;
@@ -5039,7 +5040,7 @@ split_live_ranges_for_shrink_wrap (void)
       df_ref use, next;
       for (use = DF_REG_USE_CHAIN (REGNO (dest)); use; use = next)
 	{
-	  rtx uin = DF_REF_INSN (use);
+	  rtx_base_insn uin = DF_REF_INSN (use);
 	  next = DF_REF_NEXT_REG (use);
 
 	  basic_block ubb = BLOCK_FOR_INSN (uin);
@@ -5085,12 +5086,13 @@ move_unallocated_pseudos (void)
       {
 	int idx = i - first_moveable_pseudo;
 	rtx other_reg = pseudo_replaced_reg[idx];
-	rtx def_insn = DF_REF_INSN (DF_REG_DEF_CHAIN (i));
+	rtx_base_insn def_insn = DF_REF_INSN (DF_REG_DEF_CHAIN (i));
 	/* The use must follow all definitions of OTHER_REG, so we can
 	   insert the new definition immediately after any of them.  */
 	df_ref other_def = DF_REG_DEF_CHAIN (REGNO (other_reg));
-	rtx move_insn = DF_REF_INSN (other_def);
-	rtx newinsn = emit_insn_after (PATTERN (def_insn), move_insn);
+	rtx_base_insn move_insn = DF_REF_INSN (other_def);
+	rtx_base_insn newinsn = emit_insn_after (PATTERN (def_insn),
+						 move_insn);
 	rtx set;
 	int success;
 
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index 38cccf4..12b2937 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -78,7 +78,7 @@ struct loop_data
 struct use
 {
   rtx *pos;			/* Position of the use.  */
-  rtx insn;			/* The insn in that the use occurs.  */
+  rtx_base_insn insn;		/* The insn in that the use occurs.  */
   unsigned addr_use_p;		/* Whether the use occurs in an address.  */
   struct use *next;		/* Next use in the list.  */
 };
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index e9b3080..dd872e7 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -355,7 +355,7 @@ iv_get_reaching_def (rtx insn, rtx reg, df_ref *def)
 {
   df_ref use, adef;
   basic_block def_bb, use_bb;
-  rtx def_insn;
+  rtx_base_insn def_insn;
   bool dom_p;
 
   *def = NULL;
@@ -662,7 +662,7 @@ get_biv_step_1 (df_ref def, rtx reg,
   rtx set, rhs, op0 = NULL_RTX, op1 = NULL_RTX;
   rtx next, nextr, tmp;
   enum rtx_code code;
-  rtx insn = DF_REF_INSN (def);
+  rtx_base_insn insn = DF_REF_INSN (def);
   df_ref next_def;
   enum iv_grd_result res;
 
@@ -1085,7 +1085,7 @@ iv_analyze_expr (rtx insn, rtx rhs, enum machine_mode mode, struct rtx_iv *iv)
 static bool
 iv_analyze_def (df_ref def, struct rtx_iv *iv)
 {
-  rtx insn = DF_REF_INSN (def);
+  rtx_base_insn insn = DF_REF_INSN (def);
   rtx reg = DF_REF_REG (def);
   rtx set, rhs;
 
diff --git a/gcc/ree.c b/gcc/ree.c
index 49a49c9..2bd3aef 100644
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -279,7 +279,7 @@ static int max_insn_uid;
    assign it to the register.  */
 
 static bool
-combine_set_extension (ext_cand *cand, rtx curr_insn, rtx *orig_set)
+combine_set_extension (ext_cand *cand, rtx_base_insn curr_insn, rtx *orig_set)
 {
   rtx orig_src = SET_SRC (*orig_set);
   rtx new_reg = gen_rtx_REG (cand->mode, REGNO (SET_DEST (*orig_set)));
@@ -360,7 +360,7 @@ combine_set_extension (ext_cand *cand, rtx curr_insn, rtx *orig_set)
    DEF_INSN is the if_then_else insn.  */
 
 static bool
-transform_ifelse (ext_cand *cand, rtx def_insn)
+transform_ifelse (ext_cand *cand, rtx_base_insn def_insn)
 {
   rtx set_insn = PATTERN (def_insn);
   rtx srcreg, dstreg, srcreg2;
@@ -406,7 +406,7 @@ transform_ifelse (ext_cand *cand, rtx def_insn)
    of the definitions onto DEST.  */
 
 static struct df_link *
-get_defs (rtx insn, rtx reg, vec<rtx> *dest)
+get_defs (rtx_base_insn insn, rtx reg, vec<rtx_base_insn> *dest)
 {
   df_ref reg_info, *uses;
   struct df_link *ref_chain, *ref_link;
@@ -447,7 +447,7 @@ get_defs (rtx insn, rtx reg, vec<rtx> *dest)
    and store x1 and x2 in REG_1 and REG_2.  */
 
 static bool
-is_cond_copy_insn (rtx insn, rtx *reg1, rtx *reg2)
+is_cond_copy_insn (rtx_base_insn insn, rtx *reg1, rtx *reg2)
 {
   rtx expr = single_set (insn);
 
@@ -494,10 +494,10 @@ typedef struct ext_state
   /* In order to avoid constant alloc/free, we keep these
      4 vectors live through the entire find_and_remove_re and just
      truncate them each time.  */
-  vec<rtx> defs_list;
-  vec<rtx> copies_list;
-  vec<rtx> modified_list;
-  vec<rtx> work_list;
+  vec<rtx_base_insn> defs_list;
+  vec<rtx_base_insn> copies_list;
+  vec<rtx_base_insn> modified_list;
+  vec<rtx_base_insn> work_list;
 
   /* For instructions that have been successfully modified, this is
      the original mode from which the insn is extending and
@@ -518,7 +518,7 @@ typedef struct ext_state
    success.  */
 
 static bool
-make_defs_and_copies_lists (rtx extend_insn, const_rtx set_pat,
+make_defs_and_copies_lists (rtx_base_insn extend_insn, const_rtx set_pat,
 			    ext_state *state)
 {
   rtx src_reg = XEXP (SET_SRC (set_pat), 0);
@@ -536,7 +536,7 @@ make_defs_and_copies_lists (rtx extend_insn, const_rtx set_pat,
   /* Perform transitive closure for conditional copies.  */
   while (!state->work_list.is_empty ())
     {
-      rtx def_insn = state->work_list.pop ();
+      rtx_base_insn def_insn = state->work_list.pop ();
       rtx reg1, reg2;
 
       gcc_assert (INSN_UID (def_insn) < max_insn_uid);
@@ -571,7 +571,7 @@ make_defs_and_copies_lists (rtx extend_insn, const_rtx set_pat,
    on the SET pattern.  */
 
 static bool
-merge_def_and_ext (ext_cand *cand, rtx def_insn, ext_state *state)
+merge_def_and_ext (ext_cand *cand, rtx_base_insn def_insn, ext_state *state)
 {
   enum machine_mode ext_src_mode;
   enum rtx_code code;
@@ -648,7 +648,7 @@ merge_def_and_ext (ext_cand *cand, rtx def_insn, ext_state *state)
 static bool
 combine_reaching_defs (ext_cand *cand, const_rtx set_pat, ext_state *state)
 {
-  rtx def_insn;
+  rtx_base_insn def_insn;
   bool merge_successful = true;
   int i;
   int defs_ix;
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 83d48c8..e22ce90 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -2076,7 +2076,7 @@ remove_reg_equal_equiv_notes_for_regno (unsigned int regno)
      over the head.  We plan to drain the list anyway.  */
   while ((eq_use = DF_REG_EQ_USE_CHAIN (regno)) != NULL)
     {
-      rtx insn = DF_REF_INSN (eq_use);
+      rtx_base_insn insn = DF_REF_INSN (eq_use);
       rtx note = find_reg_equal_equiv_note (insn);
 
       /* This assert is generally triggered when someone deletes a REG_EQUAL
diff --git a/gcc/valtrack.c b/gcc/valtrack.c
index c61c117..3082609 100644
--- a/gcc/valtrack.c
+++ b/gcc/valtrack.c
@@ -341,7 +341,7 @@ dead_debug_reset_uses (struct dead_debug_local *debug,
   while (head)
     {
       struct dead_debug_use *next = head->next;
-      rtx insn;
+      rtx_base_insn insn;
 
       insn = DF_REF_INSN (head->use);
       if (!next || DF_REF_INSN (next->use) != insn)
@@ -429,7 +429,7 @@ dead_debug_promote_uses (struct dead_debug_local *debug)
 						 REGNO (reg),
 						 &debug->to_rescan))
 	      {
-		rtx insn = DF_REF_INSN (ref);
+		rtx_base_insn insn = DF_REF_INSN (ref);
 		INSN_VAR_LOCATION_LOC (insn) = gen_rtx_UNKNOWN_VAR_LOC ();
 		bitmap_set_bit (debug->to_rescan, INSN_UID (insn));
 	      }
@@ -695,7 +695,7 @@ dead_debug_insert_temp (struct dead_debug_local *debug, unsigned int uregno,
      probably doesn't make sense to introduce a new debug temp.  */
   if (where == DEBUG_TEMP_AFTER_WITH_REG && !uses->next)
     {
-      rtx next = DF_REF_INSN (uses->use);
+      rtx_base_insn next = DF_REF_INSN (uses->use);
 
       if (DEBUG_INSN_P (next) && reg == INSN_VAR_LOCATION_LOC (next))
 	{
-- 
1.7.11.7

