From patchwork Mon Apr 27 05:55:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tbsaunde+gcc@tbsaunde.org X-Patchwork-Id: 464792 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 6C4B7140082 for ; Mon, 27 Apr 2015 15:57:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=yTMnSDXS; dkim-adsp=none (unprotected policy); 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:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=PkiW1X5gMcqtO912uMl4g5dMTF4PUvwb1RhunJ/fV+oMYp784FVlw jyNhnHzvzC0Vh51/6u3CCKmoicLDInTJGoGVmy2prNpU+hqP1j8WVgfLfoZ2RgFM wiIJMWuSA0vj0Mc4/4fGP0b7oyV2mkovnPG3g+EvmpUfcpFpNY6RKE= 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:date:message-id:in-reply-to:references; s=default; bh=shwXj5DFAYFvYm9wu0r5oDdrn1c=; b=yTMnSDXS4p6pZ5pj0HcCFsf5lMTv Aes0bgV+JSrGov+VC6ctz2ytNFn1grl24CZO6iOiMUvNWVuoJJwUJb80V2c8VJpf kI0z+6RzMBfK6cbeYa41ckg64wIBjrlT4ajFj6u10A5CsE5HfFPvtjUt5hypTgu7 bk45y0+7kQCnQNo= Received: (qmail 89954 invoked by alias); 27 Apr 2015 05:56:51 -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 89206 invoked by uid 89); 27 Apr 2015 05:56:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=no 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; Mon, 27 Apr 2015 05:56:46 +0000 Received: from iceball.corp.tor1.mozilla.com (unknown [23.233.68.71]) by paperclip.tbsaunde.org (Postfix) with ESMTPSA id 6E047C0B1 for ; Mon, 27 Apr 2015 05:56:45 +0000 (UTC) From: tbsaunde+gcc@tbsaunde.org To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/8] add default for PCC_BITFIELD_TYPE_MATTERS Date: Mon, 27 Apr 2015 01:55:35 -0400 Message-Id: <1430114140-15817-4-git-send-email-tbsaunde+gcc@tbsaunde.org> In-Reply-To: <1430114140-15817-1-git-send-email-tbsaunde+gcc@tbsaunde.org> References: <1430114140-15817-1-git-send-email-tbsaunde+gcc@tbsaunde.org> X-IsSubscribed: yes From: Trevor Saunders gcc/ChangeLog: 2015-04-27 Trevor Saunders * defaults.h (PCC_BITFIELD_TYPE_MATTERS): Add default definition to false. * dwarf2out.c (field_byte_offset): REmove check if PCC_BITFIELD_TYPE_MATTERS is defined. * stor-layout.c (layout_decl): Likewise. (update_alignment_for_field): Likewise. (place_field): Likewise. gcc/cp/ChangeLog: 2015-04-27 Trevor Saunders * class.c (layout_class_type): Remove check if PCC_BITFIELD_TYPE_MATTERS is defined. --- gcc/cp/class.c | 4 ++-- gcc/defaults.h | 4 ++++ gcc/dwarf2out.c | 2 -- gcc/stor-layout.c | 10 ---------- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/gcc/cp/class.c b/gcc/cp/class.c index d80d312e..be5f5c2 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -6258,7 +6258,7 @@ layout_class_type (tree t, tree *virtuals_p) padding = size_binop (MINUS_EXPR, DECL_SIZE (field), TYPE_SIZE (integer_type)); } -#ifdef PCC_BITFIELD_TYPE_MATTERS + /* An unnamed bitfield does not normally affect the alignment of the containing class on a target where PCC_BITFIELD_TYPE_MATTERS. But, the C++ ABI does not @@ -6270,7 +6270,7 @@ layout_class_type (tree t, tree *virtuals_p) was_unnamed_p = true; DECL_NAME (field) = make_anon_name (); } -#endif + DECL_SIZE (field) = TYPE_SIZE (integer_type); DECL_ALIGN (field) = TYPE_ALIGN (integer_type); DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (integer_type); diff --git a/gcc/defaults.h b/gcc/defaults.h index 7e04be2..0af7a02 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -1201,6 +1201,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define DEFAULT_PCC_STRUCT_RETURN 1 #endif +#ifndef PCC_BITFIELD_TYPE_MATTERS +#define PCC_BITFIELD_TYPE_MATTERS false +#endif + #ifndef INSN_SETS_ARE_DELAYED #define INSN_SETS_ARE_DELAYED(INSN) false #endif diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index a04e6f6..8591cd7 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -15120,7 +15120,6 @@ field_byte_offset (const_tree decl) bitpos_int = wi::to_offset (bit_position (decl)); -#ifdef PCC_BITFIELD_TYPE_MATTERS if (PCC_BITFIELD_TYPE_MATTERS) { tree type; @@ -15218,7 +15217,6 @@ field_byte_offset (const_tree decl) } } else -#endif /* PCC_BITFIELD_TYPE_MATTERS */ object_offset_in_bits = bitpos_int; object_offset_in_bytes diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index f18f1ac..6150d85 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -85,10 +85,8 @@ static tree self_referential_size (tree); static void finalize_record_size (record_layout_info); static void finalize_type_size (tree); static void place_union_field (record_layout_info, tree); -#if defined (PCC_BITFIELD_TYPE_MATTERS) || defined (BITFIELD_NBYTES_LIMITED) static int excess_unit_span (HOST_WIDE_INT, HOST_WIDE_INT, HOST_WIDE_INT, HOST_WIDE_INT, tree); -#endif extern void debug_rli (record_layout_info); /* Show that REFERENCE_TYPES are internal and should use address_mode. @@ -698,11 +696,9 @@ layout_decl (tree decl, unsigned int known_align) { zero_bitfield = true; packed_p = false; -#ifdef PCC_BITFIELD_TYPE_MATTERS if (PCC_BITFIELD_TYPE_MATTERS) do_type_align (type, decl); else -#endif { #ifdef EMPTY_FIELD_BOUNDARY if (EMPTY_FIELD_BOUNDARY > DECL_ALIGN (decl)) @@ -1066,7 +1062,6 @@ update_alignment_for_field (record_layout_info rli, tree field, rli->unpacked_align = MAX (rli->unpacked_align, TYPE_ALIGN (type)); } } -#ifdef PCC_BITFIELD_TYPE_MATTERS else if (is_bitfield && PCC_BITFIELD_TYPE_MATTERS) { /* Named bit-fields cause the entire structure to have the @@ -1109,7 +1104,6 @@ update_alignment_for_field (record_layout_info rli, tree field, user_align |= TYPE_USER_ALIGN (type); } } -#endif else { rli->record_align = MAX (rli->record_align, desired_align); @@ -1147,7 +1141,6 @@ place_union_field (record_layout_info rli, tree field) DECL_SIZE_UNIT (field), rli->offset); } -#if defined (PCC_BITFIELD_TYPE_MATTERS) || defined (BITFIELD_NBYTES_LIMITED) /* A bitfield of SIZE with a required access alignment of ALIGN is allocated at BYTE_OFFSET / BIT_OFFSET. Return nonzero if the field would span more units of alignment than the underlying TYPE. */ @@ -1163,7 +1156,6 @@ excess_unit_span (HOST_WIDE_INT byte_offset, HOST_WIDE_INT bit_offset, return ((offset + size + align - 1) / align > tree_to_uhwi (TYPE_SIZE (type)) / align); } -#endif /* RLI contains information about the layout of a RECORD_TYPE. FIELD is a FIELD_DECL to be added after those fields already present in @@ -1290,7 +1282,6 @@ place_field (record_layout_info rli, tree field) /* Handle compatibility with PCC. Note that if the record has any variable-sized fields, we need not worry about compatibility. */ -#ifdef PCC_BITFIELD_TYPE_MATTERS if (PCC_BITFIELD_TYPE_MATTERS && ! targetm.ms_bitfield_layout_p (rli->t) && TREE_CODE (field) == FIELD_DECL @@ -1335,7 +1326,6 @@ place_field (record_layout_info rli, tree field) if (! DECL_PACKED (field)) TYPE_USER_ALIGN (rli->t) |= TYPE_USER_ALIGN (type); } -#endif #ifdef BITFIELD_NBYTES_LIMITED if (BITFIELD_NBYTES_LIMITED