From patchwork Fri Mar 11 04:23:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 86368 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 E9F59B6FA4 for ; Fri, 11 Mar 2011 15:25:07 +1100 (EST) Received: (qmail 19600 invoked by alias); 11 Mar 2011 04:24:23 -0000 Received: (qmail 19437 invoked by uid 22791); 11 Mar 2011 04:24:20 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, 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; Fri, 11 Mar 2011 04:24:13 +0000 Received: (qmail 1854 invoked from network); 11 Mar 2011 04:24:11 -0000 Received: from unknown (HELO codesourcery.com) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 11 Mar 2011 04:24:11 -0000 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Cc: Nathan Froyd Subject: [PATCH 16/18] make TS_IDENTIFIER be a substructure of TS_BASE Date: Thu, 10 Mar 2011 23:23:24 -0500 Message-Id: <1299817406-16745-17-git-send-email-froydnj@codesourcery.com> In-Reply-To: <1299817406-16745-1-git-send-email-froydnj@codesourcery.com> References: <1299817406-16745-1-git-send-email-froydnj@codesourcery.com> 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 Now that we've done the requisite surgery on the C++ FE, we can eliminate TREE_CHAIN and TREE_TYPE from IDENTIFIER_NODEs. Doing 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. Previously, due to C++ FE machinations, we'd free REAL_IDENTIFIER_TYPE_VALUE naturally, through punning of TREE_TYPE. Now 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? -Nathan gcc/ * print-tree.c (print_node): Check for TS_TYPED structures before accessing TREE_TYPE. * tree.h (struct tree_identifier): Inherit from tree_base, not tree_common. (HT_IDENT_TO_GCC_IDENT): Adjust for said change. * tree.c (initialize_tree_contains_struct): Mark TS_IDENTIFIER as TS_BASE instead of TS_COMMON. (free_lang_data_in_decl): Don't set TREE_TYPE of DECL_NAME. (find_decls_types_r): Check for TS_TYPED structures before accessing TREE_TYPE. * varasm.c (assemble_name): Remove assert. gcc/c-family/ * c-common.h (struct c_common_identifier): Inherit from tree_base, not 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 /* Identifier part common to the C front ends. Inherits from tree_identifier, despite appearances. */ struct GTY(()) c_common_identifier { - struct tree_common common; + struct tree_base base; struct cpp_hashnode node; }; 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) if (indent <= 4) print_node_brief (file, "type", TREE_TYPE (node), indent + 4); } - else + else if (CODE_CONTAINS_STRUCT (code, TS_TYPED)) { print_node (file, "type", TREE_TYPE (node), indent + 4); 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) switch (ts_code) { case TS_TYPED: + case TS_IDENTIFIER: MARK_TS_BASE (code); break; @@ -383,7 +384,6 @@ initialize_tree_contains_struct (void) MARK_TS_TYPED (code); break; - case TS_IDENTIFIER: case TS_DECL_MINIMAL: case TS_TYPE: case TS_LIST: @@ -4495,10 +4495,6 @@ free_lang_data_in_decl (tree decl) TREE_LANG_FLAG_5 (decl) = 0; TREE_LANG_FLAG_6 (decl) = 0; - /* Identifiers need not have a type. */ - if (DECL_NAME (decl)) - TREE_TYPE (DECL_NAME (decl)) = NULL_TREE; - free_lang_data_in_one_sizepos (&DECL_SIZE (decl)); free_lang_data_in_one_sizepos (&DECL_SIZE_UNIT (decl)); if (TREE_CODE (decl) == FIELD_DECL) @@ -4795,7 +4791,8 @@ find_decls_types_r (tree *tp, int *ws, void *data) fld_worklist_push (BLOCK_ABSTRACT_ORIGIN (t), fld); } - fld_worklist_push (TREE_TYPE (t), fld); + if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_TYPED)) + fld_worklist_push (TREE_TYPE (t), fld); return NULL_TREE; } 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 { pointer, and vice versa. */ #define HT_IDENT_TO_GCC_IDENT(NODE) \ - ((tree) ((char *) (NODE) - sizeof (struct tree_common))) + ((tree) ((char *) (NODE) - sizeof (struct tree_base))) #define GCC_IDENT_TO_HT_IDENT(NODE) (&((struct tree_identifier *) (NODE))->id) struct GTY(()) tree_identifier { - struct tree_common common; + struct tree_base base; struct ht_identifier id; }; 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) ultimate_transparent_alias_target (&id); if (id != id_orig) name = IDENTIFIER_POINTER (id); - gcc_assert (! TREE_CHAIN (id)); } assemble_name_raw (file, name);