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: 116844 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4903412qgn; Mon, 23 Oct 2017 10:40:45 -0700 (PDT) X-Received: by 10.99.121.131 with SMTP id u125mr9901378pgc.265.1508780445073; Mon, 23 Oct 2017 10:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508780445; cv=none; d=google.com; s=arc-20160816; b=K6Ed3sCq1ARKVLMFxJt2kiCawmRTpTuf70RluO715SfAVfKo30T5FncGrBpUeZT/JP BMdRAUYl6YYAcFCTjjzzGzw0ZXWoSRd6K1SuTepstcIodNqM+5QDx95J0/dxXyfPHpHj Yo8ig76gktjUWrFJ8b+OlmBV7aGgmxhTzWg1thyjc3EKszgFFrd4h3wSX24+bDQp6P8U 8ebsh/2lAvvD0lCbekcAH1Tw0OASV2+S75pyqnXpOfi01nTq+m4MZ3iWQWJG1M39xjV2 Xthxai+Ygn5N4MSxDSVVHoVEkY5Rn9G4rrBmfQkfslRAKbDaXolKC91GPXq5R8HFjMOW kMjA== 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=TtQTsbcBuYrSIEpPWRIW+fUKjXcBU2DfZ7zeZ2Xnaw8=; b=xmZTPU9n4Kbp/VOwcQIQxDGPShYTJVmXdUQS8axqF46lPxAX7mDvpvwbc0kDfVCT8d qrP2be4LrsQTAsIAf0Wyn2EUweQBFdWmu94SUhLXlsKbvmbMG+aHq2Igv5iDa3+H7s6z lwIOCYnMbgU7/igv7xmOdpiepRRCHCWNJoOZQov2oPrKgSPkVboy1XI+1+0OcguUQ7qj C5abq+3Py7jhXo73zfSlFDI1vskzFxWtAAWWJ4vcGJwxxpK63ZfUT+iZcGZXNVXwftDy siDL0M8SbzI9xbr3zj2VAkz6IV+C3wsQ1n2rUZwBpQ8Ye+n2jFbrgiOFZx//4fh7FxnP FQQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Ik5kvl0t; spf=pass (google.com: domain of gcc-patches-return-464875-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464875-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 o8si5118178pgp.359.2017.10.23.10.40.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:40:45 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464875-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=Ik5kvl0t; spf=pass (google.com: domain of gcc-patches-return-464875-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464875-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=SrConaLnjvnTAPgBl3SbuJlcMuxiG jvy/7kGh1iouv59kLAcC10BM/t+ubSPk1zSpKNbRpSMt1TUNrAXDyZAEZ6+DPMXM 4WgijTiSO5V5HOAx5pY6+T592RSh6dM2fC4BB3T8SloPOC4zqHDdih/TpQP7AHUX GlJuxl4Dxn7KbM= 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=Ik5 kvl0tzsodFaptS+GAoMUMlMUFgPjDwuK/9x8vucyz2ZsbgOlMZS0PmThB0jCTxxQ w/g5QC5XmpZQlyLHhNtjQp7kk6bjVPo9XGmXl+6oe6qwzmzb8sMac/YgXsmN8umZ jwqqQDm/jqhTiLMmMKRcSwkLY/6VhqrBVurEeN8E= 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. */