From patchwork Mon Oct 23 17:18:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 116786 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4884301qgn; Mon, 23 Oct 2017 10:19:03 -0700 (PDT) X-Received: by 10.159.218.9 with SMTP id v9mr10473852plp.92.1508779143563; Mon, 23 Oct 2017 10:19:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508779143; cv=none; d=google.com; s=arc-20160816; b=zAWvoA4/KNcigVNm/8crTaXwKLgabu42aXYhadkngANnhNLu+KnxhsFQb1mRwE0O7o HkSufjj6RetBqlmU74roPp5MwsguuFxDQOEtLX5Ifim9LNAp2rnZ7o5Z3MllGnQLQgmX a5Ed7cOaulFvI6Gp+v4XAHPJF1YBFwnAjbhH/ObH4v3iES8qEVlXzek7CrZhDT1GqKT5 B5fli4SVab11Cdr6eBk0GcYkwT120XUvQ5jN3YE1sVmfEBimQivnkwmTDPSnh8rrUhCH LrflxFqVjlfeh3tKWuMCywvcCIP5OHMjHQt8vBsDE1XMBAV6t2nyC2SnBH3NCwJBMFW3 uS3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:mail-followup-to:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=a5pDCY58YALwxZZKLMeODDKNqZ1jkq84EMFMAVOciRM=; b=nkhOeO5QdsiFCLGlvEv67X35xNMniKpfjouloIGYcJBGmLGUPVrP5OBt/UuSrAww5S WFtIqoaQjmraLr2k0n9xz4McBgJV3CNYJeuKksKTd5+CPM6CuIgZwNzZneIMNplFNwbw SAxs3qNnvdicfnwoLaQ8miqU0ieMjkk2HhWRjQlxVnB2QRDCGSg8f0mOza0FaWvWiK7x poegXhjZ6MsNJ3KW5O27KdOMby3oOYAXRiuB5TK1vZUCkIq7nueczqSgoZPt1eInrSLF al2IINtUdq+vIY4kvBOSRYmnC3hu7/0j+sNifeYFeoT1KHzgn+1Hxl1ZU3J1JCe/AV48 nL+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=pX4vOG9m; spf=pass (google.com: domain of gcc-patches-return-464818-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464818-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id j16si4259901pli.353.2017.10.23.10.19.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:19:03 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464818-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=pX4vOG9m; spf=pass (google.com: domain of gcc-patches-return-464818-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464818-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=emlzlMfbbfZ9j5NAaOA5N3rzBHFwq Cx7v/eRkRQq6v3v5vnitlfqAwDMQ9ybcmhXDTOHBpgGd/xBCII4mX1PVfWa2iW+6 h8wdQkUYDxZsDmvBLnELc9Rt+GVyb+GTTsFQro5FnKH+FsDxYiF8WpkB9PZehXpA CKYZhmFM81C+4k= 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=JlCQBcUOkcftM3FGzJ1B2cwJNds=; b=pX4 vOG9mLwkYxLSOqDvdteJ65UYcvlZ/U+YKVzUITT7CEYnUS2iQ6I1MDKXdG0n4+Ig +5zerJXSAjYsnOceFz7TOj9n2T3CiLqjjE75842iG1nPnl+owhZdB/j/RH+IUZRO oUJOFae4RbXWss/zIQmUxwnCaSqw1Hi/Xk4FJC1g= Received: (qmail 70061 invoked by alias); 23 Oct 2017 17:18:27 -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 69921 invoked by uid 89); 23 Oct 2017 17:18:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f53.google.com Received: from mail-wm0-f53.google.com (HELO mail-wm0-f53.google.com) (74.125.82.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:18:25 +0000 Received: by mail-wm0-f53.google.com with SMTP id 78so8406458wmb.1 for ; Mon, 23 Oct 2017 10:18:24 -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=a5pDCY58YALwxZZKLMeODDKNqZ1jkq84EMFMAVOciRM=; b=U8sfq/FNbcW8AD/e8Ow06vO8CCk1tisdXS9j3HTvq3/bo4y98Jn1dn6gNKSi4VHpBs B84n2MReKo1P2Mt4ugyRW/b0GngFloFZdcNe0Q47A7HdlYyEeORSx1qv5Iech4oVZH/7 ku/qzhQH3iAHeLn3p3kaHQqu4dKogwkTkNTRAjpbRSxvB7BTj7MqA3gg3zTXZO5g26yK KABdhO7D++ctZVlwMM+zkVa6y1JOAIjEBoHxXEyukLpXt5hDC4DG7TxZpezmHK3mBOfR yPeKVP3i4ImBN657QrdGuYQqY4JfMpfXls7Km+ZlVvtIPzOCbYvHdGSWzdz5WS1wHUBa CBpw== X-Gm-Message-State: AMCzsaUoADOX+pW0yEwdlcSL2meq4kLh5h/IMVmir8LIcoQ0dKyDR49o PcgAWeHBKJcfKiAPWYVazcmZ2MF8wko= X-Google-Smtp-Source: ABhQp+RJYnKvRerHIKuF/kn3B2mJj3g+DXE6ahs30EayfBVRNdNis40DiV4pD6EfhPkYa7ic9DimzA== X-Received: by 10.28.132.66 with SMTP id g63mr3834920wmd.22.1508779102894; Mon, 23 Oct 2017 10:18:22 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id t6sm3353wra.28.2017.10.23.10.18.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:18: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: [042/nnn] poly_int: reload1.c References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:18:21 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87tvypn5pe.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes a few small poly_int64 changes to reload1.c, mostly related to eliminations. Again, there's no real expectation that reload will be used for targets that have polynomial-sized modes, but it seemed easier to convert it anyway. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * reload1.c (elim_table): Change initial_offset, offset and previous_offset from HOST_WIDE_INT to poly_int64_pod. (offsets_at): Change the target array's element type from HOST_WIDE_INT to poly_int64_pod. (set_label_offsets, eliminate_regs_1, eliminate_regs_in_insn) (elimination_costs_in_insn, update_eliminable_offsets) (verify_initial_elim_offsets, set_offsets_for_label) (init_eliminable_invariants): Update after above changes. Index: gcc/reload1.c =================================================================== --- gcc/reload1.c 2017-10-23 17:18:51.486721146 +0100 +++ gcc/reload1.c 2017-10-23 17:18:52.641619623 +0100 @@ -261,13 +261,13 @@ struct elim_table { int from; /* Register number to be eliminated. */ int to; /* Register number used as replacement. */ - HOST_WIDE_INT initial_offset; /* Initial difference between values. */ + poly_int64_pod initial_offset; /* Initial difference between values. */ int can_eliminate; /* Nonzero if this elimination can be done. */ int can_eliminate_previous; /* Value returned by TARGET_CAN_ELIMINATE target hook in previous scan over insns made by reload. */ - HOST_WIDE_INT offset; /* Current offset between the two regs. */ - HOST_WIDE_INT previous_offset;/* Offset at end of previous insn. */ + poly_int64_pod offset; /* Current offset between the two regs. */ + poly_int64_pod previous_offset; /* Offset at end of previous insn. */ int ref_outside_mem; /* "to" has been referenced outside a MEM. */ rtx from_rtx; /* REG rtx for the register to be eliminated. We cannot simply compare the number since @@ -313,7 +313,7 @@ #define NUM_ELIMINABLE_REGS ARRAY_SIZE ( static int first_label_num; static char *offsets_known_at; -static HOST_WIDE_INT (*offsets_at)[NUM_ELIMINABLE_REGS]; +static poly_int64_pod (*offsets_at)[NUM_ELIMINABLE_REGS]; vec *reg_equivs; @@ -2351,9 +2351,9 @@ set_label_offsets (rtx x, rtx_insn *insn where the offsets disagree. */ for (i = 0; i < NUM_ELIMINABLE_REGS; i++) - if (offsets_at[CODE_LABEL_NUMBER (x) - first_label_num][i] - != (initial_p ? reg_eliminate[i].initial_offset - : reg_eliminate[i].offset)) + if (may_ne (offsets_at[CODE_LABEL_NUMBER (x) - first_label_num][i], + (initial_p ? reg_eliminate[i].initial_offset + : reg_eliminate[i].offset))) reg_eliminate[i].can_eliminate = 0; return; @@ -2436,7 +2436,7 @@ set_label_offsets (rtx x, rtx_insn *insn /* If we reach here, all eliminations must be at their initial offset because we are doing a jump to a variable address. */ for (p = reg_eliminate; p < ®_eliminate[NUM_ELIMINABLE_REGS]; p++) - if (p->offset != p->initial_offset) + if (may_ne (p->offset, p->initial_offset)) p->can_eliminate = 0; break; @@ -2593,8 +2593,9 @@ eliminate_regs_1 (rtx x, machine_mode me We special-case the commonest situation in eliminate_regs_in_insn, so just replace a PLUS with a PLUS here, unless inside a MEM. */ - if (mem_mode != 0 && CONST_INT_P (XEXP (x, 1)) - && INTVAL (XEXP (x, 1)) == - ep->previous_offset) + if (mem_mode != 0 + && CONST_INT_P (XEXP (x, 1)) + && must_eq (INTVAL (XEXP (x, 1)), -ep->previous_offset)) return ep->to_rtx; else return gen_rtx_PLUS (Pmode, ep->to_rtx, @@ -3344,7 +3345,7 @@ eliminate_regs_in_insn (rtx_insn *insn, if (plus_cst_src) { rtx reg = XEXP (plus_cst_src, 0); - HOST_WIDE_INT offset = INTVAL (XEXP (plus_cst_src, 1)); + poly_int64 offset = INTVAL (XEXP (plus_cst_src, 1)); if (GET_CODE (reg) == SUBREG) reg = SUBREG_REG (reg); @@ -3364,7 +3365,7 @@ eliminate_regs_in_insn (rtx_insn *insn, increase the cost of the insn by replacing a simple REG with (plus (reg sp) CST). So try only when we already had a PLUS before. */ - if (offset == 0 || plus_src) + if (known_zero (offset) || plus_src) { rtx new_src = plus_constant (GET_MODE (to_rtx), to_rtx, offset); @@ -3562,12 +3563,12 @@ eliminate_regs_in_insn (rtx_insn *insn, for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++) { - if (ep->previous_offset != ep->offset && ep->ref_outside_mem) + if (may_ne (ep->previous_offset, ep->offset) && ep->ref_outside_mem) ep->can_eliminate = 0; ep->ref_outside_mem = 0; - if (ep->previous_offset != ep->offset) + if (may_ne (ep->previous_offset, ep->offset)) val = 1; } @@ -3733,7 +3734,7 @@ elimination_costs_in_insn (rtx_insn *ins for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++) { - if (ep->previous_offset != ep->offset && ep->ref_outside_mem) + if (may_ne (ep->previous_offset, ep->offset) && ep->ref_outside_mem) ep->can_eliminate = 0; ep->ref_outside_mem = 0; @@ -3758,7 +3759,7 @@ update_eliminable_offsets (void) for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++) { ep->previous_offset = ep->offset; - if (ep->can_eliminate && ep->offset != ep->initial_offset) + if (ep->can_eliminate && may_ne (ep->offset, ep->initial_offset)) num_not_at_initial_offset++; } } @@ -3812,7 +3813,7 @@ mark_not_eliminable (rtx dest, const_rtx static bool verify_initial_elim_offsets (void) { - HOST_WIDE_INT t; + poly_int64 t; struct elim_table *ep; if (!num_eliminable) @@ -3822,7 +3823,7 @@ verify_initial_elim_offsets (void) for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++) { INITIAL_ELIMINATION_OFFSET (ep->from, ep->to, t); - if (t != ep->initial_offset) + if (may_ne (t, ep->initial_offset)) return false; } @@ -3893,7 +3894,7 @@ set_offsets_for_label (rtx_insn *insn) { ep->offset = ep->previous_offset = offsets_at[label_nr - first_label_num][i]; - if (ep->can_eliminate && ep->offset != ep->initial_offset) + if (ep->can_eliminate && may_ne (ep->offset, ep->initial_offset)) num_not_at_initial_offset++; } } @@ -4095,7 +4096,8 @@ init_eliminable_invariants (rtx_insn *fi /* Allocate the tables used to store offset information at labels. */ offsets_known_at = XNEWVEC (char, num_labels); - offsets_at = (HOST_WIDE_INT (*)[NUM_ELIMINABLE_REGS]) xmalloc (num_labels * NUM_ELIMINABLE_REGS * sizeof (HOST_WIDE_INT)); + offsets_at = (poly_int64_pod (*)[NUM_ELIMINABLE_REGS]) + xmalloc (num_labels * NUM_ELIMINABLE_REGS * sizeof (poly_int64)); /* Look for REG_EQUIV notes; record what each pseudo is equivalent to. If DO_SUBREGS is true, also find all paradoxical subregs and