From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15874 invoked by alias); 11 Mar 2011 13:05:02 -0000 Received: (qmail 15838 invoked by uid 22791); 11 Mar 2011 13:05:01 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-iw0-f175.google.com (HELO mail-iw0-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Mar 2011 13:04:55 +0000 Received: by iwn10 with SMTP id 10so2934772iwn.20 for ; Fri, 11 Mar 2011 05:04:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.171.205 with SMTP id i13mr1399610ibz.181.1299848693805; Fri, 11 Mar 2011 05:04:53 -0800 (PST) Received: by 10.231.10.130 with HTTP; Fri, 11 Mar 2011 05:04:53 -0800 (PST) In-Reply-To: <1299817406-16745-2-git-send-email-froydnj@codesourcery.com> References: <1299817406-16745-1-git-send-email-froydnj@codesourcery.com> <1299817406-16745-2-git-send-email-froydnj@codesourcery.com> Date: Fri, 11 Mar 2011 13:05:00 -0000 Message-ID: Subject: Re: [PATCH 01/18] add typed_tree structure From: Richard Guenther To: Nathan Froyd Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 X-SW-Source: 2011-03/txt/msg00590.txt.bz2 On Fri, Mar 11, 2011 at 5:23 AM, Nathan Froyd wr= ote: > The first step in removing TREE_CHAIN (and even TREE_TYPE) from a select > few nodes is to create separate substructures for trees-with-type and > trees-with-chain. =A0Since trees-with-type but no chain are expected to be > more common that vice versa, make the hierarchy reflect that. =A0Modify a > few macros to reflect the new inheritance structure, and add a new tree > structure enum for the new structure. =A0Make note that we support the new > tree structure in the LTO streamer, even though we don't need to do > anything about it yet. Ok for 4.7 (I assume you have tested each patch separately for _all_ languages, or if not, will do so before applying). Thanks, Richard. > -Nathan > > gcc/ > =A0 =A0 =A0 =A0* tree.h (struct typed_tree): New. > =A0 =A0 =A0 =A0(struct tree_common): Include it instead of tree_base. > =A0 =A0 =A0 =A0(TREE_TYPE): Update for new location of type field. > =A0 =A0 =A0 =A0(TYPE_USER_ALIGN, TYPE_PACKED): Refer to base field direct= ly. > =A0 =A0 =A0 =A0(DECL_USER_ALIGN, DECL_PACKED): Likewise. > =A0 =A0 =A0 =A0(union tree_node): Add typed field. > =A0 =A0 =A0 =A0* treestruct.def (TS_TYPED): New. > =A0 =A0 =A0 =A0* lto-streamer.c (check_handled_ts_structures): Handle it. > =A0 =A0 =A0 =A0* tree.c (MARK_TS_TYPED): New macro. > =A0 =A0 =A0 =A0(MARK_TS_COMMON): Call it instead of MARK_TS_BASE. > > diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c > index dba9d2d..546228c 100644 > --- a/gcc/lto-streamer.c > +++ b/gcc/lto-streamer.c > @@ -270,6 +270,7 @@ check_handled_ts_structures (void) > =A0 /* These are the TS_* structures that are either handled or > =A0 =A0 =A0explicitly ignored by the streamer routines. =A0*/ > =A0 handled_p[TS_BASE] =3D true; > + =A0handled_p[TS_TYPED] =3D true; > =A0 handled_p[TS_COMMON] =3D true; > =A0 handled_p[TS_INT_CST] =3D true; > =A0 handled_p[TS_REAL_CST] =3D true; > diff --git a/gcc/tree.c b/gcc/tree.c > index c947072..798bc08 100644 > --- a/gcc/tree.c > +++ b/gcc/tree.c > @@ -356,9 +356,15 @@ initialize_tree_contains_struct (void) > =A0 =A0 tree_contains_struct[C][TS_BASE] =3D 1; =A0 =A0 =A0 =A0 =A0 =A0 = =A0\ > =A0 } while (0) > > -#define MARK_TS_COMMON(C) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0\ > +#define MARK_TS_TYPED(C) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 \ > =A0 do { =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \ > =A0 =A0 MARK_TS_BASE (C); =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0\ > + =A0 =A0tree_contains_struct[C][TS_TYPED] =3D 1; =A0 =A0 =A0 =A0 =A0 =A0= \ > + =A0} while (0) > + > +#define MARK_TS_COMMON(C) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0\ > + =A0do { =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \ > + =A0 =A0MARK_TS_TYPED (C); =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 \ > =A0 =A0 tree_contains_struct[C][TS_COMMON] =3D 1; =A0 =A0 =A0 =A0 =A0 =A0\ > =A0 } while (0) > > diff --git a/gcc/tree.h b/gcc/tree.h > index a49e335..2f772e1 100644 > --- a/gcc/tree.h > +++ b/gcc/tree.h > @@ -407,12 +407,16 @@ struct GTY(()) tree_base { > =A0 unsigned address_space : 8; > =A0}; > > -struct GTY(()) tree_common { > +struct GTY(()) typed_tree { > =A0 struct tree_base base; > - =A0tree chain; > =A0 tree type; > =A0}; > > +struct GTY(()) tree_common { > + =A0struct typed_tree typed; > + =A0tree chain; > +}; > + > =A0/* The following table lists the uses of each of the above flags and > =A0 =A0for which types of nodes they are defined. > > @@ -869,7 +873,7 @@ enum tree_node_structure_enum { > =A0 =A0In VECTOR_TYPE nodes, this is the type of the elements. =A0*/ > =A0#define TREE_TYPE(NODE) __extension__ \ > =A0(*({__typeof (NODE) const __t =3D (NODE); =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\ > - =A0 =A0&__t->common.type; })) > + =A0 =A0&__t->typed.type; })) > > =A0extern void tree_contains_struct_check_failed (const_tree, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 const enum tree_node_structure_enum, > @@ -2151,7 +2155,7 @@ extern enum machine_mode vector_type_mode (const_tr= ee); > > =A0/* 1 if the alignment for this type was requested by "aligned" attribu= te, > =A0 =A00 if it is the default for this type. =A0*/ > -#define TYPE_USER_ALIGN(NODE) (TYPE_CHECK (NODE)->common.base.user_align) > +#define TYPE_USER_ALIGN(NODE) (TYPE_CHECK (NODE)->base.user_align) > > =A0/* The alignment for NODE, in bytes. =A0*/ > =A0#define TYPE_ALIGN_UNIT(NODE) (TYPE_ALIGN (NODE) / BITS_PER_UNIT) > @@ -2289,7 +2293,7 @@ extern enum machine_mode vector_type_mode (const_tr= ee); > > =A0/* Indicated that objects of this type should be laid out in as > =A0 =A0compact a way as possible. =A0*/ > -#define TYPE_PACKED(NODE) (TYPE_CHECK (NODE)->common.base.packed_flag) > +#define TYPE_PACKED(NODE) (TYPE_CHECK (NODE)->base.packed_flag) > > =A0/* Used by type_contains_placeholder_p to avoid recomputation. > =A0 =A0Values are: 0 (unknown), 1 (false), 2 (true). =A0Never access > @@ -2632,7 +2636,7 @@ struct GTY(()) tree_decl_minimal { > =A0/* Set if the alignment of this DECL has been set by the user, for > =A0 =A0example with an 'aligned' attribute. =A0*/ > =A0#define DECL_USER_ALIGN(NODE) \ > - =A0(DECL_COMMON_CHECK (NODE)->common.base.user_align) > + =A0(DECL_COMMON_CHECK (NODE)->base.user_align) > =A0/* Holds the machine mode corresponding to the declaration of a variab= le or > =A0 =A0field. =A0Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a > =A0 =A0FIELD_DECL. =A0*/ > @@ -2900,7 +2904,7 @@ struct GTY(()) tree_decl_with_rtl { > =A0#define DECL_FCONTEXT(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.fcont= ext) > > =A0/* In a FIELD_DECL, indicates this field should be bit-packed. =A0*/ > -#define DECL_PACKED(NODE) (FIELD_DECL_CHECK (NODE)->common.base.packed_f= lag) > +#define DECL_PACKED(NODE) (FIELD_DECL_CHECK (NODE)->base.packed_flag) > > =A0/* Nonzero in a FIELD_DECL means it is a bit field, and must be access= ed > =A0 =A0specially. =A0*/ > @@ -3505,6 +3509,7 @@ extern tree build_target_option_node (void); > =A0union GTY ((ptr_alias (union lang_tree_node), > =A0 =A0 =A0 =A0 =A0 =A0desc ("tree_node_structure (&%h)"), variable_size)= ) tree_node { > =A0 struct tree_base GTY ((tag ("TS_BASE"))) base; > + =A0struct typed_tree GTY ((tag ("TS_TYPED"))) typed; > =A0 struct tree_common GTY ((tag ("TS_COMMON"))) common; > =A0 struct tree_int_cst GTY ((tag ("TS_INT_CST"))) int_cst; > =A0 struct tree_real_cst GTY ((tag ("TS_REAL_CST"))) real_cst; > diff --git a/gcc/treestruct.def b/gcc/treestruct.def > index baea46a..b65bdc2 100644 > --- a/gcc/treestruct.def > +++ b/gcc/treestruct.def > @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. =A0If not see > =A0 =A0specifying what structures contain what other structures in the > =A0 =A0tree_contains_struct array. =A0*/ > =A0DEFTREESTRUCT(TS_BASE, "base") > +DEFTREESTRUCT(TS_TYPED, "typed") > =A0DEFTREESTRUCT(TS_COMMON, "common") > =A0DEFTREESTRUCT(TS_INT_CST, "integer cst") > =A0DEFTREESTRUCT(TS_REAL_CST, "real cst") > -- > 1.7.0.4 > >