From patchwork Mon Oct 23 17:40:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 829527 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-464875-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Dhs0G0dE"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yLNwS1symz9s7F for ; Tue, 24 Oct 2017 04:40:40 +1100 (AEDT) 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=y1ahzOj6uBxivYcdDhFyQeTKpLDTX SHdrdEO6saBnRF9cRIXd1WnAeFIGmIQ5BBo1204QHAZOsKnlMfS18XKAmNMyxa/a 8qAvZ4sCtaXXMg04TFHGy9fSDdNI7VMEu41WUTbptoXZalRTz8Jc62Z8OPWkP1MK lWuGX46qIWNVAs= 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=1uZY5YU+61bku4LM7PohJoXh78E=; b=Dhs 0G0dEnrISOmClpjeXkUJLmQkEAndP1+AN91frTERmSFgQwCLoiJf2JU14WXAVkSH DyjRHjVKLnaCifikLn7DdipEgJMh3H/EXc5QMtXai/U7mhDvY7GDt+ity7aDtBF2 VSH44A5LNU/+nAZecdBqVjnf4g3Wbp7JdHOQno9c= Received: (qmail 119569 invoked by alias); 23 Oct 2017 17:40:30 -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 119552 invoked by uid 89); 23 Oct 2017 17:40:30 -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=099 X-HELO: mail-wr0-f174.google.com Received: from mail-wr0-f174.google.com (HELO mail-wr0-f174.google.com) (209.85.128.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:40:28 +0000 Received: by mail-wr0-f174.google.com with SMTP id 15so4381668wrb.5 for ; Mon, 23 Oct 2017 10:40:28 -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=TtQTsbcBuYrSIEpPWRIW+fUKjXcBU2DfZ7zeZ2Xnaw8=; b=H2YatHqKO8DyujAKB2OjcYYKbMZK6kg4genwfgEq2hTaXHGsCaNU43GhUiXbH2J4J/ KhQI1Y0pbYMr/D+Ksyx/Q04148GfO6ScXeOfpObUjcpFAETwTgVy3wGcR/ytpeT5Gp/b uKd98yqZMuEwSCNEAQ0rskoVQblu4JCABtsgHVUXR7w4tJScG7Mhr4z9uNsDWgpfFtyV u+oGJ7YZX8lXkW4gc5sraCqEOtc7phw/8wH/0V4spOK7Na85LgMiTybNTqWa+IMXWvdh eLlqFV3TlH+Qj0eVn9SHYyiluBM4FcXzdA93hbZrrqO7HfbemvKXho+893jb7RTJDS8C mXeA== X-Gm-Message-State: AMCzsaUlnqDvjoD8/fJcwr0AtDG/bT20KS3GQJ59k34XtUOB0IsTcZUU MTTUDemrhcAcFcEO/S4Jvx6w1l2yAPY= X-Google-Smtp-Source: ABhQp+SP6Gm52wrI5ZxIjo9zqSsSwkLOa8w9nmSYeAhhYa5rBWujl62Xs/peF39p0jBfYanQBr6AQQ== X-Received: by 10.223.157.40 with SMTP id k40mr6447203wre.153.1508780426577; Mon, 23 Oct 2017 10:40:26 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id m138sm4976440wmd.29.2017.10.23.10.40.25 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:40:25 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [099/nnn] poly_int: struct_value_size References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:40:25 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87wp3ldapi.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes calls.c treat struct_value_size (one of the operands to a call pattern) as polynomial. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * calls.c (emit_call_1, expand_call): Change struct_value_size from a HOST_WIDE_INT to a poly_int64. Index: gcc/calls.c =================================================================== --- gcc/calls.c 2017-10-23 17:25:45.501604113 +0100 +++ gcc/calls.c 2017-10-23 17:25:46.488568637 +0100 @@ -377,7 +377,7 @@ emit_call_1 (rtx funexp, tree fntree ATT tree funtype ATTRIBUTE_UNUSED, poly_int64 stack_size ATTRIBUTE_UNUSED, poly_int64 rounded_stack_size, - HOST_WIDE_INT struct_value_size ATTRIBUTE_UNUSED, + poly_int64 struct_value_size ATTRIBUTE_UNUSED, rtx next_arg_reg ATTRIBUTE_UNUSED, rtx valreg, int old_inhibit_defer_pop, rtx call_fusage, int ecf_flags, cumulative_args_t args_so_far ATTRIBUTE_UNUSED) @@ -437,7 +437,8 @@ emit_call_1 (rtx funexp, tree fntree ATT next_arg_reg, NULL_RTX); else pat = targetm.gen_sibcall (funmem, rounded_stack_size_rtx, - next_arg_reg, GEN_INT (struct_value_size)); + next_arg_reg, + gen_int_mode (struct_value_size, Pmode)); } /* If the target has "call" or "call_value" insns, then prefer them if no arguments are actually popped. If the target does not have @@ -470,7 +471,7 @@ emit_call_1 (rtx funexp, tree fntree ATT next_arg_reg, NULL_RTX); else pat = targetm.gen_call (funmem, rounded_stack_size_rtx, next_arg_reg, - GEN_INT (struct_value_size)); + gen_int_mode (struct_value_size, Pmode)); } emit_insn (pat); @@ -3048,7 +3049,7 @@ expand_call (tree exp, rtx target, int i /* Size of aggregate value wanted, or zero if none wanted or if we are using the non-reentrant PCC calling convention or expecting the value in registers. */ - HOST_WIDE_INT struct_value_size = 0; + poly_int64 struct_value_size = 0; /* Nonzero if called function returns an aggregate in memory PCC style, by returning the address of where to find it. */ int pcc_struct_value = 0; @@ -3210,7 +3211,8 @@ expand_call (tree exp, rtx target, int i } #else /* not PCC_STATIC_STRUCT_RETURN */ { - struct_value_size = int_size_in_bytes (rettype); + if (!poly_int_tree_p (TYPE_SIZE_UNIT (rettype), &struct_value_size)) + struct_value_size = -1; /* Even if it is semantically safe to use the target as the return slot, it may be not sufficiently aligned for the return type. */