From b5384d02c5d7772463e68bfba9652a36899828b9 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Mon, 30 Dec 2013 17:15:26 -0500
Subject: [PATCH 023/159] FIXME: various rtx->rtx_base_insn

---
 gcc/bb-reorder.c        |  2 +-
 gcc/combine-stack-adj.c | 11 ++++-----
 gcc/config/i386/i386.c  |  3 ++-
 gcc/ddg.c               |  8 +++----
 gcc/ddg.h               |  4 ++--
 gcc/dse.c               | 10 ++++-----
 gcc/except.c            | 11 ++++-----
 gcc/function.c          | 13 ++++++-----
 gcc/ira-emit.c          |  7 +++---
 gcc/ira.c               | 13 ++++++-----
 gcc/loop-unroll.c       |  4 ++--
 gcc/lower-subreg.c      |  2 +-
 gcc/lra-constraints.c   | 44 +++++++++++++++++++++++-------------
 gcc/lra-int.h           |  2 +-
 gcc/lra.c               |  3 ++-
 gcc/mode-switching.c    |  6 ++---
 gcc/optabs.c            |  2 +-
 gcc/reg-stack.c         | 59 +++++++++++++++++++++++++++----------------------
 gcc/reload.c            | 25 +++++++++++----------
 gcc/reload.h            |  2 +-
 gcc/sched-ebb.c         | 10 ++++-----
 gcc/sched-int.h         |  2 +-
 22 files changed, 136 insertions(+), 107 deletions(-)

diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 8cc08ad..94d58a3 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -2118,7 +2118,7 @@ static void
 fix_crossing_unconditional_branches (void)
 {
   basic_block cur_bb;
-  rtx last_insn;
+  rtx_base_insn last_insn;
   rtx label;
   rtx label_addr;
   rtx indirect_jump_sequence;
diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
index 5ca131f..41cbfc5 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -345,7 +345,7 @@ next_active_insn_bb (basic_block bb, rtx insn)
    search for a nearby candidate within BB where we can stick the note.  */
 
 static void
-force_move_args_size_note (basic_block bb, rtx prev, rtx insn)
+force_move_args_size_note (basic_block bb, rtx prev, rtx_base_insn insn)
 {
   rtx note, test, next_candidate, prev_candidate;
 
@@ -425,10 +425,11 @@ static void
 combine_stack_adjustments_for_block (basic_block bb)
 {
   HOST_WIDE_INT last_sp_adjust = 0;
-  rtx last_sp_set = NULL_RTX;
+  rtx_base_insn last_sp_set = NULL_RTX_BASE_INSN;
   rtx last2_sp_set = NULL_RTX;
   struct csa_reflist *reflist = NULL;
-  rtx insn, next, set;
+  rtx_base_insn insn, next;
+  rtx set;
   struct record_stack_refs_data data;
   bool end_of_block = false;
 
@@ -574,7 +575,7 @@ combine_stack_adjustments_for_block (basic_block bb)
 	      delete_insn (last_sp_set);
 	      free_csa_reflist (reflist);
 	      reflist = NULL;
-	      last_sp_set = NULL_RTX;
+	      last_sp_set = NULL_RTX_BASE_INSN;
 	      last_sp_adjust = 0;
 	      continue;
 	    }
@@ -604,7 +605,7 @@ combine_stack_adjustments_for_block (basic_block bb)
 	  free_csa_reflist (reflist);
 	  reflist = NULL;
 	  last2_sp_set = NULL_RTX;
-	  last_sp_set = NULL_RTX;
+	  last_sp_set = NULL_RTX_BASE_INSN;
 	  last_sp_adjust = 0;
 	}
     }
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 5add844..bef60e4 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -37101,7 +37101,8 @@ ix86_expand_vector_init_duplicate (bool mmx_ok, enum machine_mode mode,
     case V4SFmode:
     case V4SImode:
       {
-	rtx insn, dup;
+	rtx_base_insn insn;
+	rtx dup;
 
 	/* First attempt to recognize VAL as-is.  */
 	dup = gen_rtx_VEC_DUPLICATE (mode, val);
diff --git a/gcc/ddg.c b/gcc/ddg.c
index 0d9089f..d845451 100644
--- a/gcc/ddg.c
+++ b/gcc/ddg.c
@@ -594,7 +594,7 @@ ddg_ptr
 create_ddg (basic_block bb, int closing_branch_deps)
 {
   ddg_ptr g;
-  rtx insn, first_note;
+  rtx_base_insn insn, first_note;
   int i;
   int num_nodes = 0;
 
@@ -634,7 +634,7 @@ create_ddg (basic_block bb, int closing_branch_deps)
   g->nodes = (ddg_node_ptr) xcalloc (num_nodes, sizeof (struct ddg_node));
   g->closing_branch = NULL;
   i = 0;
-  first_note = NULL_RTX;
+  first_note = NULL_RTX_NOTE;
   for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb));
        insn = NEXT_INSN (insn))
     {
@@ -642,7 +642,7 @@ create_ddg (basic_block bb, int closing_branch_deps)
 	{
 	  if (! first_note && NOTE_P (insn)
 	      && NOTE_KIND (insn) !=  NOTE_INSN_BASIC_BLOCK)
-	    first_note = insn;
+	    first_note = insn->as_an_rtx_note ();
 	  continue;
 	}
       if (JUMP_P (insn))
@@ -664,7 +664,7 @@ create_ddg (basic_block bb, int closing_branch_deps)
       bitmap_clear (g->nodes[i].predecessors);
       g->nodes[i].first_note = (first_note ? first_note : insn);
       g->nodes[i++].insn = insn;
-      first_note = NULL_RTX;
+      first_note = NULL_RTX_BASE_INSN;
     }
 
   /* We must have found a branch in DDG.  */
diff --git a/gcc/ddg.h b/gcc/ddg.h
index e16c8c9..f367c84 100644
--- a/gcc/ddg.h
+++ b/gcc/ddg.h
@@ -52,13 +52,13 @@ struct ddg_node
   int cuid;
 
   /* The insn represented by the node.  */
-  rtx insn;
+  rtx_base_insn insn;
 
   /* A note preceding INSN (or INSN itself), such that all insns linked
      from FIRST_NOTE until INSN (inclusive of both) are moved together
      when reordering the insns.  This takes care of notes that should
      continue to precede INSN.  */
-  rtx first_note;
+  rtx_base_insn first_note;
 
   /* Incoming and outgoing dependency edges.  */
   ddg_edge_ptr in;
diff --git a/gcc/dse.c b/gcc/dse.c
index 0b68a36..66c75df 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -380,7 +380,7 @@ struct insn_info
   bool contains_cselib_groups;
 
   /* The insn. */
-  rtx insn;
+  rtx_base_insn insn;
 
   /* The list of mem sets or mem clobbers that are contained in this
      insn.  If the insn is deletable, it contains only one mem set.
@@ -869,7 +869,7 @@ emit_inc_dec_insn_before (rtx mem ATTRIBUTE_UNUSED,
 			  rtx dest, rtx src, rtx srcoff, void *arg)
 {
   insn_info_t insn_info = (insn_info_t) arg;
-  rtx insn = insn_info->insn, new_insn, cur;
+  rtx_base_insn insn = insn_info->insn, new_insn, cur;
   note_add_store_info info;
 
   /* We can reuse all operands without copying, because we are about
@@ -882,7 +882,7 @@ emit_inc_dec_insn_before (rtx mem ATTRIBUTE_UNUSED,
       end_sequence ();
     }
   else
-    new_insn = gen_move_insn (dest, src);
+    new_insn = gen_move_insn (dest, src)->as_an_rtx_base_insn ();
   info.first = new_insn;
   info.fixed_regs_live = insn_info->fixed_regs_live;
   info.failure = false;
@@ -927,7 +927,7 @@ check_for_inc_dec (rtx insn)
   struct insn_info insn_info;
   rtx note;
 
-  insn_info.insn = insn;
+  insn_info.insn = insn->as_an_rtx_base_insn ();
   insn_info.fixed_regs_live = NULL;
   note = find_reg_note (insn, REG_INC, NULL_RTX);
   if (note)
@@ -2449,7 +2449,7 @@ copy_fixed_regs (const_bitmap in)
    non-register target.  */
 
 static void
-scan_insn (bb_info_t bb_info, rtx insn)
+scan_insn (bb_info_t bb_info, rtx_base_insn insn)
 {
   rtx body;
   insn_info_t insn_info = (insn_info_t) pool_alloc (insn_info_pool);
diff --git a/gcc/except.c b/gcc/except.c
index 027ec0c..76958c8 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -946,7 +946,7 @@ assign_filter_values (void)
    first instruction of some existing BB and return the newly
    produced block.  */
 static basic_block
-emit_to_new_bb_before (rtx seq, rtx insn)
+emit_to_new_bb_before (rtx seq, rtx_base_insn insn)
 {
   rtx last;
   basic_block bb, prev_bb;
@@ -1107,7 +1107,8 @@ static void
 sjlj_mark_call_sites (void)
 {
   int last_call_site = -2;
-  rtx insn, mem;
+  rtx_base_insn insn;
+  rtx mem;
 
   for (insn = get_insns (); insn ; insn = NEXT_INSN (insn))
     {
@@ -1115,7 +1116,7 @@ sjlj_mark_call_sites (void)
       eh_region r;
       bool nothrow;
       int this_call_site;
-      rtx before, p;
+      rtx_base_insn before, p;
 
       /* Reset value tracking at extended basic block boundaries.  */
       if (LABEL_P (insn))
@@ -1283,8 +1284,8 @@ sjlj_emit_dispatch_table (rtx_code_label dispatch_label, int num_dispatch)
   enum machine_mode unwind_word_mode = targetm.unwind_word_mode ();
   enum machine_mode filter_mode = targetm.eh_return_filter_mode ();
   eh_landing_pad lp;
-  rtx mem, seq, fc, before, exc_ptr_reg, filter_reg;
-  rtx first_reachable_label;
+  rtx mem, seq, fc, exc_ptr_reg, filter_reg;
+  rtx_code_label before, first_reachable_label;
   basic_block bb;
   eh_region r;
   edge e;
diff --git a/gcc/function.c b/gcc/function.c
index 1d338e5..636966b 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1491,7 +1491,7 @@ safe_insn_predicate (int code, int operand, rtx x)
    registers present inside of insn.  The result will be a valid insn.  */
 
 static void
-instantiate_virtual_regs_in_insn (rtx insn)
+instantiate_virtual_regs_in_insn (rtx_base_insn insn)
 {
   HOST_WIDE_INT offset;
   int insn_code, i;
@@ -1887,7 +1887,7 @@ instantiate_decls (tree fndecl)
 static unsigned int
 instantiate_virtual_regs (void)
 {
-  rtx insn;
+  rtx_base_insn insn;
 
   /* Compute the offsets to use for this function.  */
   in_arg_offset = FIRST_PARM_OFFSET (current_function_decl);
@@ -5583,7 +5583,7 @@ prepare_shrink_wrap (basic_block entry_block)
 static void
 emit_use_return_register_into_block (basic_block bb)
 {
-  rtx seq, insn;
+  rtx_base_insn seq, insn;
   start_sequence ();
   use_return_register ();
   seq = get_insns ();
@@ -5646,7 +5646,8 @@ set_return_jump_label (rtx returnjump)
 /* Create a copy of BB instructions and insert at BEFORE.  Redirect
    preds of BB to COPY_BB if they don't appear in NEED_PROLOGUE.  */
 static void
-dup_block_and_redirect (basic_block bb, basic_block copy_bb, rtx before,
+dup_block_and_redirect (basic_block bb, basic_block copy_bb,
+			rtx_base_insn before,
 			bitmap_head *need_prologue)
 {
   edge_iterator ei;
@@ -6625,7 +6626,7 @@ epilogue_done:
 							     )
     {
       basic_block bb = e->src;
-      rtx insn = BB_END (bb);
+      rtx_base_insn insn = BB_END (bb);
       rtx ep_seq;
 
       if (!CALL_P (insn)
@@ -7083,7 +7084,7 @@ make_pass_thread_prologue_and_epilogue (gcc::context *ctxt)
      asm ("": "=mr" (inout_2) : "0" (inout_2));  */
 
 static void
-match_asm_constraints_1 (rtx insn, rtx *p_sets, int noutputs)
+match_asm_constraints_1 (rtx_base_insn insn, rtx *p_sets, int noutputs)
 {
   int i;
   bool changed = false;
diff --git a/gcc/ira-emit.c b/gcc/ira-emit.c
index 9b3d01a..1076582 100644
--- a/gcc/ira-emit.c
+++ b/gcc/ira-emit.c
@@ -894,12 +894,13 @@ modify_move_list (move_t list)
 
 /* Generate RTX move insns from the move list LIST.  This updates
    allocation cost using move execution frequency FREQ.  */
-static rtx
+static rtx_base_insn
 emit_move_list (move_t list, int freq)
 {
   rtx to, from, dest;
   int to_regno, from_regno, cost, regno;
-  rtx result, insn, set;
+  rtx_base_insn result;
+  rtx insn, set;
   enum machine_mode mode;
   enum reg_class aclass;
 
@@ -985,7 +986,7 @@ emit_moves (void)
   basic_block bb;
   edge_iterator ei;
   edge e;
-  rtx insns, tmp;
+  rtx_base_insn insns, tmp;
 
   FOR_EACH_BB (bb)
     {
diff --git a/gcc/ira.c b/gcc/ira.c
index 5680599..8e28f5b 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3451,7 +3451,7 @@ static int recorded_label_ref;
 static int
 update_equiv_regs (void)
 {
-  rtx insn;
+  rtx_base_insn insn;
   basic_block bb;
   int loop_depth;
   bitmap cleared_regs;
@@ -3477,7 +3477,10 @@ update_equiv_regs (void)
   FOR_EACH_BB (bb)
     FOR_BB_INSNS (bb, insn)
       if (NONDEBUG_INSN_P (insn))
-	for_each_rtx (&insn, set_paradoxical_subreg, (void *) pdx_subregs);
+	{
+	  rtx tmp = insn;
+	  for_each_rtx (&tmp, set_paradoxical_subreg, (void *) pdx_subregs);
+	}
 
   /* Scan the insns and find which registers have equivalences.  Do this
      in a separate scan of the insns because (due to -fcse-follow-jumps)
@@ -4506,7 +4509,7 @@ find_moveable_pseudos (void)
   int max_uid = get_max_uid ();
   basic_block bb;
   int *uid_luid = XNEWVEC (int, max_uid);
-  rtx *closest_uses = XNEWVEC (rtx, max_regs);
+  rtx_base_insn *closest_uses = XNEWVEC (rtx_base_insn, max_regs);
   /* A set of registers which are live but not modified throughout a block.  */
   bitmap_head *bb_transp_live = XNEWVEC (bitmap_head, last_basic_block);
   /* A set of registers which only exist in a given basic block.  */
@@ -4696,7 +4699,7 @@ find_moveable_pseudos (void)
 	      }
 #endif
 	    bitmap_set_bit (&interesting, regno);
-	    closest_uses[regno] = closest_use;
+	    closest_uses[regno] = closest_use->as_an_rtx_base_insn ();
 
 	    if (dump_file && (all_local || all_dominated))
 	      {
@@ -4721,7 +4724,7 @@ find_moveable_pseudos (void)
       bitmap def_bb_moveable = bb_moveable_reg_sets + def_block->index;
       bitmap def_bb_transp = bb_transp_live + def_block->index;
       bool local_to_bb_p = bitmap_bit_p (def_bb_local, i);
-      rtx use_insn = closest_uses[i];
+      rtx_base_insn use_insn = closest_uses[i];
       df_ref *def_insn_use_rec = DF_INSN_USES (def_insn);
       bool all_ok = true;
       bool all_transp = true;
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 5678de5..e28913fc 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -2064,7 +2064,7 @@ allocate_basic_variable (struct iv_to_split *ivts)
    the initial value from INSN.  */
 
 static void
-insert_base_initialization (struct iv_to_split *ivts, rtx insn)
+insert_base_initialization (struct iv_to_split *ivts, rtx_base_insn insn)
 {
   rtx expr = copy_rtx (*get_ivts_expr (single_set (insn), ivts));
   rtx seq;
@@ -2083,7 +2083,7 @@ insert_base_initialization (struct iv_to_split *ivts, rtx insn)
    by base variable + DELTA * step.  */
 
 static void
-split_iv (struct iv_to_split *ivts, rtx insn, unsigned delta)
+split_iv (struct iv_to_split *ivts, rtx_base_insn insn, unsigned delta)
 {
   rtx expr, *loc, seq, incr, var;
   enum machine_mode mode = GET_MODE (ivts->base_var);
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 5778e19..502b022 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -1240,7 +1240,7 @@ find_decomposable_shift_zext (rtx insn, bool speed_p)
    replacement was done.  */
 
 static rtx_base_insn
-resolve_shift_zext (rtx insn)
+resolve_shift_zext (rtx_base_insn insn)
 {
   rtx set;
   rtx op;
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index e7caea6..551d8a7 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -138,7 +138,7 @@ static int bb_reload_num;
 /* The current insn being processed and corresponding its single set
    (NULL otherwise), its data (basic block, the insn data, the insn
    static data, and the mode of each operand).  */
-static rtx curr_insn;
+static rtx_base_insn curr_insn;
 static rtx curr_insn_set;
 static basic_block curr_bb;
 static lra_insn_recog_data_t curr_id;
@@ -4225,6 +4225,15 @@ substitute_pseudo (rtx *loc, int old_regno, rtx new_reg)
   return result;
 }
 
+static bool
+substitute_pseudo_in_insn (rtx_base_insn *insn, int old_regno, rtx new_reg)
+{
+  rtx tmp = *insn;
+  bool changed = substitute_pseudo (&tmp, old_regno, new_reg);
+  *insn = tmp->as_an_rtx_base_insn ();
+  return changed;
+}
+
 /* Return first non-debug insn in list USAGE_INSNS.  */
 static rtx
 skip_usage_debug_insns (rtx usage_insns)
@@ -4296,7 +4305,8 @@ static bitmap_head check_only_regs;
    class of ORIGINAL REGNO.  */
 static bool
 inherit_reload_reg (bool def_p, int original_regno,
-		    enum reg_class cl, rtx insn, rtx next_usage_insns)
+		    enum reg_class cl, rtx_base_insn insn,
+		    rtx next_usage_insns)
 {
   enum reg_class rclass = lra_get_allocno_class (original_regno);
   rtx original_reg = regno_reg_rtx[original_regno];
@@ -4381,7 +4391,7 @@ inherit_reload_reg (bool def_p, int original_regno,
 	}
       return false;
     }
-  substitute_pseudo (&insn, original_regno, new_reg);
+  substitute_pseudo_in_insn (&insn, original_regno, new_reg);
   lra_update_insn_regno_info (insn);
   if (! def_p)
     /* We now have a new usage insn for original regno.  */
@@ -4562,12 +4572,14 @@ choose_split_class (enum reg_class allocno_class,
    if BEFORE_P is true.	 Return true if we succeed in such
    transformation.  */
 static bool
-split_reg (bool before_p, int original_regno, rtx insn, rtx next_usage_insns)
+split_reg (bool before_p, int original_regno, rtx_base_insn insn,
+	   rtx next_usage_insns)
 {
   enum reg_class rclass;
   rtx original_reg;
   int hard_regno, nregs;
-  rtx new_reg, save, restore, usage_insn;
+  rtx new_reg, save, restore;
+  rtx_base_insn usage_insn;
   bool after_p;
   bool call_save_p;
 
@@ -4666,13 +4678,13 @@ split_reg (bool before_p, int original_regno, rtx insn, rtx next_usage_insns)
     {
       if (GET_CODE (next_usage_insns) != INSN_LIST)
 	{
-	  usage_insn = next_usage_insns;
+	  usage_insn = next_usage_insns->as_an_rtx_base_insn ();
 	  break;
 	}
-      usage_insn = XEXP (next_usage_insns, 0);
+      usage_insn = XEXP (next_usage_insns, 0)->as_an_rtx_base_insn ();
       lra_assert (DEBUG_INSN_P (usage_insn));
       next_usage_insns = XEXP (next_usage_insns, 1);
-      substitute_pseudo (&usage_insn, original_regno, new_reg);
+      substitute_pseudo_in_insn (&usage_insn, original_regno, new_reg);
       lra_update_insn_regno_info (usage_insn);
       if (lra_dump_file != NULL)
 	{
@@ -4714,7 +4726,7 @@ split_reg (bool before_p, int original_regno, rtx insn, rtx next_usage_insns)
 static bool
 split_if_necessary (int regno, enum machine_mode mode,
 		    HARD_REG_SET potential_reload_hard_regs,
-		    bool before_p, rtx insn, int max_uid)
+		    bool before_p, rtx_base_insn insn, int max_uid)
 {
   bool res = false;
   int i, nregs = 1;
@@ -4744,12 +4756,13 @@ static bitmap_head live_regs;
    inheritance/split transformation.  The function removes dead moves
    too.	 */
 static void
-update_ebb_live_info (rtx head, rtx tail)
+update_ebb_live_info (rtx head, rtx_base_insn tail)
 {
   unsigned int j;
   int regno;
   bool live_p;
-  rtx prev_insn, set;
+  rtx_base_insn prev_insn;
+  rtx set;
   bool remove_p;
   basic_block last_bb, prev_bb, curr_bb;
   bitmap_iterator bi;
@@ -4923,11 +4936,12 @@ static bitmap_head temp_bitmap;
    splitting even more but it is to expensive and the current approach
    works well enough.  */
 static bool
-inherit_in_ebb (rtx head, rtx tail)
+inherit_in_ebb (rtx head, rtx_base_insn tail)
 {
   int i, src_regno, dst_regno, nregs;
   bool change_p, succ_p;
-  rtx prev_insn, next_usage_insns, set, last_insn;
+  rtx_base_insn prev_insn;
+  rtx next_usage_insns, set, last_insn;
   enum reg_class cl;
   struct lra_insn_reg *reg;
   basic_block last_processed_bb, curr_bb = NULL;
@@ -5513,8 +5527,8 @@ remove_inheritance_pseudos (bitmap remove_pseudos)
 		    {
 		      if (change_p && bitmap_bit_p (remove_pseudos, regno))
 			{
-			  substitute_pseudo (&curr_insn, regno,
-					     regno_reg_rtx[restore_regno]);
+			  substitute_pseudo_in_insn (
+			    &curr_insn, regno, regno_reg_rtx[restore_regno]);
 			  restored_regs_p = true;
 			}
 		      else
diff --git a/gcc/lra-int.h b/gcc/lra-int.h
index be2da2e..c1346ce 100644
--- a/gcc/lra-int.h
+++ b/gcc/lra-int.h
@@ -292,7 +292,7 @@ extern void lra_emit_add (rtx, rtx, rtx);
 extern void lra_emit_move (rtx, rtx);
 extern void lra_update_dups (lra_insn_recog_data_t, signed char *);
 
-extern void lra_process_new_insns (rtx, rtx, rtx, const char *);
+extern void lra_process_new_insns (rtx_base_insn, rtx, rtx, const char *);
 
 extern lra_insn_recog_data_t lra_set_insn_recog_data (rtx);
 extern lra_insn_recog_data_t lra_update_insn_recog_data (rtx);
diff --git a/gcc/lra.c b/gcc/lra.c
index 9bfd90d..351d3fa 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -1863,7 +1863,8 @@ setup_sp_offset (rtx from, rtx last)
    insns onto the stack.  Print about emitting the insns with
    TITLE.  */
 void
-lra_process_new_insns (rtx insn, rtx before, rtx after, const char *title)
+lra_process_new_insns (rtx_base_insn insn, rtx before, rtx after,
+		       const char *title)
 {
   rtx last;
 
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index 66250b7..87095a3 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -70,7 +70,7 @@ along with GCC; see the file COPYING3.  If not see
 struct seginfo
 {
   int mode;
-  rtx insn_ptr;
+  rtx_base_insn insn_ptr;
   int bbnum;
   struct seginfo *next;
   HARD_REG_SET regs_live;
@@ -88,7 +88,7 @@ static sbitmap *antic;
 static sbitmap *transp;
 static sbitmap *comp;
 
-static struct seginfo * new_seginfo (int, rtx, int, HARD_REG_SET);
+static struct seginfo * new_seginfo (int, rtx_base_insn, int, HARD_REG_SET);
 static void add_seginfo (struct bb_info *, struct seginfo *);
 static void reg_dies (rtx, HARD_REG_SET *);
 static void reg_becomes_live (rtx, const_rtx, void *);
@@ -99,7 +99,7 @@ static void make_preds_opaque (basic_block, int);
    with the MODE, INSN, and basic block BB parameters.  */
 
 static struct seginfo *
-new_seginfo (int mode, rtx insn, int bb, HARD_REG_SET regs_live)
+new_seginfo (int mode, rtx_base_insn insn, int bb, HARD_REG_SET regs_live)
 {
   struct seginfo *ptr;
   ptr = XNEW (struct seginfo);
diff --git a/gcc/optabs.c b/gcc/optabs.c
index a5dc217..d10b554 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -4814,7 +4814,7 @@ have_sub2_insn (rtx x, rtx y)
 rtx
 gen_move_insn (rtx x, rtx y)
 {
-  rtx seq;
+  rtx_base_insn seq;
 
   start_sequence ();
   emit_move_insn_1 (x, y);
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index a810ccd..7d3789a 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -253,17 +253,19 @@ static rtx stack_result (tree);
 static void replace_reg (rtx *, int);
 static void remove_regno_note (rtx, enum reg_note, unsigned int);
 static int get_hard_regnum (stack_ptr, rtx);
-static rtx emit_pop_insn (rtx, stack_ptr, rtx, enum emit_where);
-static void swap_to_top (rtx, stack_ptr, rtx, rtx);
-static bool move_for_stack_reg (rtx, stack_ptr, rtx);
-static bool move_nan_for_stack_reg (rtx, stack_ptr, rtx);
+static rtx_base_insn emit_pop_insn (rtx_base_insn, stack_ptr, rtx,
+				    enum emit_where);
+static void swap_to_top (rtx_base_insn, stack_ptr, rtx, rtx);
+static bool move_for_stack_reg (rtx_base_insn, stack_ptr, rtx);
+static bool move_nan_for_stack_reg (rtx_base_insn, stack_ptr, rtx);
 static int swap_rtx_condition_1 (rtx);
 static int swap_rtx_condition (rtx);
-static void compare_for_stack_reg (rtx, stack_ptr, rtx);
-static bool subst_stack_regs_pat (rtx, stack_ptr, rtx);
-static void subst_asm_stack_regs (rtx, stack_ptr);
-static bool subst_stack_regs (rtx, stack_ptr);
-static void change_stack (rtx, stack_ptr, stack_ptr, enum emit_where);
+static void compare_for_stack_reg (rtx_base_insn, stack_ptr, rtx);
+static bool subst_stack_regs_pat (rtx_base_insn, stack_ptr, rtx);
+static void subst_asm_stack_regs (rtx_base_insn, stack_ptr);
+static bool subst_stack_regs (rtx_base_insn, stack_ptr);
+static void change_stack (rtx_base_insn, stack_ptr, stack_ptr,
+			  enum emit_where);
 static void print_stack (FILE *, stack_ptr);
 static rtx next_flags_user (rtx);
 
@@ -352,7 +354,7 @@ next_flags_user (rtx insn)
 /* Reorganize the stack into ascending numbers, before this insn.  */
 
 static void
-straighten_stack (rtx insn, stack_ptr regstack)
+straighten_stack (rtx_base_insn insn, stack_ptr regstack)
 {
   struct stack_def temp_stack;
   int top;
@@ -739,10 +741,12 @@ get_hard_regnum (stack_ptr regstack, rtx reg)
    and source is the top of stack.  A death note for the top of stack
    cases the movdf pattern to pop.  */
 
-static rtx
-emit_pop_insn (rtx insn, stack_ptr regstack, rtx reg, enum emit_where where)
+static rtx_base_insn
+emit_pop_insn (rtx_base_insn insn, stack_ptr regstack, rtx reg,
+	       enum emit_where where)
 {
-  rtx pop_insn, pop_rtx;
+  rtx_base_insn pop_insn;
+  rtx pop_rtx;
   int hard_regno;
 
   /* For complex types take care to pop both halves.  These may survive in
@@ -752,7 +756,7 @@ emit_pop_insn (rtx insn, stack_ptr regstack, rtx reg, enum emit_where where)
       rtx reg1 = FP_MODE_REG (REGNO (reg), DFmode);
       rtx reg2 = FP_MODE_REG (REGNO (reg) + 1, DFmode);
 
-      pop_insn = NULL_RTX;
+      pop_insn = NULL_RTX_BASE_INSN;
       if (get_hard_regnum (regstack, reg1) >= 0)
 	pop_insn = emit_pop_insn (insn, regstack, reg1, where);
       if (get_hard_regnum (regstack, reg2) >= 0)
@@ -791,7 +795,7 @@ emit_pop_insn (rtx insn, stack_ptr regstack, rtx reg, enum emit_where where)
    If REG is already at the top of the stack, no insn is emitted.  */
 
 static void
-emit_swap_insn (rtx insn, stack_ptr regstack, rtx reg)
+emit_swap_insn (rtx_base_insn insn, stack_ptr regstack, rtx reg)
 {
   int hard_regno;
   rtx swap_rtx;
@@ -898,7 +902,7 @@ emit_swap_insn (rtx insn, stack_ptr regstack, rtx reg)
    is emitted.  */
 
 static void
-swap_to_top (rtx insn, stack_ptr regstack, rtx src1, rtx src2)
+swap_to_top (rtx_base_insn insn, stack_ptr regstack, rtx src1, rtx src2)
 {
   struct stack_def temp_stack;
   int regno, j, k, temp;
@@ -939,7 +943,7 @@ swap_to_top (rtx insn, stack_ptr regstack, rtx src1, rtx src2)
    was deleted in the process.  */
 
 static bool
-move_for_stack_reg (rtx insn, stack_ptr regstack, rtx pat)
+move_for_stack_reg (rtx_base_insn insn, stack_ptr regstack, rtx pat)
 {
   rtx *psrc =  get_true_reg (&SET_SRC (pat));
   rtx *pdest = get_true_reg (&SET_DEST (pat));
@@ -1090,7 +1094,7 @@ move_for_stack_reg (rtx insn, stack_ptr regstack, rtx pat)
    a NaN into DEST, then invokes move_for_stack_reg.  */
 
 static bool
-move_nan_for_stack_reg (rtx insn, stack_ptr regstack, rtx dest)
+move_nan_for_stack_reg (rtx_base_insn insn, stack_ptr regstack, rtx dest)
 {
   rtx pat;
 
@@ -1229,7 +1233,7 @@ swap_rtx_condition (rtx insn)
    set up.  */
 
 static void
-compare_for_stack_reg (rtx insn, stack_ptr regstack, rtx pat_src)
+compare_for_stack_reg (rtx_base_insn insn, stack_ptr regstack, rtx pat_src)
 {
   rtx *src1, *src2;
   rtx src1_note, src2_note;
@@ -1355,7 +1359,7 @@ subst_all_stack_regs_in_debug_insn (rtx insn, struct stack_def *regstack)
    was deleted in the process.  */
 
 static bool
-subst_stack_regs_pat (rtx insn, stack_ptr regstack, rtx pat)
+subst_stack_regs_pat (rtx_base_insn insn, stack_ptr regstack, rtx pat)
 {
   rtx *dest, *src;
   bool control_flow_insn_deleted = false;
@@ -1432,7 +1436,7 @@ subst_stack_regs_pat (rtx insn, stack_ptr regstack, rtx pat)
 			if (get_hard_regnum (regstack, u) == -1)
 			  {
 			    rtx pat2 = gen_rtx_CLOBBER (VOIDmode, u);
-			    rtx insn2 = emit_insn_before (pat2, insn);
+			    rtx_base_insn insn2 = emit_insn_before (pat2, insn);
 			    control_flow_insn_deleted
 			      |= move_nan_for_stack_reg (insn2, regstack, u);
 			  }
@@ -1568,14 +1572,14 @@ subst_stack_regs_pat (rtx insn, stack_ptr regstack, rtx pat)
 		if (src1_hard_regnum == -1)
 		  {
 		    rtx pat2 = gen_rtx_CLOBBER (VOIDmode, *src1);
-		    rtx insn2 = emit_insn_before (pat2, insn);
+		    rtx_base_insn insn2 = emit_insn_before (pat2, insn);
 		    control_flow_insn_deleted
 		      |= move_nan_for_stack_reg (insn2, regstack, *src1);
 		  }
 		if (src2_hard_regnum == -1)
 		  {
 		    rtx pat2 = gen_rtx_CLOBBER (VOIDmode, *src2);
-		    rtx insn2 = emit_insn_before (pat2, insn);
+		    rtx_base_insn insn2 = emit_insn_before (pat2, insn);
 		    control_flow_insn_deleted
 		      |= move_nan_for_stack_reg (insn2, regstack, *src2);
 		  }
@@ -2003,7 +2007,7 @@ subst_stack_regs_pat (rtx insn, stack_ptr regstack, rtx pat)
    requirements, since record_asm_stack_regs removes any problem asm.  */
 
 static void
-subst_asm_stack_regs (rtx insn, stack_ptr regstack)
+subst_asm_stack_regs (rtx_base_insn insn, stack_ptr regstack)
 {
   rtx body = PATTERN (insn);
   int alt;
@@ -2288,7 +2292,7 @@ subst_asm_stack_regs (rtx insn, stack_ptr regstack)
    a control flow insn was deleted in the process.  */
 
 static bool
-subst_stack_regs (rtx insn, stack_ptr regstack)
+subst_stack_regs (rtx_base_insn insn, stack_ptr regstack)
 {
   rtx *note_link, note;
   bool control_flow_insn_deleted = false;
@@ -2400,7 +2404,8 @@ subst_stack_regs (rtx insn, stack_ptr regstack)
    is no longer needed once this has executed.  */
 
 static void
-change_stack (rtx insn, stack_ptr old, stack_ptr new_stack, enum emit_where where)
+change_stack (rtx_base_insn insn, stack_ptr old, stack_ptr new_stack,
+	      enum emit_where where)
 {
   int reg;
   int update_end = 0;
@@ -2899,7 +2904,7 @@ convert_regs_1 (basic_block block)
   struct stack_def regstack;
   block_info bi = BLOCK_INFO (block);
   int reg;
-  rtx insn, next;
+  rtx_base_insn insn, next;
   bool control_flow_insn_deleted = false;
   bool cfg_altered = false;
   int debug_insns_with_starting_stack = 0;
diff --git a/gcc/reload.c b/gcc/reload.c
index 96619f6..b4d8fd8 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -264,24 +264,24 @@ static int hard_reg_set_here_p (unsigned int, unsigned int, rtx);
 static struct decomposition decompose (rtx);
 static int immune_p (rtx, rtx, struct decomposition);
 static bool alternative_allows_const_pool_ref (rtx, const char *, int);
-static rtx find_reloads_toplev (rtx, int, enum reload_type, int, int, rtx,
-				int *);
+static rtx find_reloads_toplev (rtx, int, enum reload_type, int, int,
+				rtx_base_insn, int *);
 static rtx make_memloc (rtx, int);
 static int maybe_memory_address_addr_space_p (enum machine_mode, rtx,
 					      addr_space_t, rtx *);
 static int find_reloads_address (enum machine_mode, rtx *, rtx, rtx *,
-				 int, enum reload_type, int, rtx);
-static rtx subst_reg_equivs (rtx, rtx);
+				 int, enum reload_type, int, rtx_base_insn);
+static rtx subst_reg_equivs (rtx, rtx_base_insn);
 static rtx subst_indexed_address (rtx);
 static void update_auto_inc_notes (rtx, int, int);
 static int find_reloads_address_1 (enum machine_mode, addr_space_t, rtx, int,
 				   enum rtx_code, enum rtx_code, rtx *,
-				   int, enum reload_type,int, rtx);
+				   int, enum reload_type,int, rtx_base_insn);
 static void find_reloads_address_part (rtx, rtx *, enum reg_class,
 				       enum machine_mode, int,
 				       enum reload_type, int);
 static rtx find_reloads_subreg_address (rtx, int, enum reload_type,
-					int, rtx, int *);
+					int, rtx_base_insn, int *);
 static void copy_replacements_1 (rtx *, rtx *, int);
 static int find_inc_amount (rtx, rtx);
 static int refers_to_mem_for_reload_p (rtx);
@@ -2617,7 +2617,7 @@ safe_from_earlyclobber (rtx op, rtx clobber)
    commutative operands, reg_equiv_address substitution, or whatever.  */
 
 int
-find_reloads (rtx insn, int replace, int ind_levels, int live_known,
+find_reloads (rtx_base_insn insn, int replace, int ind_levels, int live_known,
 	      short *reload_reg_p)
 {
   int insn_code_number;
@@ -4720,7 +4720,7 @@ alternative_allows_const_pool_ref (rtx mem ATTRIBUTE_UNUSED,
 
 static rtx
 find_reloads_toplev (rtx x, int opnum, enum reload_type type,
-		     int ind_levels, int is_set_dest, rtx insn,
+		     int ind_levels, int is_set_dest, rtx_base_insn insn,
 		     int *address_reloaded)
 {
   RTX_CODE code = GET_CODE (x);
@@ -4928,7 +4928,7 @@ maybe_memory_address_addr_space_p (enum machine_mode mode, rtx ad,
 static int
 find_reloads_address (enum machine_mode mode, rtx *memrefloc, rtx ad,
 		      rtx *loc, int opnum, enum reload_type type,
-		      int ind_levels, rtx insn)
+		      int ind_levels, rtx_base_insn insn)
 {
   addr_space_t as = memrefloc? MEM_ADDR_SPACE (*memrefloc)
 			     : ADDR_SPACE_GENERIC;
@@ -5330,7 +5330,7 @@ find_reloads_address (enum machine_mode mode, rtx *memrefloc, rtx ad,
    front of it for pseudos that we have to replace with stack slots.  */
 
 static rtx
-subst_reg_equivs (rtx ad, rtx insn)
+subst_reg_equivs (rtx ad, rtx_base_insn insn)
 {
   RTX_CODE code = GET_CODE (ad);
   int i;
@@ -5554,7 +5554,7 @@ find_reloads_address_1 (enum machine_mode mode, addr_space_t as,
 			rtx x, int context,
 			enum rtx_code outer_code, enum rtx_code index_code,
 			rtx *loc, int opnum, enum reload_type type,
-			int ind_levels, rtx insn)
+			int ind_levels, rtx_base_insn insn)
 {
 #define REG_OK_FOR_CONTEXT(CONTEXT, REGNO, MODE, AS, OUTER, INDEX)	\
   ((CONTEXT) == 0							\
@@ -6183,7 +6183,8 @@ find_reloads_address_part (rtx x, rtx *loc, enum reg_class rclass,
 
 static rtx
 find_reloads_subreg_address (rtx x, int opnum, enum reload_type type,
-			     int ind_levels, rtx insn, int *address_reloaded)
+			     int ind_levels, rtx_base_insn insn,
+			     int *address_reloaded)
 {
   enum machine_mode outer_mode = GET_MODE (x);
   enum machine_mode inner_mode = GET_MODE (SUBREG_REG (x));
diff --git a/gcc/reload.h b/gcc/reload.h
index 84691e4..05626a5 100644
--- a/gcc/reload.h
+++ b/gcc/reload.h
@@ -364,7 +364,7 @@ extern int safe_from_earlyclobber (rtx, rtx);
 /* Search the body of INSN for values that need reloading and record them
    with push_reload.  REPLACE nonzero means record also where the values occur
    so that subst_reloads can be used.  */
-extern int find_reloads (rtx, int, int, int, short *);
+extern int find_reloads (rtx_base_insn, int, int, int, short *);
 
 /* Compute the sum of X and Y, making canonicalizations assumed in an
    address, namely: sum constant integers, surround the sum of two
diff --git a/gcc/sched-ebb.c b/gcc/sched-ebb.c
index 5e6a830..bceb7fa 100644
--- a/gcc/sched-ebb.c
+++ b/gcc/sched-ebb.c
@@ -61,7 +61,7 @@ static const char *ebb_print_insn (const_rtx, int);
 static int rank (rtx, rtx);
 static int ebb_contributes_to_priority (rtx, rtx);
 static basic_block earliest_block_with_similiar_load (basic_block, rtx);
-static void add_deps_for_risky_insns (rtx, rtx);
+static void add_deps_for_risky_insns (rtx_base_insn, rtx_base_insn);
 static void debug_ebb_dependencies (rtx, rtx);
 
 static void ebb_add_remove_insn (rtx, int);
@@ -381,12 +381,12 @@ earliest_block_with_similiar_load (basic_block last_block, rtx load_insn)
    insns in given ebb.  */
 
 static void
-add_deps_for_risky_insns (rtx head, rtx tail)
+add_deps_for_risky_insns (rtx_base_insn head, rtx_base_insn tail)
 {
-  rtx insn, prev;
+  rtx_base_insn insn, prev;
   int classification;
-  rtx last_jump = NULL_RTX;
-  rtx next_tail = NEXT_INSN (tail);
+  rtx_base_insn last_jump = NULL_RTX_BASE_INSN;
+  rtx_base_insn next_tail = NEXT_INSN (tail);
   basic_block last_block = NULL, bb;
 
   for (insn = head; insn != next_tail; insn = NEXT_INSN (insn))
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index ecd069f..5b28633 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -602,7 +602,7 @@ struct haifa_sched_info
   bool (*insn_finishes_block_p) (rtx);
 
   /* The boundaries of the set of insns to be scheduled.  */
-  rtx prev_head, next_tail;
+  rtx_base_insn prev_head, next_tail;
 
   /* Filled in after the schedule is finished; the first and last scheduled
      insns.  */
-- 
1.7.11.7

