From 4a195d986463fa9114f3752712dee500af1cdf23 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Thu, 3 Jul 2014 10:45:38 -0400
Subject: [PATCH 187/249] cselib and incdec

gcc/
	* rtl.h (for_each_inc_dec): Strengthen param 1 from rtx * to
	rtx_insn **.
	(check_for_inc_dec): Strengthen param "insn" from rtx to
	rtx_insn *.

	* cselib.h (cselib_process_insn): Likewise.

	* cselib.c (cselib_record_sets): Likewise.
	(cselib_process_insn): Likewise.

	* dse.c (struct insn_info): Likewise for field "insn".
	(check_for_inc_dec_1): Likewise for local "insn".
	(check_for_inc_dec): Likewise for param "insn".
	(scan_insn): Likewise.
	(dse_step1): Likewise for local "insn".

	* rtlanal.c (for_each_inc_dec): Strengthen param 1 from rtx * to
	rtx_insn **.  Use for_each_rtx_in_insn rather than for_each_rtx.
---
 gcc/cselib.c  |  6 +++---
 gcc/cselib.h  |  2 +-
 gcc/dse.c     | 10 +++++-----
 gcc/rtl.h     |  4 ++--
 gcc/rtlanal.c |  6 +++---
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/gcc/cselib.c b/gcc/cselib.c
index 00a04ba..c453904 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -67,7 +67,7 @@ static cselib_val *cselib_lookup_mem (rtx, int);
 static void cselib_invalidate_regno (unsigned int, enum machine_mode);
 static void cselib_invalidate_mem (rtx);
 static void cselib_record_set (rtx, cselib_val *, cselib_val *);
-static void cselib_record_sets (rtx);
+static void cselib_record_sets (rtx_insn *);
 
 struct expand_value_data
 {
@@ -2468,7 +2468,7 @@ cselib_record_autoinc_cb (rtx mem ATTRIBUTE_UNUSED, rtx op ATTRIBUTE_UNUSED,
 
 /* Record the effects of any sets and autoincs in INSN.  */
 static void
-cselib_record_sets (rtx insn)
+cselib_record_sets (rtx_insn *insn)
 {
   int n_sets = 0;
   int i;
@@ -2626,7 +2626,7 @@ fp_setter_insn (rtx insn)
 /* Record the effects of INSN.  */
 
 void
-cselib_process_insn (rtx insn)
+cselib_process_insn (rtx_insn *insn)
 {
   int i;
   rtx x;
diff --git a/gcc/cselib.h b/gcc/cselib.h
index 785f3b6..62374c0 100644
--- a/gcc/cselib.h
+++ b/gcc/cselib.h
@@ -75,7 +75,7 @@ extern cselib_val *cselib_lookup_from_insn (rtx, enum machine_mode,
 extern void cselib_init (int);
 extern void cselib_clear_table (void);
 extern void cselib_finish (void);
-extern void cselib_process_insn (rtx);
+extern void cselib_process_insn (rtx_insn *);
 extern bool fp_setter_insn (rtx);
 extern enum machine_mode cselib_reg_set_mode (const_rtx);
 extern int rtx_equal_for_cselib_p (rtx, rtx);
diff --git a/gcc/dse.c b/gcc/dse.c
index 167920c..0dc6b22 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_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.
@@ -904,7 +904,7 @@ emit_inc_dec_insn_before (rtx mem ATTRIBUTE_UNUSED,
 static bool
 check_for_inc_dec_1 (insn_info_t insn_info)
 {
-  rtx insn = insn_info->insn;
+  rtx_insn *insn = insn_info->insn;
   rtx note = find_reg_note (insn, REG_INC, NULL_RTX);
   if (note)
     return for_each_inc_dec (&insn, emit_inc_dec_insn_before, insn_info) == 0;
@@ -917,7 +917,7 @@ check_for_inc_dec_1 (insn_info_t insn_info)
    and add a parameter to this function so that it can be passed down in
    insn_info.fixed_regs_live.  */
 bool
-check_for_inc_dec (rtx insn)
+check_for_inc_dec (rtx_insn *insn)
 {
   struct insn_info insn_info;
   rtx note;
@@ -2444,7 +2444,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_insn *insn)
 {
   rtx body;
   insn_info_t insn_info = (insn_info_t) pool_alloc (insn_info_pool);
@@ -2710,7 +2710,7 @@ dse_step1 (void)
 
       if (bb->index >= NUM_FIXED_BLOCKS)
 	{
-	  rtx insn;
+	  rtx_insn *insn;
 
 	  cse_store_info_pool
 	    = create_alloc_pool ("cse_store_info_pool",
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 1b06430..11cbd45 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2624,7 +2624,7 @@ extern int for_each_rtx_in_insn (rtx_insn **, rtx_function, void *);
    for_each_inc_dec.  */
 typedef int (*for_each_inc_dec_fn) (rtx mem, rtx op, rtx dest, rtx src,
 				    rtx srcoff, void *arg);
-extern int for_each_inc_dec (rtx *, for_each_inc_dec_fn, void *arg);
+extern int for_each_inc_dec (rtx_insn **, for_each_inc_dec_fn, void *arg);
 
 typedef int (*rtx_equal_p_callback_function) (const_rtx *, const_rtx *,
                                               rtx *, rtx *);
@@ -3029,7 +3029,7 @@ extern int exp_equiv_p (const_rtx, const_rtx, int, bool);
 extern unsigned hash_rtx (const_rtx x, enum machine_mode, int *, int *, bool);
 
 /* In dse.c */
-extern bool check_for_inc_dec (rtx insn);
+extern bool check_for_inc_dec (rtx_insn *insn);
 
 /* In jump.c */
 extern int comparison_dominates_p (enum rtx_code, enum rtx_code);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 9481d52..5c5e643 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -3120,7 +3120,7 @@ for_each_inc_dec_find_mem (rtx *r, void *d)
   return 0;
 }
 
-/* Traverse *X looking for MEMs, and for autoinc operations within
+/* Traverse *INSN looking for MEMs, and for autoinc operations within
    them.  For each such autoinc operation found, call FN, passing it
    the innermost enclosing MEM, the operation itself, the RTX modified
    by the operation, two RTXs (the second may be NULL) that, once
@@ -3131,7 +3131,7 @@ for_each_inc_dec_find_mem (rtx *r, void *d)
    for_each_inc_dec.  */
 
 int
-for_each_inc_dec (rtx *x,
+for_each_inc_dec (rtx_insn **insn,
 		  for_each_inc_dec_fn fn,
 		  void *arg)
 {
@@ -3141,7 +3141,7 @@ for_each_inc_dec (rtx *x,
   data.arg = arg;
   data.mem = NULL;
 
-  return for_each_rtx (x, for_each_inc_dec_find_mem, &data);
+  return for_each_rtx_in_insn (insn, for_each_inc_dec_find_mem, &data);
 }
 
 
-- 
1.8.5.3

