From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46672 invoked by alias); 30 Oct 2015 11:48:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 46206 invoked by uid 89); 30 Oct 2015 11:48:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: paperclip.tbsaunde.org Received: from tbsaunde.org (HELO paperclip.tbsaunde.org) (66.228.47.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 30 Oct 2015 11:48:45 +0000 Received: from iceball.corp.tor1.mozilla.com (unknown [23.233.68.71]) by paperclip.tbsaunde.org (Postfix) with ESMTPSA id D4328C0CC for ; Fri, 30 Oct 2015 11:48:42 +0000 (UTC) From: tbsaunde+gcc@tbsaunde.org To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/5] stop using ROUND_TYPE_ALIGN in libobjc/ Date: Fri, 30 Oct 2015 11:48:00 -0000 Message-Id: <1446205692-22412-4-git-send-email-tbsaunde+gcc@tbsaunde.org> In-Reply-To: <1446205692-22412-1-git-send-email-tbsaunde+gcc@tbsaunde.org> References: <1446205692-22412-1-git-send-email-tbsaunde+gcc@tbsaunde.org> X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg03367.txt.bz2 From: Trevor Saunders Given the layering violation that using ROUND_TYPE_ALIGN in target libs is, and the hacks needed to make it work just coppying the relevant code into encoding.c seems to make sense as an incremental improvement. The epiphany version of this macro called a function that doesn't exist in target libs, so libobjc must not build on that target and not coppying that macro definition doesn't make anything worse. We already explicitly prefered the default version to the macro for sparc so we don't need to copy that version either. On ppc linux64 and freebsd64 after constant folding values of other target macros used for libobjc the macro turned out to be the same as the default version so we can just use the default for them. Which means the only version of the macro we actually need to copy are for ppc-darwin and AIX. libobjc/ChangeLog: 2015-10-30 Trevor Saunders PR libobjc/24775 * encoding.c (objc_layout_finish_structure): Remove usage of ROUND_TYPE_ALIGN. --- libobjc/encoding.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/libobjc/encoding.c b/libobjc/encoding.c index 7de768f..867372d 100644 --- a/libobjc/encoding.c +++ b/libobjc/encoding.c @@ -1237,10 +1237,22 @@ void objc_layout_finish_structure (struct objc_struct_layout *layout, /* Work out the alignment of the record as one expression and store in the record type. Round it up to a multiple of the record's alignment. */ -#if defined (ROUND_TYPE_ALIGN) && ! defined (__sparc__) - layout->record_align = ROUND_TYPE_ALIGN (layout->original_type-1, - 1, - layout->record_align); +#if _AIX + char type = layout->original_type[-1]; + if (type == '{' || type == '(') + layout->record_align = + rs6000_special_round_type_align (layout->original_type-1, 1, + layout->record_align); + else + layout->record_align = MAX (1, layout->record_align); +#elif __POWERPC__ && __APPLE__ + char type = layout->original_type[-1]; + if (type == '{' || type == '(') + layout->record_align + = darwin_rs6000_special_round_type_align (layout->original_type - 1, + 1, layout->record_align); + else + layout->record_align = MAX (1, layout->record_align); #else layout->record_align = MAX (1, layout->record_align); #endif -- 2.6.2