More rtx to rtx_insn * cleanups

Message ID 1529007055-20298-1-git-send-email-dmalcolm@redhat.com
State New
Headers show
Series
  • More rtx to rtx_insn * cleanups
Related show

Commit Message

David Malcolm June 14, 2018, 8:10 p.m.
These are mostly pre-approved, but there are some slightly non-trivial
cases in frv.c and mips.c.

Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.

Successfully built "cc1" binaries on all 197 configurations in
contrib/config-list.mk.

OK for trunk?

gcc/ChangeLog:
	* config/frv/frv-protos.h (frv_ifcvt_modify_insn): Strengthen 3rd
	param from rtx to rtx_insn *.
	* config/frv/frv.c (frv_ifcvt_add_insn): Likewise for "insn"
	param.
	(frv_ifcvt_modify_insn): Likwise.
	(frv_ifcvt_modify_final): Likwise for local "existing_insn",
	adding an as_a <rtx_insn *> cast.  Likewise for local "insn".
	* config/mips/mips.c (r10k_insert_cache_barriers): Add an
	as_a <rtx_insn *> cast to local "unprotected_region" once
	it's been established that it's not NULL or pc_rtx.
	* config/nds32/nds32-relax-opt.c (nds32_group_insns): Strengthen
	param "sethi" from rtx to rtx_insn *.
	(nds32_group_float_insns): Likewise for param "insn".
	* config/vax/vax-protos.h (vax_output_int_add): Likewise for 1st
	param.
	(vax_output_int_subtract): Likewise.
	* config/vax/vax.c (vax_output_int_add): Likewise for param
	"insn".
	(vax_output_int_subtract): Likewise.
	* emit-rtl.c (set_insn_deleted): Likewise, removing cast.
	(emit_pattern_after): Likewise for param "after".
	(emit_insn_after): Likewise.
	(emit_jump_insn_after): Likewise.
	(emit_call_insn_after): Likewise.
	(emit_debug_insn_after): Likewise.
	(emit_pattern_before): Likewise for param "before".
	(emit_insn_before): Likewise.
	(emit_jump_insn_before): Likewise.
	* final.c (get_insn_template): Likewise for param "insn", removing
	a cast.
	* output.h (get_insn_template): Likewise for 2nd param.
	* rtl.h (emit_insn_before): Likewise.
	(emit_jump_insn_before): Likewise.
	(emit_debug_insn_before_noloc): Likewise.
	(emit_insn_after): Likewise.
	(emit_jump_insn_after): Likewise.
	(emit_call_insn_after): Likewise.
	(emit_debug_insn_after): Likewise.
	(set_insn_deleted): Likewise for param.
---
 gcc/config/frv/frv-protos.h        |  2 +-
 gcc/config/frv/frv.c               | 12 ++++++------
 gcc/config/mips/mips.c             |  2 +-
 gcc/config/nds32/nds32-relax-opt.c |  4 ++--
 gcc/config/vax/vax-protos.h        |  4 ++--
 gcc/config/vax/vax.c               |  4 ++--
 gcc/emit-rtl.c                     | 22 ++++++++++------------
 gcc/final.c                        |  5 ++---
 gcc/output.h                       |  2 +-
 gcc/rtl.h                          | 16 ++++++++--------
 10 files changed, 35 insertions(+), 38 deletions(-)

-- 
1.8.5.3

Comments

Jeff Law June 18, 2018, 3:46 p.m. | #1
On 06/14/2018 02:10 PM, David Malcolm wrote:
> These are mostly pre-approved, but there are some slightly non-trivial

> cases in frv.c and mips.c.

They looked pretty trivial to me :-)

> 

> Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.

> 

> Successfully built "cc1" binaries on all 197 configurations in

> contrib/config-list.mk.

> 

> OK for trunk?

> 

> gcc/ChangeLog:

> 	* config/frv/frv-protos.h (frv_ifcvt_modify_insn): Strengthen 3rd

> 	param from rtx to rtx_insn *.

> 	* config/frv/frv.c (frv_ifcvt_add_insn): Likewise for "insn"

> 	param.

> 	(frv_ifcvt_modify_insn): Likwise.

> 	(frv_ifcvt_modify_final): Likwise for local "existing_insn",

> 	adding an as_a <rtx_insn *> cast.  Likewise for local "insn".

> 	* config/mips/mips.c (r10k_insert_cache_barriers): Add an

> 	as_a <rtx_insn *> cast to local "unprotected_region" once

> 	it's been established that it's not NULL or pc_rtx.

> 	* config/nds32/nds32-relax-opt.c (nds32_group_insns): Strengthen

> 	param "sethi" from rtx to rtx_insn *.

> 	(nds32_group_float_insns): Likewise for param "insn".

> 	* config/vax/vax-protos.h (vax_output_int_add): Likewise for 1st

> 	param.

> 	(vax_output_int_subtract): Likewise.

> 	* config/vax/vax.c (vax_output_int_add): Likewise for param

> 	"insn".

> 	(vax_output_int_subtract): Likewise.

> 	* emit-rtl.c (set_insn_deleted): Likewise, removing cast.

> 	(emit_pattern_after): Likewise for param "after".

> 	(emit_insn_after): Likewise.

> 	(emit_jump_insn_after): Likewise.

> 	(emit_call_insn_after): Likewise.

> 	(emit_debug_insn_after): Likewise.

> 	(emit_pattern_before): Likewise for param "before".

> 	(emit_insn_before): Likewise.

> 	(emit_jump_insn_before): Likewise.

> 	* final.c (get_insn_template): Likewise for param "insn", removing

> 	a cast.

> 	* output.h (get_insn_template): Likewise for 2nd param.

> 	* rtl.h (emit_insn_before): Likewise.

> 	(emit_jump_insn_before): Likewise.

> 	(emit_debug_insn_before_noloc): Likewise.

> 	(emit_insn_after): Likewise.

> 	(emit_jump_insn_after): Likewise.

> 	(emit_call_insn_after): Likewise.

> 	(emit_debug_insn_after): Likewise.

> 	(set_insn_deleted): Likewise for param.

OK.  Note the tester doesn't test the vax port.  It will test nds32-elf
(big and little endian), mips and frv though.

jeff

Patch

diff --git a/gcc/config/frv/frv-protos.h b/gcc/config/frv/frv-protos.h
index 7a83569..67c4b09 100644
--- a/gcc/config/frv/frv-protos.h
+++ b/gcc/config/frv/frv-protos.h
@@ -67,7 +67,7 @@  extern void frv_ifcvt_modify_tests	(struct ce_if_block *, rtx *, rtx *);
 extern void frv_ifcvt_modify_multiple_tests
 					(struct ce_if_block *, basic_block,
 					 rtx *, rtx *);
-extern rtx frv_ifcvt_modify_insn	(struct ce_if_block *, rtx, rtx);
+extern rtx frv_ifcvt_modify_insn	(struct ce_if_block *, rtx, rtx_insn *);
 extern void frv_ifcvt_modify_final	(struct ce_if_block *);
 extern void frv_ifcvt_modify_cancel	(struct ce_if_block *);
 #endif
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index 56027bd..78f1a80 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -318,7 +318,7 @@  static rtx frv_expand_mwtacc_builtin		(enum insn_code, tree);
 static rtx frv_expand_noargs_builtin		(enum insn_code);
 static void frv_split_iacc_move			(rtx, rtx);
 static rtx frv_emit_comparison			(enum rtx_code, rtx, rtx);
-static void frv_ifcvt_add_insn			(rtx, rtx, int);
+static void frv_ifcvt_add_insn			(rtx, rtx_insn *, int);
 static rtx frv_ifcvt_rewrite_mem		(rtx, machine_mode, rtx);
 static rtx frv_ifcvt_load_value			(rtx, rtx);
 static unsigned int frv_insn_unit		(rtx_insn *);
@@ -5160,7 +5160,7 @@  frv_ifcvt_machdep_init (void *ce_info ATTRIBUTE_UNUSED)
    if the conditional execution conversion is successful.  */
 
 static void
-frv_ifcvt_add_insn (rtx pattern, rtx insn, int before_p)
+frv_ifcvt_add_insn (rtx pattern, rtx_insn *insn, int before_p)
 {
   rtx link = alloc_EXPR_LIST (VOIDmode, pattern, insn);
 
@@ -5842,7 +5842,7 @@  single_set_pattern (rtx pattern)
 rtx
 frv_ifcvt_modify_insn (ce_if_block *ce_info,
                        rtx pattern,
-                       rtx insn)
+                       rtx_insn *insn)
 {
   rtx orig_ce_pattern = pattern;
   rtx set;
@@ -6106,7 +6106,7 @@  frv_ifcvt_modify_insn (ce_if_block *ce_info,
 void
 frv_ifcvt_modify_final (ce_if_block *ce_info ATTRIBUTE_UNUSED)
 {
-  rtx existing_insn;
+  rtx_insn *existing_insn;
   rtx check_insn;
   rtx p = frv_ifcvt.added_insns_list;
   int i;
@@ -6121,7 +6121,7 @@  frv_ifcvt_modify_final (ce_if_block *ce_info ATTRIBUTE_UNUSED)
       rtx old_p = p;
 
       check_insn = XEXP (check_and_insert_insns, 0);
-      existing_insn = XEXP (check_and_insert_insns, 1);
+      existing_insn = as_a <rtx_insn *> (XEXP (check_and_insert_insns, 1));
       p = XEXP (p, 1);
 
       /* The jump bit is used to say that the new insn is to be inserted BEFORE
@@ -6142,7 +6142,7 @@  frv_ifcvt_modify_final (ce_if_block *ce_info ATTRIBUTE_UNUSED)
   /* Load up any constants needed into temp gprs */
   for (i = 0; i < frv_ifcvt.cur_scratch_regs; i++)
     {
-      rtx insn = emit_insn_before (frv_ifcvt.scratch_regs[i], existing_insn);
+      rtx_insn *insn = emit_insn_before (frv_ifcvt.scratch_regs[i], existing_insn);
       if (! frv_ifcvt.scratch_insns_bitmap)
 	frv_ifcvt.scratch_insns_bitmap = BITMAP_ALLOC (NULL);
       bitmap_set_bit (frv_ifcvt.scratch_insns_bitmap, INSN_UID (insn));
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index bfe64bb..fc05f6c 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -17799,7 +17799,7 @@  r10k_insert_cache_barriers (void)
 		  if (r10k_needs_protection_p (insn))
 		    {
 		      emit_insn_before (gen_r10k_cache_barrier (),
-					unprotected_region);
+					as_a <rtx_insn *> (unprotected_region));
 		      unprotected_region = NULL_RTX;
 		    }
 		}
diff --git a/gcc/config/nds32/nds32-relax-opt.c b/gcc/config/nds32/nds32-relax-opt.c
index e54bd97..e6609a0 100644
--- a/gcc/config/nds32/nds32-relax-opt.c
+++ b/gcc/config/nds32/nds32-relax-opt.c
@@ -304,7 +304,7 @@  nds32_pic_tls_symbol_type (rtx x)
 
 /* Group the relax candidates with group id.  */
 static void
-nds32_group_insns (rtx sethi)
+nds32_group_insns (rtx_insn *sethi)
 {
   df_ref def_record, use_record;
   df_link *link;
@@ -435,7 +435,7 @@  nds32_float_reg_load_store_p (rtx_insn *insn)
    flsi $rt, [$ra + offset] */
 
 static void
-nds32_group_float_insns (rtx insn)
+nds32_group_float_insns (rtx_insn *insn)
 {
   df_ref def_record, use_record;
   df_link *link;
diff --git a/gcc/config/vax/vax-protos.h b/gcc/config/vax/vax-protos.h
index 3de4687..a526017 100644
--- a/gcc/config/vax/vax-protos.h
+++ b/gcc/config/vax/vax-protos.h
@@ -29,8 +29,8 @@  extern void print_operand (FILE *, rtx, int);
 extern void vax_notice_update_cc (rtx, rtx);
 extern void vax_expand_addsub_di_operands (rtx *, enum rtx_code);
 extern const char * vax_output_int_move (rtx, rtx *, machine_mode);
-extern const char * vax_output_int_add (rtx, rtx *, machine_mode);
-extern const char * vax_output_int_subtract (rtx, rtx *, machine_mode);
+extern const char * vax_output_int_add (rtx_insn *, rtx *, machine_mode);
+extern const char * vax_output_int_subtract (rtx_insn *, rtx *, machine_mode);
 extern const char * vax_output_movmemsi (rtx, rtx *);
 #endif /* RTX_CODE */
 
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
index 927b82f..631c598 100644
--- a/gcc/config/vax/vax.c
+++ b/gcc/config/vax/vax.c
@@ -1354,7 +1354,7 @@  vax_output_int_move (rtx insn ATTRIBUTE_UNUSED, rtx *operands,
    which are not modified very often.  */
 
 const char *
-vax_output_int_add (rtx insn, rtx *operands, machine_mode mode)
+vax_output_int_add (rtx_insn *insn, rtx *operands, machine_mode mode)
 {
   switch (mode)
     {
@@ -1564,7 +1564,7 @@  vax_output_int_add (rtx insn, rtx *operands, machine_mode mode)
 }
 
 const char *
-vax_output_int_subtract (rtx insn, rtx *operands, machine_mode mode)
+vax_output_int_subtract (rtx_insn *insn, rtx *operands, machine_mode mode)
 {
   switch (mode)
     {
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index a327ff2..e4b0704 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -4282,10 +4282,10 @@  add_insn_before (rtx_insn *insn, rtx_insn *before, basic_block bb)
 /* Replace insn with an deleted instruction note.  */
 
 void
-set_insn_deleted (rtx insn)
+set_insn_deleted (rtx_insn *insn)
 {
   if (INSN_P (insn))
-    df_insn_delete (as_a <rtx_insn *> (insn));
+    df_insn_delete (insn);
   PUT_CODE (insn, NOTE);
   NOTE_KIND (insn) = NOTE_INSN_DELETED;
 }
@@ -4861,10 +4861,9 @@  emit_pattern_after_setloc (rtx pattern, rtx_insn *after, location_t loc,
    any DEBUG_INSNs.  */
 
 static rtx_insn *
-emit_pattern_after (rtx pattern, rtx uncast_after, bool skip_debug_insns,
+emit_pattern_after (rtx pattern, rtx_insn *after, bool skip_debug_insns,
 		    rtx_insn *(*make_raw) (rtx))
 {
-  rtx_insn *after = safe_as_a <rtx_insn *> (uncast_after);
   rtx_insn *prev = after;
 
   if (skip_debug_insns)
@@ -4887,7 +4886,7 @@  emit_insn_after_setloc (rtx pattern, rtx_insn *after, location_t loc)
 
 /* Like emit_insn_after_noloc, but set INSN_LOCATION according to AFTER.  */
 rtx_insn *
-emit_insn_after (rtx pattern, rtx after)
+emit_insn_after (rtx pattern, rtx_insn *after)
 {
   return emit_pattern_after (pattern, after, true, make_insn_raw);
 }
@@ -4902,7 +4901,7 @@  emit_jump_insn_after_setloc (rtx pattern, rtx_insn *after, location_t loc)
 
 /* Like emit_jump_insn_after_noloc, but set INSN_LOCATION according to AFTER.  */
 rtx_jump_insn *
-emit_jump_insn_after (rtx pattern, rtx after)
+emit_jump_insn_after (rtx pattern, rtx_insn *after)
 {
   return as_a <rtx_jump_insn *> (
 	emit_pattern_after (pattern, after, true, make_jump_insn_raw));
@@ -4917,7 +4916,7 @@  emit_call_insn_after_setloc (rtx pattern, rtx_insn *after, location_t loc)
 
 /* Like emit_call_insn_after_noloc, but set INSN_LOCATION according to AFTER.  */
 rtx_insn *
-emit_call_insn_after (rtx pattern, rtx after)
+emit_call_insn_after (rtx pattern, rtx_insn *after)
 {
   return emit_pattern_after (pattern, after, true, make_call_insn_raw);
 }
@@ -4931,7 +4930,7 @@  emit_debug_insn_after_setloc (rtx pattern, rtx_insn *after, location_t loc)
 
 /* Like emit_debug_insn_after_noloc, but set INSN_LOCATION according to AFTER.  */
 rtx_insn *
-emit_debug_insn_after (rtx pattern, rtx after)
+emit_debug_insn_after (rtx pattern, rtx_insn *after)
 {
   return emit_pattern_after (pattern, after, false, make_debug_insn_raw);
 }
@@ -4976,10 +4975,9 @@  emit_pattern_before_setloc (rtx pattern, rtx_insn *before, location_t loc,
    INSN as opposed to a JUMP_INSN, CALL_INSN, etc.  */
 
 static rtx_insn *
-emit_pattern_before (rtx pattern, rtx uncast_before, bool skip_debug_insns,
+emit_pattern_before (rtx pattern, rtx_insn *before, bool skip_debug_insns,
 		     bool insnp, rtx_insn *(*make_raw) (rtx))
 {
-  rtx_insn *before = safe_as_a <rtx_insn *> (uncast_before);
   rtx_insn *next = before;
 
   if (skip_debug_insns)
@@ -5005,7 +5003,7 @@  emit_insn_before_setloc (rtx pattern, rtx_insn *before, location_t loc)
 
 /* Like emit_insn_before_noloc, but set INSN_LOCATION according to BEFORE.  */
 rtx_insn *
-emit_insn_before (rtx pattern, rtx before)
+emit_insn_before (rtx pattern, rtx_insn *before)
 {
   return emit_pattern_before (pattern, before, true, true, make_insn_raw);
 }
@@ -5021,7 +5019,7 @@  emit_jump_insn_before_setloc (rtx pattern, rtx_insn *before, location_t loc)
 
 /* Like emit_jump_insn_before_noloc, but set INSN_LOCATION according to BEFORE.  */
 rtx_jump_insn *
-emit_jump_insn_before (rtx pattern, rtx before)
+emit_jump_insn_before (rtx pattern, rtx_insn *before)
 {
   return as_a <rtx_jump_insn *> (
 	emit_pattern_before (pattern, before, true, false,
diff --git a/gcc/final.c b/gcc/final.c
index 4c600f0..a17a3a6 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -2128,7 +2128,7 @@  final (rtx_insn *first, FILE *file, int optimize_p)
 }
 
 const char *
-get_insn_template (int code, rtx insn)
+get_insn_template (int code, rtx_insn *insn)
 {
   switch (insn_data[code].output_format)
     {
@@ -2138,8 +2138,7 @@  get_insn_template (int code, rtx insn)
       return insn_data[code].output.multi[which_alternative];
     case INSN_OUTPUT_FORMAT_FUNCTION:
       gcc_assert (insn);
-      return (*insn_data[code].output.function) (recog_data.operand,
-						 as_a <rtx_insn *> (insn));
+      return (*insn_data[code].output.function) (recog_data.operand, insn);
 
     default:
       gcc_unreachable ();
diff --git a/gcc/output.h b/gcc/output.h
index f708cc7..afe72be 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -149,7 +149,7 @@  extern int only_leaf_regs_used (void);
 extern void leaf_renumber_regs_insn (rtx);
 
 /* Locate the proper template for the given insn-code.  */
-extern const char *get_insn_template (int, rtx);
+extern const char *get_insn_template (int, rtx_insn *);
 
 /* Functions in varasm.c.  */
 
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 5ae58b4..565ce3a 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3214,10 +3214,10 @@  extern rtx simplify_subtraction (rtx);
 extern void decide_function_section (tree);
 
 /* In emit-rtl.c */
-extern rtx_insn *emit_insn_before (rtx, rtx);
+extern rtx_insn *emit_insn_before (rtx, rtx_insn *);
 extern rtx_insn *emit_insn_before_noloc (rtx, rtx_insn *, basic_block);
 extern rtx_insn *emit_insn_before_setloc (rtx, rtx_insn *, location_t);
-extern rtx_jump_insn *emit_jump_insn_before (rtx, rtx);
+extern rtx_jump_insn *emit_jump_insn_before (rtx, rtx_insn *);
 extern rtx_jump_insn *emit_jump_insn_before_noloc (rtx, rtx_insn *);
 extern rtx_jump_insn *emit_jump_insn_before_setloc (rtx, rtx_insn *,
 						    location_t);
@@ -3225,21 +3225,21 @@  extern rtx_insn *emit_call_insn_before (rtx, rtx_insn *);
 extern rtx_insn *emit_call_insn_before_noloc (rtx, rtx_insn *);
 extern rtx_insn *emit_call_insn_before_setloc (rtx, rtx_insn *, location_t);
 extern rtx_insn *emit_debug_insn_before (rtx, rtx_insn *);
-extern rtx_insn *emit_debug_insn_before_noloc (rtx, rtx);
+extern rtx_insn *emit_debug_insn_before_noloc (rtx, rtx_insn *);
 extern rtx_insn *emit_debug_insn_before_setloc (rtx, rtx_insn *, location_t);
 extern rtx_barrier *emit_barrier_before (rtx_insn *);
 extern rtx_code_label *emit_label_before (rtx_code_label *, rtx_insn *);
 extern rtx_note *emit_note_before (enum insn_note, rtx_insn *);
-extern rtx_insn *emit_insn_after (rtx, rtx);
+extern rtx_insn *emit_insn_after (rtx, rtx_insn *);
 extern rtx_insn *emit_insn_after_noloc (rtx, rtx_insn *, basic_block);
 extern rtx_insn *emit_insn_after_setloc (rtx, rtx_insn *, location_t);
-extern rtx_jump_insn *emit_jump_insn_after (rtx, rtx);
+extern rtx_jump_insn *emit_jump_insn_after (rtx, rtx_insn *);
 extern rtx_jump_insn *emit_jump_insn_after_noloc (rtx, rtx_insn *);
 extern rtx_jump_insn *emit_jump_insn_after_setloc (rtx, rtx_insn *, location_t);
-extern rtx_insn *emit_call_insn_after (rtx, rtx);
+extern rtx_insn *emit_call_insn_after (rtx, rtx_insn *);
 extern rtx_insn *emit_call_insn_after_noloc (rtx, rtx_insn *);
 extern rtx_insn *emit_call_insn_after_setloc (rtx, rtx_insn *, location_t);
-extern rtx_insn *emit_debug_insn_after (rtx, rtx);
+extern rtx_insn *emit_debug_insn_after (rtx, rtx_insn *);
 extern rtx_insn *emit_debug_insn_after_noloc (rtx, rtx_insn *);
 extern rtx_insn *emit_debug_insn_after_setloc (rtx, rtx_insn *, location_t);
 extern rtx_barrier *emit_barrier_after (rtx_insn *);
@@ -3355,7 +3355,7 @@  extern const HARD_REG_SET &simplifiable_subregs (const subreg_shape &);
 extern rtx set_for_reg_notes (rtx);
 extern rtx set_unique_reg_note (rtx, enum reg_note, rtx);
 extern rtx set_dst_reg_note (rtx, enum reg_note, rtx, rtx);
-extern void set_insn_deleted (rtx);
+extern void set_insn_deleted (rtx_insn *);
 
 /* Functions in rtlanal.c */