From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69815 invoked by alias); 26 Oct 2015 22:47:31 -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 69805 invoked by uid 89); 26 Oct 2015 22:47:31 -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_50,KAM_ASCII_DIVIDERS,KAM_STOCKGEN,RCVD_IN_SBL autolearn=no version=3.3.2 X-HELO: contrabass.corbina.net Received: from contrabass.corbina.net (HELO contrabass.corbina.net) (85.21.78.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Oct 2015 22:47:30 +0000 Received: from corbina.ru (violin.corbina.net [195.14.50.30]) by contrabass.corbina.net (Postfix) with ESMTP id A8175E6472 for ; Tue, 27 Oct 2015 02:47:27 +0400 (MSK) Received: from [95.26.217.172] (account aesok@post.ru HELO [192.168.1.101]) by post.ru (CommuniGate Pro SMTP 6.0.10) with ESMTPSA id 511186339 for gcc-patches@gcc.gnu.org; Tue, 27 Oct 2015 01:47:27 +0300 From: Anatoliy Sokolov Subject: [PATCH] Add contains_symbol_ref_p . To: gcc-patches Message-ID: <562EAD7F.6040202@post.ru> Date: Mon, 26 Oct 2015 23:11:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg02822.txt.bz2 Hello. This patch add contains_symbol_ref_p function in rtlanal.c and remove contains_symbol_ref_p from lra-constraints.c and contains_symbol_ref from var-tracking.c. Bootstrapped and reg-tested on x86_64-unknown-linux-gnu. OK for trunk? 2015-10-27 Anatoly Sokolov * rtl.h (contains_symbol_ref_p): Declare. (SYMBOL_REF_P): Define. * rtlanal.c (contains_symbol_ref_p: New function. * lra-constraints.c (contains_symbol_ref_p): Remove. * var-tracking.c (contains_symbol_ref): Remove. (track_expr_p): Use contains_symbol_ref_p instead of contains_symbol_ref. Index: gcc/lra-constraints.c =================================================================== --- gcc/lra-constraints.c (revision 228971) +++ gcc/lra-constraints.c (working copy) @@ -4007,35 +4007,6 @@ return false; } -/* Return true if X contains a symbol reg. */ -static bool -contains_symbol_ref_p (rtx x) -{ - int i, j; - const char *fmt; - enum rtx_code code; - - code = GET_CODE (x); - if (code == SYMBOL_REF) - return true; - fmt = GET_RTX_FORMAT (code); - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) - { - if (fmt[i] == 'e') - { - if (contains_symbol_ref_p (XEXP (x, i))) - return true; - } - else if (fmt[i] == 'E') - { - for (j = XVECLEN (x, i) - 1; j >= 0; j--) - if (contains_symbol_ref_p (XVECEXP (x, i, j))) - return true; - } - } - return false; -} - /* Process all regs in location *LOC and change them on equivalent substitution. Return true if any change was done. */ static bool Index: gcc/rtl.h =================================================================== --- gcc/rtl.h (revision 228971) +++ gcc/rtl.h (working copy) @@ -829,6 +829,9 @@ /* Predicate yielding nonzero iff RTX is a subreg. */ #define SUBREG_P(RTX) (GET_CODE (RTX) == SUBREG) +/* Predicate yielding true iff RTX is a symbol ref. */ +#define SYMBOL_REF_P(RTX) (GET_CODE (RTX) == SYMBOL_REF) + template <> template <> inline bool @@ -2926,6 +2929,7 @@ /* Functions in rtlanal.c */ extern rtx single_set_2 (const rtx_insn *, const_rtx); +extern bool contains_symbol_ref_p (const_rtx); /* Handle the cheap and common cases inline for performance. */ Index: gcc/rtlanal.c =================================================================== --- gcc/rtlanal.c (revision 228971) +++ gcc/rtlanal.c (working copy) @@ -6232,6 +6232,19 @@ return SCRATCH; } +/* Return true if RTL X contains a SYMBOL_REF. */ + +bool +contains_symbol_ref_p (const_rtx x) +{ + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, x, ALL) + if (SYMBOL_REF_P (*iter)) + return true; + + return false; +} + /* Return true if X contains a thread-local symbol. */ bool Index: gcc/var-tracking.c =================================================================== --- gcc/var-tracking.c (revision 228971) +++ gcc/var-tracking.c (working copy) @@ -671,7 +671,6 @@ static bool dataflow_set_different (dataflow_set *, dataflow_set *); static void dataflow_set_destroy (dataflow_set *); -static bool contains_symbol_ref (rtx); static bool track_expr_p (tree, bool); static bool same_variable_part_p (rtx, tree, HOST_WIDE_INT); static void add_uses_1 (rtx *, void *); @@ -5031,42 +5030,6 @@ set->vars = NULL; } -/* Return true if RTL X contains a SYMBOL_REF. */ - -static bool -contains_symbol_ref (rtx x) -{ - const char *fmt; - RTX_CODE code; - int i; - - if (!x) - return false; - - code = GET_CODE (x); - if (code == SYMBOL_REF) - return true; - - fmt = GET_RTX_FORMAT (code); - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) - { - if (fmt[i] == 'e') - { - if (contains_symbol_ref (XEXP (x, i))) - return true; - } - else if (fmt[i] == 'E') - { - int j; - for (j = 0; j < XVECLEN (x, i); j++) - if (contains_symbol_ref (XVECEXP (x, i, j))) - return true; - } - } - - return false; -} - /* Shall EXPR be tracked? */ static bool @@ -5147,7 +5110,7 @@ char **_dl_argv; */ if (decl_rtl && MEM_P (decl_rtl) - && contains_symbol_ref (XEXP (decl_rtl, 0))) + && contains_symbol_ref_p (XEXP (decl_rtl, 0))) return 0; /* If RTX is a memory it should not be very large (because it would be Anatoliy.