From e663f6156cf099ae665a6dbee8237681a096db58 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Wed, 9 Jul 2014 16:40:12 -0400
Subject: [PATCH 128/236] config/avr: Use rtx_insn

gcc/
	* config/avr/avr-protos.h (output_movqi): Strengthen first param
	from rtx to rtx_insn *.
	(output_movhi): Likewise.
	(output_movsisf): Likewise.
	(avr_out_tstsi): Likewise.
	(avr_out_tsthi): Likewise.
	(avr_out_tstpsi): Likewise.
	(avr_out_compare): Likewise.
	(avr_out_compare64): Likewise.
	(avr_out_movpsi): Likewise.
	(ashlqi3_out): Likewise.
	(ashlhi3_out): Likewise.
	(ashlsi3_out): Likewise.
	(ashrqi3_out): Likewise.
	(ashrhi3_out): Likewise.
	(ashrsi3_out): Likewise.
	(lshrqi3_out): Likewise.
	(lshrhi3_out): Likewise.
	(lshrsi3_out): Likewise.
	(avr_out_ashlpsi3): Likewise.
	(avr_out_ashrpsi3): Likewise.
	(avr_out_lshrpsi3): Likewise.
	(avr_out_fract): Likewise.
	(avr_out_sbxx_branch): Likewise.
	(avr_out_round): Likewise.
	(avr_out_xload): Likewise.
	(avr_out_movmem): Likewise.
	(adjust_insn_length): Likewise.
	(avr_out_lpm): Likewise.
	(reg_unused_after): Likewise.
	(_reg_unused_after): Likewise.
	(avr_jump_mode): Likewise for second param.
	(jump_over_one_insn): Likewise for first param.
	(avr_final_prescan_insn): Likewise.
	(out_shift_with_cnt): Likewise for second param.

	* config/avr/avr.c (get_sequence_length): Likewise for param
	"insns" and local "insn".
	(emit_push_byte): Likewise for local "insn".
	(emit_push_sfr): Likewise.
	(avr_prologue_setup_frame): Likewise for locals "insn",
	"fp_plus_insns", "sp_plus_insns".
	(avr_expand_epilogue): Likewise for local "fp_plus_insns",
	"sp_plus_insns".
	(avr_jump_mode): Likewise for param "insn".
	(avr_final_prescan_insn): Likewise.
	(avr_find_unused_d_reg): Likewise.
	(avr_out_lpm_no_lpmx): Likewise.
	(avr_out_lpm): Likewise.
	(avr_out_xload): Likewise.
	(output_movqi): Likewise.
	(output_movhi): Likewise.
	(out_movqi_r_mr): Likewise.
	(out_movhi_r_mr): Likewise.
	(out_movsi_r_mr): Likewise.
	(out_movsi_mr_r): Likewise.
	(output_movsisf): Likewise.
	(avr_out_load_psi): Likewise.
	(avr_out_store_psi): Likewise.
	(avr_out_movpsi): Likewise.
	(out_movqi_mr_r): Likewise.
	(avr_out_movhi_mr_r_xmega): Likewise.
	(out_movhi_mr_r): Likewise.
	(compare_condition): Likewise for param "insn" and local "next".
	(compare_sign_p): Likewise for param "insn".
	(compare_diff_p): Likewise.
	(compare_eq_p): Likewise.
	(avr_out_compare): Likewise.
	(avr_out_compare64): Likewise.
	(avr_out_tsthi): Likewise.
	(avr_out_tstpsi): Likewise.
	(avr_out_tstsi): Likewise.
	(out_shift_with_cnt): Likewise.
	(ashlqi3_out): Likewise.
	(ashlhi3_out): Likewise.
	(avr_out_ashlpsi3): Likewise.
	(ashlsi3_out): Likewise.
	(ashrqi3_out): Likewise.
	(ashrhi3_out): Likewise.
	(avr_out_ashrpsi3): Likewise.
	(ashrsi3_out): Likewise.
	(lshrqi3_out): Likewise.
	(lshrhi3_out): Likewise.
	(avr_out_lshrpsi3): Likewise.
	(lshrsi3_out): Likewise.
	(avr_out_fract): Likewise.
	(avr_out_round): Likewise.
	(avr_adjust_insn_length): Likewise.
	(reg_unused_after): Likewise.
	(_reg_unused_after): Likewise.
	(avr_compare_pattern): Likewise.
	(avr_reorg_remove_redundant_compare): Likewise for param "insn1"
	and locals "branch1", "branch2", "insn2", "jump".
	(avr_reorg): Likewise for local "insn".
	(avr_2word_insn_p): Likewise for param "insn".
	(jump_over_one_insn_p): Likewise.
	(avr_out_sbxx_branch): Likewise.
	(avr_out_movmem): Likewise.
---
 gcc/config/avr/avr-protos.h |  69 ++++++++++----------
 gcc/config/avr/avr.c        | 153 +++++++++++++++++++++++---------------------
 2 files changed, 114 insertions(+), 108 deletions(-)

diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index c5ce784..9fa9324 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -45,36 +45,36 @@ extern void avr_init_cumulative_args (CUMULATIVE_ARGS*, tree, rtx, tree);
 
 #ifdef RTX_CODE
 extern int avr_hard_regno_call_part_clobbered (unsigned, enum machine_mode);
-extern const char *output_movqi (rtx insn, rtx operands[], int *l);
-extern const char *output_movhi (rtx insn, rtx operands[], int *l);
-extern const char *output_movsisf (rtx insn, rtx operands[], int *l);
-extern const char *avr_out_tstsi (rtx, rtx*, int*);
-extern const char *avr_out_tsthi (rtx, rtx*, int*);
-extern const char *avr_out_tstpsi (rtx, rtx*, int*);
-extern const char *avr_out_compare (rtx, rtx*, int*);
-extern const char *avr_out_compare64 (rtx, rtx*, int*);
+extern const char *output_movqi (rtx_insn *insn, rtx operands[], int *l);
+extern const char *output_movhi (rtx_insn *insn, rtx operands[], int *l);
+extern const char *output_movsisf (rtx_insn *insn, rtx operands[], int *l);
+extern const char *avr_out_tstsi (rtx_insn *, rtx*, int*);
+extern const char *avr_out_tsthi (rtx_insn *, rtx*, int*);
+extern const char *avr_out_tstpsi (rtx_insn *, rtx*, int*);
+extern const char *avr_out_compare (rtx_insn *, rtx*, int*);
+extern const char *avr_out_compare64 (rtx_insn *, rtx*, int*);
 extern const char *ret_cond_branch (rtx x, int len, int reverse);
-extern const char *avr_out_movpsi (rtx, rtx*, int*);
+extern const char *avr_out_movpsi (rtx_insn *, rtx*, int*);
 
-extern const char *ashlqi3_out (rtx insn, rtx operands[], int *len);
-extern const char *ashlhi3_out (rtx insn, rtx operands[], int *len);
-extern const char *ashlsi3_out (rtx insn, rtx operands[], int *len);
+extern const char *ashlqi3_out (rtx_insn *insn, rtx operands[], int *len);
+extern const char *ashlhi3_out (rtx_insn *insn, rtx operands[], int *len);
+extern const char *ashlsi3_out (rtx_insn *insn, rtx operands[], int *len);
 
-extern const char *ashrqi3_out (rtx insn, rtx operands[], int *len);
-extern const char *ashrhi3_out (rtx insn, rtx operands[], int *len);
-extern const char *ashrsi3_out (rtx insn, rtx operands[], int *len);
+extern const char *ashrqi3_out (rtx_insn *insn, rtx operands[], int *len);
+extern const char *ashrhi3_out (rtx_insn *insn, rtx operands[], int *len);
+extern const char *ashrsi3_out (rtx_insn *insn, rtx operands[], int *len);
 
-extern const char *lshrqi3_out (rtx insn, rtx operands[], int *len);
-extern const char *lshrhi3_out (rtx insn, rtx operands[], int *len);
-extern const char *lshrsi3_out (rtx insn, rtx operands[], int *len);
+extern const char *lshrqi3_out (rtx_insn *insn, rtx operands[], int *len);
+extern const char *lshrhi3_out (rtx_insn *insn, rtx operands[], int *len);
+extern const char *lshrsi3_out (rtx_insn *insn, rtx operands[], int *len);
 
-extern const char *avr_out_ashlpsi3 (rtx, rtx*, int*);
-extern const char *avr_out_ashrpsi3 (rtx, rtx*, int*);
-extern const char *avr_out_lshrpsi3 (rtx, rtx*, int*);
+extern const char *avr_out_ashlpsi3 (rtx_insn *, rtx*, int*);
+extern const char *avr_out_ashrpsi3 (rtx_insn *, rtx*, int*);
+extern const char *avr_out_lshrpsi3 (rtx_insn *, rtx*, int*);
 
 extern bool avr_rotate_bytes (rtx operands[]);
 
-extern const char* avr_out_fract (rtx, rtx[], bool, int*);
+extern const char* avr_out_fract (rtx_insn *, rtx[], bool, int*);
 extern rtx avr_to_int_mode (rtx);
 
 extern void avr_expand_prologue (void);
@@ -84,36 +84,37 @@ extern int avr_epilogue_uses (int regno);
 extern int avr_starting_frame_offset (void);
 
 extern void avr_output_addr_vec_elt (FILE *stream, int value);
-extern const char *avr_out_sbxx_branch (rtx insn, rtx operands[]);
+extern const char *avr_out_sbxx_branch (rtx_insn *insn, rtx operands[]);
 extern const char* avr_out_bitop (rtx, rtx*, int*);
 extern const char* avr_out_plus (rtx, rtx*, int* =NULL, int* =NULL, bool =true);
-extern const char* avr_out_round (rtx, rtx*, int* =NULL);
+extern const char* avr_out_round (rtx_insn *, rtx*, int* =NULL);
 extern const char* avr_out_addto_sp (rtx*, int*);
-extern const char* avr_out_xload (rtx, rtx*, int*);
-extern const char* avr_out_movmem (rtx, rtx*, int*);
+extern const char* avr_out_xload (rtx_insn *, rtx*, int*);
+extern const char* avr_out_movmem (rtx_insn *, rtx*, int*);
 extern const char* avr_out_insert_bits (rtx*, int*);
 extern bool avr_popcount_each_byte (rtx, int, int);
 extern bool avr_has_nibble_0xf (rtx);
 
 extern int extra_constraint_Q (rtx x);
-extern int avr_adjust_insn_length (rtx insn, int len);
+extern int avr_adjust_insn_length (rtx_insn *insn, int len);
 extern const char* output_reload_inhi (rtx*, rtx, int*);
 extern const char* output_reload_insisf (rtx*, rtx, int*);
 extern const char* avr_out_reload_inpsi (rtx*, rtx, int*);
-extern const char* avr_out_lpm (rtx, rtx*, int*);
+extern const char* avr_out_lpm (rtx_insn *, rtx*, int*);
 extern void avr_notice_update_cc (rtx body, rtx insn);
-extern int reg_unused_after (rtx insn, rtx reg);
-extern int _reg_unused_after (rtx insn, rtx reg);
-extern int avr_jump_mode (rtx x, rtx insn);
+extern int reg_unused_after (rtx_insn *insn, rtx reg);
+extern int _reg_unused_after (rtx_insn *insn, rtx reg);
+extern int avr_jump_mode (rtx x, rtx_insn *insn);
 extern int test_hard_reg_class (enum reg_class rclass, rtx x);
-extern int jump_over_one_insn_p (rtx insn, rtx dest);
+extern int jump_over_one_insn_p (rtx_insn *insn, rtx dest);
 
 extern int avr_hard_regno_mode_ok (int regno, enum machine_mode mode);
-extern void avr_final_prescan_insn (rtx insn, rtx *operand, int num_operands);
+extern void avr_final_prescan_insn (rtx_insn *insn, rtx *operand,
+				    int num_operands);
 extern int avr_simplify_comparison_p (enum machine_mode mode,
 				      RTX_CODE op, rtx x);
 extern RTX_CODE avr_normalize_condition (RTX_CODE condition);
-extern void out_shift_with_cnt (const char *templ, rtx insn,
+extern void out_shift_with_cnt (const char *templ, rtx_insn *insn,
 				rtx operands[], int *len, int t_len);
 extern enum reg_class avr_mode_code_base_reg_class (enum machine_mode, addr_space_t, RTX_CODE, RTX_CODE);
 extern bool avr_regno_mode_code_ok_for_base_p (int, enum machine_mode, addr_space_t, RTX_CODE, RTX_CODE);
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 2b6b487..bdc061c 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -123,14 +123,14 @@ static avr_addr_t avr_addr;
 
 /* Prototypes for local helper functions.  */
 
-static const char* out_movqi_r_mr (rtx, rtx[], int*);
-static const char* out_movhi_r_mr (rtx, rtx[], int*);
-static const char* out_movsi_r_mr (rtx, rtx[], int*);
-static const char* out_movqi_mr_r (rtx, rtx[], int*);
-static const char* out_movhi_mr_r (rtx, rtx[], int*);
-static const char* out_movsi_mr_r (rtx, rtx[], int*);
-
-static int get_sequence_length (rtx insns);
+static const char* out_movqi_r_mr (rtx_insn *, rtx[], int*);
+static const char* out_movhi_r_mr (rtx_insn *, rtx[], int*);
+static const char* out_movsi_r_mr (rtx_insn *, rtx[], int*);
+static const char* out_movqi_mr_r (rtx_insn *, rtx[], int*);
+static const char* out_movhi_mr_r (rtx_insn *, rtx[], int*);
+static const char* out_movsi_mr_r (rtx_insn *, rtx[], int*);
+
+static int get_sequence_length (rtx_insn *insns);
 static int sequent_regs_live (void);
 static const char *ptrreg_to_str (int);
 static const char *cond_string (enum rtx_code);
@@ -950,9 +950,9 @@ sequent_regs_live (void)
 /* Obtain the length sequence of insns.  */
 
 int
-get_sequence_length (rtx insns)
+get_sequence_length (rtx_insn *insns)
 {
-  rtx insn;
+  rtx_insn *insn;
   int length;
 
   for (insn = insns, length = 0; insn; insn = NEXT_INSN (insn))
@@ -977,7 +977,8 @@ avr_incoming_return_addr_rtx (void)
 static void
 emit_push_byte (unsigned regno, bool frame_related_p)
 {
-  rtx mem, reg, insn;
+  rtx mem, reg;
+  rtx_insn *insn;
 
   mem = gen_rtx_POST_DEC (HImode, stack_pointer_rtx);
   mem = gen_frame_mem (QImode, mem);
@@ -998,7 +999,7 @@ emit_push_byte (unsigned regno, bool frame_related_p)
 static void
 emit_push_sfr (rtx sfr, bool frame_related_p, bool clr_p)
 {
-  rtx insn;
+  rtx_insn *insn;
 
   gcc_assert (MEM_P (sfr));
 
@@ -1022,7 +1023,7 @@ emit_push_sfr (rtx sfr, bool frame_related_p, bool clr_p)
 static void
 avr_prologue_setup_frame (HOST_WIDE_INT size, HARD_REG_SET set)
 {
-  rtx insn;
+  rtx_insn *insn;
   bool isr_p = cfun->machine->is_interrupt || cfun->machine->is_signal;
   int live_seq = sequent_regs_live ();
 
@@ -1138,7 +1139,8 @@ avr_prologue_setup_frame (HOST_WIDE_INT size, HARD_REG_SET set)
 
           int irq_state = -1;
           HOST_WIDE_INT size_cfa = size, neg_size;
-          rtx fp_plus_insns, fp, my_fp;
+          rtx_insn *fp_plus_insns;
+          rtx fp, my_fp;
 
           gcc_assert (frame_pointer_needed
                       || !isr_p
@@ -1247,7 +1249,7 @@ avr_prologue_setup_frame (HOST_WIDE_INT size, HARD_REG_SET set)
 
           if (avr_sp_immediate_operand (gen_int_mode (-size, HImode), HImode))
             {
-              rtx sp_plus_insns;
+              rtx_insn *sp_plus_insns;
 
               start_sequence ();
 
@@ -1489,7 +1491,7 @@ avr_expand_epilogue (bool sibcall_p)
 
       int irq_state = -1;
       rtx fp, my_fp;
-      rtx fp_plus_insns;
+      rtx_insn *fp_plus_insns;
       HOST_WIDE_INT size_max;
 
       gcc_assert (frame_pointer_needed
@@ -1542,7 +1544,7 @@ avr_expand_epilogue (bool sibcall_p)
 
       if (avr_sp_immediate_operand (gen_int_mode (size, HImode), HImode))
         {
-          rtx sp_plus_insns;
+          rtx_insn *sp_plus_insns;
 
           start_sequence ();
 
@@ -2398,7 +2400,7 @@ avr_notice_update_cc (rtx body ATTRIBUTE_UNUSED, rtx insn)
    3 - absolute jump (only for ATmega[16]03).  */
 
 int
-avr_jump_mode (rtx x, rtx insn)
+avr_jump_mode (rtx x, rtx_insn *insn)
 {
   int dest_addr = INSN_ADDRESSES (INSN_UID (GET_CODE (x) == LABEL_REF
                                             ? XEXP (x, 0) : x));
@@ -2522,7 +2524,7 @@ ret_cond_branch (rtx x, int len, int reverse)
 /* Output insn cost for next insn.  */
 
 void
-avr_final_prescan_insn (rtx insn, rtx *operand ATTRIBUTE_UNUSED,
+avr_final_prescan_insn (rtx_insn *insn, rtx *operand ATTRIBUTE_UNUSED,
                         int num_operands ATTRIBUTE_UNUSED)
 {
   if (avr_log.rtx_costs)
@@ -2780,7 +2782,7 @@ avr_xload_libgcc_p (enum machine_mode mode)
    Return a QImode d-register or NULL_RTX if nothing found.  */
 
 static rtx
-avr_find_unused_d_reg (rtx insn, rtx exclude)
+avr_find_unused_d_reg (rtx_insn *insn, rtx exclude)
 {
   int regno;
   bool isr_p = (avr_interrupt_function_p (current_function_decl)
@@ -2826,7 +2828,7 @@ avr_find_unused_d_reg (rtx insn, rtx exclude)
    version of LPM instruction is available.  */
 
 static const char*
-avr_out_lpm_no_lpmx (rtx insn, rtx *xop, int *plen)
+avr_out_lpm_no_lpmx (rtx_insn *insn, rtx *xop, int *plen)
 {
   rtx dest = xop[0];
   rtx addr = xop[1];
@@ -2925,7 +2927,7 @@ avr_out_lpm_no_lpmx (rtx insn, rtx *xop, int *plen)
    Return "".  */
 
 const char*
-avr_out_lpm (rtx insn, rtx *op, int *plen)
+avr_out_lpm (rtx_insn *insn, rtx *op, int *plen)
 {
   rtx xop[7];
   rtx dest = op[0];
@@ -3096,7 +3098,7 @@ avr_out_lpm (rtx insn, rtx *op, int *plen)
 /* Worker function for xload_8 insn.  */
 
 const char*
-avr_out_xload (rtx insn ATTRIBUTE_UNUSED, rtx *op, int *plen)
+avr_out_xload (rtx_insn *insn ATTRIBUTE_UNUSED, rtx *op, int *plen)
 {
   rtx xop[4];
 
@@ -3118,7 +3120,7 @@ avr_out_xload (rtx insn ATTRIBUTE_UNUSED, rtx *op, int *plen)
 
 
 const char*
-output_movqi (rtx insn, rtx operands[], int *plen)
+output_movqi (rtx_insn *insn, rtx operands[], int *plen)
 {
   rtx dest = operands[0];
   rtx src = operands[1];
@@ -3165,7 +3167,7 @@ output_movqi (rtx insn, rtx operands[], int *plen)
 
 
 const char *
-output_movhi (rtx insn, rtx xop[], int *plen)
+output_movhi (rtx_insn *insn, rtx xop[], int *plen)
 {
   rtx dest = xop[0];
   rtx src = xop[1];
@@ -3245,7 +3247,7 @@ output_movhi (rtx insn, rtx xop[], int *plen)
 }
 
 static const char*
-out_movqi_r_mr (rtx insn, rtx op[], int *plen)
+out_movqi_r_mr (rtx_insn *insn, rtx op[], int *plen)
 {
   rtx dest = op[0];
   rtx src = op[1];
@@ -3305,7 +3307,7 @@ out_movqi_r_mr (rtx insn, rtx op[], int *plen)
 }
 
 static const char*
-out_movhi_r_mr (rtx insn, rtx op[], int *plen)
+out_movhi_r_mr (rtx_insn *insn, rtx op[], int *plen)
 {
   rtx dest = op[0];
   rtx src = op[1];
@@ -3425,7 +3427,7 @@ out_movhi_r_mr (rtx insn, rtx op[], int *plen)
 }
 
 static const char*
-out_movsi_r_mr (rtx insn, rtx op[], int *l)
+out_movsi_r_mr (rtx_insn *insn, rtx op[], int *l)
 {
   rtx dest = op[0];
   rtx src = op[1];
@@ -3586,7 +3588,7 @@ out_movsi_r_mr (rtx insn, rtx op[], int *l)
 }
 
 static const char*
-out_movsi_mr_r (rtx insn, rtx op[], int *l)
+out_movsi_mr_r (rtx_insn *insn, rtx op[], int *l)
 {
   rtx dest = op[0];
   rtx src = op[1];
@@ -3741,7 +3743,7 @@ out_movsi_mr_r (rtx insn, rtx op[], int *l)
 }
 
 const char *
-output_movsisf (rtx insn, rtx operands[], int *l)
+output_movsisf (rtx_insn *insn, rtx operands[], int *l)
 {
   int dummy;
   rtx dest = operands[0];
@@ -3821,7 +3823,7 @@ output_movsisf (rtx insn, rtx operands[], int *l)
 /* Handle loads of 24-bit types from memory to register.  */
 
 static const char*
-avr_out_load_psi (rtx insn, rtx *op, int *plen)
+avr_out_load_psi (rtx_insn *insn, rtx *op, int *plen)
 {
   rtx dest = op[0];
   rtx src = op[1];
@@ -3952,7 +3954,7 @@ avr_out_load_psi (rtx insn, rtx *op, int *plen)
 /* Handle store of 24-bit type from register or zero to memory.  */
 
 static const char*
-avr_out_store_psi (rtx insn, rtx *op, int *plen)
+avr_out_store_psi (rtx_insn *insn, rtx *op, int *plen)
 {
   rtx dest = op[0];
   rtx src = op[1];
@@ -4046,7 +4048,7 @@ avr_out_store_psi (rtx insn, rtx *op, int *plen)
 /* Move around 24-bit stuff.  */
 
 const char *
-avr_out_movpsi (rtx insn, rtx *op, int *plen)
+avr_out_movpsi (rtx_insn *insn, rtx *op, int *plen)
 {
   rtx dest = op[0];
   rtx src = op[1];
@@ -4105,7 +4107,7 @@ avr_out_movpsi (rtx insn, rtx *op, int *plen)
 
 
 static const char*
-out_movqi_mr_r (rtx insn, rtx op[], int *plen)
+out_movqi_mr_r (rtx_insn *insn, rtx op[], int *plen)
 {
   rtx dest = op[0];
   rtx src = op[1];
@@ -4172,7 +4174,7 @@ out_movqi_mr_r (rtx insn, rtx op[], int *plen)
    but with low byte first.  */
 
 static const char*
-avr_out_movhi_mr_r_xmega (rtx insn, rtx op[], int *plen)
+avr_out_movhi_mr_r_xmega (rtx_insn *insn, rtx op[], int *plen)
 {
   rtx dest = op[0];
   rtx src = op[1];
@@ -4281,7 +4283,7 @@ avr_out_movhi_mr_r_xmega (rtx insn, rtx op[], int *plen)
 
 
 static const char*
-out_movhi_mr_r (rtx insn, rtx op[], int *plen)
+out_movhi_mr_r (rtx_insn *insn, rtx op[], int *plen)
 {
   rtx dest = op[0];
   rtx src = op[1];
@@ -4415,9 +4417,9 @@ avr_frame_pointer_required_p (void)
 /* Returns the condition of compare insn INSN, or UNKNOWN.  */
 
 static RTX_CODE
-compare_condition (rtx insn)
+compare_condition (rtx_insn *insn)
 {
-  rtx next = next_real_insn (insn);
+  rtx_insn *next = next_real_insn (insn);
 
   if (next && JUMP_P (next))
     {
@@ -4435,7 +4437,7 @@ compare_condition (rtx insn)
 /* Returns true iff INSN is a tst insn that only tests the sign.  */
 
 static bool
-compare_sign_p (rtx insn)
+compare_sign_p (rtx_insn *insn)
 {
   RTX_CODE cond = compare_condition (insn);
   return (cond == GE || cond == LT);
@@ -4446,7 +4448,7 @@ compare_sign_p (rtx insn)
    that needs to be swapped (GT, GTU, LE, LEU).  */
 
 static bool
-compare_diff_p (rtx insn)
+compare_diff_p (rtx_insn *insn)
 {
   RTX_CODE cond = compare_condition (insn);
   return (cond == GT || cond == GTU || cond == LE || cond == LEU) ? cond : 0;
@@ -4455,7 +4457,7 @@ compare_diff_p (rtx insn)
 /* Returns true iff INSN is a compare insn with the EQ or NE condition.  */
 
 static bool
-compare_eq_p (rtx insn)
+compare_eq_p (rtx_insn *insn)
 {
   RTX_CODE cond = compare_condition (insn);
   return (cond == EQ || cond == NE);
@@ -4474,7 +4476,7 @@ compare_eq_p (rtx insn)
                   Don't output anything.  */
 
 const char*
-avr_out_compare (rtx insn, rtx *xop, int *plen)
+avr_out_compare (rtx_insn *insn, rtx *xop, int *plen)
 {
   /* Register to compare and value to compare against. */
   rtx xreg = xop[0];
@@ -4631,7 +4633,7 @@ avr_out_compare (rtx insn, rtx *xop, int *plen)
 /* Prepare operands of compare_const_di2 to be used with avr_out_compare.  */
 
 const char*
-avr_out_compare64 (rtx insn, rtx *op, int *plen)
+avr_out_compare64 (rtx_insn *insn, rtx *op, int *plen)
 {
   rtx xop[3];
 
@@ -4645,7 +4647,7 @@ avr_out_compare64 (rtx insn, rtx *op, int *plen)
 /* Output test instruction for HImode.  */
 
 const char*
-avr_out_tsthi (rtx insn, rtx *op, int *plen)
+avr_out_tsthi (rtx_insn *insn, rtx *op, int *plen)
 {
   if (compare_sign_p (insn))
     {
@@ -4669,7 +4671,7 @@ avr_out_tsthi (rtx insn, rtx *op, int *plen)
 /* Output test instruction for PSImode.  */
 
 const char*
-avr_out_tstpsi (rtx insn, rtx *op, int *plen)
+avr_out_tstpsi (rtx_insn *insn, rtx *op, int *plen)
 {
   if (compare_sign_p (insn))
     {
@@ -4694,7 +4696,7 @@ avr_out_tstpsi (rtx insn, rtx *op, int *plen)
 /* Output test instruction for SImode.  */
 
 const char*
-avr_out_tstsi (rtx insn, rtx *op, int *plen)
+avr_out_tstsi (rtx_insn *insn, rtx *op, int *plen)
 {
   if (compare_sign_p (insn))
     {
@@ -4729,7 +4731,7 @@ avr_out_tstsi (rtx insn, rtx *op, int *plen)
    T_LEN is the length of this template.  */
 
 void
-out_shift_with_cnt (const char *templ, rtx insn, rtx operands[],
+out_shift_with_cnt (const char *templ, rtx_insn *insn, rtx operands[],
 		    int *plen, int t_len)
 {
   bool second_label = true;
@@ -4843,7 +4845,7 @@ out_shift_with_cnt (const char *templ, rtx insn, rtx operands[],
 /* 8bit shift left ((char)x << i)   */
 
 const char *
-ashlqi3_out (rtx insn, rtx operands[], int *len)
+ashlqi3_out (rtx_insn *insn, rtx operands[], int *len)
 {
   if (GET_CODE (operands[2]) == CONST_INT)
     {
@@ -4940,7 +4942,7 @@ ashlqi3_out (rtx insn, rtx operands[], int *len)
 /* 16bit shift left ((short)x << i)   */
 
 const char *
-ashlhi3_out (rtx insn, rtx operands[], int *len)
+ashlhi3_out (rtx_insn *insn, rtx operands[], int *len)
 {
   if (GET_CODE (operands[2]) == CONST_INT)
     {
@@ -5197,7 +5199,7 @@ ashlhi3_out (rtx insn, rtx operands[], int *len)
 /* 24-bit shift left */
 
 const char*
-avr_out_ashlpsi3 (rtx insn, rtx *op, int *plen)
+avr_out_ashlpsi3 (rtx_insn *insn, rtx *op, int *plen)
 {
   if (plen)
     *plen = 0;
@@ -5260,7 +5262,7 @@ avr_out_ashlpsi3 (rtx insn, rtx *op, int *plen)
 /* 32bit shift left ((long)x << i)   */
 
 const char *
-ashlsi3_out (rtx insn, rtx operands[], int *len)
+ashlsi3_out (rtx_insn *insn, rtx operands[], int *len)
 {
   if (GET_CODE (operands[2]) == CONST_INT)
     {
@@ -5349,7 +5351,7 @@ ashlsi3_out (rtx insn, rtx operands[], int *len)
 /* 8bit arithmetic shift right  ((signed char)x >> i) */
 
 const char *
-ashrqi3_out (rtx insn, rtx operands[], int *len)
+ashrqi3_out (rtx_insn *insn, rtx operands[], int *len)
 {
   if (GET_CODE (operands[2]) == CONST_INT)
     {
@@ -5421,7 +5423,7 @@ ashrqi3_out (rtx insn, rtx operands[], int *len)
 /* 16bit arithmetic shift right  ((signed short)x >> i) */
 
 const char *
-ashrhi3_out (rtx insn, rtx operands[], int *len)
+ashrhi3_out (rtx_insn *insn, rtx operands[], int *len)
 {
   if (GET_CODE (operands[2]) == CONST_INT)
     {
@@ -5584,7 +5586,7 @@ ashrhi3_out (rtx insn, rtx operands[], int *len)
 /* 24-bit arithmetic shift right */
 
 const char*
-avr_out_ashrpsi3 (rtx insn, rtx *op, int *plen)
+avr_out_ashrpsi3 (rtx_insn *insn, rtx *op, int *plen)
 {
   int dest = REGNO (op[0]);
   int src = REGNO (op[1]);
@@ -5643,7 +5645,7 @@ avr_out_ashrpsi3 (rtx insn, rtx *op, int *plen)
 /* 32-bit arithmetic shift right  ((signed long)x >> i) */
 
 const char *
-ashrsi3_out (rtx insn, rtx operands[], int *len)
+ashrsi3_out (rtx_insn *insn, rtx operands[], int *len)
 {
   if (GET_CODE (operands[2]) == CONST_INT)
     {
@@ -5740,7 +5742,7 @@ ashrsi3_out (rtx insn, rtx operands[], int *len)
 /* 8-bit logic shift right ((unsigned char)x >> i) */
 
 const char *
-lshrqi3_out (rtx insn, rtx operands[], int *len)
+lshrqi3_out (rtx_insn *insn, rtx operands[], int *len)
 {
   if (GET_CODE (operands[2]) == CONST_INT)
     {
@@ -5835,7 +5837,7 @@ lshrqi3_out (rtx insn, rtx operands[], int *len)
 /* 16-bit logic shift right ((unsigned short)x >> i) */
 
 const char *
-lshrhi3_out (rtx insn, rtx operands[], int *len)
+lshrhi3_out (rtx_insn *insn, rtx operands[], int *len)
 {
   if (GET_CODE (operands[2]) == CONST_INT)
     {
@@ -6092,7 +6094,7 @@ lshrhi3_out (rtx insn, rtx operands[], int *len)
 /* 24-bit logic shift right */
 
 const char*
-avr_out_lshrpsi3 (rtx insn, rtx *op, int *plen)
+avr_out_lshrpsi3 (rtx_insn *insn, rtx *op, int *plen)
 {
   int dest = REGNO (op[0]);
   int src = REGNO (op[1]);
@@ -6146,7 +6148,7 @@ avr_out_lshrpsi3 (rtx insn, rtx *op, int *plen)
 /* 32-bit logic shift right ((unsigned int)x >> i) */
 
 const char *
-lshrsi3_out (rtx insn, rtx operands[], int *len)
+lshrsi3_out (rtx_insn *insn, rtx operands[], int *len)
 {
   if (GET_CODE (operands[2]) == CONST_INT)
     {
@@ -7050,7 +7052,7 @@ avr_out_addto_sp (rtx *op, int *plen)
    is stored in either the carry or T bit.  */
 
 const char*
-avr_out_fract (rtx insn, rtx operands[], bool intsigned, int *plen)
+avr_out_fract (rtx_insn *insn, rtx operands[], bool intsigned, int *plen)
 {
   size_t i;
   rtx xop[6];
@@ -7566,7 +7568,7 @@ avr_out_fract (rtx insn, rtx operands[], bool intsigned, int *plen)
    preparing operands for calls to `avr_out_plus' and `avr_out_bitop'.  */
 
 const char*
-avr_out_round (rtx insn ATTRIBUTE_UNUSED, rtx *xop, int *plen)
+avr_out_round (rtx_insn *insn ATTRIBUTE_UNUSED, rtx *xop, int *plen)
 {
   enum machine_mode mode = GET_MODE (xop[0]);
   enum machine_mode imode = int_mode_for_mode (mode);
@@ -7776,7 +7778,7 @@ avr_rotate_bytes (rtx operands[])
    LEN is the initially computed length of the insn.  */
 
 int
-avr_adjust_insn_length (rtx insn, int len)
+avr_adjust_insn_length (rtx_insn *insn, int len)
 {
   rtx *op = recog_data.operand;
   enum attr_adjust_len adjust_len;
@@ -7868,7 +7870,7 @@ avr_adjust_insn_length (rtx insn, int len)
 /* Return nonzero if register REG dead after INSN.  */
 
 int
-reg_unused_after (rtx insn, rtx reg)
+reg_unused_after (rtx_insn *insn, rtx reg)
 {
   return (dead_or_set_p (insn, reg)
 	  || (REG_P(reg) && _reg_unused_after (insn, reg)));
@@ -7879,7 +7881,7 @@ reg_unused_after (rtx insn, rtx reg)
    not live past labels.  It may live past calls or jumps though.  */
 
 int
-_reg_unused_after (rtx insn, rtx reg)
+_reg_unused_after (rtx_insn *insn, rtx reg)
 {
   enum rtx_code code;
   rtx set;
@@ -9788,7 +9790,7 @@ avr_normalize_condition (RTX_CODE condition)
 /* Helper function for `avr_reorg'.  */
 
 static rtx
-avr_compare_pattern (rtx insn)
+avr_compare_pattern (rtx_insn *insn)
 {
   rtx pattern = single_set (insn);
 
@@ -9844,12 +9846,15 @@ avr_compare_pattern (rtx insn)
    basic blocks.  */
 
 static bool
-avr_reorg_remove_redundant_compare (rtx insn1)
+avr_reorg_remove_redundant_compare (rtx_insn *insn1)
 {
-  rtx comp1, ifelse1, xcond1, branch1;
-  rtx comp2, ifelse2, xcond2, branch2, insn2;
+  rtx comp1, ifelse1, xcond1;
+  rtx_insn *branch1;
+  rtx comp2, ifelse2, xcond2;
+  rtx_insn *branch2, *insn2;
   enum rtx_code code;
-  rtx jump, target, cond;
+  rtx_insn *jump;
+  rtx target, cond;
 
   /* Look out for:  compare1 - branch1 - compare2 - branch2  */
 
@@ -9987,7 +9992,7 @@ avr_reorg_remove_redundant_compare (rtx insn1)
 static void
 avr_reorg (void)
 {
-  rtx insn = get_insns();
+  rtx_insn *insn = get_insns();
 
   for (insn = next_real_insn (insn); insn; insn = next_real_insn (insn))
     {
@@ -10133,7 +10138,7 @@ test_hard_reg_class (enum reg_class rclass, rtx x)
    and thus is suitable to be skipped by CPSE, SBRC, etc.  */
 
 static bool
-avr_2word_insn_p (rtx insn)
+avr_2word_insn_p (rtx_insn *insn)
 {
   if ((avr_current_device->dev_attribute & AVR_ERRATA_SKIP)
       || !insn
@@ -10179,7 +10184,7 @@ avr_2word_insn_p (rtx insn)
 
 
 int
-jump_over_one_insn_p (rtx insn, rtx dest)
+jump_over_one_insn_p (rtx_insn *insn, rtx dest)
 {
   int uid = INSN_UID (GET_CODE (dest) == LABEL_REF
 		      ? XEXP (dest, 0)
@@ -10733,7 +10738,7 @@ avr_hard_regno_rename_ok (unsigned int old_reg,
    Operand 3: label to jump to if the test is true.  */
 
 const char*
-avr_out_sbxx_branch (rtx insn, rtx operands[])
+avr_out_sbxx_branch (rtx_insn *insn, rtx operands[])
 {
   enum rtx_code comp = GET_CODE (operands[0]);
   bool long_jump = get_attr_length (insn) >= 4;
@@ -11241,7 +11246,7 @@ avr_emit_movmemhi (rtx *xop)
 */
 
 const char*
-avr_out_movmem (rtx insn ATTRIBUTE_UNUSED, rtx *op, int *plen)
+avr_out_movmem (rtx_insn *insn ATTRIBUTE_UNUSED, rtx *op, int *plen)
 {
   addr_space_t as = (addr_space_t) INTVAL (op[0]);
   enum machine_mode loop_mode = GET_MODE (op[1]);
-- 
1.8.5.3

