public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Expect JUMP_TABLE_DATA in NEXT_INSN(label)
@ 2013-11-02  0:46 Steven Bosscher
  2013-11-04 11:12 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Bosscher @ 2013-11-02  0:46 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

Hello,

As $SUBJECT. The assert for this has been in place for several months
now without triggering any issues, so I'd like to make this next step
before stage1 is over.

OK for trunk?

Ciao!
Steven

[-- Attachment #2: tablejump.diff --]
[-- Type: text/x-patch, Size: 7070 bytes --]

	* rtlanal.c (tablejump_p): Expect a JUMP_TABLE_DATA to always follow
	immediately after a label for a tablejump pattern.

	* config/arm/arm.c (is_jump_table): Remove.
	(create_fix_barrier): Use tablejump_p instead.
	(arm_reorg): Likewise.
	(thumb1_output_casesi): Expect JUMP_TABLE_DATA to always be NEXT_INSN.
	(thumb2_output_casesi): Likewise.
	* config/aarch64/aarch64.c (aarch64_output_casesi): Likewise.
	* config/sh/sh.md (casesi_worker_1, casesi_worker_2,
	casesi_shift_media, casesi_load_media): Likewise.
	* config/iq2000/iq2000.md: Likewise (in anonymous define_insn).
	* config/microblaze/microblaze.md: Likewise.

Index: rtlanal.c
===================================================================
--- rtlanal.c	(revision 204308)
+++ rtlanal.c	(working copy)
@@ -2742,10 +2742,9 @@ tablejump_p (const_rtx insn, rtx *labelp, rtx *tab
 
   label = JUMP_LABEL (insn);
   if (label != NULL_RTX && !ANY_RETURN_P (label)
-      && (table = next_active_insn (label)) != NULL_RTX
+      && (table = NEXT_INSN (label)) != NULL_RTX
       && JUMP_TABLE_DATA_P (table))
     {
-      gcc_assert (table == NEXT_INSN (label));
       if (labelp)
 	*labelp = label;
       if (tablep)
Index: config/arm/arm.c
===================================================================
--- config/arm/arm.c	(revision 204308)
+++ config/arm/arm.c	(working copy)
@@ -95,13 +95,11 @@ static bool arm_print_operand_punct_valid_p (unsig
 static const char *fp_const_from_val (REAL_VALUE_TYPE *);
 static arm_cc get_arm_condition_code (rtx);
 static HOST_WIDE_INT int_log2 (HOST_WIDE_INT);
-static rtx is_jump_table (rtx);
 static const char *output_multi_immediate (rtx *, const char *, const char *,
 					   int, HOST_WIDE_INT);
 static const char *shift_op (rtx, HOST_WIDE_INT *);
 static struct machine_function *arm_init_machine_status (void);
 static void thumb_exit (FILE *, int);
-static rtx is_jump_table (rtx);
 static HOST_WIDE_INT get_jump_table_size (rtx);
 static Mnode *move_minipool_fix_forward_ref (Mnode *, Mnode *, HOST_WIDE_INT);
 static Mnode *add_minipool_forward_ref (Mfix *);
@@ -15468,23 +15466,6 @@ Mfix * 		minipool_fix_tail;
 /* The fix entry for the current minipool, once it has been placed.  */
 Mfix *		minipool_barrier;
 
-/* Determines if INSN is the start of a jump table.  Returns the end
-   of the TABLE or NULL_RTX.  */
-static rtx
-is_jump_table (rtx insn)
-{
-  rtx table;
-
-  if (jump_to_label_p (insn)
-      && ((table = next_active_insn (JUMP_LABEL (insn)))
-	  == next_active_insn (insn))
-      && table != NULL
-      && JUMP_TABLE_DATA_P (table))
-    return table;
-
-  return NULL_RTX;
-}
-
 #ifndef JUMP_TABLES_IN_TEXT_SECTION
 #define JUMP_TABLES_IN_TEXT_SECTION 0
 #endif
@@ -16093,8 +16074,7 @@ create_fix_barrier (Mfix *fix, HOST_WIDE_INT max_a
 	count += get_attr_length (from);
 
       /* If there is a jump table, add its length.  */
-      tmp = is_jump_table (from);
-      if (tmp != NULL)
+      if (tablejump_p (from, NULL, &tmp))
 	{
 	  count += get_jump_table_size (tmp);
 
@@ -16700,7 +16680,7 @@ arm_reorg (void)
 
 	  /* If the insn is a vector jump, add the size of the table
 	     and skip the table.  */
-	  if ((table = is_jump_table (insn)) != NULL)
+	  if (tablejump_p (insn, NULL, &table))
 	    {
 	      address += get_jump_table_size (table);
 	      insn = table;
@@ -28610,7 +28590,7 @@ arm_output_iwmmxt_tinsr (rtx *operands)
 const char *
 thumb1_output_casesi (rtx *operands)
 {
-  rtx diff_vec = PATTERN (next_active_insn (operands[0]));
+  rtx diff_vec = PATTERN (NEXT_INSN (operands[0]));
 
   gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC);
 
@@ -28633,7 +28613,7 @@ thumb1_output_casesi (rtx *operands)
 const char *
 thumb2_output_casesi (rtx *operands)
 {
-  rtx diff_vec = PATTERN (next_active_insn (operands[2]));
+  rtx diff_vec = PATTERN (NEXT_INSN (operands[2]));
 
   gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC);
 
Index: config/aarch64/aarch64.c
===================================================================
--- config/aarch64/aarch64.c	(revision 204308)
+++ config/aarch64/aarch64.c	(working copy)
@@ -4329,7 +4329,7 @@ aarch64_output_casesi (rtx *operands)
 {
   char buf[100];
   char label[100];
-  rtx diff_vec = PATTERN (next_active_insn (operands[2]));
+  rtx diff_vec = PATTERN (NEXT_INSN (operands[2]));
   int index;
   static const char *const patterns[4][2] =
   {
Index: config/sh/sh.md
===================================================================
--- config/sh/sh.md	(revision 204308)
+++ config/sh/sh.md	(working copy)
@@ -10827,7 +10827,7 @@ label:
    (clobber (match_scratch:SI 3 "=X,1"))]
   "TARGET_SH1"
 {
-  rtx diff_vec = PATTERN (next_active_insn (operands[2]));
+  rtx diff_vec = PATTERN (NEXT_INSN (operands[2]));
 
   gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC);
 
@@ -10861,7 +10861,7 @@ label:
    (clobber (match_operand:SI 4 "" "=X,1"))]
   "TARGET_SH2 && reload_completed && flag_pic"
 {
-  rtx diff_vec = PATTERN (next_active_insn (operands[2]));
+  rtx diff_vec = PATTERN (NEXT_INSN (operands[2]));
   gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC);
 
   switch (GET_MODE (diff_vec))
@@ -10899,7 +10899,7 @@ label:
 		    UNSPEC_CASESI)))]
   "TARGET_SHMEDIA"
 {
-  rtx diff_vec = PATTERN (next_active_insn (operands[2]));
+  rtx diff_vec = PATTERN (NEXT_INSN (operands[2]));
 
   gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC);
 
@@ -10926,7 +10926,7 @@ label:
 		      (label_ref:DI (match_operand 3 "" ""))] UNSPEC_CASESI)))]
   "TARGET_SHMEDIA"
 {
-  rtx diff_vec = PATTERN (next_active_insn (operands[3]));
+  rtx diff_vec = PATTERN (NEXT_INSN (operands[3]));
 
   gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC);
 
Index: config/iq2000/iq2000.md
===================================================================
--- config/iq2000/iq2000.md	(revision 204308)
+++ config/iq2000/iq2000.md	(working copy)
@@ -1398,9 +1398,8 @@
 	(plus:SI (match_operand:SI 0 "register_operand" "d")
 		 (label_ref:SI (match_operand 1 "" ""))))
    (use (label_ref:SI (match_dup 1)))]
-  "!(Pmode == DImode) && next_active_insn (insn) != 0
-   && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
-   && PREV_INSN (next_active_insn (insn)) == operands[1]"
+  "!(Pmode == DImode) && NEXT_INSN (operands[1]) != 0
+   && GET_CODE (PATTERN (NEXT_INSN (operands[1]))) == ADDR_DIFF_VEC"
   "*
 {
   return \"j\\t%0\";
Index: config/microblaze/microblaze.md
===================================================================
--- config/microblaze/microblaze.md	(revision 204308)
+++ config/microblaze/microblaze.md	(working copy)
@@ -1798,9 +1798,8 @@
 	(plus:SI (match_operand:SI 0 "register_operand" "d")
 		 (label_ref:SI (match_operand 1 "" ""))))
   (use (label_ref:SI (match_dup 1)))]
- "next_active_insn (insn) != 0
-  && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
-  && PREV_INSN (next_active_insn (insn)) == operands[1]
+ "NEXT_INSN (operands[1]) != 0
+  && GET_CODE (PATTERN (NEXT_INSN (operands[1]))) == ADDR_DIFF_VEC
   && flag_pic"
   {
     output_asm_insn ("addk\t%0,%0,r20",operands);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Expect JUMP_TABLE_DATA in NEXT_INSN(label)
  2013-11-02  0:46 Expect JUMP_TABLE_DATA in NEXT_INSN(label) Steven Bosscher
@ 2013-11-04 11:12 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2013-11-04 11:12 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: GCC Patches

On Sat, Nov 2, 2013 at 1:45 AM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> Hello,
>
> As $SUBJECT. The assert for this has been in place for several months
> now without triggering any issues, so I'd like to make this next step
> before stage1 is over.
>
> OK for trunk?

Ok.  Can you verify this from some RTL insn verifier (if it not already is).

Thanks,
Richard.

> Ciao!
> Steven

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-04 11:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-02  0:46 Expect JUMP_TABLE_DATA in NEXT_INSN(label) Steven Bosscher
2013-11-04 11:12 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).