From patchwork Tue Jan 16 10:52:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 124651 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp970063lje; Tue, 16 Jan 2018 02:53:00 -0800 (PST) X-Google-Smtp-Source: ACJfBoviIk/3eCUeU/+/VQz4z+CeE3kSkmXPcAadMA14J26IiAjtGBEfYoupXMCX1wAA7R3vAO4V X-Received: by 10.99.157.207 with SMTP id i198mr29738249pgd.353.1516099979920; Tue, 16 Jan 2018 02:52:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516099979; cv=none; d=google.com; s=arc-20160816; b=OKh/t7G/693tVv3ts21+f4A3fIq2tTvDtsr6o09UVZwxbXxJGyJacsUQMFmg1qXlX5 /iMXp1COKWMPZ+E56al+x0GR/JS5/DPKuL4oubiDLGA8fV5aUkrC0y0ctAotPhwx4eT0 idX4d6XpUMhvWuuxdun4fBDjIrfRl516Ag/Gmuq0M5OzAY28nsXr8WsBCiHJIKmt+2Q0 0uaJ5a0UCsp+6Injm+Yc0EXcnFI8gCXyUzi4immP73x0An0Y2vLqGGSM4ADy96+pvOQ9 7dbpZCC5IWsva4JVd63gX8Zo6+HN5vmy991is9EPkWWVujBuMunQdCJ9TWC21IkfQ7/R Fbew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:date:subject:cc: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=WOi715WkAhU4lQ8DTv6Qt3DIxmm4VxXCbgbn21JbQJY=; b=p7aQTinLXMW3bep94C1Kg3yaJvsi7qevOU46BMc1tER8X5JOVvxfZN6sR2/txAA9pS Ji9jyX8kQkSl2CiBrPqlKip0SpNP400IthhjTg61d3bDm0oaiVeZbGpeO4E5FY1QyQCO 7ZgTgOk6sbfl0tbx9eOl6mglD6HAbFs3NLVmChsm5h6Jw0XRy/80NrwSEEHC7eEmAyRh p8SGcNgJPz0N243rNuuAScSSjrJeXSVgnSEo57wCqeHJYbxoOe7LZLRwtOHiWuCW/SBi hJqoPCUNvMiVK+M8GLX8DdbEApjwA1ENAAg0VGx0fDJ1Oj57S4Sf1L05A3vzTjComfct +CfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Zs9d2Fai; spf=pass (google.com: domain of gcc-patches-return-471355-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-471355-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 e3si1434003pgt.217.2018.01.16.02.52.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jan 2018 02:52:59 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-471355-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=Zs9d2Fai; spf=pass (google.com: domain of gcc-patches-return-471355-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-471355-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:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=nvg47v5gouc6sHKEcJAEIC3dkWlwckZUHnEjEP2a9lRdDoVAAu mbAaBeUN9LH7I4LexZwrK9NFCjCPoNz2fzVFNFXUOgbZoXY1PuaASJ95KIeqcQlM BlX/KRcJGFIinBVjafLd14lB42tSoROzPI+LZYkFD2Q5z1c+5eyAgsGNM= 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:cc:subject:date:message-id:mime-version:content-type; s= default; bh=1np9DmG/Zf+MkG5MBIbd1dx1/vE=; b=Zs9d2Fai4Qm/yxKFKuwO bVQ98NXV3PuoQ1/GIpglh8mhrA85ECZeV8MBWN9zxYOuTizATlrRFxSqdjNRBYKQ pihqAFBm7vldnbjceSeKATnw4a72+Gdk7m7ocgFxyvRcV6zqqjab6FfCUJL+siVp KMuavTOLU+BOawh78AetsfU= Received: (qmail 16492 invoked by alias); 16 Jan 2018 10:52:48 -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 16459 invoked by uid 89); 16 Jan 2018 10:52:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=H*p:D*org X-HELO: mail-wm0-f67.google.com Received: from mail-wm0-f67.google.com (HELO mail-wm0-f67.google.com) (74.125.82.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Jan 2018 10:52:36 +0000 Received: by mail-wm0-f67.google.com with SMTP id g1so7405417wmg.2 for ; Tue, 16 Jan 2018 02:52:36 -0800 (PST) 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:cc:subject:date :message-id:user-agent:mime-version; bh=WOi715WkAhU4lQ8DTv6Qt3DIxmm4VxXCbgbn21JbQJY=; b=mkS8UK8eFSSP7fLIyJRO0TgWdeYgqqJnzzOHim127trpps/DgSN3KzRiPT5yDLnAiB 51vk1odU11XvbO8h7L79GTFasnkN+ToQl7O+3SYuiN9Zz2LkGWY1yVY7zt+ml8Rk4JEP ALxmJNiCHniHrJqZyn7Pj4w7CDQdDzNUkMCIUrbtq2NRVYn7s6OWh08TY3FVEWkBhfPW mq36Nln+pjA7KCwAqWxh3GOD8As3IuiH8aM+mUSCqfFhwl6yh7suU9k/kFA0Aw7vwWzd p4vmkMMMY6xzFGmwJBOABUoM9MOd28zJOd4gKTn4OOAVsGI3RcBrJvF5rHBGEZxbUjiM HlWg== X-Gm-Message-State: AKwxytdEAQI7/2QGQvnR8HqyuTSnirlg0TpQXus69m7OoVFMdp5nKEJh 7sBMybF+xJcJQWtNYu/vBwG3qA== X-Received: by 10.28.191.132 with SMTP id o4mr11746991wmi.74.1516099954493; Tue, 16 Jan 2018 02:52:34 -0800 (PST) Received: from localhost ([95.144.14.233]) by smtp.gmail.com with ESMTPSA id o107sm2410355wrc.63.2018.01.16.02.52.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jan 2018 02:52:33 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, law@redhat.com, dave.anglin@bell.net, richard.sandiford@linaro.org Cc: law@redhat.com, dave.anglin@bell.net Subject: Move pa.h FUNCTION_ARG_SIZE to pa.c (PR83858) Date: Tue, 16 Jan 2018 10:52:32 +0000 Message-ID: <87lggyxehb.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 The port-local FUNCTION_ARG_SIZE: ((((MODE) != BLKmode \ ? (HOST_WIDE_INT) GET_MODE_SIZE (MODE) \ : int_size_in_bytes (TYPE)) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) is used by code in pa.c and by ASM_DECLARE_FUNCTION_NAME in som.h. Treating GET_MODE_SIZE as a constant is OK for the former but not the latter, which is used in target-independent code. This caused a build failure on hppa2.0w-hp-hpux11.11. Tested with a cross build of hppa2.0w-hp-hpux11.11. OK to install? Richard 2018-01-16 Richard Sandiford gcc/ PR target/83858 * config/pa/pa.h (FUNCTION_ARG_SIZE): Delete. * config/pa/pa-protos.h (pa_function_arg_size): Declare. * config/pa/som.h (ASM_DECLARE_FUNCTION_NAME): Use pa_function_arg_size instead of FUNCTION_ARG_SIZE. * config/pa/pa.c (pa_function_arg_advance): Likewise. (pa_function_arg, pa_arg_partial_bytes): Likewise. (pa_function_arg_size): New function. Index: gcc/config/pa/pa.h =================================================================== --- gcc/config/pa/pa.h 2018-01-03 11:12:55.202783713 +0000 +++ gcc/config/pa/pa.h 2018-01-16 10:50:31.245063090 +0000 @@ -592,15 +592,6 @@ #define INIT_CUMULATIVE_INCOMING_ARGS(CU (CUM).indirect = 0, \ (CUM).nargs_prototype = 1000 -/* Figure out the size in words of the function argument. The size - returned by this macro should always be greater than zero because - we pass variable and zero sized objects by reference. */ - -#define FUNCTION_ARG_SIZE(MODE, TYPE) \ - ((((MODE) != BLKmode \ - ? (HOST_WIDE_INT) GET_MODE_SIZE (MODE) \ - : int_size_in_bytes (TYPE)) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) - /* Determine where to put an argument to a function. Value is zero to push the argument on the stack, or a hard register in which to store the argument. Index: gcc/config/pa/pa-protos.h =================================================================== --- gcc/config/pa/pa-protos.h 2018-01-03 11:12:55.198783870 +0000 +++ gcc/config/pa/pa-protos.h 2018-01-16 10:50:31.244063125 +0000 @@ -107,5 +107,6 @@ extern void pa_asm_output_aligned_local unsigned int); extern void pa_hpux_asm_output_external (FILE *, tree, const char *); extern HOST_WIDE_INT pa_initial_elimination_offset (int, int); +extern HOST_WIDE_INT pa_function_arg_size (machine_mode, const_tree); extern const int pa_magic_milli[]; Index: gcc/config/pa/som.h =================================================================== --- gcc/config/pa/som.h 2018-01-03 11:12:55.191784145 +0000 +++ gcc/config/pa/som.h 2018-01-16 10:50:31.246063055 +0000 @@ -136,8 +136,8 @@ #define ASM_DECLARE_FUNCTION_NAME(FILE, else \ { \ int arg_size = \ - FUNCTION_ARG_SIZE (TYPE_MODE (DECL_ARG_TYPE (parm)),\ - DECL_ARG_TYPE (parm)); \ + pa_function_arg_size (TYPE_MODE (DECL_ARG_TYPE (parm)),\ + DECL_ARG_TYPE (parm)); \ /* Passing structs by invisible reference uses \ one general register. */ \ if (arg_size > 2 \ Index: gcc/config/pa/pa.c =================================================================== --- gcc/config/pa/pa.c 2018-01-03 11:12:55.201783752 +0000 +++ gcc/config/pa/pa.c 2018-01-16 10:50:31.245063090 +0000 @@ -9485,7 +9485,7 @@ pa_function_arg_advance (cumulative_args const_tree type, bool named ATTRIBUTE_UNUSED) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - int arg_size = FUNCTION_ARG_SIZE (mode, type); + int arg_size = pa_function_arg_size (mode, type); cum->nargs_prototype--; cum->words += (arg_size @@ -9517,7 +9517,7 @@ pa_function_arg (cumulative_args_t cum_v if (mode == VOIDmode) return NULL_RTX; - arg_size = FUNCTION_ARG_SIZE (mode, type); + arg_size = pa_function_arg_size (mode, type); /* If this arg would be passed partially or totally on the stack, then this routine should return zero. pa_arg_partial_bytes will @@ -9724,10 +9724,10 @@ pa_arg_partial_bytes (cumulative_args_t if (!TARGET_64BIT) return 0; - if (FUNCTION_ARG_SIZE (mode, type) > 1 && (cum->words & 1)) + if (pa_function_arg_size (mode, type) > 1 && (cum->words & 1)) offset = 1; - if (cum->words + offset + FUNCTION_ARG_SIZE (mode, type) <= max_arg_words) + if (cum->words + offset + pa_function_arg_size (mode, type) <= max_arg_words) /* Arg fits fully into registers. */ return 0; else if (cum->words + offset >= max_arg_words) @@ -10835,4 +10835,16 @@ pa_starting_frame_offset (void) return 8; } +/* Figure out the size in words of the function argument. The size + returned by this macro should always be greater than zero because + we pass variable and zero sized objects by reference. */ + +HOST_WIDE_INT +pa_function_arg_size (machine_mode mode, const_tree type) +{ + if (mode != BLKmode) + return GET_MODE_SIZE (mode); + return CEIL (int_size_in_bytes (type), UNITS_PER_WORD); +} + #include "gt-pa.h"