From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29457 invoked by alias); 19 Aug 2014 17:42:15 -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 29438 invoked by uid 89); 19 Aug 2014 17:42:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 19 Aug 2014 17:42:12 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7JHgA6U026378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 19 Aug 2014 13:42:11 -0400 Received: from [10.3.225.110] (vpn-225-110.phx2.redhat.com [10.3.225.110]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7JHg93X005219; Tue, 19 Aug 2014 13:42:09 -0400 Message-ID: <1408469941.2473.90.camel@surprise> Subject: Re: [PATCH 018/236] Strengthen return types of various {next|prev}_*insn from rtx to rtx_insn * From: David Malcolm To: Jeff Law Cc: gcc-patches@gcc.gnu.org Date: Tue, 19 Aug 2014 17:42:00 -0000 In-Reply-To: <53EA8E52.9050909@redhat.com> References: <1407345815-14551-1-git-send-email-dmalcolm@redhat.com> <1407345815-14551-19-git-send-email-dmalcolm@redhat.com> <53EA8E52.9050909@redhat.com> Content-Type: multipart/mixed; boundary="=-xzpX87cEKR3aSXszHrl5" Mime-Version: 1.0 X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg01918.txt.bz2 --=-xzpX87cEKR3aSXszHrl5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 2083 On Tue, 2014-08-12 at 15:59 -0600, Jeff Law wrote: > On 08/06/14 11:19, David Malcolm wrote: > > These should all eventually require an rtx_insn * as an argument, > > but we'll save that for a later patch. > > > > gcc/ > > * rtl.h (previous_insn): Strengthen return type from rtx to > > rtx_insn *. > > (next_insn): Likewise. > > (prev_nonnote_insn): Likewise. > > (prev_nonnote_insn_bb): Likewise. > > (next_nonnote_insn): Likewise. > > (next_nonnote_insn_bb): Likewise. > > (prev_nondebug_insn): Likewise. > > (next_nondebug_insn): Likewise. > > (prev_nonnote_nondebug_insn): Likewise. > > (next_nonnote_nondebug_insn): Likewise. > > (prev_real_insn): Likewise. > > (next_real_insn): Likewise. > > (prev_active_insn): Likewise. > > (next_active_insn): Likewise. > > > > * emit-rtl.c (next_insn): Strengthen return type from rtx to > > rtx_insn *, adding a checked cast. > > (previous_insn): Likewise. > > (next_nonnote_insn): Likewise. > > (next_nonnote_insn_bb): Likewise. > > (prev_nonnote_insn): Likewise. > > (prev_nonnote_insn_bb): Likewise. > > (next_nondebug_insn): Likewise. > > (prev_nondebug_insn): Likewise. > > (next_nonnote_nondebug_insn): Likewise. > > (prev_nonnote_nondebug_insn): Likewise. > > (next_real_insn): Likewise. > > (prev_real_insn): Likewise. > > (next_active_insn): Likewise. > > (prev_active_insn): Likewise. > > > > * config/sh/sh-protos.h (sh_find_set_of_reg): Convert function ptr > > param "stepfunc" so that it returns an rtx_insn * rather than an > > rtx, to track the change to prev_nonnote_insn_bb, which is the > > only function this is called with. > > * config/sh/sh.c (sh_find_set_of_reg): Likewise. > OK. Thanks. I fixed up the various as_a_nullable to safe_as_a, and committed to trunk as r214178, having verified bootstrap®rtest on x86_64-unknown-linux-gnu (Fedora 20) albeit in combination with patches 9-29 [1], and verified that it builds standalone with 10 targets, including sh-elf. Am attaching what I committed. Dave [1] as per https://gcc.gnu.org/ml/gcc-patches/2014-08/msg01420.html --=-xzpX87cEKR3aSXszHrl5 Content-Disposition: attachment; filename="r214178.patch" Content-Type: text/x-patch; name="r214178.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 9186 Index: gcc/ChangeLog =================================================================== --- gcc/ChangeLog (revision 214177) +++ gcc/ChangeLog (revision 214178) @@ -1,3 +1,43 @@ +2014-08-19 David Malcolm + + * rtl.h (previous_insn): Strengthen return type from rtx to + rtx_insn *. + (next_insn): Likewise. + (prev_nonnote_insn): Likewise. + (prev_nonnote_insn_bb): Likewise. + (next_nonnote_insn): Likewise. + (next_nonnote_insn_bb): Likewise. + (prev_nondebug_insn): Likewise. + (next_nondebug_insn): Likewise. + (prev_nonnote_nondebug_insn): Likewise. + (next_nonnote_nondebug_insn): Likewise. + (prev_real_insn): Likewise. + (next_real_insn): Likewise. + (prev_active_insn): Likewise. + (next_active_insn): Likewise. + + * emit-rtl.c (next_insn): Strengthen return type from rtx to + rtx_insn *, adding a checked cast. + (previous_insn): Likewise. + (next_nonnote_insn): Likewise. + (next_nonnote_insn_bb): Likewise. + (prev_nonnote_insn): Likewise. + (prev_nonnote_insn_bb): Likewise. + (next_nondebug_insn): Likewise. + (prev_nondebug_insn): Likewise. + (next_nonnote_nondebug_insn): Likewise. + (prev_nonnote_nondebug_insn): Likewise. + (next_real_insn): Likewise. + (prev_real_insn): Likewise. + (next_active_insn): Likewise. + (prev_active_insn): Likewise. + + * config/sh/sh-protos.h (sh_find_set_of_reg): Convert function ptr + param "stepfunc" so that it returns an rtx_insn * rather than an + rtx, to track the change to prev_nonnote_insn_bb, which is the + only function this is called with. + * config/sh/sh.c (sh_find_set_of_reg): Likewise. + 2014-08-19 Jan Hubicka * ipa-visibility.c (update_visibility_by_resolution_info): Fix Index: gcc/emit-rtl.c =================================================================== --- gcc/emit-rtl.c (revision 214177) +++ gcc/emit-rtl.c (revision 214178) @@ -3179,7 +3179,7 @@ /* Return the next insn. If it is a SEQUENCE, return the first insn of the sequence. */ -rtx +rtx_insn * next_insn (rtx insn) { if (insn) @@ -3190,13 +3190,13 @@ insn = XVECEXP (PATTERN (insn), 0, 0); } - return insn; + return safe_as_a (insn); } /* Return the previous insn. If it is a SEQUENCE, return the last insn of the sequence. */ -rtx +rtx_insn * previous_insn (rtx insn) { if (insn) @@ -3207,13 +3207,13 @@ insn = XVECEXP (PATTERN (insn), 0, XVECLEN (PATTERN (insn), 0) - 1); } - return insn; + return safe_as_a (insn); } /* Return the next insn after INSN that is not a NOTE. This routine does not look inside SEQUENCEs. */ -rtx +rtx_insn * next_nonnote_insn (rtx insn) { while (insn) @@ -3223,7 +3223,7 @@ break; } - return insn; + return safe_as_a (insn); } /* Return the next insn after INSN that is not a NOTE, but stop the @@ -3230,7 +3230,7 @@ search before we enter another basic block. This routine does not look inside SEQUENCEs. */ -rtx +rtx_insn * next_nonnote_insn_bb (rtx insn) { while (insn) @@ -3239,16 +3239,16 @@ if (insn == 0 || !NOTE_P (insn)) break; if (NOTE_INSN_BASIC_BLOCK_P (insn)) - return NULL_RTX; + return NULL; } - return insn; + return safe_as_a (insn); } /* Return the previous insn before INSN that is not a NOTE. This routine does not look inside SEQUENCEs. */ -rtx +rtx_insn * prev_nonnote_insn (rtx insn) { while (insn) @@ -3258,7 +3258,7 @@ break; } - return insn; + return safe_as_a (insn); } /* Return the previous insn before INSN that is not a NOTE, but stop @@ -3265,7 +3265,7 @@ the search before we enter another basic block. This routine does not look inside SEQUENCEs. */ -rtx +rtx_insn * prev_nonnote_insn_bb (rtx insn) { while (insn) @@ -3274,16 +3274,16 @@ if (insn == 0 || !NOTE_P (insn)) break; if (NOTE_INSN_BASIC_BLOCK_P (insn)) - return NULL_RTX; + return NULL; } - return insn; + return safe_as_a (insn); } /* Return the next insn after INSN that is not a DEBUG_INSN. This routine does not look inside SEQUENCEs. */ -rtx +rtx_insn * next_nondebug_insn (rtx insn) { while (insn) @@ -3293,13 +3293,13 @@ break; } - return insn; + return safe_as_a (insn); } /* Return the previous insn before INSN that is not a DEBUG_INSN. This routine does not look inside SEQUENCEs. */ -rtx +rtx_insn * prev_nondebug_insn (rtx insn) { while (insn) @@ -3309,13 +3309,13 @@ break; } - return insn; + return safe_as_a (insn); } /* Return the next insn after INSN that is not a NOTE nor DEBUG_INSN. This routine does not look inside SEQUENCEs. */ -rtx +rtx_insn * next_nonnote_nondebug_insn (rtx insn) { while (insn) @@ -3325,13 +3325,13 @@ break; } - return insn; + return safe_as_a (insn); } /* Return the previous insn before INSN that is not a NOTE nor DEBUG_INSN. This routine does not look inside SEQUENCEs. */ -rtx +rtx_insn * prev_nonnote_nondebug_insn (rtx insn) { while (insn) @@ -3341,7 +3341,7 @@ break; } - return insn; + return safe_as_a (insn); } /* Return the next INSN, CALL_INSN or JUMP_INSN after INSN; @@ -3348,7 +3348,7 @@ or 0, if there is none. This routine does not look inside SEQUENCEs. */ -rtx +rtx_insn * next_real_insn (rtx insn) { while (insn) @@ -3358,7 +3358,7 @@ break; } - return insn; + return safe_as_a (insn); } /* Return the last INSN, CALL_INSN or JUMP_INSN before INSN; @@ -3365,7 +3365,7 @@ or 0, if there is none. This routine does not look inside SEQUENCEs. */ -rtx +rtx_insn * prev_real_insn (rtx insn) { while (insn) @@ -3375,7 +3375,7 @@ break; } - return insn; + return safe_as_a (insn); } /* Return the last CALL_INSN in the current list, or 0 if there is none. @@ -3409,7 +3409,7 @@ && GET_CODE (PATTERN (insn)) != CLOBBER)))); } -rtx +rtx_insn * next_active_insn (rtx insn) { while (insn) @@ -3419,7 +3419,7 @@ break; } - return insn; + return safe_as_a (insn); } /* Find the last insn before INSN that really does something. This routine @@ -3426,7 +3426,7 @@ does not look inside SEQUENCEs. After reload this also skips over standalone USE and CLOBBER insn. */ -rtx +rtx_insn * prev_active_insn (rtx insn) { while (insn) @@ -3436,7 +3436,7 @@ break; } - return insn; + return safe_as_a (insn); } #ifdef HAVE_cc0 Index: gcc/rtl.h =================================================================== --- gcc/rtl.h (revision 214177) +++ gcc/rtl.h (revision 214178) @@ -2417,20 +2417,20 @@ extern rtx make_insn_raw (rtx); extern void add_function_usage_to (rtx, rtx); extern rtx last_call_insn (void); -extern rtx previous_insn (rtx); -extern rtx next_insn (rtx); -extern rtx prev_nonnote_insn (rtx); -extern rtx prev_nonnote_insn_bb (rtx); -extern rtx next_nonnote_insn (rtx); -extern rtx next_nonnote_insn_bb (rtx); -extern rtx prev_nondebug_insn (rtx); -extern rtx next_nondebug_insn (rtx); -extern rtx prev_nonnote_nondebug_insn (rtx); -extern rtx next_nonnote_nondebug_insn (rtx); -extern rtx prev_real_insn (rtx); -extern rtx next_real_insn (rtx); -extern rtx prev_active_insn (rtx); -extern rtx next_active_insn (rtx); +extern rtx_insn *previous_insn (rtx); +extern rtx_insn *next_insn (rtx); +extern rtx_insn *prev_nonnote_insn (rtx); +extern rtx_insn *prev_nonnote_insn_bb (rtx); +extern rtx_insn *next_nonnote_insn (rtx); +extern rtx_insn *next_nonnote_insn_bb (rtx); +extern rtx_insn *prev_nondebug_insn (rtx); +extern rtx_insn *next_nondebug_insn (rtx); +extern rtx_insn *prev_nonnote_nondebug_insn (rtx); +extern rtx_insn *next_nonnote_nondebug_insn (rtx); +extern rtx_insn *prev_real_insn (rtx); +extern rtx_insn *next_real_insn (rtx); +extern rtx_insn *prev_active_insn (rtx); +extern rtx_insn *next_active_insn (rtx); extern int active_insn_p (const_rtx); extern rtx next_cc0_user (rtx); extern rtx prev_cc0_setter (rtx); Index: gcc/config/sh/sh-protos.h =================================================================== --- gcc/config/sh/sh-protos.h (revision 214177) +++ gcc/config/sh/sh-protos.h (revision 214178) @@ -181,7 +181,7 @@ rtx set_src; }; -extern set_of_reg sh_find_set_of_reg (rtx reg, rtx insn, rtx(*stepfunc)(rtx)); +extern set_of_reg sh_find_set_of_reg (rtx reg, rtx insn, rtx_insn *(*stepfunc)(rtx)); extern bool sh_is_logical_t_store_expr (rtx op, rtx insn); extern rtx sh_try_omit_signzero_extend (rtx extended_op, rtx insn); #endif /* RTX_CODE */ Index: gcc/config/sh/sh.c =================================================================== --- gcc/config/sh/sh.c (revision 214177) +++ gcc/config/sh/sh.c (revision 214178) @@ -13505,7 +13505,7 @@ 'prev_nonnote_insn_bb'. When the insn is found, try to extract the rtx of the reg set. */ set_of_reg -sh_find_set_of_reg (rtx reg, rtx insn, rtx(*stepfunc)(rtx)) +sh_find_set_of_reg (rtx reg, rtx insn, rtx_insn *(*stepfunc)(rtx)) { set_of_reg result; result.insn = insn; --=-xzpX87cEKR3aSXszHrl5--