From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42305 invoked by alias); 23 Oct 2017 17:22:27 -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 41721 invoked by uid 89); 23 Oct 2017 17:22:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=32447, 053 X-HELO: mail-wr0-f177.google.com Received: from mail-wr0-f177.google.com (HELO mail-wr0-f177.google.com) (209.85.128.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:22:25 +0000 Received: by mail-wr0-f177.google.com with SMTP id z55so12097568wrz.1 for ; Mon, 23 Oct 2017 10:22:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=GI7MOGEWYjI2bh7fH28czt+FtxGPekg+uRrz+K3XEkQ=; b=ir5uXogiqEwiayZ6bFdLMHyGyCyIwSSUWfOgTrmJuPCm44Ap3e4YXw1PxdelALAVNo W5i6tiD1txCJuUEkscPf3cBE/tE76nYK9uGsLhvtF7J6ZnJZxwx7ArhemfemROBAgohV XfvYovkaHHB22+9x0JVcKoELR90TkCFNvSyIPaveDvT8S64S3QFlT4i709i1Psezwytg bCnn9R4P5Pxi9WmdZSRRJuTrKHKYOzih0UalZi/RcbSnbUPwo/qIxhPjmvtE6y/ZHsUE FyK6MxAK4ETqKNsScWau9xd4YQRnsdcKGvAiJGjC0Gpj+qyArQefK/gh+pH8pX3tsmec HxrA== X-Gm-Message-State: AMCzsaUJwnSCgggEz7IlxgsDp2/xdpjQgIIyI/m/NMdm0KpGeQKb8/+U zNbSsKZ0yQKEf2Oqv4PaC4h5+HsY1mU= X-Google-Smtp-Source: ABhQp+RtRre1gQfXd2bO/3H6gk5AVfLzww6FO7etKRPQ0V3hmgn+IzXJNDismWc/2A3+Pqr1bwnjzw== X-Received: by 10.223.169.167 with SMTP id b36mr13329259wrd.61.1508779343698; Mon, 23 Oct 2017 10:22:23 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id v9sm6178225wre.12.2017.10.23.10.22.22 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:22:22 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [053/nnn] poly_int: decode_addr_const References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 17:22:00 -0000 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87inf5lqy9.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2017-10/txt/msg01554.txt.bz2 This patch makes the varasm-local addr_const track polynomial offsets. I'm not sure how useful this is, but it was easier to convert than not. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * varasm.c (addr_const::offset): Change from HOST_WIDE_INT to poly_int64. (decode_addr_const): Update accordingly. Index: gcc/varasm.c =================================================================== --- gcc/varasm.c 2017-10-23 17:11:39.974428235 +0100 +++ gcc/varasm.c 2017-10-23 17:20:52.530629696 +0100 @@ -2873,29 +2873,31 @@ assemble_real (REAL_VALUE_TYPE d, scalar struct addr_const { rtx base; - HOST_WIDE_INT offset; + poly_int64 offset; }; static void decode_addr_const (tree exp, struct addr_const *value) { tree target = TREE_OPERAND (exp, 0); - int offset = 0; + poly_int64 offset = 0; rtx x; while (1) { + poly_int64 bytepos; if (TREE_CODE (target) == COMPONENT_REF - && tree_fits_shwi_p (byte_position (TREE_OPERAND (target, 1)))) + && poly_int_tree_p (byte_position (TREE_OPERAND (target, 1)), + &bytepos)) { - offset += int_byte_position (TREE_OPERAND (target, 1)); + offset += bytepos; target = TREE_OPERAND (target, 0); } else if (TREE_CODE (target) == ARRAY_REF || TREE_CODE (target) == ARRAY_RANGE_REF) { offset += (tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (target))) - * tree_to_shwi (TREE_OPERAND (target, 1))); + * tree_to_poly_int64 (TREE_OPERAND (target, 1))); target = TREE_OPERAND (target, 0); } else if (TREE_CODE (target) == MEM_REF @@ -3042,14 +3044,14 @@ const_hash_1 (const tree exp) case SYMBOL_REF: /* Don't hash the address of the SYMBOL_REF; only use the offset and the symbol name. */ - hi = value.offset; + hi = value.offset.coeffs[0]; p = XSTR (value.base, 0); for (i = 0; p[i] != 0; i++) hi = ((hi * 613) + (unsigned) (p[i])); break; case LABEL_REF: - hi = (value.offset + hi = (value.offset.coeffs[0] + CODE_LABEL_NUMBER (label_ref_label (value.base)) * 13); break; @@ -3242,7 +3244,7 @@ compare_constant (const tree t1, const t decode_addr_const (t1, &value1); decode_addr_const (t2, &value2); - if (value1.offset != value2.offset) + if (may_ne (value1.offset, value2.offset)) return 0; code = GET_CODE (value1.base);