From patchwork Sat Nov 16 13:10:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 291775 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AD2522C0084 for ; Sun, 17 Nov 2013 00:11:11 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=Z4kquAJVY/SnYvCZXYTi54fvMeYTh B3eoJe2TdGEB49wBJGmz7FeNbNsHTU4d0HBvYb5iohw2E8QGJSsOIj7rzOtDikYb 63pVvvB3mxe3JP1YZ6JablyAePnAHoQoREMq20RKVt7YYEe37CpMXypa+sTABbdC YMwtL4vO/MIv80= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=oQSBclbrfBsPegVDZUFV9nUWeFM=; b=nhc N2CyXz3ZjxxeE8wso5VYKpRM6PCI795vVW0lYp6okXIgQsLuGWfwWEyRn5uABttK c14Gja6JNgB8aXZyLDlE6+A/d0Hl+3+I4fk2uTo3QvCN89hr/aZuPVdVpHi1Be/G c6clOgqll0Tx0EPG9yxv5+0HpQTepDjK5Rz1yHSY= Received: (qmail 25172 invoked by alias); 16 Nov 2013 13:11:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 25160 invoked by uid 89); 16 Nov 2013 13:10:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, RDNS_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mail-we0-f170.google.com Received: from Unknown (HELO mail-we0-f170.google.com) (74.125.82.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 16 Nov 2013 13:10:58 +0000 Received: by mail-we0-f170.google.com with SMTP id w61so872689wes.29 for ; Sat, 16 Nov 2013 05:10:49 -0800 (PST) X-Received: by 10.180.185.179 with SMTP id fd19mr10591133wic.18.1384607448958; Sat, 16 Nov 2013 05:10:48 -0800 (PST) Received: from localhost ([2.28.235.51]) by mx.google.com with ESMTPSA id uc12sm4887146wib.3.2013.11.16.05.10.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Nov 2013 05:10:48 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [8/10] Mop up remaining tree_low_cst calls References: <87ppq0tsn4.fsf@talisman.default> Date: Sat, 16 Nov 2013 13:10:48 +0000 In-Reply-To: <87ppq0tsn4.fsf@talisman.default> (Richard Sandiford's message of "Sat, 16 Nov 2013 12:53:19 +0000") Message-ID: <87ob5ksd9j.fsf@talisman.default> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Handle tree_low_cst references that weren't caught by the sed. Thanks, Richard gcc/ada/ * gcc-interface/cuintp.c (UI_From_gnu): Use tree_to_shwi rather than tree_low_cst. gcc/c-family/ * c-common.c (fold_offsetof_1): Use tree_to_uhwi rather than tree_low_cst. (complete_array_type): Update comment to refer to tree_to_[su]hwi rather than tree_low_cst. gcc/c/ * c-decl.c (grokdeclarator): Update comment to refer to tree_to_[su]hwi rather than tree_low_cst. gcc/cp/ * decl.c (reshape_init_array_1): Use tree_to_uhwi rather than tree_low_cst. (grokdeclarator): Update comment to refer to tree_to_[su]hwi rather than tree_low_cst. gcc/ * expr.h: Update comments to refer to tree_to_[su]hwi rather than tree_low_cst. * fold-const.c (fold_binary_loc): Likewise. * expr.c (store_constructor): Use tree_to_uhwi rather than tree_low_cst. * ipa-utils.h (possible_polymorphic_call_target_p): Likewise. * stmt.c (emit_case_dispatch_table): Likewise. * tree-switch-conversion.c (emit_case_bit_tests): Likewise. Index: gcc/ada/gcc-interface/cuintp.c =================================================================== --- gcc/ada/gcc-interface/cuintp.c 2013-11-16 13:08:22.531824320 +0000 +++ gcc/ada/gcc-interface/cuintp.c 2013-11-16 13:08:24.254837390 +0000 @@ -176,9 +176,9 @@ UI_From_gnu (tree Input) for (i = Max_For_Dint - 1; i >= 0; i--) { - v[i] = tree_low_cst (fold_build1 (ABS_EXPR, gnu_type, + v[i] = tree_to_shwi (fold_build1 (ABS_EXPR, gnu_type, fold_build2 (TRUNC_MOD_EXPR, gnu_type, - gnu_temp, gnu_base)), 0); + gnu_temp, gnu_base))); gnu_temp = fold_build2 (TRUNC_DIV_EXPR, gnu_type, gnu_temp, gnu_base); } Index: gcc/c-family/c-common.c =================================================================== --- gcc/c-family/c-common.c 2013-11-16 13:08:22.531824320 +0000 +++ gcc/c-family/c-common.c 2013-11-16 13:08:46.400005771 +0000 @@ -9721,8 +9721,7 @@ fold_offsetof_1 (tree expr) return error_mark_node; } off = size_binop_loc (input_location, PLUS_EXPR, DECL_FIELD_OFFSET (t), - size_int (tree_low_cst (DECL_FIELD_BIT_OFFSET (t), - 1) + size_int (tree_to_uhwi (DECL_FIELD_BIT_OFFSET (t)) / BITS_PER_UNIT)); break; @@ -10091,7 +10090,7 @@ complete_array_type (tree *ptype, tree i { error ("size of array is too large"); /* If we proceed with the array type as it is, we'll eventually - crash in tree_low_cst(). */ + crash in tree_to_[su]hwi(). */ type = error_mark_node; } Index: gcc/c/c-decl.c =================================================================== --- gcc/c/c-decl.c 2013-11-16 13:08:22.531824320 +0000 +++ gcc/c/c-decl.c 2013-11-16 13:08:24.258837421 +0000 @@ -5912,7 +5912,7 @@ grokdeclarator (const struct c_declarato else error_at (loc, "size of unnamed array is too large"); /* If we proceed with the array type as it is, we'll eventually - crash in tree_low_cst(). */ + crash in tree_to_[su]hwi(). */ type = error_mark_node; } Index: gcc/cp/decl.c =================================================================== --- gcc/cp/decl.c 2013-11-16 13:08:22.531824320 +0000 +++ gcc/cp/decl.c 2013-11-16 13:09:31.845353189 +0000 @@ -5095,8 +5095,7 @@ reshape_init_array_1 (tree elt_type, tre max_index_cst = tree_to_uhwi (max_index); /* sizetype is sign extended, not zero extended. */ else - max_index_cst = tree_low_cst (fold_convert (size_type_node, max_index), - 1); + max_index_cst = tree_to_uhwi (fold_convert (size_type_node, max_index)); } /* Loop until there are no more initializers. */ @@ -10031,7 +10030,7 @@ grokdeclarator (const cp_declarator *dec { error ("size of array %qs is too large", name); /* If we proceed with the array type as it is, we'll eventually - crash in tree_low_cst(). */ + crash in tree_to_[su]hwi(). */ type = error_mark_node; } Index: gcc/expr.h =================================================================== --- gcc/expr.h 2013-11-16 13:08:22.531824320 +0000 +++ gcc/expr.h 2013-11-16 13:08:24.263837459 +0000 @@ -26,8 +26,8 @@ #define GCC_EXPR_H #include "rtl.h" /* For optimize_size */ #include "flags.h" -/* For tree_fits_[su]hwi_p, tree_low_cst, fold_convert, size_binop, ssize_int, - TREE_CODE, TYPE_SIZE, int_size_in_bytes, */ +/* For tree_fits_[su]hwi_p, tree_to_[su]hwi, fold_convert, size_binop, + ssize_int, TREE_CODE, TYPE_SIZE, int_size_in_bytes, */ #include "tree-core.h" /* For GET_MODE_BITSIZE, word_mode */ #include "machmode.h" Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c 2013-11-16 13:08:22.531824320 +0000 +++ gcc/fold-const.c 2013-11-16 13:09:52.781513992 +0000 @@ -11904,7 +11904,7 @@ fold_binary_loc (location_t loc, if (TREE_CODE (TREE_OPERAND (pmop[which], 1)) != INTEGER_CST) break; - /* tree_low_cst not used, because we don't care about + /* tree_to_[su]hwi not used, because we don't care about the upper bits. */ cst0 = TREE_INT_CST_LOW (TREE_OPERAND (pmop[which], 1)); cst0 &= cst1; Index: gcc/expr.c =================================================================== --- gcc/expr.c 2013-11-16 13:08:22.531824320 +0000 +++ gcc/expr.c 2013-11-16 13:08:24.263837459 +0000 @@ -6240,10 +6240,10 @@ store_constructor (tree exp, rtx target, FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (exp), idx, value) { - int n_elts_here = tree_low_cst + int n_elts_here = tree_to_uhwi (int_const_binop (TRUNC_DIV_EXPR, TYPE_SIZE (TREE_TYPE (value)), - TYPE_SIZE (elttype)), 1); + TYPE_SIZE (elttype))); count += n_elts_here; if (mostly_zeros_p (value)) Index: gcc/ipa-utils.h =================================================================== --- gcc/ipa-utils.h 2013-11-16 13:08:22.531824320 +0000 +++ gcc/ipa-utils.h 2013-11-16 13:08:24.266837481 +0000 @@ -117,8 +117,8 @@ possible_polymorphic_call_target_p (tree struct cgraph_node *n) { return possible_polymorphic_call_target_p (obj_type_ref_class (call), - tree_low_cst - (OBJ_TYPE_REF_TOKEN (call), 1), + tree_to_uhwi + (OBJ_TYPE_REF_TOKEN (call)), n); } #endif /* GCC_IPA_UTILS_H */ Index: gcc/stmt.c =================================================================== --- gcc/stmt.c 2013-11-16 13:08:22.531824320 +0000 +++ gcc/stmt.c 2013-11-16 13:08:24.267837489 +0000 @@ -1029,11 +1029,11 @@ emit_case_dispatch_table (tree index_exp value since that should fit in a HOST_WIDE_INT while the actual values may not. */ HOST_WIDE_INT i_low - = tree_low_cst (fold_build2 (MINUS_EXPR, index_type, - n->low, minval), 1); + = tree_to_uhwi (fold_build2 (MINUS_EXPR, index_type, + n->low, minval)); HOST_WIDE_INT i_high - = tree_low_cst (fold_build2 (MINUS_EXPR, index_type, - n->high, minval), 1); + = tree_to_uhwi (fold_build2 (MINUS_EXPR, index_type, + n->high, minval)); HOST_WIDE_INT i; for (i = i_low; i <= i_high; i ++) Index: gcc/tree-switch-conversion.c =================================================================== --- gcc/tree-switch-conversion.c 2013-11-16 13:08:22.531824320 +0000 +++ gcc/tree-switch-conversion.c 2013-11-16 13:08:24.267837489 +0000 @@ -354,15 +354,13 @@ emit_case_bit_tests (gimple swtch, tree else test[k].bits++; - lo = tree_low_cst (int_const_binop (MINUS_EXPR, - CASE_LOW (cs), minval), - 1); + lo = tree_to_uhwi (int_const_binop (MINUS_EXPR, + CASE_LOW (cs), minval)); if (CASE_HIGH (cs) == NULL_TREE) hi = lo; else - hi = tree_low_cst (int_const_binop (MINUS_EXPR, - CASE_HIGH (cs), minval), - 1); + hi = tree_to_uhwi (int_const_binop (MINUS_EXPR, + CASE_HIGH (cs), minval)); for (j = lo; j <= hi; j++) if (j >= HOST_BITS_PER_WIDE_INT)