public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [PATCH 09/10] Simplification within reorg.c
Date: Fri, 05 Sep 2014 01:47:00 -0000	[thread overview]
Message-ID: <1409881927-61672-10-git-send-email-dmalcolm@redhat.com> (raw)
In-Reply-To: <1409881927-61672-1-git-send-email-dmalcolm@redhat.com>

gcc/
	* reorg.c (relax_delay_slots): Move declaration of "trial_seq"
	above the conditional, and convert the check on GET_CODE to a
	dyn_cast, so that "trial_seq" is available as an rtx_sequence * in
	the conditional.  Simplify the conditional by using methods of
	"trial_seq".
---
 gcc/reorg.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/gcc/reorg.c b/gcc/reorg.c
index 89d500d..7bacc6d 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -3385,13 +3385,14 @@ relax_delay_slots (rtx_insn *first)
 
       /* Similarly, if it is an unconditional jump with one insn in its
 	 delay list and that insn is redundant, thread the jump.  */
-      if (trial && GET_CODE (PATTERN (trial)) == SEQUENCE
-	  && XVECLEN (PATTERN (trial), 0) == 2
-	  && JUMP_P (XVECEXP (PATTERN (trial), 0, 0))
-	  && simplejump_or_return_p (XVECEXP (PATTERN (trial), 0, 0))
-	  && redundant_insn (XVECEXP (PATTERN (trial), 0, 1), insn, 0))
+      rtx_sequence *trial_seq =
+	trial ? dyn_cast <rtx_sequence *> (PATTERN (trial)) : NULL;
+      if (trial_seq
+	  && trial_seq->len () == 2
+	  && JUMP_P (trial_seq->insn (0))
+	  && simplejump_or_return_p (trial_seq->insn (0))
+	  && redundant_insn (trial_seq->insn (1), insn, 0))
 	{
-	  rtx_sequence *trial_seq = as_a <rtx_sequence *> (PATTERN (trial));
 	  target_label = JUMP_LABEL (trial_seq->insn (0));
 	  if (ANY_RETURN_P (target_label))
 	    target_label = find_end_label (target_label);
-- 
1.8.5.3

  parent reply	other threads:[~2014-09-05  1:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05  1:47 [PATCH 00/10] More use of rtx subclasses David Malcolm
2014-09-05  1:47 ` [PATCH 10/10] Use rtx_insn for various jump-handling functions and predicates David Malcolm
2014-09-05  2:34   ` Jeff Law
2014-09-05 13:03   ` Richard Sandiford
2014-09-05 15:16     ` David Malcolm
2014-09-05  1:47 ` David Malcolm [this message]
2014-09-05  2:32   ` [PATCH 09/10] Simplification within reorg.c Jeff Law
2014-09-05  1:47 ` [PATCH 03/10] for_each_eh_label callbacks take an rtx_code_label David Malcolm
2014-09-05  2:27   ` Jeff Law
2014-09-05  1:47 ` [PATCH 07/10] Use rtx_insn for more scheduler things, plus CONST_CAST_RTX_INSN David Malcolm
2014-09-05  2:31   ` Jeff Law
2014-09-05  1:47 ` [PATCH 06/10] Use rtx_insn more within peep2 David Malcolm
2014-09-05  2:29   ` Jeff Law
2014-09-05  1:47 ` [PATCH 01/10] Use rtx_jump_table_data in jump.c:delete_related_insns David Malcolm
2014-09-05  2:23   ` Jeff Law
2014-09-05  1:47 ` [PATCH 05/10] Convert set_block_for_insn from a macro to an inline function David Malcolm
2014-09-05  2:29   ` Jeff Law
2014-09-05  1:47 ` [PATCH 08/10] Use rtx_insn_list within haifa-sched.c David Malcolm
2014-09-05  2:31   ` Jeff Law
2014-09-05  1:47 ` [PATCH 02/10] Drop uncast_insn from param 1 of final_scan_insn David Malcolm
2014-09-05  2:25   ` Jeff Law
2014-09-05  1:47 ` [PATCH 04/10] Eliminate the checked cast from get_call_reg_set_usage David Malcolm
2014-09-05  2:28   ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409881927-61672-10-git-send-email-dmalcolm@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).