From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18023 invoked by alias); 11 Mar 2011 13:06:48 -0000 Received: (qmail 18015 invoked by uid 22791); 11 Mar 2011 13:06:47 -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:06:43 +0000 Received: by iwn10 with SMTP id 10so2936248iwn.20 for ; Fri, 11 Mar 2011 05:06:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.42.156.68 with SMTP id y4mr1273983icw.81.1299848801263; Fri, 11 Mar 2011 05:06:41 -0800 (PST) Received: by 10.231.10.130 with HTTP; Fri, 11 Mar 2011 05:06:41 -0800 (PST) In-Reply-To: <1299817406-16745-5-git-send-email-froydnj@codesourcery.com> References: <1299817406-16745-1-git-send-email-froydnj@codesourcery.com> <1299817406-16745-5-git-send-email-froydnj@codesourcery.com> Date: Fri, 11 Mar 2011 13:06:00 -0000 Message-ID: Subject: Re: [PATCH 04/18] remove TREE_CHAIN from SSA_NAME nodes 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/msg00593.txt.bz2 On Fri, Mar 11, 2011 at 5:23 AM, Nathan Froyd wr= ote: > This conversion is straightforward. =A0The tricky part is converting > FREE_SSANAMES into a VEC to eliminate the only use of TREE_CHAIN on > SSA_NAMEs. Ok for 4.7. Thanks, Richard. > -Nathan > > gcc/ > =A0 =A0 =A0 =A0* tree-flow.h (struct gimple_df): Make free_ssanames a VEC. > =A0 =A0 =A0 =A0* tree-ssanames.c (fini_ssanames): VEC_free it. > =A0 =A0 =A0 =A0(make_ssa_name_fn): Update for VECness of free_ssanames. > =A0 =A0 =A0 =A0(release_ssa_name, release_dead_ssa_names): Likewise. > =A0 =A0 =A0 =A0* tree.h (struct tree_ssa_name): Include typed_tree instea= d of > =A0 =A0 =A0 =A0tree_common. > =A0 =A0 =A0 =A0* tree.c (initialize_tree_contains_struct): Mark TS_SSA_NA= ME as > =A0 =A0 =A0 =A0TS_TYPED instead of TS_COMMON. > > diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h > index 14c8827..6b48697 100644 > --- a/gcc/tree-flow.h > +++ b/gcc/tree-flow.h > @@ -61,7 +61,7 @@ struct GTY(()) gimple_df { > =A0 struct pointer_map_t * GTY((skip(""))) decls_to_pointers; > > =A0 /* Free list of SSA_NAMEs. =A0*/ > - =A0tree free_ssanames; > + =A0VEC(tree,gc) *free_ssanames; > > =A0 /* Hashtable holding definition for symbol. =A0If this field is not N= ULL, it > =A0 =A0 =A0means that the first reference to this variable in the functio= n is a > diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c > index c76dba5..06cdbee 100644 > --- a/gcc/tree-ssanames.c > +++ b/gcc/tree-ssanames.c > @@ -96,7 +96,7 @@ void > =A0fini_ssanames (void) > =A0{ > =A0 VEC_free (tree, gc, SSANAMES (cfun)); > - =A0FREE_SSANAMES (cfun) =3D NULL; > + =A0VEC_free (tree, gc, FREE_SSANAMES (cfun)); > =A0} > > =A0/* Dump some simple statistics regarding the re-use of SSA_NAME nodes.= =A0*/ > @@ -124,10 +124,9 @@ make_ssa_name_fn (struct function *fn, tree var, gim= ple stmt) > =A0 gcc_assert (DECL_P (var)); > > =A0 /* If our free list has an element, then use it. =A0*/ > - =A0if (FREE_SSANAMES (fn)) > + =A0if (!VEC_empty (tree, FREE_SSANAMES (fn))) > =A0 =A0 { > - =A0 =A0 =A0t =3D FREE_SSANAMES (fn); > - =A0 =A0 =A0FREE_SSANAMES (fn) =3D TREE_CHAIN (FREE_SSANAMES (fn)); > + =A0 =A0 =A0t =3D VEC_pop (tree, FREE_SSANAMES (fn)); > =A0#ifdef GATHER_STATISTICS > =A0 =A0 =A0 ssa_name_nodes_reused++; > =A0#endif > @@ -234,9 +233,8 @@ release_ssa_name (tree var) > =A0 =A0 =A0 /* Note this SSA_NAME is now in the first list. =A0*/ > =A0 =A0 =A0 SSA_NAME_IN_FREE_LIST (var) =3D 1; > > - =A0 =A0 =A0/* And finally link it into the free list. =A0*/ > - =A0 =A0 =A0TREE_CHAIN (var) =3D FREE_SSANAMES (cfun); > - =A0 =A0 =A0FREE_SSANAMES (cfun) =3D var; > + =A0 =A0 =A0/* And finally put it on the free list. =A0*/ > + =A0 =A0 =A0VEC_safe_push (tree, gc, FREE_SSANAMES (cfun), var); > =A0 =A0 } > =A0} > > @@ -334,8 +332,8 @@ replace_ssa_name_symbol (tree ssa_name, tree sym) > =A0static unsigned int > =A0release_dead_ssa_names (void) > =A0{ > - =A0tree t, next; > - =A0int n =3D 0; > + =A0tree t; > + =A0int n =3D VEC_length (tree, FREE_SSANAMES (cfun)); > =A0 referenced_var_iterator rvi; > > =A0 /* Current defs point to various dead SSA names that in turn point to > @@ -343,17 +341,7 @@ release_dead_ssa_names (void) > =A0 FOR_EACH_REFERENCED_VAR (cfun, t, rvi) > =A0 =A0 set_current_def (t, NULL); > =A0 /* Now release the freelist. =A0*/ > - =A0for (t =3D FREE_SSANAMES (cfun); t; t =3D next) > - =A0 =A0{ > - =A0 =A0 =A0next =3D TREE_CHAIN (t); > - =A0 =A0 =A0/* Dangling pointers might make GGC to still see dead SSA na= mes, so it is > - =A0 =A0 =A0 =A0important to unlink the list and avoid GGC from seeing a= ll subsequent > - =A0 =A0 =A0 =A0SSA names. =A0In longer run we want to have all dangling= pointers here > - =A0 =A0 =A0 =A0removed (since they usually go through dead statements t= hat consume > - =A0 =A0 =A0 =A0considerable amounts of memory). =A0*/ > - =A0 =A0 =A0TREE_CHAIN (t) =3D NULL_TREE; > - =A0 =A0 =A0n++; > - =A0 =A0} > + =A0VEC_free (tree, gc, FREE_SSANAMES (cfun)); > =A0 FREE_SSANAMES (cfun) =3D NULL; > > =A0 statistics_counter_event (cfun, "SSA names released", n); > diff --git a/gcc/tree.c b/gcc/tree.c > index 7d73c74..072ff19 100644 > --- a/gcc/tree.c > +++ b/gcc/tree.c > @@ -376,6 +376,7 @@ initialize_tree_contains_struct (void) > =A0 =A0 =A0 =A0case TS_VECTOR: > =A0 =A0 =A0 =A0case TS_STRING: > =A0 =A0 =A0 =A0case TS_COMPLEX: > + =A0 =A0 =A0 case TS_SSA_NAME: > =A0 =A0 =A0 =A0 =A0MARK_TS_TYPED (code); > =A0 =A0 =A0 =A0 =A0break; > > @@ -385,7 +386,6 @@ initialize_tree_contains_struct (void) > =A0 =A0 =A0 =A0case TS_LIST: > =A0 =A0 =A0 =A0case TS_VEC: > =A0 =A0 =A0 =A0case TS_EXP: > - =A0 =A0 =A0 case TS_SSA_NAME: > =A0 =A0 =A0 =A0case TS_BLOCK: > =A0 =A0 =A0 =A0case TS_BINFO: > =A0 =A0 =A0 =A0case TS_STATEMENT_LIST: > diff --git a/gcc/tree.h b/gcc/tree.h > index 11c2f83..80888bc 100644 > --- a/gcc/tree.h > +++ b/gcc/tree.h > @@ -1970,7 +1970,7 @@ typedef struct GTY(()) ssa_use_operand_d { > =A0#define SSA_NAME_IMM_USE_NODE(NODE) SSA_NAME_CHECK (NODE)->ssa_name.im= m_uses > > =A0struct GTY(()) tree_ssa_name { > - =A0struct tree_common common; > + =A0struct typed_tree typed; > > =A0 /* _DECL wrapped by this SSA name. =A0*/ > =A0 tree var; > -- > 1.7.0.4 > >