From deb08ddf6974147a1d58f71d23d3f504310d32f0 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Mon, 7 Jul 2014 15:17:04 -0400
Subject: [PATCH 191/236] Remove DF_REF_INSN scaffolding

gcc/
	* df.h (df_dump_insn_problem_function): Strengthen first param of
	this callback from const_rtx to const rtx_insn *.
	(struct df_insn_info): Strengthen field "insn" from rtx to
	rtx_insn *.
	(DF_REF_INSN): Eliminate this function, reinstating the older
	macro definition.
	(df_find_def): Strengthen param 1 from rtx to rtx_insn *.
	(df_reg_defined): Likewise.
	(df_find_use): Likewise.
	(df_reg_used): Likewise.
	(df_dump_insn_top): Strengthen param 1 from const_rtx to
	const rtx_insn *.
	(df_dump_insn_bottom): Likewise.
	(df_insn_debug): Strengthen param 1 from rtx to rtx_insn *.
	(df_insn_debug_regno): Likewise.
	(debug_df_insn): Likewise.
	(df_rd_simulate_one_insn): Likewise for param 2.
	(df_word_lr_simulate_defs): Likewise for param 1.
	(df_word_lr_simulate_uses): Likewise.
	(df_md_simulate_one_insn): Likewise for param 2.
	(df_simulate_find_noclobber_defs): Likewise for param 1.
	(df_simulate_find_defs): Likewise.
	(df_simulate_defs): Likewise.
	(df_simulate_uses): Likewise.
	(df_simulate_one_insn_backwards): Likewise for param 2.
	(df_simulate_one_insn_forwards): Likewise.
	(df_ref_create): Likewise for param 3.
	(df_uses_create): Likewise for param 2.
	(df_insn_create_insn_record): Likewise for param 1.
	(df_insn_delete): Likewise.
	(df_insn_rescan): Likewise.
	(df_insn_rescan_debug_internal): Likewise.
	(df_insn_change_bb): Likewise.
	(df_notes_rescan): Likewise.
	* rtl.h (remove_death): Likewise for param 2.
	(print_rtl_with_bb): Strengthen param 2 from const_rtx to
	const rtx_insn *.
	* sched-int.h (reemit_notes): Strengthen param from rtx to
	rtx_insn *.
	* valtrack.h (propagate_for_debug): Likewise for param 1.

	* cfgrtl.c (print_rtl_with_bb): Strengthen param "rtx_first" and
	local "tmp_rtx" from const_rtx to const rtx_insn *.
	* combine.c (remove_death): Strengthen param "insn" from rtx to
	rtx_insn *.
	(move_deaths): Likewise for local "where_dead".
	* cse.c (delete_trivially_dead_insns): Introduce local
	"bind_var_loc" so that "bind" can be strengthened to an rtx_insn *.
	* df-core.c (df_find_def): Strengthen param "insn" from rtx to
	rtx_insn *.
	(df_reg_defined): Likewise.
	(df_find_use): Likewise.
	(df_reg_used): Likewise.
	(df_dump_insn_problem_data): Strengthen param "insn" from
	const_rtx to const rtx_insn *.
	(df_dump_insn_top): Likewise.
	(df_dump_insn_bottom): Likewise.
	(df_insn_debug): Strengthen param "insn" from rtx to rtx_insn *.
	(df_insn_debug_regno): Likewise.
	(debug_df_insn): Likewise.
	(DF_REF_INSN): Delete.
	* df-problems.c (df_rd_simulate_one_insn): Strengthen param "insn"
	from rtx to rtx_insn *.
	(df_chain_insn_top_dump): Strengthen param "insn" from
	const_rtx to const rtx_insn *.
	(df_chain_insn_bottom_dump): Likewise.
	(df_word_lr_simulate_defs): Strengthen param "insn" from rtx to
	rtx_insn *.
	(df_word_lr_simulate_uses): Likewise.
	(df_print_note): Likewise.
	(df_remove_dead_and_unused_notes): Likewise.
	(df_set_unused_notes_for_mw): Likewise.
	(df_set_dead_notes_for_mw): Likewise.
	(df_create_unused_note): Likewise.
	(df_simulate_find_defs): Likewise.
	(df_simulate_find_uses): Likewise.
	(df_simulate_find_noclobber_defs): Likewise.
	(df_simulate_defs): Likewise.
	(df_simulate_uses): Likewise.
	(df_simulate_one_insn_backwards): Likewise.
	(df_simulate_one_insn_forwards): Likewise.
	(df_md_simulate_one_insn): Likewise.
	* df-scan.c (df_uses_create): Likewise.
	(df_ref_create): Likewise.
	(df_insn_create_insn_record): Likewise.
	(df_insn_delete): Likewise.
	(df_insn_rescan): Likewise.
	(df_insn_rescan_debug_internal): Likewise.
	(df_insn_change_bb): Likewise.
	(df_notes_rescan): Likewise.
	(df_refs_add_to_chains): Likewise.
	(df_insn_refs_verify): Likewise.
	* emit-rtl.c (set_insn_deleted): Add checked cast to rtx_insn *
	when invoking df_insn_delete.
	(reorder_insns): Strengthen local "x" from rtx to rtx_insn *.
	(set_unique_reg_note): Add checked cast.
	* final.c (cleanup_subreg_operands): Likewise.
	* gcse.c (update_ld_motion_stores): Likewise, strengthening local
	"insn" from rtx to rtx_insn *.
	* haifa-sched.c (reemit_notes): Strengthen param "insn" and local
	"last" from rtx to rtx_insn *.
	* ira-emit.c (change_regs_in_insn): New function.
	(change_loop): Strengthen local "insn" from rtx to rtx_insn *.
	Invoke change_regs_in_insn rather than change_regs.
	* ira.c (update_equiv_regs): Strengthen locals "insn",
	"init_insn", "new_insn" from rtx to rtx_insn *.  Invoke
	for_each_rtx_in_insn rather than for_each_rtx.
	* recog.c (confirm_change_group): Add checked casts.
	(peep2_update_life): Strengthen local "x" from rtx to rtx_insn *.
	Add checked cast.
	(peep2_fill_buffer): Add checked cast.
	* rtlanal.c (remove_note): Likewise.
	* valtrack.c (propagate_for_debug): Strengthen param "insn" and
	locals "next" "end" from rtx to rtx_insn *.

/
	* rtx-classes-status.txt: DF_REF_INSN is done.
---
 gcc/cfgrtl.c           |  4 ++--
 gcc/combine.c          |  4 ++--
 gcc/cse.c              | 18 +++++++++-------
 gcc/df-core.c          | 26 +++++++++-------------
 gcc/df-problems.c      | 36 +++++++++++++++----------------
 gcc/df-scan.c          | 23 ++++++++++----------
 gcc/df.h               | 58 +++++++++++++++++++++++++-------------------------
 gcc/emit-rtl.c         |  6 +++---
 gcc/final.c            |  2 +-
 gcc/gcse.c             |  2 +-
 gcc/haifa-sched.c      |  5 +++--
 gcc/ira-emit.c         | 14 ++++++++++--
 gcc/ira.c              | 10 +++++----
 gcc/recog.c            | 10 ++++-----
 gcc/rtl.h              |  4 ++--
 gcc/rtlanal.c          |  2 +-
 gcc/sched-int.h        |  2 +-
 gcc/valtrack.c         |  5 +++--
 gcc/valtrack.h         |  2 +-
 rtx-classes-status.txt |  1 -
 20 files changed, 122 insertions(+), 112 deletions(-)

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 10f01b5..d51f0a7 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2128,9 +2128,9 @@ rtl_dump_bb (FILE *outf, basic_block bb, int indent, int flags)
    in dumpfile.h.  */
 
 void
-print_rtl_with_bb (FILE *outf, const_rtx rtx_first, int flags)
+print_rtl_with_bb (FILE *outf, const rtx_insn *rtx_first, int flags)
 {
-  const_rtx tmp_rtx;
+  const rtx_insn *tmp_rtx;
   if (rtx_first == 0)
     fprintf (outf, "(nil)\n");
   else
diff --git a/gcc/combine.c b/gcc/combine.c
index cf8ab3f..1e56eb56 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -12997,7 +12997,7 @@ mark_used_regs_combine (rtx x)
    Return the note used to record the death, if there was one.  */
 
 rtx
-remove_death (unsigned int regno, rtx insn)
+remove_death (unsigned int regno, rtx_insn *insn)
 {
   rtx note = find_regno_note (insn, REG_DEAD, regno);
 
@@ -13028,7 +13028,7 @@ move_deaths (rtx x, rtx maybe_kill_insn, int from_luid, rtx_insn *to_insn,
   if (code == REG)
     {
       unsigned int regno = REGNO (x);
-      rtx where_dead = reg_stat[regno].last_death;
+      rtx_insn *where_dead = reg_stat[regno].last_death;
 
       /* Don't move the register if it gets killed in between from and to.  */
       if (maybe_kill_insn && reg_set_p (x, maybe_kill_insn)
diff --git a/gcc/cse.c b/gcc/cse.c
index 5d9abf5..32efc47 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -7025,20 +7025,22 @@ delete_trivially_dead_insns (rtx_insn *insns, int nreg)
 		  && !side_effects_p (SET_SRC (set))
 		  && asm_noperands (PATTERN (insn)) < 0)
 		{
-		  rtx dval, bind;
+		  rtx dval, bind_var_loc;
+		  rtx_insn *bind;
 
 		  /* Create DEBUG_EXPR (and DEBUG_EXPR_DECL).  */
 		  dval = make_debug_expr_from_rtl (SET_DEST (set));
 
 		  /* Emit a debug bind insn before the insn in which
 		     reg dies.  */
-		  bind = gen_rtx_VAR_LOCATION (GET_MODE (SET_DEST (set)),
-					       DEBUG_EXPR_TREE_DECL (dval),
-					       SET_SRC (set),
-					       VAR_INIT_STATUS_INITIALIZED);
-		  count_reg_usage (bind, counts + nreg, NULL_RTX, 1);
-
-		  bind = emit_debug_insn_before (bind, insn);
+		  bind_var_loc =
+		    gen_rtx_VAR_LOCATION (GET_MODE (SET_DEST (set)),
+					  DEBUG_EXPR_TREE_DECL (dval),
+					  SET_SRC (set),
+					  VAR_INIT_STATUS_INITIALIZED);
+		  count_reg_usage (bind_var_loc, counts + nreg, NULL_RTX, 1);
+
+		  bind = emit_debug_insn_before (bind_var_loc, insn);
 		  df_insn_rescan (bind);
 
 		  if (replacements == NULL)
diff --git a/gcc/df-core.c b/gcc/df-core.c
index c225ad2..4b7d660 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -1984,7 +1984,7 @@ df_bb_regno_last_def_find (basic_block bb, unsigned int regno)
    DF is the dataflow object.  */
 
 df_ref
-df_find_def (rtx insn, rtx reg)
+df_find_def (rtx_insn *insn, rtx reg)
 {
   df_ref def;
 
@@ -2003,7 +2003,7 @@ df_find_def (rtx insn, rtx reg)
 /* Return true if REG is defined in INSN, zero otherwise.  */
 
 bool
-df_reg_defined (rtx insn, rtx reg)
+df_reg_defined (rtx_insn *insn, rtx reg)
 {
   return df_find_def (insn, reg) != NULL;
 }
@@ -2013,7 +2013,7 @@ df_reg_defined (rtx insn, rtx reg)
    DF is the dataflow object.  */
 
 df_ref
-df_find_use (rtx insn, rtx reg)
+df_find_use (rtx_insn *insn, rtx reg)
 {
   df_ref use;
 
@@ -2036,7 +2036,7 @@ df_find_use (rtx insn, rtx reg)
 /* Return true if REG is referenced in INSN, zero otherwise.  */
 
 bool
-df_reg_used (rtx insn, rtx reg)
+df_reg_used (rtx_insn *insn, rtx reg)
 {
   return df_find_use (insn, reg) != NULL;
 }
@@ -2262,7 +2262,7 @@ df_dump_bottom (basic_block bb, FILE *file)
 
 /* Dump information about INSN just before or after dumping INSN itself.  */
 static void
-df_dump_insn_problem_data (const_rtx insn, FILE *file, bool top)
+df_dump_insn_problem_data (const rtx_insn *insn, FILE *file, bool top)
 {
   int i;
 
@@ -2290,7 +2290,7 @@ df_dump_insn_problem_data (const_rtx insn, FILE *file, bool top)
 /* Dump information about INSN before dumping INSN itself.  */
 
 void
-df_dump_insn_top (const_rtx insn, FILE *file)
+df_dump_insn_top (const rtx_insn *insn, FILE *file)
 {
   df_dump_insn_problem_data (insn,  file, /*top=*/true);
 }
@@ -2298,7 +2298,7 @@ df_dump_insn_top (const_rtx insn, FILE *file)
 /* Dump information about INSN after dumping INSN itself.  */
 
 void
-df_dump_insn_bottom (const_rtx insn, FILE *file)
+df_dump_insn_bottom (const rtx_insn *insn, FILE *file)
 {
   df_dump_insn_problem_data (insn,  file, /*top=*/false);
 }
@@ -2389,13 +2389,13 @@ df_insn_uid_debug (unsigned int uid,
 
 
 DEBUG_FUNCTION void
-df_insn_debug (rtx insn, bool follow_chain, FILE *file)
+df_insn_debug (rtx_insn *insn, bool follow_chain, FILE *file)
 {
   df_insn_uid_debug (INSN_UID (insn), follow_chain, file);
 }
 
 DEBUG_FUNCTION void
-df_insn_debug_regno (rtx insn, FILE *file)
+df_insn_debug_regno (rtx_insn *insn, FILE *file)
 {
   struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
 
@@ -2454,7 +2454,7 @@ df_ref_debug (df_ref ref, FILE *file)
 /* Functions for debugging from GDB.  */
 
 DEBUG_FUNCTION void
-debug_df_insn (rtx insn)
+debug_df_insn (rtx_insn *insn)
 {
   df_insn_debug (insn, true, stderr);
   debug_rtx (insn);
@@ -2502,9 +2502,3 @@ debug_df_chain (struct df_link *link)
   df_chain_dump (link, stderr);
   fputc ('\n', stderr);
 }
-
-rtx_insn *DF_REF_INSN (df_ref ref)
-{
-  rtx insn = ref->base.insn_info->insn;
-  return as_a_nullable <rtx_insn *> (insn);
-}
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 305ed5d..34b4f7e 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -262,7 +262,7 @@ df_rd_simulate_artificial_defs_at_top (basic_block bb, bitmap local_rd)
    LOCAL_RD.  */
 
 void
-df_rd_simulate_one_insn (basic_block bb ATTRIBUTE_UNUSED, rtx insn,
+df_rd_simulate_one_insn (basic_block bb ATTRIBUTE_UNUSED, rtx_insn *insn,
 			 bitmap local_rd)
 {
   df_ref def;
@@ -2198,7 +2198,7 @@ df_chain_bottom_dump (basic_block bb, FILE *file)
 }
 
 static void
-df_chain_insn_top_dump (const_rtx insn, FILE *file)
+df_chain_insn_top_dump (const rtx_insn *insn, FILE *file)
 {
   if (df_chain_problem_p (DF_UD_CHAIN) && INSN_P (insn))
     {
@@ -2229,7 +2229,7 @@ df_chain_insn_top_dump (const_rtx insn, FILE *file)
 }
 
 static void
-df_chain_insn_bottom_dump (const_rtx insn, FILE *file)
+df_chain_insn_bottom_dump (const rtx_insn *insn, FILE *file)
 {
   if (df_chain_problem_p (DF_DU_CHAIN) && INSN_P (insn))
     {
@@ -2668,7 +2668,7 @@ df_word_lr_add_problem (void)
    an insn.  */
 
 bool
-df_word_lr_simulate_defs (rtx insn, bitmap live)
+df_word_lr_simulate_defs (rtx_insn *insn, bitmap live)
 {
   bool changed = false;
   df_ref def;
@@ -2685,7 +2685,7 @@ df_word_lr_simulate_defs (rtx insn, bitmap live)
 /* Simulate the effects of the uses of INSN on LIVE.  */
 
 void
-df_word_lr_simulate_uses (rtx insn, bitmap live)
+df_word_lr_simulate_uses (rtx_insn *insn, bitmap live)
 {
   df_ref use;
 
@@ -2705,7 +2705,7 @@ df_note_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
 
 /* This is only used if REG_DEAD_DEBUGGING is in effect.  */
 static void
-df_print_note (const char *prefix, rtx insn, rtx note)
+df_print_note (const char *prefix, rtx_insn *insn, rtx note)
 {
   if (dump_file)
     {
@@ -2739,7 +2739,7 @@ df_ignore_stack_reg (int regno ATTRIBUTE_UNUSED)
 /* Remove all of the REG_DEAD or REG_UNUSED notes from INSN.  */
 
 static void
-df_remove_dead_and_unused_notes (rtx insn)
+df_remove_dead_and_unused_notes (rtx_insn *insn)
 {
   rtx *pprev = &REG_NOTES (insn);
   rtx link = *pprev;
@@ -2895,7 +2895,7 @@ df_whole_mw_reg_unused_p (struct df_mw_hardreg *mws,
 */
 
 static void
-df_set_unused_notes_for_mw (rtx insn, struct df_mw_hardreg *mws,
+df_set_unused_notes_for_mw (rtx_insn *insn, struct df_mw_hardreg *mws,
 			    bitmap live, bitmap do_not_gen,
 			    bitmap artificial_uses,
 			    struct dead_debug_local *debug)
@@ -2968,7 +2968,7 @@ df_whole_mw_reg_dead_p (struct df_mw_hardreg *mws,
    register.  */
 
 static void
-df_set_dead_notes_for_mw (rtx insn, struct df_mw_hardreg *mws,
+df_set_dead_notes_for_mw (rtx_insn *insn, struct df_mw_hardreg *mws,
 			  bitmap live, bitmap do_not_gen,
 			  bitmap artificial_uses, bool *added_notes_p)
 {
@@ -3025,7 +3025,7 @@ df_set_dead_notes_for_mw (rtx insn, struct df_mw_hardreg *mws,
    LIVE.  Do not generate notes for registers in ARTIFICIAL_USES.  */
 
 static void
-df_create_unused_note (rtx insn, df_ref def,
+df_create_unused_note (rtx_insn *insn, df_ref def,
 		       bitmap live, bitmap artificial_uses,
 		       struct dead_debug_local *debug)
 {
@@ -3357,7 +3357,7 @@ df_note_add_problem (void)
 /* Find the set of DEFs for INSN.  */
 
 void
-df_simulate_find_defs (rtx insn, bitmap defs)
+df_simulate_find_defs (rtx_insn *insn, bitmap defs)
 {
   df_ref def;
 
@@ -3368,7 +3368,7 @@ df_simulate_find_defs (rtx insn, bitmap defs)
 /* Find the set of uses for INSN.  This includes partial defs.  */
 
 static void
-df_simulate_find_uses (rtx insn, bitmap uses)
+df_simulate_find_uses (rtx_insn *insn, bitmap uses)
 {
   df_ref def, use;
   struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
@@ -3383,7 +3383,7 @@ df_simulate_find_uses (rtx insn, bitmap uses)
 /* Find the set of real DEFs, which are not clobbers, for INSN.  */
 
 void
-df_simulate_find_noclobber_defs (rtx insn, bitmap defs)
+df_simulate_find_noclobber_defs (rtx_insn *insn, bitmap defs)
 {
   df_ref def;
 
@@ -3396,7 +3396,7 @@ df_simulate_find_noclobber_defs (rtx insn, bitmap defs)
 /* Simulate the effects of the defs of INSN on LIVE.  */
 
 void
-df_simulate_defs (rtx insn, bitmap live)
+df_simulate_defs (rtx_insn *insn, bitmap live)
 {
   df_ref def;
 
@@ -3415,7 +3415,7 @@ df_simulate_defs (rtx insn, bitmap live)
 /* Simulate the effects of the uses of INSN on LIVE.  */
 
 void
-df_simulate_uses (rtx insn, bitmap live)
+df_simulate_uses (rtx_insn *insn, bitmap live)
 {
   df_ref use;
 
@@ -3476,7 +3476,7 @@ df_simulate_initialize_backwards (basic_block bb, bitmap live)
 /* Simulate the backwards effects of INSN on the bitmap LIVE.  */
 
 void
-df_simulate_one_insn_backwards (basic_block bb, rtx insn, bitmap live)
+df_simulate_one_insn_backwards (basic_block bb, rtx_insn *insn, bitmap live)
 {
   if (!NONDEBUG_INSN_P (insn))
     return;
@@ -3539,7 +3539,7 @@ df_simulate_initialize_forwards (basic_block bb, bitmap live)
 /* Simulate the forwards effects of INSN on the bitmap LIVE.  */
 
 void
-df_simulate_one_insn_forwards (basic_block bb, rtx insn, bitmap live)
+df_simulate_one_insn_forwards (basic_block bb, rtx_insn *insn, bitmap live)
 {
   rtx link;
   if (! INSN_P (insn))
@@ -4051,7 +4051,7 @@ df_md_simulate_artificial_defs_at_top (basic_block bb, bitmap local_md)
    LOCAL_MD.  */
 
 void
-df_md_simulate_one_insn (basic_block bb ATTRIBUTE_UNUSED, rtx insn,
+df_md_simulate_one_insn (basic_block bb ATTRIBUTE_UNUSED, rtx_insn *insn,
 			 bitmap local_md)
 {
   df_ref def;
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index a853914..e2aaf61 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -109,9 +109,10 @@ static void df_ref_chain_delete_du_chain (df_ref);
 static void df_ref_chain_delete (df_ref);
 
 static void df_refs_add_to_chains (struct df_collection_rec *,
-				   basic_block, rtx, unsigned int);
+				   basic_block, rtx_insn *, unsigned int);
 
-static bool df_insn_refs_verify (struct df_collection_rec *, basic_block, rtx, bool);
+static bool df_insn_refs_verify (struct df_collection_rec *, basic_block,
+				 rtx_insn *, bool);
 static void df_entry_block_defs_collect (struct df_collection_rec *, bitmap);
 static void df_exit_block_uses_collect (struct df_collection_rec *, bitmap);
 static void df_install_ref (df_ref, struct df_reg_info *,
@@ -626,7 +627,7 @@ df_scan_blocks (void)
    depending on whether LOC is inside PATTERN (INSN) or a note.  */
 
 void
-df_uses_create (rtx *loc, rtx insn, int ref_flags)
+df_uses_create (rtx *loc, rtx_insn *insn, int ref_flags)
 {
   gcc_assert (!(ref_flags & ~DF_REF_IN_NOTE));
   df_uses_record (NULL, loc, DF_REF_REG_USE,
@@ -833,7 +834,7 @@ df_reg_chain_unlink (df_ref ref)
    out.  */
 
 struct df_insn_info *
-df_insn_create_insn_record (rtx insn)
+df_insn_create_insn_record (rtx_insn *insn)
 {
   struct df_scan_problem_data *problem_data
     = (struct df_scan_problem_data *) df_scan->problem_data;
@@ -941,7 +942,7 @@ df_insn_info_delete (unsigned int uid)
    or marked for later in deferred mode.  */
 
 void
-df_insn_delete (rtx insn)
+df_insn_delete (rtx_insn *insn)
 {
   unsigned int uid;
   basic_block bb;
@@ -1027,7 +1028,7 @@ df_free_collection_rec (struct df_collection_rec *collection_rec)
 /* Rescan INSN.  Return TRUE if the rescanning produced any changes.  */
 
 bool
-df_insn_rescan (rtx insn)
+df_insn_rescan (rtx_insn *insn)
 {
   unsigned int uid = INSN_UID (insn);
   struct df_insn_info *insn_info = NULL;
@@ -1117,7 +1118,7 @@ df_insn_rescan (rtx insn)
    dirty.  */
 
 bool
-df_insn_rescan_debug_internal (rtx insn)
+df_insn_rescan_debug_internal (rtx_insn *insn)
 {
   unsigned int uid = INSN_UID (insn);
   struct df_insn_info *insn_info;
@@ -1763,7 +1764,7 @@ df_maybe_reorganize_def_refs (enum df_ref_order order)
    instructions from one block to another.  */
 
 void
-df_insn_change_bb (rtx insn, basic_block new_bb)
+df_insn_change_bb (rtx_insn *insn, basic_block new_bb)
 {
   basic_block old_bb = BLOCK_FOR_INSN (insn);
   struct df_insn_info *insn_info;
@@ -1944,7 +1945,7 @@ df_mw_hardreg_chain_delete_eq_uses (struct df_insn_info *insn_info)
 /* Rescan only the REG_EQUIV/REG_EQUAL notes part of INSN.  */
 
 void
-df_notes_rescan (rtx insn)
+df_notes_rescan (rtx_insn *insn)
 {
   struct df_insn_info *insn_info;
   unsigned int uid = INSN_UID (insn);
@@ -2434,7 +2435,7 @@ df_install_mws (const vec<df_mw_hardreg_ptr, va_heap> *old_vec)
 
 static void
 df_refs_add_to_chains (struct df_collection_rec *collection_rec,
-		       basic_block bb, rtx insn, unsigned int flags)
+		       basic_block bb, rtx_insn *insn, unsigned int flags)
 {
   if (insn)
     {
@@ -4135,7 +4136,7 @@ df_mws_verify (const vec<df_mw_hardreg_ptr, va_heap> *new_rec,
 static bool
 df_insn_refs_verify (struct df_collection_rec *collection_rec,
 		     basic_block bb,
-                     rtx insn,
+                     rtx_insn *insn,
 		     bool abort_if_fail)
 {
   bool ret1, ret2, ret3, ret4;
diff --git a/gcc/df.h b/gcc/df.h
index bfd02a0..740657d 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -239,7 +239,7 @@ typedef void (*df_dump_problem_function) (FILE *);
 typedef void (*df_dump_bb_problem_function) (basic_block, FILE *);
 
 /* Function to dump before or after an insn to FILE.  */
-typedef void (*df_dump_insn_problem_function) (const_rtx, FILE *);
+typedef void (*df_dump_insn_problem_function) (const rtx_insn *, FILE *);
 
 /* Function to dump top or bottom of basic block results to FILE.  */
 typedef void (*df_verify_solution_start) (void);
@@ -421,7 +421,7 @@ typedef union df_ref_d *df_ref;
 /* One of these structures is allocated for every insn.  */
 struct df_insn_info
 {
-  rtx insn;                     /* The insn this info comes from.  */
+  rtx_insn *insn;	        /* The insn this info comes from.  */
   df_ref defs;	                /* Head of insn-def chain.  */
   df_ref uses;	                /* Head of insn-use chain.  */
   /* Head of insn-use chain for uses in REG_EQUAL/EQUIV notes.  */
@@ -649,7 +649,7 @@ struct df_d
 			: BLOCK_FOR_INSN (DF_REF_INSN (REF)))
 #define DF_REF_BBNO(REF) (DF_REF_BB (REF)->index)
 #define DF_REF_INSN_INFO(REF) ((REF)->base.insn_info)
-extern rtx_insn *DF_REF_INSN (df_ref ref);
+#define DF_REF_INSN(REF) ((REF)->base.insn_info->insn)
 #define DF_REF_INSN_UID(REF) (INSN_UID (DF_REF_INSN(REF)))
 #define DF_REF_CLASS(REF) ((REF)->base.cl)
 #define DF_REF_TYPE(REF) ((REF)->base.type)
@@ -953,10 +953,10 @@ extern void df_check_cfg_clean (void);
 #endif
 extern df_ref df_bb_regno_first_def_find (basic_block, unsigned int);
 extern df_ref df_bb_regno_last_def_find (basic_block, unsigned int);
-extern df_ref df_find_def (rtx, rtx);
-extern bool df_reg_defined (rtx, rtx);
-extern df_ref df_find_use (rtx, rtx);
-extern bool df_reg_used (rtx, rtx);
+extern df_ref df_find_def (rtx_insn *, rtx);
+extern bool df_reg_defined (rtx_insn *, rtx);
+extern df_ref df_find_use (rtx_insn *, rtx);
+extern bool df_reg_used (rtx_insn *, rtx);
 extern void df_worklist_dataflow (struct dataflow *,bitmap, int *, int);
 extern void df_print_regset (FILE *file, bitmap r);
 extern void df_print_word_regset (FILE *file, bitmap r);
@@ -965,15 +965,15 @@ extern void df_dump_region (FILE *);
 extern void df_dump_start (FILE *);
 extern void df_dump_top (basic_block, FILE *);
 extern void df_dump_bottom (basic_block, FILE *);
-extern void df_dump_insn_top (const_rtx, FILE *);
-extern void df_dump_insn_bottom (const_rtx, FILE *);
+extern void df_dump_insn_top (const rtx_insn *, FILE *);
+extern void df_dump_insn_bottom (const rtx_insn *, FILE *);
 extern void df_refs_chain_dump (df_ref, bool, FILE *);
 extern void df_regs_chain_dump (df_ref,  FILE *);
-extern void df_insn_debug (rtx, bool, FILE *);
-extern void df_insn_debug_regno (rtx, FILE *);
+extern void df_insn_debug (rtx_insn *, bool, FILE *);
+extern void df_insn_debug_regno (rtx_insn *, FILE *);
 extern void df_regno_debug (unsigned int, FILE *);
 extern void df_ref_debug (df_ref, FILE *);
-extern void debug_df_insn (rtx);
+extern void debug_df_insn (rtx_insn *);
 extern void debug_df_regno (unsigned int);
 extern void debug_df_reg (rtx);
 extern void debug_df_defno (unsigned int);
@@ -991,7 +991,7 @@ extern void df_chain_dump (struct df_link *, FILE *);
 extern void df_print_bb_index (basic_block bb, FILE *file);
 extern void df_rd_add_problem (void);
 extern void df_rd_simulate_artificial_defs_at_top (basic_block, bitmap);
-extern void df_rd_simulate_one_insn (basic_block, rtx, bitmap);
+extern void df_rd_simulate_one_insn (basic_block, rtx_insn *, bitmap);
 extern void df_lr_add_problem (void);
 extern void df_lr_verify_transfer_functions (void);
 extern void df_live_verify_transfer_functions (void);
@@ -1000,23 +1000,23 @@ extern void df_live_set_all_dirty (void);
 extern void df_chain_add_problem (unsigned int);
 extern void df_word_lr_add_problem (void);
 extern bool df_word_lr_mark_ref (df_ref, bool, bitmap);
-extern bool df_word_lr_simulate_defs (rtx, bitmap);
-extern void df_word_lr_simulate_uses (rtx, bitmap);
+extern bool df_word_lr_simulate_defs (rtx_insn *, bitmap);
+extern void df_word_lr_simulate_uses (rtx_insn *, bitmap);
 extern void df_word_lr_simulate_artificial_refs_at_top (basic_block, bitmap);
 extern void df_word_lr_simulate_artificial_refs_at_end (basic_block, bitmap);
 extern void df_note_add_problem (void);
 extern void df_md_add_problem (void);
 extern void df_md_simulate_artificial_defs_at_top (basic_block, bitmap);
-extern void df_md_simulate_one_insn (basic_block, rtx, bitmap);
-extern void df_simulate_find_noclobber_defs (rtx, bitmap);
-extern void df_simulate_find_defs (rtx, bitmap);
-extern void df_simulate_defs (rtx, bitmap);
-extern void df_simulate_uses (rtx, bitmap);
+extern void df_md_simulate_one_insn (basic_block, rtx_insn *, bitmap);
+extern void df_simulate_find_noclobber_defs (rtx_insn *, bitmap);
+extern void df_simulate_find_defs (rtx_insn *, bitmap);
+extern void df_simulate_defs (rtx_insn *, bitmap);
+extern void df_simulate_uses (rtx_insn *, bitmap);
 extern void df_simulate_initialize_backwards (basic_block, bitmap);
-extern void df_simulate_one_insn_backwards (basic_block, rtx, bitmap);
+extern void df_simulate_one_insn_backwards (basic_block, rtx_insn *, bitmap);
 extern void df_simulate_finalize_backwards (basic_block, bitmap);
 extern void df_simulate_initialize_forwards (basic_block, bitmap);
-extern void df_simulate_one_insn_forwards (basic_block, rtx, bitmap);
+extern void df_simulate_one_insn_forwards (basic_block, rtx_insn *, bitmap);
 extern void simulate_backwards_to_point (basic_block, regset, rtx);
 extern bool can_move_insns_across (rtx_insn *, rtx_insn *,
 				   rtx_insn *, rtx_insn *,
@@ -1029,20 +1029,20 @@ extern void df_scan_add_problem (void);
 extern void df_grow_reg_info (void);
 extern void df_grow_insn_info (void);
 extern void df_scan_blocks (void);
-extern void df_uses_create (rtx *, rtx, int);
-extern struct df_insn_info * df_insn_create_insn_record (rtx);
-extern void df_insn_delete (rtx);
+extern void df_uses_create (rtx *, rtx_insn *, int);
+extern struct df_insn_info * df_insn_create_insn_record (rtx_insn *);
+extern void df_insn_delete (rtx_insn *);
 extern void df_bb_refs_record (int, bool);
-extern bool df_insn_rescan (rtx);
-extern bool df_insn_rescan_debug_internal (rtx);
+extern bool df_insn_rescan (rtx_insn *);
+extern bool df_insn_rescan_debug_internal (rtx_insn *);
 extern void df_insn_rescan_all (void);
 extern void df_process_deferred_rescans (void);
 extern void df_recompute_luids (basic_block);
-extern void df_insn_change_bb (rtx, basic_block);
+extern void df_insn_change_bb (rtx_insn *, basic_block);
 extern void df_maybe_reorganize_use_refs (enum df_ref_order);
 extern void df_maybe_reorganize_def_refs (enum df_ref_order);
 extern void df_ref_change_reg_with_loc (int, int, rtx);
-extern void df_notes_rescan (rtx);
+extern void df_notes_rescan (rtx_insn *);
 extern void df_hard_reg_init (void);
 extern void df_update_entry_block_defs (void);
 extern void df_update_exit_block_uses (void);
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 6a550c4..f3cf87f 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -4043,7 +4043,7 @@ void
 set_insn_deleted (rtx insn)
 {
   if (INSN_P (insn))
-    df_insn_delete (insn);
+    df_insn_delete (as_a <rtx_insn *> (insn));
   PUT_CODE (insn, NOTE);
   NOTE_KIND (insn) = NOTE_INSN_DELETED;
 }
@@ -4227,7 +4227,7 @@ reorder_insns (rtx_insn *from, rtx_insn *to, rtx_insn *after)
   if (!BARRIER_P (after)
       && (bb = BLOCK_FOR_INSN (after)))
     {
-      rtx x;
+      rtx_insn *x;
       df_set_bb_dirty (bb);
 
       if (!BARRIER_P (from)
@@ -5184,7 +5184,7 @@ set_unique_reg_note (rtx insn, enum reg_note kind, rtx datum)
     {
     case REG_EQUAL:
     case REG_EQUIV:
-      df_notes_rescan (insn);
+      df_notes_rescan (as_a <rtx_insn *> (insn));
       break;
     default:
       break;
diff --git a/gcc/final.c b/gcc/final.c
index 3a88e2b..37d775c 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -3106,7 +3106,7 @@ cleanup_subreg_operands (rtx insn)
 	*recog_data.dup_loc[i] = walk_alter_subreg (recog_data.dup_loc[i], &changed);
     }
   if (changed)
-    df_insn_rescan (insn);
+    df_insn_rescan (as_a <rtx_insn *> (insn));
 }
 
 /* If X is a SUBREG, try to replace it with a REG or a MEM, based on
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 2148a7e..98b74ec 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4092,7 +4092,7 @@ update_ld_motion_stores (struct expr * expr)
 
       for ( ; list != NULL_RTX; list = XEXP (list, 1))
 	{
-	  rtx insn = XEXP (list, 0);
+	  rtx_insn *insn = as_a <rtx_insn *> (XEXP (list, 0));
 	  rtx pat = PATTERN (insn);
 	  rtx src = SET_SRC (pat);
 	  rtx reg = expr->reaching_reg;
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index bd13320..bc46002 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -5223,9 +5223,10 @@ debug_ready_list (struct ready_list *ready)
    NOTEs.  This is used for NOTE_INSN_EPILOGUE_BEG, so that sched-ebb
    replaces the epilogue note in the correct basic block.  */
 void
-reemit_notes (rtx insn)
+reemit_notes (rtx_insn *insn)
 {
-  rtx note, last = insn;
+  rtx note;
+  rtx_insn *last = insn;
 
   for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
     {
diff --git a/gcc/ira-emit.c b/gcc/ira-emit.c
index 445b386..a3bf41e 100644
--- a/gcc/ira-emit.c
+++ b/gcc/ira-emit.c
@@ -301,6 +301,15 @@ change_regs (rtx *loc)
   return result;
 }
 
+static bool
+change_regs_in_insn (rtx_insn **insn_ptr)
+{
+  rtx rtx = *insn_ptr;
+  bool result = change_regs (&rtx);
+  *insn_ptr = as_a <rtx_insn *> (rtx);
+  return result;
+}
+
 /* Attach MOVE to the edge E.  The move is attached to the head of the
    list if HEAD_P is TRUE.  */
 static void
@@ -557,7 +566,8 @@ change_loop (ira_loop_tree_node_t node)
   int regno;
   bool used_p;
   ira_allocno_t allocno, parent_allocno, *map;
-  rtx insn, original_reg;
+  rtx_insn *insn;
+  rtx original_reg;
   enum reg_class aclass, pclass;
   ira_loop_tree_node_t parent;
 
@@ -568,7 +578,7 @@ change_loop (ira_loop_tree_node_t node)
       if (node->bb != NULL)
 	{
 	  FOR_BB_INSNS (node->bb, insn)
-	    if (INSN_P (insn) && change_regs (&insn))
+	    if (INSN_P (insn) && change_regs_in_insn (&insn))
 	      {
 		df_insn_rescan (insn);
 		df_notes_rescan (insn);
diff --git a/gcc/ira.c b/gcc/ira.c
index f636e5c..a2c357a 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3319,7 +3319,7 @@ static int recorded_label_ref;
 static int
 update_equiv_regs (void)
 {
-  rtx insn;
+  rtx_insn *insn;
   basic_block bb;
   int loop_depth;
   bitmap cleared_regs;
@@ -3345,7 +3345,8 @@ update_equiv_regs (void)
   FOR_EACH_BB_FN (bb, cfun)
     FOR_BB_INSNS (bb, insn)
       if (NONDEBUG_INSN_P (insn))
-	for_each_rtx (&insn, set_paradoxical_subreg, (void *) pdx_subregs);
+	for_each_rtx_in_insn (&insn, 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)
@@ -3616,7 +3617,8 @@ update_equiv_regs (void)
 	  && ! contains_replace_regs (XEXP (dest, 0))
 	  && ! pdx_subregs[regno])
 	{
-	  rtx init_insn = XEXP (reg_equiv[regno].init_insns, 0);
+	  rtx_insn *init_insn =
+	    as_a <rtx_insn *> (XEXP (reg_equiv[regno].init_insns, 0));
 	  if (validate_equiv_mem (init_insn, src, dest)
 	      && ! memref_used_between_p (dest, init_insn, insn)
 	      /* Attaching a REG_EQUIV note will fail if INIT_INSN has
@@ -3737,7 +3739,7 @@ update_equiv_regs (void)
 		     INSN.  Update the flow information.  */
 		  else if (prev_nondebug_insn (insn) != equiv_insn)
 		    {
-		      rtx new_insn;
+		      rtx_insn *new_insn;
 
 		      new_insn = emit_insn_before (PATTERN (equiv_insn), insn);
 		      REG_NOTES (new_insn) = REG_NOTES (equiv_insn);
diff --git a/gcc/recog.c b/gcc/recog.c
index 40d66d7..fe71ab6 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -500,13 +500,13 @@ confirm_change_group (void)
       if (object)
 	{
 	  if (object != last_object && last_object && INSN_P (last_object))
-	    df_insn_rescan (last_object);
+	    df_insn_rescan (as_a <rtx_insn *> (last_object));
 	  last_object = object;
 	}
     }
 
   if (last_object && INSN_P (last_object))
-    df_insn_rescan (last_object);
+    df_insn_rescan (as_a <rtx_insn *> (last_object));
   num_changes = 0;
 }
 
@@ -3396,7 +3396,7 @@ static void
 peep2_update_life (basic_block bb, int match_len, rtx last, rtx prev)
 {
   int i = peep2_buf_position (peep2_current + match_len + 1);
-  rtx x;
+  rtx_insn *x;
   regset_head live;
 
   INIT_REG_SET (&live);
@@ -3405,7 +3405,7 @@ peep2_update_life (basic_block bb, int match_len, rtx last, rtx prev)
   gcc_assert (peep2_current_count >= match_len + 1);
   peep2_current_count -= match_len + 1;
 
-  x = last;
+  x = as_a <rtx_insn *> (last);
   do
     {
       if (INSN_P (x))
@@ -3461,7 +3461,7 @@ peep2_fill_buffer (basic_block bb, rtx insn, regset live)
   COPY_REG_SET (peep2_insn_data[pos].live_before, live);
   peep2_current_count++;
 
-  df_simulate_one_insn_forwards (bb, insn, live);
+  df_simulate_one_insn_forwards (bb, as_a <rtx_insn *> (insn), live);
   return true;
 }
 
diff --git a/gcc/rtl.h b/gcc/rtl.h
index b379512..331f9dc 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3158,7 +3158,7 @@ extern bool validate_subreg (enum machine_mode, enum machine_mode,
 
 /* In combine.c  */
 extern unsigned int extended_count (const_rtx, enum machine_mode, int);
-extern rtx remove_death (unsigned int, rtx);
+extern rtx remove_death (unsigned int, rtx_insn *);
 extern void dump_combine_stats (FILE *);
 extern void dump_combine_total_stats (FILE *);
 extern rtx make_compound_operation (rtx, enum rtx_code);
@@ -3222,7 +3222,7 @@ extern HOST_WIDE_INT find_args_size_adjust (rtx);
 extern int fixup_args_size_notes (rtx, rtx, int);
 
 /* In cfgrtl.c */
-extern void print_rtl_with_bb (FILE *, const_rtx, int);
+extern void print_rtl_with_bb (FILE *, const rtx_insn *, int);
 extern rtx_insn *duplicate_insn_chain (rtx_insn *, rtx_insn *);
 
 /* In expmed.c */
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 5eca287..2412436 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -2060,7 +2060,7 @@ remove_note (rtx insn, const_rtx note)
     {
     case REG_EQUAL:
     case REG_EQUIV:
-      df_notes_rescan (insn);
+      df_notes_rescan (as_a <rtx_insn *> (insn));
       break;
     default:
       break;
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index a3e9e46..2b0eb92 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -134,7 +134,7 @@ extern void sched_insns_finish (void);
 
 extern void *xrecalloc (void *, size_t, size_t, size_t);
 
-extern void reemit_notes (rtx);
+extern void reemit_notes (rtx_insn *);
 
 /* Functions in haifa-sched.c.  */
 extern int haifa_classify_insn (const_rtx);
diff --git a/gcc/valtrack.c b/gcc/valtrack.c
index 44001bf..aef38a5 100644
--- a/gcc/valtrack.c
+++ b/gcc/valtrack.c
@@ -177,10 +177,11 @@ propagate_for_debug_subst (rtx from, const_rtx old_rtx, void *data)
    of THIS_BASIC_BLOCK.  */
 
 void
-propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src,
+propagate_for_debug (rtx_insn *insn, rtx last, rtx dest, rtx src,
 		     basic_block this_basic_block)
 {
-  rtx next, loc, end = NEXT_INSN (BB_END (this_basic_block));
+  rtx_insn *next, *end = NEXT_INSN (BB_END (this_basic_block));
+  rtx loc;
   rtx (*saved_rtl_hook_no_emit) (enum machine_mode, rtx);
 
   struct rtx_subst_pair p;
diff --git a/gcc/valtrack.h b/gcc/valtrack.h
index 528eaad..60dcad5 100644
--- a/gcc/valtrack.h
+++ b/gcc/valtrack.h
@@ -149,7 +149,7 @@ extern int dead_debug_insert_temp (struct dead_debug_local *,
 				   unsigned int uregno, rtx insn,
 				   enum debug_temp_where);
 
-extern void propagate_for_debug (rtx, rtx, rtx, rtx, basic_block);
+extern void propagate_for_debug (rtx_insn *, rtx, rtx, rtx, basic_block);
 
 
 #endif /* GCC_VALTRACK_H */
diff --git a/rtx-classes-status.txt b/rtx-classes-status.txt
index 8d56d11..5667ae9 100644
--- a/rtx-classes-status.txt
+++ b/rtx-classes-status.txt
@@ -10,5 +10,4 @@ Phase 6: use extra rtx_def subclasses:             TODO
 
 TODO: "Scaffolding" to be removed
 =================================
-* DF_REF_INSN
 * SET_NEXT_INSN, SET_PREV_INSN
-- 
1.8.5.3

