From patchwork Fri Jan 15 14:17:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Lawrence X-Patchwork-Id: 568115 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 8DC8B140C05 for ; Sat, 16 Jan 2016 01:18:16 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ZzAlr7cZ; dkim-atps=neutral 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:in-reply-to:references; q=dns; s= default; b=aelTiswUUzbgVg2Zc51rR83RJKhvQHB+SxLvdswF0NjVIUmkVHP9c OE2AXYlgpchQrKQBDy2K1gjISRBo++oc61f8zviSas7Yx/T8fVcNwu94qoVcKYdP GtQ80WJtys7QlguhY1JRdSqDx6xOJIkYzyIbGnTsBhR7V01U99KLyM= 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:in-reply-to:references; s= default; bh=gkFuzXeaHENLz5G7ZzHK4Y8rhnQ=; b=ZzAlr7cZQbSDiuIIsjL+ 8Sz7SBbtv4gAIpHqVYvvgzs6C31n9U116YPlW5+p30vYbKZm25rTLGQaVY+y1sZP rba/PicWKAdlKoc/9tKo0zuzOEu+oUj7OboMZ9neaQAWeF5DxSDJbPWBH+VWhqj8 1ZweGP7FG+w7otOFJ3O8RHc= Received: (qmail 109300 invoked by alias); 15 Jan 2016 14:18:07 -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 109198 invoked by uid 89); 15 Jan 2016 14:18:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=UD:aarch64.c, aarch64.c, aarch64c, Hx-languages-length:1511 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Jan 2016 14:18:05 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5E9C946A; Fri, 15 Jan 2016 06:17:27 -0800 (PST) Received: from arm.com (e105915-lin.emea.arm.com [10.2.206.30]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A87C23F246; Fri, 15 Jan 2016 06:18:02 -0800 (PST) From: Alan Lawrence To: gcc-patches@gcc.gnu.org Cc: marcus.shawcroft@arm.com, james.greenhalgh@arm.com, richard.earnshaw@arm.com, charlet@adacore.com, ebotcazou@libertysurf.fr Subject: [PATCH 1/2][AArch64] Implement AAPCS64 updates for alignment attribute Date: Fri, 15 Jan 2016 14:17:42 +0000 Message-Id: <1452867463-30768-2-git-send-email-alan.lawrence@arm.com> In-Reply-To: <1452867463-30768-1-git-send-email-alan.lawrence@arm.com> References: <1452867463-30768-1-git-send-email-alan.lawrence@arm.com> X-IsSubscribed: yes gcc/ChangeLog: * gcc/config/aarch64/aarch64.c (aarch64_function_arg_alignment): Rewrite, looking one level down for records and arrays. --- gcc/config/aarch64/aarch64.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index ae4cfb3..8eb8c3e 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1925,22 +1925,24 @@ aarch64_vfp_is_call_candidate (cumulative_args_t pcum_v, machine_mode mode, static unsigned int aarch64_function_arg_alignment (machine_mode mode, const_tree type) { - unsigned int alignment; + if (!type) + return GET_MODE_ALIGNMENT (mode); + if (integer_zerop (TYPE_SIZE (type))) + return 0; - if (type) - { - if (!integer_zerop (TYPE_SIZE (type))) - { - if (TYPE_MODE (type) == mode) - alignment = TYPE_ALIGN (type); - else - alignment = GET_MODE_ALIGNMENT (mode); - } - else - alignment = 0; - } - else - alignment = GET_MODE_ALIGNMENT (mode); + gcc_assert (TYPE_MODE (type) == mode); + + if (!AGGREGATE_TYPE_P (type)) + return TYPE_ALIGN (TYPE_MAIN_VARIANT (type)); + + if (TREE_CODE (type) == ARRAY_TYPE) + return TYPE_ALIGN (TREE_TYPE (type)); + + unsigned int alignment = 0; + gcc_assert (TYPE_FIELDS (type)); + + for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) + alignment = std::max (alignment, DECL_ALIGN (field)); return alignment; }