From patchwork Thu Jun 17 18:48:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 56078 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 E3B7F1007D2 for ; Fri, 18 Jun 2010 04:48:45 +1000 (EST) Received: (qmail 11349 invoked by alias); 17 Jun 2010 18:48:44 -0000 Received: (qmail 11341 invoked by uid 22791); 17 Jun 2010 18:48:43 -0000 X-SWARE-Spam-Status: No, hits=-1.9 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; Thu, 17 Jun 2010 18:48:35 +0000 Received: (qmail 20096 invoked from network); 17 Jun 2010 18:48:33 -0000 Received: from unknown (HELO localhost) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 17 Jun 2010 18:48:33 -0000 Date: Thu, 17 Jun 2010 11:48:33 -0700 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Subject: [PATCH,c] VECify types_used_by_cur_var_decl Message-ID: <20100617184833.GO27105@codesourcery.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) 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 As $SUBJECT suggests. Need C FE approval and middle-end approval. Tested on x86_64-unknown-linux-gnu. OK? -Nathan gcc/ * function.h (types_used_by_cur_var_decl): Change type to a VEC. * function.c (types_used_by_cur_var_decl): Likewise. (used_types_insert): Adjust for new type of types_used_by_cur_var_decl. gcc/c-family/ * c-common.c (record_types_used_by_current_var_decl): Adjust for new type of types_used_by_cur_var_decl. --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -9384,17 +9384,10 @@ record_types_used_by_current_var_decl (tree decl) { gcc_assert (decl && DECL_P (decl) && TREE_STATIC (decl)); - if (types_used_by_cur_var_decl) + while (!VEC_empty (tree, types_used_by_cur_var_decl)) { - tree node; - for (node = types_used_by_cur_var_decl; - node; - node = TREE_CHAIN (node)) - { - tree type = TREE_PURPOSE (node); - types_used_by_var_decl_insert (type, decl); - } - types_used_by_cur_var_decl = NULL; + tree type = VEC_pop (tree, types_used_by_cur_var_decl); + types_used_by_var_decl_insert (type, decl); } } --- a/gcc/function.c +++ b/gcc/function.c @@ -132,7 +132,7 @@ static GTY((if_marked ("ggc_marked_p"), param_is (struct rtx_def))) htab_t types_used_by_vars_hash = NULL; -tree types_used_by_cur_var_decl = NULL; +VEC(tree,gc) *types_used_by_cur_var_decl; /* Forward declarations. */ @@ -5562,9 +5562,7 @@ used_types_insert (tree t) /* So this might be a type referenced by a global variable. Record that type so that we can later decide to emit its debug information. */ - types_used_by_cur_var_decl = - tree_cons (t, NULL, types_used_by_cur_var_decl); - + VEC_safe_push (tree, gc, types_used_by_cur_var_decl, t); } } --- a/gcc/function.h +++ b/gcc/function.h @@ -645,9 +645,9 @@ hashval_t types_used_by_vars_do_hash (const void*); int types_used_by_vars_eq (const void *, const void *); void types_used_by_var_decl_insert (tree type, tree var_decl); -/* During parsing of a global variable, this linked list points to - the list of types referenced by the global variable. */ -extern GTY(()) tree types_used_by_cur_var_decl; +/* During parsing of a global variable, this vector contains the types + referenced by the global variable. */ +extern GTY(()) VEC(tree,gc) *types_used_by_cur_var_decl; /* cfun shouldn't be set directly; use one of these functions instead. */