[5/5] sh: update for emit-rtl.h changes

Message ID 1528829652-43336-6-git-send-email-dmalcolm@redhat.com
State New
Headers show
Series
  • More rtx->rtx_insn * cleanups
Related show

Commit Message

David Malcolm June 12, 2018, 6:54 p.m.
gcc/ChangeLog:
	* config/sh/sh-protos.h (get_dest_uid): Strengthen 1st param from
	rtx to rtx_insn *.
	* config/sh/sh.c (dump_table): Strengthen local "lab" from rtx to
	rtx_code_label *, adding safe_as_a <rtx_code_label *> casts to
	the loops over LABEL_REFS.
	(fixup_addr_diff_vecs): Add as_a <rtx_insn *> to usage of
	braf_label.
	(barrier_align): Convert usage of JUMP_LABEL to JUMP_LABEL_AS_INSN.
	(get_dest_uid): Strengthen param "label" from rtx to rtx_insn *.
	(split_branches): Strengthen local "olabel" from rtx to
	rtx_insn *, adding a safe_as_a cast.
---
 gcc/config/sh/sh-protos.h |  2 +-
 gcc/config/sh/sh.c        | 30 ++++++++++++++++++------------
 2 files changed, 19 insertions(+), 13 deletions(-)

Comments

Jeff Law June 12, 2018, 8:46 p.m. | #1
On 06/12/2018 12:54 PM, David Malcolm wrote:
> gcc/ChangeLog:
> 	* config/sh/sh-protos.h (get_dest_uid): Strengthen 1st param from
> 	rtx to rtx_insn *.
> 	* config/sh/sh.c (dump_table): Strengthen local "lab" from rtx to
> 	rtx_code_label *, adding safe_as_a <rtx_code_label *> casts to
> 	the loops over LABEL_REFS.
> 	(fixup_addr_diff_vecs): Add as_a <rtx_insn *> to usage of
> 	braf_label.
> 	(barrier_align): Convert usage of JUMP_LABEL to JUMP_LABEL_AS_INSN.
> 	(get_dest_uid): Strengthen param "label" from rtx to rtx_insn *.
> 	(split_branches): Strengthen local "olabel" from rtx to
> 	rtx_insn *, adding a safe_as_a cast.
> ---
>  gcc/config/sh/sh-protos.h |  2 +-
>  gcc/config/sh/sh.c        | 30 ++++++++++++++++++------------
>  2 files changed, 19 insertions(+), 13 deletions(-)
>
OK when prereqs are approved.

jeff

Patch

diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h
index 23405b4..66ee315 100644
--- a/gcc/config/sh/sh-protos.h
+++ b/gcc/config/sh/sh-protos.h
@@ -88,7 +88,7 @@  extern int shl_sext_length (rtx);
 extern bool gen_shl_sext (rtx, rtx, rtx, rtx);
 extern int regs_used (rtx, int);
 extern void fixup_addr_diff_vecs (rtx_insn *);
-extern int get_dest_uid (rtx, int);
+extern int get_dest_uid (rtx_insn *, int);
 extern void final_prescan_insn (rtx_insn *, rtx *, int);
 extern enum tls_model tls_symbolic_operand (rtx, machine_mode);
 extern bool system_reg_operand (rtx, machine_mode);
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index ced6640..5f6fbb3 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -4583,7 +4583,7 @@  dump_table (rtx_insn *start, rtx_insn *barrier)
 {
   rtx_insn *scan = barrier;
   bool need_align = true;
-  rtx lab;
+  rtx_code_label *lab;
   label_ref_list_t ref;
   bool have_df = false;
 
@@ -4600,7 +4600,8 @@  dump_table (rtx_insn *start, rtx_insn *barrier)
 	      scan = emit_insn_after (gen_align_2 (), scan);
 	      need_align = false;
 	    }
-	  for (lab = p->label; lab; lab = LABEL_REFS (lab))
+	  for (lab = p->label; lab;
+	       lab = safe_as_a <rtx_code_label *> (LABEL_REFS (lab)))
 	    scan = emit_label_after (lab, scan);
 	  scan = emit_insn_after (gen_consttable_2 (p->value, const0_rtx),
 				  scan);
@@ -4627,7 +4628,7 @@  dump_table (rtx_insn *start, rtx_insn *barrier)
 	    rtx src = SET_SRC (XVECEXP (PATTERN (start), 0, 0));
 	    rtx lab = XEXP (XVECEXP (src, 0, 3), 0);
 
-	    scan = emit_label_after (lab, scan);
+	    scan = emit_label_after (as_a <rtx_insn *> (lab), scan);
 	  }
     }
   if (TARGET_FMOVD && TARGET_ALIGN_DOUBLE && have_df)
@@ -4650,7 +4651,8 @@  dump_table (rtx_insn *start, rtx_insn *barrier)
 	    case E_SFmode:
 	      if (align_insn && !p->part_of_sequence_p)
 		{
-		  for (lab = p->label; lab; lab = LABEL_REFS (lab))
+		  for (lab = p->label; lab;
+		       lab = safe_as_a <rtx_code_label *> (LABEL_REFS (lab)))
 		    emit_label_before (lab, align_insn);
 		  emit_insn_before (gen_consttable_4 (p->value, const0_rtx),
 				    align_insn);
@@ -4666,7 +4668,8 @@  dump_table (rtx_insn *start, rtx_insn *barrier)
 		}
 	      else
 		{
-		  for (lab = p->label; lab; lab = LABEL_REFS (lab))
+		  for (lab = p->label; lab;
+		       lab = safe_as_a <rtx_code_label *> (LABEL_REFS (lab)))
 		    scan = emit_label_after (lab, scan);
 		  scan = emit_insn_after (gen_consttable_4 (p->value,
 							    const0_rtx), scan);
@@ -4682,7 +4685,8 @@  dump_table (rtx_insn *start, rtx_insn *barrier)
 		}
 	      /* FALLTHRU */
 	    case E_DImode:
-	      for (lab = p->label; lab; lab = LABEL_REFS (lab))
+	      for (lab = p->label; lab;
+		   lab = safe_as_a <rtx_code_label *> (LABEL_REFS (lab)))
 		scan = emit_label_after (lab, scan);
 	      scan = emit_insn_after (gen_consttable_8 (p->value, const0_rtx),
 				      scan);
@@ -4721,7 +4725,8 @@  dump_table (rtx_insn *start, rtx_insn *barrier)
 	      scan = emit_label_after (gen_label_rtx (), scan);
 	      scan = emit_insn_after (gen_align_4 (), scan);
 	    }
-	  for (lab = p->label; lab; lab = LABEL_REFS (lab))
+	  for (lab = p->label; lab;
+	       lab = safe_as_a <rtx_code_label *> (LABEL_REFS (lab)))
 	    scan = emit_label_after (lab, scan);
 	  scan = emit_insn_after (gen_consttable_4 (p->value, const0_rtx),
 				  scan);
@@ -4734,7 +4739,8 @@  dump_table (rtx_insn *start, rtx_insn *barrier)
 	      scan = emit_label_after (gen_label_rtx (), scan);
 	      scan = emit_insn_after (gen_align_4 (), scan);
 	    }
-	  for (lab = p->label; lab; lab = LABEL_REFS (lab))
+	  for (lab = p->label; lab;
+	       lab = safe_as_a <rtx_code_label *> (LABEL_REFS (lab)))
 	    scan = emit_label_after (lab, scan);
 	  scan = emit_insn_after (gen_consttable_8 (p->value, const0_rtx),
 				  scan);
@@ -5706,7 +5712,7 @@  fixup_addr_diff_vecs (rtx_insn *first)
       /* Emit the reference label of the braf where it belongs, right after
 	 the casesi_jump_2 (i.e. braf).  */
       braf_label = XEXP (XEXP (SET_SRC (XVECEXP (prevpat, 0, 0)), 1), 0);
-      emit_label_after (braf_label, prev);
+      emit_label_after (as_a <rtx_insn *> (braf_label), prev);
 
       /* Fix up the ADDR_DIF_VEC to be relative
 	 to the reference address of the braf.  */
@@ -5810,7 +5816,7 @@  barrier_align (rtx_insn *barrier_or_label)
 	{
 	  rtx_insn *x;
 	  if (jump_to_next
-	      || next_real_insn (JUMP_LABEL (prev)) == next
+	      || next_real_insn (JUMP_LABEL_AS_INSN (prev)) == next
 	      /* If relax_delay_slots() decides NEXT was redundant
 		 with some previous instruction, it will have
 		 redirected PREV's jump to the following insn.  */
@@ -6310,7 +6316,7 @@  sh_reorg (void)
 
 /* Return the UID of the insn that follows the specified label.  */
 int
-get_dest_uid (rtx label, int max_uid)
+get_dest_uid (rtx_insn *label, int max_uid)
 {
   rtx_insn *dest = next_real_insn (label);
 
@@ -6370,7 +6376,7 @@  split_branches (rtx_insn *first)
 	    if (get_attr_length (insn) > 4)
 	      {
 		rtx src = SET_SRC (PATTERN (insn));
-		rtx olabel = XEXP (XEXP (src, 1), 0);
+		rtx_insn *olabel = safe_as_a <rtx_insn *> (XEXP (XEXP (src, 1), 0));
 		int addr = INSN_ADDRESSES (INSN_UID (insn));
 		rtx_insn *label = 0;
 		int dest_uid = get_dest_uid (olabel, max_uid);