From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16870 invoked by alias); 6 Aug 2014 17:41:55 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 16817 invoked by uid 89); 6 Aug 2014 17:41:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 06 Aug 2014 17:41:54 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XF4uX-0001n5-V1 for gcc-patches@gcc.gnu.org; Wed, 06 Aug 2014 13:22:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44508) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF4uX-0001n1-N5 for gcc-patches@gcc.gnu.org; Wed, 06 Aug 2014 13:22:01 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s76HL16g013061 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 6 Aug 2014 13:21:01 -0400 Received: from c64.redhat.com (vpn-239-139.phx2.redhat.com [10.3.239.139]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s76HJ2r0030913; Wed, 6 Aug 2014 13:21:00 -0400 From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 204/236] final.c: Use rtx_sequence Date: Wed, 06 Aug 2014 17:41:00 -0000 Message-Id: <1407345815-14551-205-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1407345815-14551-1-git-send-email-dmalcolm@redhat.com> References: <1407345815-14551-1-git-send-email-dmalcolm@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg00629.txt.bz2 gcc/ * final.c (get_attr_length_1): Replace GET_CODE check with a dyn_cast, introducing local "seq" and the use of methods of rtx_sequence. (shorten_branches): Likewise, introducing local "body_seq". Strengthen local "inner_insn" from rtx to rtx_insn *. (reemit_insn_block_notes): Replace GET_CODE check with a dyn_cast, strengthening local "body" from rtx to rtx_sequence *. Use methods of rtx_sequence. (final_scan_insn): Likewise, introducing local "seq" for when "body" is known to be a SEQUENCE, using its methods. --- gcc/final.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/gcc/final.c b/gcc/final.c index ea22464..b53367d 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -406,9 +406,9 @@ get_attr_length_1 (rtx uncast_insn, int (*fallback_fn) (rtx)) else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0) length = asm_insn_count (body) * fallback_fn (insn); - else if (GET_CODE (body) == SEQUENCE) - for (i = 0; i < XVECLEN (body, 0); i++) - length += get_attr_length_1 (XVECEXP (body, 0, i), fallback_fn); + else if (rtx_sequence *seq = dyn_cast (body)) + for (i = 0; i < seq->len (); i++) + length += get_attr_length_1 (seq->insn (i), fallback_fn); else length = fallback_fn (insn); break; @@ -1149,12 +1149,12 @@ shorten_branches (rtx_insn *first) } else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0) insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn); - else if (GET_CODE (body) == SEQUENCE) + else if (rtx_sequence *body_seq = dyn_cast (body)) { int i; int const_delay_slots; #ifdef DELAY_SLOTS - const_delay_slots = const_num_delay_slots (XVECEXP (body, 0, 0)); + const_delay_slots = const_num_delay_slots (body_seq->insn (0)); #else const_delay_slots = 0; #endif @@ -1163,14 +1163,14 @@ shorten_branches (rtx_insn *first) /* Inside a delay slot sequence, we do not do any branch shortening if the shortening could change the number of delay slots of the branch. */ - for (i = 0; i < XVECLEN (body, 0); i++) + for (i = 0; i < body_seq->len (); i++) { - rtx inner_insn = XVECEXP (body, 0, i); + rtx_insn *inner_insn = body_seq->insn (i); int inner_uid = INSN_UID (inner_insn); int inner_length; if (GET_CODE (body) == ASM_INPUT - || asm_noperands (PATTERN (XVECEXP (body, 0, i))) >= 0) + || asm_noperands (PATTERN (inner_insn)) >= 0) inner_length = (asm_insn_count (PATTERN (inner_insn)) * insn_default_length (inner_insn)); else @@ -1685,15 +1685,14 @@ reemit_insn_block_notes (void) this_block = insn_scope (insn); /* For sequences compute scope resulting from merging all scopes of instructions nested inside. */ - if (GET_CODE (PATTERN (insn)) == SEQUENCE) + if (rtx_sequence *body = dyn_cast (PATTERN (insn))) { int i; - rtx body = PATTERN (insn); this_block = NULL; - for (i = 0; i < XVECLEN (body, 0); i++) + for (i = 0; i < body->len (); i++) this_block = choose_inner_scope (this_block, - insn_scope (XVECEXP (body, 0, i))); + insn_scope (body->insn (i))); } if (! this_block) { @@ -2614,7 +2613,7 @@ final_scan_insn (rtx uncast_insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, app_disable (); - if (GET_CODE (body) == SEQUENCE) + if (rtx_sequence *seq = dyn_cast (body)) { /* A delayed-branch sequence */ int i; @@ -2626,16 +2625,16 @@ final_scan_insn (rtx uncast_insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, thought unnecessary. If that happens, cancel this sequence and cause that insn to be restored. */ - next = final_scan_insn (XVECEXP (body, 0, 0), file, 0, 1, seen); - if (next != XVECEXP (body, 0, 1)) + next = final_scan_insn (seq->insn (0), file, 0, 1, seen); + if (next != seq->insn (1)) { final_sequence = 0; return next; } - for (i = 1; i < XVECLEN (body, 0); i++) + for (i = 1; i < seq->len (); i++) { - rtx insn = XVECEXP (body, 0, i); + rtx_insn *insn = seq->insn (i); rtx_insn *next = NEXT_INSN (insn); /* We loop in case any instruction in a delay slot gets split. */ @@ -2653,7 +2652,7 @@ final_scan_insn (rtx uncast_insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, called function. Hence we don't preserve any CC-setting actions in these insns and the CC must be marked as being clobbered by the function. */ - if (CALL_P (XVECEXP (body, 0, 0))) + if (CALL_P (seq->insn (0))) { CC_STATUS_INIT; } -- 1.8.5.3