From patchwork Wed Sep 29 17:21:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chung-Lin Tang X-Patchwork-Id: 66080 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]) by ozlabs.org (Postfix) with SMTP id C75D7B6EEC for ; Thu, 30 Sep 2010 03:21:41 +1000 (EST) Received: (qmail 1102 invoked by alias); 29 Sep 2010 17:21:34 -0000 Received: (qmail 1075 invoked by uid 22791); 29 Sep 2010 17:21:31 -0000 X-SWARE-Spam-Status: No, hits=-0.5 required=5.0 tests=AWL, BAYES_50, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Sep 2010 17:21:26 +0000 Received: (qmail 18068 invoked from network); 29 Sep 2010 17:21:25 -0000 Received: from unknown (HELO ?59.104.108.109?) (cltang@127.0.0.2) by mail.codesourcery.com with ESMTPA; 29 Sep 2010 17:21:25 -0000 Message-ID: <4CA3759B.3080208@codesourcery.com> Date: Thu, 30 Sep 2010 01:21:31 +0800 From: Chung-Lin Tang User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: gcc-patches Subject: [patch, ARM] Avoid enlarged alignment when optimizing for size X-IsSubscribed: yes 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 Hi, this patch adds guard conditions to the DATA/LOCAL_ALIGNMENT macros, to turn off the BITS_PER_WORD enlarging of data alignment when optimizing for size/conserving stack space. This corresponds to Linaro bug #640544 https://bugs.launchpad.net/gcc-linaro/+bug/640544 Okay for trunk? Thanks, Chung-Lin * config/arm/arm.h (ARM_EXPAND_ALIGNMENT): Rename from DATA_ALIGNMENT and add COND parameter. (DATA_ALIGNMENT): Use ARM_EXPAND_ALIGNMENT, with !optimize_size. (LOCAL_ALIGNMENT): Use ARM_EXPAND_ALIGNMENT, with !flag_conserve_stack. Index: arm.h =================================================================== --- arm.h (revision 300183) +++ arm.h (working copy) @@ -635,14 +635,19 @@ initializations and copies can be made more efficient. This is not ABI-changing, so it only affects places where we can see the definition. */ -#define DATA_ALIGNMENT(EXP, ALIGN) \ - ((((ALIGN) < BITS_PER_WORD) \ +#define ARM_EXPAND_ALIGNMENT(COND, EXP, ALIGN) \ + (((COND) && ((ALIGN) < BITS_PER_WORD) \ && (TREE_CODE (EXP) == ARRAY_TYPE \ || TREE_CODE (EXP) == UNION_TYPE \ || TREE_CODE (EXP) == RECORD_TYPE)) ? BITS_PER_WORD : (ALIGN)) +/* Align global data. */ +#define DATA_ALIGNMENT(EXP, ALIGN) \ + ARM_EXPAND_ALIGNMENT(!optimize_size, EXP, ALIGN) + /* Similarly, make sure that objects on the stack are sensibly aligned. */ -#define LOCAL_ALIGNMENT(EXP, ALIGN) DATA_ALIGNMENT(EXP, ALIGN) +#define LOCAL_ALIGNMENT(EXP, ALIGN) \ + ARM_EXPAND_ALIGNMENT(!flag_conserve_stack, EXP, ALIGN) /* Setting STRUCTURE_SIZE_BOUNDARY to 32 produces more efficient code, but the value set in previous versions of this toolchain was 8, which produces more