From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4093 invoked by alias); 11 Mar 2011 13:12:15 -0000 Received: (qmail 3897 invoked by uid 22791); 11 Mar 2011 13:12:14 -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-iy0-f175.google.com (HELO mail-iy0-f175.google.com) (209.85.210.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Mar 2011 13:12:08 +0000 Received: by iyb26 with SMTP id 26so2952630iyb.20 for ; Fri, 11 Mar 2011 05:12:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.43.60.71 with SMTP id wr7mr2273214icb.148.1299849126771; Fri, 11 Mar 2011 05:12:06 -0800 (PST) Received: by 10.231.10.130 with HTTP; Fri, 11 Mar 2011 05:12:06 -0800 (PST) In-Reply-To: <1299817406-16745-17-git-send-email-froydnj@codesourcery.com> References: <1299817406-16745-1-git-send-email-froydnj@codesourcery.com> <1299817406-16745-17-git-send-email-froydnj@codesourcery.com> Date: Fri, 11 Mar 2011 13:12:00 -0000 Message-ID: Subject: Re: [PATCH 16/18] make TS_IDENTIFIER be a substructure of TS_BASE 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/msg00597.txt.bz2 On Fri, Mar 11, 2011 at 5:23 AM, Nathan Froyd wr= ote: > Now that we've done the requisite surgery on the C++ FE, we can > eliminate TREE_CHAIN and TREE_TYPE from IDENTIFIER_NODEs. =A0Doing so > turns up a couple different places that need to be tweaked. > > The bit I'm not quite sure about is free_lang_data_in_decl and > find_decls_types_r. =A0Previously, due to C++ FE machinations, we'd free > REAL_IDENTIFIER_TYPE_VALUE naturally, through punning of TREE_TYPE. =A0Now > that we've shuffled that field into lang_identifier, that bit of > identifiers won't get freed...and I don't know if that causes problems. > Anybody more knowledgeable than I willing to weigh in on that? At some point we should zero-out DECL/TYPE_LANG_SPECIFIC, I don't remember why we don't do that. The patch is ok for 4.7 anyway. Thanks, Richard. > -Nathan > > gcc/ > =A0 =A0 =A0 =A0* print-tree.c (print_node): Check for TS_TYPED structures= before > =A0 =A0 =A0 =A0accessing TREE_TYPE. > =A0 =A0 =A0 =A0* tree.h (struct tree_identifier): Inherit from tree_base,= not > =A0 =A0 =A0 =A0tree_common. > =A0 =A0 =A0 =A0(HT_IDENT_TO_GCC_IDENT): Adjust for said change. > =A0 =A0 =A0 =A0* tree.c (initialize_tree_contains_struct): Mark TS_IDENTI= FIER as > =A0 =A0 =A0 =A0TS_BASE instead of TS_COMMON. > =A0 =A0 =A0 =A0(free_lang_data_in_decl): Don't set TREE_TYPE of DECL_NAME. > =A0 =A0 =A0 =A0(find_decls_types_r): Check for TS_TYPED structures before= accessing > =A0 =A0 =A0 =A0TREE_TYPE. > =A0 =A0 =A0 =A0* varasm.c (assemble_name): Remove assert. > > gcc/c-family/ > =A0 =A0 =A0 =A0* c-common.h (struct c_common_identifier): Inherit from tr= ee_base, > =A0 =A0 =A0 =A0not tree_common. > > diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h > index e7fe209..961dea7 100644 > --- a/gcc/c-family/c-common.h > +++ b/gcc/c-family/c-common.h > @@ -306,7 +306,7 @@ enum c_tree_index > =A0/* Identifier part common to the C front ends. =A0Inherits from > =A0 =A0tree_identifier, despite appearances. =A0*/ > =A0struct GTY(()) c_common_identifier { > - =A0struct tree_common common; > + =A0struct tree_base base; > =A0 struct cpp_hashnode node; > =A0}; > > diff --git a/gcc/print-tree.c b/gcc/print-tree.c > index d8acd1b..1a1e33f 100644 > --- a/gcc/print-tree.c > +++ b/gcc/print-tree.c > @@ -321,7 +321,7 @@ print_node (FILE *file, const char *prefix, tree node= , int indent) > =A0 =A0 =A0 if (indent <=3D 4) > =A0 =A0 =A0 =A0print_node_brief (file, "type", TREE_TYPE (node), indent += 4); > =A0 =A0 } > - =A0else > + =A0else if (CODE_CONTAINS_STRUCT (code, TS_TYPED)) > =A0 =A0 { > =A0 =A0 =A0 print_node (file, "type", TREE_TYPE (node), indent + 4); > =A0 =A0 =A0 if (TREE_TYPE (node)) > diff --git a/gcc/tree.c b/gcc/tree.c > index 81ee05e..001e8c8 100644 > --- a/gcc/tree.c > +++ b/gcc/tree.c > @@ -366,6 +366,7 @@ initialize_tree_contains_struct (void) > =A0 =A0 =A0 switch (ts_code) > =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0case TS_TYPED: > + =A0 =A0 =A0 case TS_IDENTIFIER: > =A0 =A0 =A0 =A0 =A0MARK_TS_BASE (code); > =A0 =A0 =A0 =A0 =A0break; > > @@ -383,7 +384,6 @@ initialize_tree_contains_struct (void) > =A0 =A0 =A0 =A0 =A0MARK_TS_TYPED (code); > =A0 =A0 =A0 =A0 =A0break; > > - =A0 =A0 =A0 case TS_IDENTIFIER: > =A0 =A0 =A0 =A0case TS_DECL_MINIMAL: > =A0 =A0 =A0 =A0case TS_TYPE: > =A0 =A0 =A0 =A0case TS_LIST: > @@ -4495,10 +4495,6 @@ free_lang_data_in_decl (tree decl) > =A0 TREE_LANG_FLAG_5 (decl) =3D 0; > =A0 TREE_LANG_FLAG_6 (decl) =3D 0; > > - =A0/* Identifiers need not have a type. =A0*/ > - =A0if (DECL_NAME (decl)) > - =A0 =A0TREE_TYPE (DECL_NAME (decl)) =3D NULL_TREE; > - > =A0 free_lang_data_in_one_sizepos (&DECL_SIZE (decl)); > =A0 free_lang_data_in_one_sizepos (&DECL_SIZE_UNIT (decl)); > =A0 if (TREE_CODE (decl) =3D=3D FIELD_DECL) > @@ -4795,7 +4791,8 @@ find_decls_types_r (tree *tp, int *ws, void *data) > =A0 =A0 =A0 fld_worklist_push (BLOCK_ABSTRACT_ORIGIN (t), fld); > =A0 =A0 } > > - =A0fld_worklist_push (TREE_TYPE (t), fld); > + =A0if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_TYPED)) > + =A0 =A0fld_worklist_push (TREE_TYPE (t), fld); > > =A0 return NULL_TREE; > =A0} > diff --git a/gcc/tree.h b/gcc/tree.h > index c81186a..f4d18f8 100644 > --- a/gcc/tree.h > +++ b/gcc/tree.h > @@ -1529,11 +1529,11 @@ struct GTY(()) tree_vector { > =A0 =A0pointer, and vice versa. =A0*/ > > =A0#define HT_IDENT_TO_GCC_IDENT(NODE) \ > - =A0((tree) ((char *) (NODE) - sizeof (struct tree_common))) > + =A0((tree) ((char *) (NODE) - sizeof (struct tree_base))) > =A0#define GCC_IDENT_TO_HT_IDENT(NODE) (&((struct tree_identifier *) (NOD= E))->id) > > =A0struct GTY(()) tree_identifier { > - =A0struct tree_common common; > + =A0struct tree_base base; > =A0 struct ht_identifier id; > =A0}; > > diff --git a/gcc/varasm.c b/gcc/varasm.c > index 76675cd..4c429de 100644 > --- a/gcc/varasm.c > +++ b/gcc/varasm.c > @@ -2300,7 +2300,6 @@ assemble_name (FILE *file, const char *name) > =A0 =A0 =A0 ultimate_transparent_alias_target (&id); > =A0 =A0 =A0 if (id !=3D id_orig) > =A0 =A0 =A0 =A0name =3D IDENTIFIER_POINTER (id); > - =A0 =A0 =A0gcc_assert (! TREE_CHAIN (id)); > =A0 =A0 } > > =A0 assemble_name_raw (file, name); > -- > 1.7.0.4 > >