From d399670b4c4bbd5e1fe232a022cdc84c21ce3b9c Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Mon, 6 Jan 2014 16:58:31 -0500
Subject: [PATCH 075/159] FIXME: recog.c, combine.c, gen

---
 gcc/combine.c  | 312 ++++++++++++++++++++++++++++++++-------------------------
 gcc/genemit.c  |  15 +--
 gcc/genrecog.c |  14 +--
 gcc/recog.c    |  23 +++--
 gcc/recog.h    |   4 +-
 gcc/rtl.h      |   2 +-
 6 files changed, 209 insertions(+), 161 deletions(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index 48ffa2b..7210e01 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -132,7 +132,7 @@ static int total_attempts, total_merges, total_extras, total_successes;
    and can cause distribute_notes to do wrong things.  This is the
    second instruction if it has been so modified, null otherwise.  */
 
-static rtx i2mod;
+static rtx_base_insn i2mod;
 
 /* When I2MOD is nonnull, this is a copy of the old right hand side.  */
 
@@ -144,10 +144,10 @@ static rtx i2mod_new_rhs;
 
 typedef struct reg_stat_struct {
   /* Record last point of death of (hard or pseudo) register n.  */
-  rtx				last_death;
+  rtx_base_insn			last_death;
 
   /* Record last point of modification of (hard or pseudo) register n.  */
-  rtx				last_set;
+  rtx_base_insn			last_set;
 
   /* The next group of fields allows the recording of the last value assigned
      to (hard or pseudo) register n.  We use this information to see if an
@@ -270,7 +270,7 @@ static int last_call_luid;
    looked at, but this may be used to examine the successors of the insn
    to judge whether a simplification is valid.  */
 
-static rtx subst_insn;
+static rtx_base_insn subst_insn;
 
 /* This is the lowest LUID that `subst' is currently dealing with.
    get_last_value will not return a value if the register was set at or
@@ -290,7 +290,7 @@ static HARD_REG_SET newpat_used_regs;
    insn is the earlier than I2 or I3, combine should rescan starting at
    that location.  */
 
-static rtx added_links_insn;
+static rtx_base_insn added_links_insn;
 
 /* Basic block in which we are performing combines.  */
 static basic_block this_basic_block;
@@ -310,7 +310,7 @@ static int *uid_insn_cost;
    instruction stream as struct insn_link pointers.  */
 
 struct insn_link {
-  rtx insn;
+  rtx_base_insn insn;
   struct insn_link *next;
 };
 
@@ -329,7 +329,7 @@ static struct obstack insn_link_obstack;
 /* Allocate a link.  */
 
 static inline struct insn_link *
-alloc_insn_link (rtx insn, struct insn_link *next)
+alloc_insn_link (rtx_base_insn insn, struct insn_link *next)
 {
   struct insn_link *l
     = (struct insn_link *) obstack_alloc (&insn_link_obstack,
@@ -384,7 +384,7 @@ struct undobuf
 {
   struct undo *undos;
   struct undo *frees;
-  rtx other_insn;
+  rtx_base_insn other_insn;
 };
 
 static struct undobuf undobuf;
@@ -404,16 +404,19 @@ static rtx reg_num_sign_bit_copies_for_combine (const_rtx, enum machine_mode, co
 static void do_SUBST (rtx *, rtx);
 static void do_SUBST_INT (int *, int);
 static void init_reg_last (void);
-static void setup_incoming_promotions (rtx);
+static void setup_incoming_promotions (rtx_base_insn);
 static void set_nonzero_bits_and_sign_copies (rtx, const_rtx, void *);
 static int cant_combine_insn_p (rtx);
-static int can_combine_p (rtx, rtx, rtx, rtx, rtx, rtx, rtx *, rtx *);
+static int can_combine_p (rtx_base_insn, rtx, rtx, rtx, rtx, rtx, rtx *,
+			  rtx *);
 static int combinable_i3pat (rtx, rtx *, rtx, rtx, rtx, int, int, rtx *);
 static int contains_muldiv (rtx);
-static rtx try_combine (rtx, rtx, rtx, rtx, int *, rtx);
+static rtx_base_insn try_combine (rtx_base_insn, rtx_base_insn,
+				  rtx_base_insn, rtx_base_insn,
+				  int *, rtx_base_insn);
 static void undo_all (void);
 static void undo_commit (void);
-static rtx *find_split_point (rtx *, rtx, bool);
+static rtx *find_split_point (rtx *, rtx_base_insn, bool);
 static rtx subst (rtx, rtx, rtx, int, int, int);
 static rtx combine_simplify_rtx (rtx, enum machine_mode, int, int);
 static rtx simplify_if_then_else (rtx);
@@ -449,10 +452,10 @@ static rtx gen_lowpart_for_combine (enum machine_mode, rtx);
 static enum rtx_code simplify_compare_const (enum rtx_code, rtx, rtx *);
 static enum rtx_code simplify_comparison (enum rtx_code, rtx *, rtx *);
 static void update_table_tick (rtx);
-static void record_value_for_reg (rtx, rtx, rtx);
+static void record_value_for_reg (rtx, rtx_base_insn, rtx);
 static void check_promoted_subreg (rtx, rtx);
 static void record_dead_and_set_regs_1 (rtx, const_rtx, void *);
-static void record_dead_and_set_regs (rtx);
+static void record_dead_and_set_regs (rtx_base_insn);
 static int get_last_value_validate (rtx *, rtx, int, int);
 static rtx get_last_value (const_rtx);
 static int use_crosses_set_p (const_rtx, int);
@@ -460,7 +463,9 @@ static void reg_dead_at_p_1 (rtx, const_rtx, void *);
 static int reg_dead_at_p (rtx, rtx);
 static void move_deaths (rtx, rtx, int, rtx, rtx *);
 static int reg_bitfield_target_p (rtx, rtx);
-static void distribute_notes (rtx, rtx, rtx, rtx, rtx, rtx, rtx);
+static void distribute_notes (rtx, rtx_base_insn,
+			      rtx_base_insn, rtx_base_insn,
+			      rtx, rtx, rtx);
 static void distribute_links (struct insn_link *);
 static void mark_used_regs_combine (rtx);
 static void record_promoted_value (rtx, rtx);
@@ -510,10 +515,10 @@ target_canonicalize_comparison (enum rtx_code *code, rtx *op0, rtx *op1,
    reg_stat vector is made larger if the splitter creates a new
    register.  */
 
-static rtx
-combine_split_insns (rtx pattern, rtx insn)
+static rtx_base_insn
+combine_split_insns (rtx pattern, rtx_base_insn insn)
 {
-  rtx ret;
+  rtx_base_insn ret;
   unsigned int nregs;
 
   ret = split_insns (pattern, insn);
@@ -636,10 +641,10 @@ find_single_use_1 (rtx dest, rtx *loc)
    and last insn referencing DEST.  */
 
 static rtx *
-find_single_use (rtx dest, rtx insn, rtx *ploc)
+find_single_use (rtx dest, rtx_base_insn insn, rtx_base_insn *ploc)
 {
   basic_block bb;
-  rtx next;
+  rtx_base_insn next;
   rtx *result;
   struct insn_link *link;
 
@@ -832,8 +837,9 @@ do_SUBST_LINK (struct insn_link **into, struct insn_link *newval)
    expensive than the original sequence.  */
 
 static bool
-combine_validate_cost (rtx i0, rtx i1, rtx i2, rtx i3, rtx newpat,
-		       rtx newi2pat, rtx newotherpat)
+combine_validate_cost (rtx_base_insn i0, rtx_base_insn i1,
+		       rtx_base_insn i2, rtx_base_insn i3,
+		       rtx newpat, rtx newi2pat, rtx newotherpat)
 {
   int i0_cost, i1_cost, i2_cost, i3_cost;
   int new_i2_cost, new_i3_cost;
@@ -957,7 +963,7 @@ combine_validate_cost (rtx i0, rtx i1, rtx i2, rtx i3, rtx newpat,
 static void
 delete_noop_moves (void)
 {
-  rtx insn, next;
+  rtx_base_insn insn, next;
   basic_block bb;
 
   FOR_EACH_BB (bb)
@@ -983,11 +989,11 @@ static void
 create_log_links (void)
 {
   basic_block bb;
-  rtx *next_use;
+  rtx_base_insn *next_use;
   rtx_base_insn insn;
   df_ref *def_vec, *use_vec;
 
-  next_use = XCNEWVEC (rtx, max_reg_num ());
+  next_use = XCNEWVEC (rtx_base_insn, max_reg_num ());
 
   /* Pass through each block from the end, recording the uses of each
      register and establishing log links when def is encountered.
@@ -1012,7 +1018,7 @@ create_log_links (void)
             {
 	      df_ref def = *def_vec;
               int regno = DF_REF_REGNO (def);
-              rtx use_insn;
+              rtx_base_insn use_insn;
 
               if (!next_use[regno])
                 continue;
@@ -1058,7 +1064,7 @@ create_log_links (void)
 			  = alloc_insn_link (insn, LOG_LINKS (use_insn));
 		    }
                 }
-              next_use[regno] = NULL_RTX;
+              next_use[regno] = NULL_RTX_BASE_INSN;
             }
 
           for (use_vec = DF_INSN_USES (insn); *use_vec; use_vec++)
@@ -1087,7 +1093,7 @@ create_log_links (void)
    pair.  */
 
 static bool
-insn_a_feeds_b (rtx a, rtx b)
+insn_a_feeds_b (rtx a, rtx_base_insn b)
 {
   struct insn_link *links;
   FOR_EACH_LOG_LINK (links, b)
@@ -1106,14 +1112,14 @@ insn_a_feeds_b (rtx a, rtx b)
    Return nonzero if the combiner has turned an indirect jump
    instruction into a direct jump.  */
 static int
-combine_instructions (rtx f, unsigned int nregs)
+combine_instructions (rtx_base_insn f, unsigned int nregs)
 {
-  rtx insn, next;
+  rtx_base_insn insn, next;
 #ifdef HAVE_cc0
   rtx prev;
 #endif
   struct insn_link *links, *nextlinks;
-  rtx first;
+  rtx_base_insn first;
   basic_block last_bb;
 
   int new_direct_jump_p = 0;
@@ -1214,7 +1220,7 @@ combine_instructions (rtx f, unsigned int nregs)
 
   FOR_EACH_BB (this_basic_block)
     {
-      rtx last_combined_insn = NULL_RTX;
+      rtx_base_insn last_combined_insn = NULL_RTX_BASE_INSN;
       optimize_this_for_speed_p = optimize_bb_for_speed_p (this_basic_block);
       last_call_luid = 0;
       mem_last_set = -1;
@@ -1254,8 +1260,10 @@ combine_instructions (rtx f, unsigned int nregs)
 	      /* Try this insn with each insn it links back to.  */
 
 	      FOR_EACH_LOG_LINK (links, insn)
-		if ((next = try_combine (insn, links->insn, NULL_RTX,
-					 NULL_RTX, &new_direct_jump_p,
+		if ((next = try_combine (insn, links->insn,
+					 NULL_RTX_BASE_INSN,
+					 NULL_RTX_BASE_INSN,
+					 &new_direct_jump_p,
 					 last_combined_insn)) != 0)
 		  goto retry;
 
@@ -1263,7 +1271,7 @@ combine_instructions (rtx f, unsigned int nregs)
 
 	      FOR_EACH_LOG_LINK (links, insn)
 		{
-		  rtx link = links->insn;
+		  rtx_base_insn link = links->insn;
 
 		  /* If the linked insn has been replaced by a note, then there
 		     is no point in pursuing this chain any further.  */
@@ -1272,7 +1280,8 @@ combine_instructions (rtx f, unsigned int nregs)
 
 		  FOR_EACH_LOG_LINK (nextlinks, link)
 		    if ((next = try_combine (insn, link, nextlinks->insn,
-					     NULL_RTX, &new_direct_jump_p,
+					     NULL_RTX_BASE_INSN,
+					     &new_direct_jump_p,
 					     last_combined_insn)) != 0)
 		      goto retry;
 		}
@@ -1344,7 +1353,7 @@ combine_instructions (rtx f, unsigned int nregs)
 		for (nextlinks = links->next; nextlinks;
 		     nextlinks = nextlinks->next)
 		  if ((next = try_combine (insn, links->insn,
-					   nextlinks->insn, NULL_RTX,
+					   nextlinks->insn, NULL_RTX_BASE_INSN,
 					   &new_direct_jump_p,
 					   last_combined_insn)) != 0)
 		    goto retry;
@@ -1353,7 +1362,7 @@ combine_instructions (rtx f, unsigned int nregs)
 	      FOR_EACH_LOG_LINK (links, insn)
 		{
 		  struct insn_link *next1;
-		  rtx link = links->insn;
+		  rtx_base_insn link = links->insn;
 
 		  /* If the linked insn has been replaced by a note, then there
 		     is no point in pursuing this chain any further.  */
@@ -1362,7 +1371,7 @@ combine_instructions (rtx f, unsigned int nregs)
 
 		  FOR_EACH_LOG_LINK (next1, link)
 		    {
-		      rtx link1 = next1->insn;
+		      rtx_base_insn link1 = next1->insn;
 		      if (NOTE_P (link1))
 			continue;
 		      /* I0 -> I1 -> I2 -> I3.  */
@@ -1384,7 +1393,7 @@ combine_instructions (rtx f, unsigned int nregs)
 
 		  for (next1 = links->next; next1; next1 = next1->next)
 		    {
-		      rtx link1 = next1->insn;
+		      rtx_base_insn link1 = next1->insn;
 		      if (NOTE_P (link1))
 			continue;
 		      /* I0 -> I2; I1, I2 -> I3.  */
@@ -1408,7 +1417,7 @@ combine_instructions (rtx f, unsigned int nregs)
 	      FOR_EACH_LOG_LINK (links, insn)
 		{
 		  rtx set, note;
-		  rtx temp = links->insn;
+		  rtx_base_insn temp = links->insn;
 		  if ((set = single_set (temp)) != 0
 		      && (note = find_reg_equal_equiv_note (temp)) != 0
 		      && (note = XEXP (note, 0), GET_CODE (note)) != EXPR_LIST
@@ -1427,10 +1436,11 @@ combine_instructions (rtx f, unsigned int nregs)
 		      i2mod = temp;
 		      i2mod_old_rhs = copy_rtx (orig);
 		      i2mod_new_rhs = copy_rtx (note);
-		      next = try_combine (insn, i2mod, NULL_RTX, NULL_RTX,
+		      next = try_combine (insn, i2mod, NULL_RTX_BASE_INSN,
+					  NULL_RTX_BASE_INSN,
 					  &new_direct_jump_p,
 					  last_combined_insn);
-		      i2mod = NULL_RTX;
+		      i2mod = NULL_RTX_BASE_INSN;
 		      if (next)
 			goto retry;
 		      SET_SRC (set) = orig;
@@ -1496,7 +1506,7 @@ init_reg_last (void)
 /* Set up any promoted values for incoming argument registers.  */
 
 static void
-setup_incoming_promotions (rtx first)
+setup_incoming_promotions (rtx_base_insn first)
 {
   tree arg;
   bool strictly_local = false;
@@ -1585,7 +1595,7 @@ setup_incoming_promotions (rtx first)
 static void
 set_nonzero_bits_and_sign_copies (rtx x, const_rtx set, void *data)
 {
-  rtx insn = (rtx) data;
+  rtx_base_insn insn = (rtx_base_insn) data;
   unsigned int num;
 
   if (REG_P (x)
@@ -1694,14 +1704,14 @@ set_nonzero_bits_and_sign_copies (rtx x, const_rtx set, void *data)
    will return 1.  */
 
 static int
-can_combine_p (rtx insn, rtx i3, rtx pred ATTRIBUTE_UNUSED,
+can_combine_p (rtx_base_insn insn, rtx i3, rtx pred ATTRIBUTE_UNUSED,
 	       rtx pred2 ATTRIBUTE_UNUSED, rtx succ, rtx succ2,
 	       rtx *pdest, rtx *psrc)
 {
   int i;
   const_rtx set = 0;
   rtx src, dest;
-  rtx p;
+  rtx_base_insn p;
 #ifdef AUTO_INC_DEC
   rtx link;
 #endif
@@ -2263,8 +2273,9 @@ likely_spilled_retval_1 (rtx x, const_rtx set, void *data)
 static int
 likely_spilled_retval_p (rtx insn)
 {
-  rtx use = BB_END (this_basic_block);
-  rtx reg, p;
+  rtx_base_insn use = BB_END (this_basic_block);
+  rtx reg;
+  rtx_base_insn p;
   unsigned regno, nregs;
   /* We assume here that no machine mode needs more than
      32 hard registers when the value overlaps with a register
@@ -2310,7 +2321,7 @@ likely_spilled_retval_p (rtx insn)
    the results of the insn and a LOG_LINK pointing to the insn.  */
 
 static void
-adjust_for_new_dest (rtx insn)
+adjust_for_new_dest (rtx_base_insn insn)
 {
   /* For notes, be conservative and simply remove them.  */
   remove_reg_equal_equiv_notes (insn);
@@ -2382,7 +2393,7 @@ update_cfg_for_uncondjump (rtx insn)
   delete_insn (insn);
   if (EDGE_COUNT (bb->succs) == 1)
     {
-      rtx insn;
+      rtx_base_insn insn;
 
       single_succ_edge (bb)->flags |= EDGE_FALLTHRU;
 
@@ -2423,9 +2434,11 @@ update_cfg_for_uncondjump (rtx insn)
    been I3 passed to an earlier try_combine within the same basic
    block.  */
 
-static rtx
-try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
-	     rtx last_combined_insn)
+static rtx_base_insn
+try_combine (rtx_base_insn i3, rtx_base_insn i2,
+	     rtx_base_insn i1, rtx_base_insn i0,
+	     int *new_direct_jump_p,
+	     rtx_base_insn last_combined_insn)
 {
   /* New patterns for I3 and I2, respectively.  */
   rtx newpat, newi2pat = 0;
@@ -2467,6 +2480,7 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
   int changed_i3_dest = 0;
 
   int maxreg;
+  rtx_base_insn temp_insn;
   rtx temp;
   struct insn_link *link;
   rtx other_pat = 0;
@@ -2539,11 +2553,11 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
   /* If multiple insns feed into one of I2 or I3, they can be in any
      order.  To simplify the code below, reorder them in sequence.  */
   if (i0 && DF_INSN_LUID (i0) > DF_INSN_LUID (i2))
-    temp = i2, i2 = i0, i0 = temp;
+    temp_insn = i2, i2 = i0, i0 = temp_insn;
   if (i0 && DF_INSN_LUID (i0) > DF_INSN_LUID (i1))
-    temp = i1, i1 = i0, i0 = temp;
+    temp_insn = i1, i1 = i0, i0 = temp_insn;
   if (i1 && DF_INSN_LUID (i1) > DF_INSN_LUID (i2))
-    temp = i1, i1 = i2, i2 = temp;
+    temp_insn = i1, i1 = i2, i2 = temp_insn;
 
   added_links_insn = 0;
 
@@ -2746,9 +2760,10 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
 	     never appear in the insn stream so giving it the same INSN_UID
 	     as I2 will not cause a problem.  */
 
-	  i1 = gen_rtx_INSN (VOIDmode, INSN_UID (i2), NULL_RTX, i2,
-			     BLOCK_FOR_INSN (i2), XVECEXP (PATTERN (i2), 0, 1),
-			     INSN_LOCATION (i2), -1, NULL_RTX);
+	  i1 = (gen_rtx_INSN (VOIDmode, INSN_UID (i2), NULL_RTX, i2,
+			      BLOCK_FOR_INSN (i2), XVECEXP (PATTERN (i2), 0, 1),
+			      INSN_LOCATION (i2), -1, NULL_RTX)
+		)->as_an_rtx_base_insn ();
 
 	  SUBST (PATTERN (i2), XVECEXP (PATTERN (i2), 0, 0));
 	  SUBST (XEXP (SET_SRC (PATTERN (i2)), 0),
@@ -2935,7 +2950,8 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
       && rtx_equal_p (XEXP (SET_SRC (PATTERN (i3)), 0), i2dest))
     {
       rtx newpat_dest;
-      rtx *cc_use_loc = NULL, cc_use_insn = NULL_RTX;
+      rtx *cc_use_loc = NULL;
+      rtx_base_insn cc_use_insn = NULL_RTX_BASE_INSN;
       rtx op0 = i2src, op1 = XEXP (SET_SRC (PATTERN (i3)), 1);
       enum machine_mode compare_mode, orig_compare_mode;
       enum rtx_code compare_code = UNKNOWN, orig_compare_code = UNKNOWN;
@@ -3305,7 +3321,9 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
   if (i1 && insn_code_number < 0 && GET_CODE (newpat) == SET
       && asm_noperands (newpat) < 0)
     {
-      rtx parallel, m_split, *split;
+      rtx parallel;
+      rtx_base_insn m_split;
+      rtx *split;
 
       /* See if the MD file can split NEWPAT.  If it can't, see if letting it
 	 use I2DEST as a scratch register will help.  In the latter case,
@@ -3383,10 +3401,10 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
 
       if (m_split && NEXT_INSN (m_split) == NULL_RTX)
 	{
-	  m_split = PATTERN (m_split);
-	  insn_code_number = recog_for_combine (&m_split, i3, &new_i3_notes);
+	  rtx m_split_pat = PATTERN (m_split);
+	  insn_code_number = recog_for_combine (&m_split_pat, i3, &new_i3_notes);
 	  if (insn_code_number >= 0)
-	    newpat = m_split;
+	    newpat = m_split_pat;
 	}
       else if (m_split && NEXT_INSN (NEXT_INSN (m_split)) == NULL_RTX
 	       && (next_nonnote_nondebug_insn (i2) == i3
@@ -3908,8 +3926,8 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
 	}
 
       distribute_notes (new_other_notes, undobuf.other_insn,
-			undobuf.other_insn, NULL_RTX, NULL_RTX, NULL_RTX,
-			NULL_RTX);
+			undobuf.other_insn, NULL_RTX_BASE_INSN, NULL_RTX,
+			NULL_RTX, NULL_RTX);
     }
 
   if (swap_i2i3)
@@ -4134,19 +4152,20 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
 
     /* Distribute all the LOG_LINKS and REG_NOTES from I1, I2, and I3.  */
     if (i3notes)
-      distribute_notes (i3notes, i3, i3, newi2pat ? i2 : NULL_RTX,
+      distribute_notes (i3notes, i3, i3, newi2pat ? i2 : NULL_RTX_BASE_INSN,
 			elim_i2, elim_i1, elim_i0);
     if (i2notes)
-      distribute_notes (i2notes, i2, i3, newi2pat ? i2 : NULL_RTX,
+      distribute_notes (i2notes, i2, i3, newi2pat ? i2 : NULL_RTX_BASE_INSN,
 			elim_i2, elim_i1, elim_i0);
     if (i1notes)
-      distribute_notes (i1notes, i1, i3, newi2pat ? i2 : NULL_RTX,
+      distribute_notes (i1notes, i1, i3, newi2pat ? i2 : NULL_RTX_BASE_INSN,
 			elim_i2, elim_i1, elim_i0);
     if (i0notes)
-      distribute_notes (i0notes, i0, i3, newi2pat ? i2 : NULL_RTX,
+      distribute_notes (i0notes, i0, i3, newi2pat ? i2 : NULL_RTX_BASE_INSN,
 			elim_i2, elim_i1, elim_i0);
     if (midnotes)
-      distribute_notes (midnotes, NULL_RTX, i3, newi2pat ? i2 : NULL_RTX,
+      distribute_notes (midnotes, NULL_RTX_BASE_INSN, i3,
+			newi2pat ? i2 : NULL_RTX_BASE_INSN,
 			elim_i2, elim_i1, elim_i0);
 
     /* Distribute any notes added to I2 or I3 by recog_for_combine.  We
@@ -4154,12 +4173,12 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
        so we always pass it as i3.  */
 
     if (newi2pat && new_i2_notes)
-      distribute_notes (new_i2_notes, i2, i2, NULL_RTX, NULL_RTX, NULL_RTX,
-			NULL_RTX);
+      distribute_notes (new_i2_notes, i2, i2, NULL_RTX_BASE_INSN, NULL_RTX,
+			NULL_RTX, NULL_RTX);
 
     if (new_i3_notes)
-      distribute_notes (new_i3_notes, i3, i3, NULL_RTX, NULL_RTX, NULL_RTX,
-			NULL_RTX);
+      distribute_notes (new_i3_notes, i3, i3, NULL_RTX_BASE_INSN, NULL_RTX,
+			NULL_RTX, NULL_RTX);
 
     /* If I3DEST was used in I3SRC, it really died in I3.  We may need to
        put a REG_DEAD note for it somewhere.  If NEWI2PAT exists and sets
@@ -4172,10 +4191,11 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
       {
 	rtx new_note = alloc_reg_note (REG_DEAD, i3dest_killed, NULL_RTX);
 	if (newi2pat && reg_set_p (i3dest_killed, newi2pat))
-	  distribute_notes (new_note, NULL_RTX, i2, NULL_RTX, elim_i2,
-			    elim_i1, elim_i0);
+	  distribute_notes (new_note, NULL_RTX_BASE_INSN, i2,
+			    NULL_RTX_BASE_INSN, elim_i2, elim_i1, elim_i0);
 	else
-	  distribute_notes (new_note, NULL_RTX, i3, newi2pat ? i2 : NULL_RTX,
+	  distribute_notes (new_note, NULL_RTX_BASE_INSN, i3,
+			    newi2pat ? i2 : NULL_RTX_BASE_INSN,
 			    elim_i2, elim_i1, elim_i0);
       }
 
@@ -4183,10 +4203,12 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
       {
 	rtx new_note = alloc_reg_note (REG_DEAD, i2dest, NULL_RTX);
 	if (newi2pat && reg_set_p (i2dest, newi2pat))
-	  distribute_notes (new_note,  NULL_RTX, i2, NULL_RTX, NULL_RTX,
+	  distribute_notes (new_note,  NULL_RTX_BASE_INSN, i2,
+			    NULL_RTX_BASE_INSN, NULL_RTX,
 			    NULL_RTX, NULL_RTX);
 	else
-	  distribute_notes (new_note, NULL_RTX, i3, newi2pat ? i2 : NULL_RTX,
+	  distribute_notes (new_note, NULL_RTX_BASE_INSN, i3,
+			    newi2pat ? i2 : NULL_RTX_BASE_INSN,
 			    NULL_RTX, NULL_RTX, NULL_RTX);
       }
 
@@ -4194,10 +4216,12 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
       {
 	rtx new_note = alloc_reg_note (REG_DEAD, i1dest, NULL_RTX);
 	if (newi2pat && reg_set_p (i1dest, newi2pat))
-	  distribute_notes (new_note, NULL_RTX, i2, NULL_RTX, NULL_RTX,
+	  distribute_notes (new_note, NULL_RTX_BASE_INSN, i2,
+			    NULL_RTX_BASE_INSN, NULL_RTX,
 			    NULL_RTX, NULL_RTX);
 	else
-	  distribute_notes (new_note, NULL_RTX, i3, newi2pat ? i2 : NULL_RTX,
+	  distribute_notes (new_note, NULL_RTX_BASE_INSN, i3,
+			    newi2pat ? i2 : NULL_RTX_BASE_INSN,
 			    NULL_RTX, NULL_RTX, NULL_RTX);
       }
 
@@ -4205,10 +4229,12 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
       {
 	rtx new_note = alloc_reg_note (REG_DEAD, i0dest, NULL_RTX);
 	if (newi2pat && reg_set_p (i0dest, newi2pat))
-	  distribute_notes (new_note, NULL_RTX, i2, NULL_RTX, NULL_RTX,
+	  distribute_notes (new_note, NULL_RTX_BASE_INSN, i2,
+			    NULL_RTX_BASE_INSN, NULL_RTX,
 			    NULL_RTX, NULL_RTX);
 	else
-	  distribute_notes (new_note, NULL_RTX, i3, newi2pat ? i2 : NULL_RTX,
+	  distribute_notes (new_note, NULL_RTX_BASE_INSN, i3,
+			    newi2pat ? i2 : NULL_RTX_BASE_INSN,
 			    NULL_RTX, NULL_RTX, NULL_RTX);
       }
 
@@ -4220,7 +4246,8 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
     if (REG_P (i2dest))
       {
 	struct insn_link *link;
-	rtx i2_insn = 0, i2_val = 0, set;
+	rtx_base_insn i2_insn = 0;
+	rtx i2_val = 0, set;
 
 	/* The insn that used to set this register doesn't exist, and
 	   this life of the register may not exist either.  See if one of
@@ -4247,7 +4274,8 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
     if (i1 && REG_P (i1dest))
       {
 	struct insn_link *link;
-	rtx i1_insn = 0, i1_val = 0, set;
+	rtx_base_insn i1_insn = 0;
+	rtx i1_val = 0, set;
 
 	FOR_EACH_LOG_LINK (link, i3)
 	  if ((set = single_set (link->insn)) != 0
@@ -4263,7 +4291,8 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
     if (i0 && REG_P (i0dest))
       {
 	struct insn_link *link;
-	rtx i0_insn = 0, i0_val = 0, set;
+	rtx_base_insn i0_insn = 0;
+	rtx i0_val = 0, set;
 
 	FOR_EACH_LOG_LINK (link, i3)
 	  if ((set = single_set (link->insn)) != 0
@@ -4443,7 +4472,7 @@ undo_commit (void)
    two insns.  */
 
 static rtx *
-find_split_point (rtx *loc, rtx insn, bool set_src)
+find_split_point (rtx *loc, rtx_base_insn insn, bool set_src)
 {
   rtx x = *loc;
   enum rtx_code code = GET_CODE (x);
@@ -4653,7 +4682,8 @@ find_split_point (rtx *loc, rtx insn, bool set_src)
 	      && REG_P (XEXP (SET_SRC (x), 0))
 	      && (pos = exact_log2 (UINTVAL (XEXP (SET_SRC (x), 1)))) >= 7
 	      && REG_P (SET_DEST (x))
-	      && (split = find_single_use (SET_DEST (x), insn, (rtx*) 0)) != 0
+	      && (split = find_single_use (SET_DEST (x), insn,
+					   (rtx_base_insn*) 0)) != 0
 	      && (GET_CODE (*split) == EQ || GET_CODE (*split) == NE)
 	      && XEXP (*split, 0) == SET_DEST (x)
 	      && XEXP (*split, 1) == const0_rtx)
@@ -6231,7 +6261,7 @@ simplify_set (rtx x)
   rtx dest = SET_DEST (x);
   enum machine_mode mode
     = GET_MODE (src) != VOIDmode ? GET_MODE (src) : GET_MODE (dest);
-  rtx other_insn;
+  rtx_base_insn other_insn;
   rtx *cc_use;
 
   /* (set (pc) (return)) gets written as (return).  */
@@ -12167,7 +12197,7 @@ update_table_tick (rtx x)
    register.  */
 
 static void
-record_value_for_reg (rtx reg, rtx insn, rtx value)
+record_value_for_reg (rtx reg, rtx_base_insn insn, rtx value)
 {
   unsigned int regno = REGNO (reg);
   unsigned int endregno = END_REGNO (reg);
@@ -12285,7 +12315,7 @@ record_value_for_reg (rtx reg, rtx insn, rtx value)
 static void
 record_dead_and_set_regs_1 (rtx dest, const_rtx setter, void *data)
 {
-  rtx record_dead_insn = (rtx) data;
+  rtx_base_insn record_dead_insn = (rtx_base_insn) data;
 
   if (GET_CODE (dest) == SUBREG)
     dest = SUBREG_REG (dest);
@@ -12293,7 +12323,7 @@ record_dead_and_set_regs_1 (rtx dest, const_rtx setter, void *data)
   if (!record_dead_insn)
     {
       if (REG_P (dest))
-	record_value_for_reg (dest, NULL_RTX, NULL_RTX);
+	record_value_for_reg (dest, NULL_RTX_BASE_INSN, NULL_RTX);
       return;
     }
 
@@ -12332,7 +12362,7 @@ record_dead_and_set_regs_1 (rtx dest, const_rtx setter, void *data)
    most recent subroutine call).  */
 
 static void
-record_dead_and_set_regs (rtx insn)
+record_dead_and_set_regs (rtx_base_insn insn)
 {
   rtx link;
   unsigned int i;
@@ -13177,15 +13207,17 @@ reg_bitfield_target_p (rtx x, rtx body)
    on the type of note.  */
 
 static void
-distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
-		  rtx elim_i1, rtx elim_i0)
+distribute_notes (rtx notes, rtx_base_insn from_insn,
+		  rtx_base_insn i3, rtx_base_insn i2,
+		  rtx elim_i2, rtx elim_i1, rtx elim_i0)
 {
   rtx note, next_note;
-  rtx tem;
+  rtx tem_note;
+  rtx_base_insn tem_insn;
 
   for (note = notes; note; note = next_note)
     {
-      rtx place = 0, place2 = 0;
+      rtx_base_insn place = 0, place2 = 0;
 
       next_note = XEXP (note, 1);
       switch (REG_NOTE_KIND (note))
@@ -13355,16 +13387,16 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
 	     a REG_EQUAL note.  */
 	  /* ??? Ignore the without-reg_equal-note problem for now.  */
 	  if (reg_mentioned_p (XEXP (note, 0), PATTERN (i3))
-	      || ((tem = find_reg_note (i3, REG_EQUAL, NULL_RTX))
-		  && GET_CODE (XEXP (tem, 0)) == LABEL_REF
-		  && XEXP (XEXP (tem, 0), 0) == XEXP (note, 0)))
+	      || ((tem_note = find_reg_note (i3, REG_EQUAL, NULL_RTX))
+		  && GET_CODE (XEXP (tem_note, 0)) == LABEL_REF
+		  && XEXP (XEXP (tem_note, 0), 0) == XEXP (note, 0)))
 	    place = i3;
 
 	  if (i2
 	      && (reg_mentioned_p (XEXP (note, 0), PATTERN (i2))
-		  || ((tem = find_reg_note (i2, REG_EQUAL, NULL_RTX))
-		      && GET_CODE (XEXP (tem, 0)) == LABEL_REF
-		      && XEXP (XEXP (tem, 0), 0) == XEXP (note, 0))))
+		  || ((tem_note = find_reg_note (i2, REG_EQUAL, NULL_RTX))
+		      && GET_CODE (XEXP (tem_note, 0)) == LABEL_REF
+		      && XEXP (XEXP (tem_note, 0), 0) == XEXP (note, 0))))
 	    {
 	      if (place)
 		place2 = i2;
@@ -13436,7 +13468,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
 	  if (from_insn
 	      && from_insn == i2mod
 	      && !reg_overlap_mentioned_p (XEXP (note, 0), i2mod_new_rhs))
-	    tem = from_insn;
+	    tem_insn = from_insn;
 	  else
 	    {
 	      if (from_insn
@@ -13455,18 +13487,19 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
 		       || rtx_equal_p (XEXP (note, 0), elim_i1)
 		       || rtx_equal_p (XEXP (note, 0), elim_i0))
 		break;
-	      tem = i3;
+	      tem_insn = i3;
 	    }
 
 	  if (place == 0)
 	    {
 	      basic_block bb = this_basic_block;
 
-	      for (tem = PREV_INSN (tem); place == 0; tem = PREV_INSN (tem))
+	      for (tem_insn = PREV_INSN (tem_insn); place == 0;
+		   tem_insn = PREV_INSN (tem_insn))
 		{
-		  if (!NONDEBUG_INSN_P (tem))
+		  if (!NONDEBUG_INSN_P (tem_insn))
 		    {
-		      if (tem == BB_HEAD (bb))
+		      if (tem_insn == BB_HEAD (bb))
 			break;
 		      continue;
 		    }
@@ -13477,9 +13510,9 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
 		     global register vars.  */
 		  if ((REGNO (XEXP (note, 0)) >= FIRST_PSEUDO_REGISTER
 		       || !global_regs[REGNO (XEXP (note, 0))])
-		      && reg_set_p (XEXP (note, 0), PATTERN (tem)))
+		      && reg_set_p (XEXP (note, 0), PATTERN (tem_insn)))
 		    {
-		      rtx set = single_set (tem);
+		      rtx set = single_set (tem_insn);
 		      rtx inner_dest = 0;
 #ifdef HAVE_cc0
 		      rtx cc0_setter = NULL_RTX;
@@ -13514,18 +13547,19 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
 			     This might delete other dead insns recursively.
 			     First set the pattern to something that won't use
 			     any register.  */
-			  rtx old_notes = REG_NOTES (tem);
+			  rtx old_notes = REG_NOTES (tem_insn);
 
-			  PATTERN (tem) = pc_rtx;
-			  REG_NOTES (tem) = NULL;
+			  PATTERN (tem_insn) = pc_rtx;
+			  REG_NOTES (tem_insn) = NULL;
 
-			  distribute_notes (old_notes, tem, tem, NULL_RTX,
+			  distribute_notes (old_notes, tem_insn, tem_insn,
+					    NULL_RTX_BASE_INSN,
 					    NULL_RTX, NULL_RTX, NULL_RTX);
-			  distribute_links (LOG_LINKS (tem));
+			  distribute_links (LOG_LINKS (tem_insn));
 
-			  SET_INSN_DELETED (tem);
-			  if (tem == i2)
-			    i2 = NULL_RTX;
+			  SET_INSN_DELETED (tem_insn);
+			  if (tem_insn == i2)
+			    i2 = NULL_RTX_BASE_INSN;
 
 #ifdef HAVE_cc0
 			  /* Delete the setter too.  */
@@ -13542,7 +13576,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
 
 			      SET_INSN_DELETED (cc0_setter);
 			      if (cc0_setter == i2)
-				i2 = NULL_RTX;
+				i2 = NULL_RTX_BASE_INSN;
 			    }
 #endif
 			}
@@ -13556,17 +13590,17 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
 			      match the algorithm used in lifetime analysis
 			      and can cause the consistency check in the
 			      scheduler to fail.  */
-			  if (! find_regno_note (tem, REG_UNUSED,
+			  if (! find_regno_note (tem_insn, REG_UNUSED,
 						 REGNO (XEXP (note, 0))))
-			    place = tem;
+			    place = tem_insn;
 			  break;
 			}
 		    }
-		  else if (reg_referenced_p (XEXP (note, 0), PATTERN (tem))
-			   || (CALL_P (tem)
-			       && find_reg_fusage (tem, USE, XEXP (note, 0))))
+		  else if (reg_referenced_p (XEXP (note, 0), PATTERN (tem_insn))
+			   || (CALL_P (tem_insn)
+			       && find_reg_fusage (tem_insn, USE, XEXP (note, 0))))
 		    {
-		      place = tem;
+		      place = tem_insn;
 
 		      /* If we are doing a 3->2 combination, and we have a
 			 register which formerly died in i3 and was not used
@@ -13586,7 +13620,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
 		      break;
 		    }
 
-		  if (tem == BB_HEAD (bb))
+		  if (tem_insn == BB_HEAD (bb))
 		    break;
 		}
 
@@ -13660,26 +13694,28 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
 							     NULL_RTX);
 
 			      distribute_notes (new_note, place, place,
-						NULL_RTX, NULL_RTX, NULL_RTX,
+						NULL_RTX_BASE_INSN,
+						NULL_RTX_BASE_INSN,
+						NULL_RTX,
 						NULL_RTX);
 			    }
 			  else if (! refers_to_regno_p (i, i + 1,
 							PATTERN (place), 0)
 				   && ! find_regno_fusage (place, USE, i))
-			    for (tem = PREV_INSN (place); ;
-				 tem = PREV_INSN (tem))
+			    for (tem_insn = PREV_INSN (place); ;
+				 tem_insn = PREV_INSN (tem_insn))
 			      {
-				if (!NONDEBUG_INSN_P (tem))
+				if (!NONDEBUG_INSN_P (tem_insn))
 				  {
-				    if (tem == BB_HEAD (bb))
+				    if (tem_insn == BB_HEAD (bb))
 			 	      break;
 				    continue;
 				  }
-				if (dead_or_set_p (tem, piece)
+				if (dead_or_set_p (tem_insn, piece)
 				    || reg_bitfield_target_p (piece,
-							      PATTERN (tem)))
+							      PATTERN (tem_insn)))
 				  {
-				    add_reg_note (tem, REG_UNUSED, piece);
+				    add_reg_note (tem_insn, REG_UNUSED, piece);
 				    break;
 				  }
 			      }
@@ -13719,8 +13755,8 @@ distribute_links (struct insn_link *links)
 
   for (link = links; link; link = next_link)
     {
-      rtx place = 0;
-      rtx insn;
+      rtx_base_insn place = 0;
+      rtx_base_insn insn;
       rtx set, reg;
 
       next_link = link->next;
diff --git a/gcc/genemit.c b/gcc/genemit.c
index 03831bf..d6b8c1f 100644
--- a/gcc/genemit.c
+++ b/gcc/genemit.c
@@ -438,7 +438,7 @@ gen_expand (rtx expand)
     printf ("  rtx operand%d;\n", i);
   for (; i <= stats.max_scratch_opno; i++)
     printf ("  rtx operand%d ATTRIBUTE_UNUSED;\n", i);
-  printf ("  rtx _val = 0;\n");
+  printf ("  rtx_base_insn _val = 0;\n");
   printf ("  start_sequence ();\n");
 
   /* The fourth operand of DEFINE_EXPAND is some code to be executed
@@ -556,15 +556,18 @@ gen_split (rtx split)
   /* Output the prototype, function name and argument declarations.  */
   if (GET_CODE (split) == DEFINE_PEEPHOLE2)
     {
-      printf ("extern rtx gen_%s_%d (rtx, rtx *);\n",
+      printf ("extern rtx_base_insn gen_%s_%d (rtx, rtx *);\n",
 	      name, insn_code_number);
-      printf ("rtx\ngen_%s_%d (rtx curr_insn ATTRIBUTE_UNUSED, rtx *operands%s)\n",
+      printf ("rtx_base_insn\n"
+	      "gen_%s_%d (rtx curr_insn ATTRIBUTE_UNUSED, rtx *operands%s)\n",
 	      name, insn_code_number, unused);
     }
   else
     {
-      printf ("extern rtx gen_split_%d (rtx, rtx *);\n", insn_code_number);
-      printf ("rtx\ngen_split_%d (rtx curr_insn ATTRIBUTE_UNUSED, rtx *operands%s)\n",
+      printf ("extern rtx_base_insn gen_split_%d (rtx, rtx *);\n",
+	      insn_code_number);
+      printf ("rtx_base_insn\n"
+	      "gen_split_%d (rtx curr_insn ATTRIBUTE_UNUSED, rtx *operands%s)\n",
 	      insn_code_number, unused);
     }
   printf ("{\n");
@@ -572,7 +575,7 @@ gen_split (rtx split)
   /* Declare all local variables.  */
   for (i = 0; i < stats.num_operand_vars; i++)
     printf ("  rtx operand%d;\n", i);
-  printf ("  rtx _val = 0;\n");
+  printf ("  rtx_base_insn _val = 0;\n");
 
   if (GET_CODE (split) == DEFINE_PEEPHOLE2)
     output_peephole2_scratches (split);
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index 814be7d..41682c6 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -2197,12 +2197,12 @@ write_subroutine (struct decision_head *head, enum routine_type type)
 recog%s (rtx x0 ATTRIBUTE_UNUSED,\n\trtx insn ATTRIBUTE_UNUSED,\n\tint *pnum_clobbers ATTRIBUTE_UNUSED)\n", s_or_e, extension);
       break;
     case SPLIT:
-      printf ("%srtx\n\
-split%s (rtx x0 ATTRIBUTE_UNUSED, rtx insn ATTRIBUTE_UNUSED)\n",
+      printf ("%srtx_base_insn\n\
+split%s (rtx x0 ATTRIBUTE_UNUSED, rtx_base_insn insn ATTRIBUTE_UNUSED)\n",
 	      s_or_e, extension);
       break;
     case PEEPHOLE2:
-      printf ("%srtx\n\
+      printf ("%srtx_base_insn\n\
 peephole2%s (rtx x0 ATTRIBUTE_UNUSED,\n\trtx insn ATTRIBUTE_UNUSED,\n\tint *_pmatch_len ATTRIBUTE_UNUSED)\n",
 	      s_or_e, extension);
       break;
@@ -2212,7 +2212,8 @@ peephole2%s (rtx x0 ATTRIBUTE_UNUSED,\n\trtx insn ATTRIBUTE_UNUSED,\n\tint *_pma
   for (i = 1; i <= max_depth; i++)
     printf ("  rtx x%d ATTRIBUTE_UNUSED;\n", i);
 
-  printf ("  %s tem ATTRIBUTE_UNUSED;\n", IS_SPLIT (type) ? "rtx" : "int");
+  printf ("  %s tem ATTRIBUTE_UNUSED;\n",
+	  IS_SPLIT (type) ? "rtx_base_insn" : "int");
 
   if (!subfunction)
     printf ("  recog_data.insn = NULL_RTX;\n");
@@ -2461,12 +2462,13 @@ make_insn_sequence (rtx insn, enum routine_type type)
 
     case SPLIT:
       /* Define the subroutine we will call below and emit in genemit.  */
-      printf ("extern rtx gen_split_%d (rtx, rtx *);\n", next_insn_code);
+      printf ("extern rtx_base_insn gen_split_%d (rtx, rtx *);\n",
+	      next_insn_code);
       break;
 
     case PEEPHOLE2:
       /* Define the subroutine we will call below and emit in genemit.  */
-      printf ("extern rtx gen_peephole2_%d (rtx, rtx *);\n",
+      printf ("extern rtx_base_insn gen_peephole2_%d (rtx, rtx *);\n",
 	      next_insn_code);
       break;
     }
diff --git a/gcc/recog.c b/gcc/recog.c
index 616bb65..c8ad932 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -3025,14 +3025,19 @@ peep2_buf_position (int n)
    does not exist.  Used by the recognizer to find the next insn to match
    in a multi-insn pattern.  */
 
-rtx
+rtx_base_insn
 peep2_next_insn (int n)
 {
+  rtx temp;
   gcc_assert (n <= peep2_current_count);
 
   n = peep2_buf_position (peep2_current + n);
 
-  return peep2_insn_data[n].insn;
+  temp = peep2_insn_data[n].insn;
+  if (temp)
+    return temp->as_an_rtx_base_insn ();
+  else
+    return NULL;
 }
 
 /* Return true if REGNO is dead before the Nth non-note insn
@@ -3229,11 +3234,12 @@ peep2_reinit_state (regset live)
    replacing them with ATTEMPT.  Returns the last insn emitted, or NULL
    if the replacement is rejected.  */
 
-static rtx
+static rtx_base_insn
 peep2_attempt (basic_block bb, rtx insn, int match_len, rtx attempt)
 {
   int i;
-  rtx last, eh_note, as_note, before_try, x;
+  rtx_base_insn last;
+  rtx eh_note, as_note, before_try, x;
   rtx old_insn, new_insn;
   bool was_call = false;
 
@@ -3461,10 +3467,10 @@ peep2_attempt (basic_block bb, rtx insn, int match_len, rtx attempt)
    matched, and which now need to be replaced in the buffer.  */
 
 static void
-peep2_update_life (basic_block bb, int match_len, rtx last, rtx prev)
+peep2_update_life (basic_block bb, int match_len, rtx_base_insn last, rtx prev)
 {
   int i = peep2_buf_position (peep2_current + match_len + 1);
-  rtx x;
+  rtx_base_insn x;
   regset_head live;
 
   INIT_REG_SET (&live);
@@ -3538,7 +3544,7 @@ peep2_fill_buffer (basic_block bb, rtx insn, regset live)
 static void
 peephole2_optimize (void)
 {
-  rtx insn;
+  rtx_base_insn insn;
   bitmap live;
   int i;
   basic_block bb;
@@ -3601,7 +3607,8 @@ peephole2_optimize (void)
 	  attempt = peephole2_insns (PATTERN (head), head, &match_len);
 	  if (attempt != NULL)
 	    {
-	      rtx last = peep2_attempt (bb, head, match_len, attempt);
+	      rtx_base_insn last = peep2_attempt (bb, head, match_len,
+						  attempt);
 	      if (last)
 		{
 		  peep2_update_life (bb, match_len, last, PREV_INSN (attempt));
diff --git a/gcc/recog.h b/gcc/recog.h
index 550a217..d380a6a 100644
--- a/gcc/recog.h
+++ b/gcc/recog.h
@@ -126,14 +126,14 @@ extern void extract_insn (rtx);
 extern void extract_constrain_insn_cached (rtx);
 extern void extract_insn_cached (rtx);
 extern void preprocess_constraints (void);
-extern rtx peep2_next_insn (int);
+extern rtx_base_insn peep2_next_insn (int);
 extern int peep2_regno_dead_p (int, int);
 extern int peep2_reg_dead_p (int, rtx);
 #ifdef CLEAR_HARD_REG_SET
 extern rtx peep2_find_free_register (int, int, const char *,
 				     enum machine_mode, HARD_REG_SET *);
 #endif
-extern rtx peephole2_insns (rtx, rtx, int *);
+extern rtx_base_insn peephole2_insns (rtx, rtx, int *);
 
 extern int store_data_bypass_p (rtx, rtx);
 extern int if_test_bypass_p (rtx, rtx);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 495ce57..766d712 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2226,7 +2226,7 @@ extern rtx_base_insn try_split (rtx, rtx_base_insn, int);
 extern int split_branch_probability;
 
 /* In unknown file  */
-extern rtx split_insns (rtx, rtx);
+extern rtx_base_insn split_insns (rtx, rtx_base_insn);
 
 /* In simplify-rtx.c  */
 extern rtx simplify_const_unary_operation (enum rtx_code, enum machine_mode,
-- 
1.7.11.7

