From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5447 invoked by alias); 11 Mar 2011 13:15:31 -0000 Received: (qmail 5240 invoked by uid 22791); 11 Mar 2011 13:15:28 -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,TW_TM 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:15:22 +0000 Received: by iyb26 with SMTP id 26so2955388iyb.20 for ; Fri, 11 Mar 2011 05:15:20 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.15.199 with SMTP id l7mr5392756iba.131.1299849320159; Fri, 11 Mar 2011 05:15:20 -0800 (PST) Received: by 10.231.10.130 with HTTP; Fri, 11 Mar 2011 05:15:20 -0800 (PST) In-Reply-To: <1299817406-16745-18-git-send-email-froydnj@codesourcery.com> References: <1299817406-16745-1-git-send-email-froydnj@codesourcery.com> <1299817406-16745-18-git-send-email-froydnj@codesourcery.com> Date: Fri, 11 Mar 2011 13:15:00 -0000 Message-ID: Subject: Re: [PATCH 17/18] introduce block_chainon and use BLOCK_CHAIN more From: Richard Guenther To: Nathan Froyd Cc: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org, java-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/msg00598.txt.bz2 On Fri, Mar 11, 2011 at 5:23 AM, Nathan Froyd wr= ote: > BLOCKs have a TREE_CHAIN and a TREE_TYPE; TREE_TYPE is useless for > blocks, but we can't remove TREE_TYPE without also removing TREE_CHAIN. > This patch lays the groundwork to do just that. =A0It changes places that > use chainon on BLOCKs to use block_chainon, which works identically to > chainon except it uses BLOCK_CHAIN. =A0And it fixes up a few places that > used TREE_CHAIN when they meant BLOCK_CHAIN. The middle-end parts are ok. Any particular reason why you choose function.[ch] for block_chainon and not tree.[ch]? Thanks, Richard. > -Nathan > > gcc/ada/ > =A0 =A0 =A0 =A0* gcc-interface/utils.c (gnat_poplevel): Use block_chainon. > > gcc/ > =A0 =A0 =A0 =A0* function.h (block_chainon): Declare. > =A0 =A0 =A0 =A0* function.c (block_chainon): Define. > > gcc/cp/ > =A0 =A0 =A0 =A0* decl.c (poplevel): Use block_chainon. > > gcc/fortran/ > =A0 =A0 =A0 =A0* f95-lang.c (poplevel): Use BLOCK_CHAIN and block_chainon. > > gcc/java/ > =A0 =A0 =A0 =A0* decl.c (poplevel): Use BLOCK_CHAIN and block_chainon. > > diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c > index eac87e0..dd06ca3 100644 > --- a/gcc/ada/gcc-interface/utils.c > +++ b/gcc/ada/gcc-interface/utils.c > @@ -395,8 +395,8 @@ gnat_poplevel (void) > =A0 else if (BLOCK_VARS (block) =3D=3D NULL_TREE) > =A0 =A0 { > =A0 =A0 =A0 BLOCK_SUBBLOCKS (level->chain->block) > - =A0 =A0 =A0 =3D chainon (BLOCK_SUBBLOCKS (block), > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0BLOCK_SUBBLOCKS (level->chain->block= )); > + =A0 =A0 =A0 =3D block_chainon (BLOCK_SUBBLOCKS (block), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0BLOCK_SUBBLOCKS (level->= chain->block)); > =A0 =A0 =A0 BLOCK_CHAIN (block) =3D free_block_chain; > =A0 =A0 =A0 free_block_chain =3D block; > =A0 =A0 } > diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c > index a0ef39f..de96ac2 100644 > --- a/gcc/cp/decl.c > +++ b/gcc/cp/decl.c > @@ -794,7 +794,7 @@ poplevel (int keep, int reverse, int functionbody) > =A0 =A0 } > =A0 else if (block) > =A0 =A0 current_binding_level->blocks > - =A0 =A0 =A0=3D chainon (current_binding_level->blocks, block); > + =A0 =A0 =A0=3D block_chainon (current_binding_level->blocks, block); > > =A0 /* If we did not make a block for the level just exited, > =A0 =A0 =A0any blocks made for inner levels > @@ -803,7 +803,7 @@ poplevel (int keep, int reverse, int functionbody) > =A0 =A0 =A0of something else. =A0*/ > =A0 else if (subblocks) > =A0 =A0 current_binding_level->blocks > - =A0 =A0 =A0=3D chainon (current_binding_level->blocks, subblocks); > + =A0 =A0 =A0=3D block_chainon (current_binding_level->blocks, subblocks); > > =A0 /* Each and every BLOCK node created here in `poplevel' is important > =A0 =A0 =A0(e.g. for proper debugging information) so if we created one > diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c > index 687f60b..aebe397 100644 > --- a/gcc/fortran/f95-lang.c > +++ b/gcc/fortran/f95-lang.c > @@ -444,7 +444,7 @@ poplevel (int keep, int reverse, int functionbody) > > =A0 /* Record the BLOCK node just built as the subblock its enclosing sco= pe. =A0*/ > =A0 for (subblock_node =3D subblock_chain; subblock_node; > - =A0 =A0 =A0 subblock_node =3D TREE_CHAIN (subblock_node)) > + =A0 =A0 =A0 subblock_node =3D BLOCK_CHAIN (subblock_node)) > =A0 =A0 BLOCK_SUPERCONTEXT (subblock_node) =3D block_node; > > =A0 /* Clear out the meanings of the local variables of this level. =A0*/ > @@ -475,7 +475,7 @@ poplevel (int keep, int reverse, int functionbody) > =A0 else if (block_node) > =A0 =A0 { > =A0 =A0 =A0 current_binding_level->blocks > - =A0 =A0 =A0 =3D chainon (current_binding_level->blocks, block_node); > + =A0 =A0 =A0 =3D block_chainon (current_binding_level->blocks, block_nod= e); > =A0 =A0 } > > =A0 /* If we did not make a block for the level just exited, any blocks m= ade for > @@ -484,7 +484,7 @@ poplevel (int keep, int reverse, int functionbody) > =A0 =A0 =A0else. =A0*/ > =A0 else if (subblock_chain) > =A0 =A0 current_binding_level->blocks > - =A0 =A0 =A0=3D chainon (current_binding_level->blocks, subblock_chain); > + =A0 =A0 =A0=3D block_chainon (current_binding_level->blocks, subblock_c= hain); > =A0 if (block_node) > =A0 =A0 TREE_USED (block_node) =3D 1; > > diff --git a/gcc/function.c b/gcc/function.c > index 3f721fb..094cf74 100644 > --- a/gcc/function.c > +++ b/gcc/function.c > @@ -4167,6 +4167,34 @@ blocks_nreverse (tree t) > =A0 return prev; > =A0} > > +/* Concatenate two chains of blocks (chained through BLOCK_CHAIN) > + =A0 by modifying the last node in chain 1 to point to chain 2. =A0*/ > + > +tree > +block_chainon (tree op1, tree op2) > +{ > + =A0tree t1; > + > + =A0if (!op1) > + =A0 =A0return op2; > + =A0if (!op2) > + =A0 =A0return op1; > + > + =A0for (t1 =3D op1; BLOCK_CHAIN (t1); t1 =3D BLOCK_CHAIN (t1)) > + =A0 =A0continue; > + =A0BLOCK_CHAIN (t1) =3D op2; > + > +#ifdef ENABLE_TREE_CHECKING > + =A0{ > + =A0 =A0tree t2; > + =A0 =A0for (t2 =3D op2; t2; t2 =3D BLOCK_CHAIN (t2)) > + =A0 =A0 =A0gcc_assert (t2 !=3D t1); > + =A0} > +#endif > + > + =A0return op1; > +} > + > =A0/* Count the subblocks of the list starting with BLOCK. =A0If VECTOR is > =A0 =A0non-NULL, list them all into VECTOR, in a depth-first preorder > =A0 =A0traversal of the block tree. =A0Also clear TREE_ASM_WRITTEN in all > diff --git a/gcc/function.h b/gcc/function.h > index 6e7f539..73af294 100644 > --- a/gcc/function.h > +++ b/gcc/function.h > @@ -713,6 +713,7 @@ extern void number_blocks (tree); > > =A0extern void clear_block_marks (tree); > =A0extern tree blocks_nreverse (tree); > +extern tree block_chainon (tree, tree); > > =A0/* Return size needed for stack frame based on slots so far allocated. > =A0 =A0This size counts from zero. =A0It is not rounded to STACK_BOUNDARY; > diff --git a/gcc/java/decl.c b/gcc/java/decl.c > index a17b826..6e94dff 100644 > --- a/gcc/java/decl.c > +++ b/gcc/java/decl.c > @@ -1481,7 +1481,7 @@ poplevel (int keep, int reverse, int functionbody) > > =A0 /* In each subblock, record that this is its superior. =A0*/ > > - =A0for (link =3D subblocks; link; link =3D TREE_CHAIN (link)) > + =A0for (link =3D subblocks; link; link =3D BLOCK_CHAIN (link)) > =A0 =A0 BLOCK_SUPERCONTEXT (link) =3D block; > > =A0 /* Clear out the meanings of the local variables of this level. =A0*/ > @@ -1545,7 +1545,7 @@ poplevel (int keep, int reverse, int functionbody) > =A0 =A0 =A0 if (block) > =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0current_binding_level->blocks > - =A0 =A0 =A0 =A0 =A0 =3D chainon (current_binding_level->blocks, block); > + =A0 =A0 =A0 =A0 =A0 =3D block_chainon (current_binding_level->blocks, b= lock); > =A0 =A0 =A0 =A0} > =A0 =A0 =A0 /* If we did not make a block for the level just exited, > =A0 =A0 =A0 =A0 any blocks made for inner levels > @@ -1554,7 +1554,7 @@ poplevel (int keep, int reverse, int functionbody) > =A0 =A0 =A0 =A0 of something else. =A0*/ > =A0 =A0 =A0 else if (subblocks) > =A0 =A0 =A0 =A0current_binding_level->blocks > - =A0 =A0 =A0 =A0 =3D chainon (current_binding_level->blocks, subblocks); > + =A0 =A0 =A0 =A0 =3D block_chainon (current_binding_level->blocks, subbl= ocks); > > =A0 =A0 =A0 if (bind) > =A0 =A0 =A0 =A0java_add_stmt (bind); > -- > 1.7.0.4 > >