From: Richard Guenther <richard.guenther@gmail.com>
To: Nathan Froyd <froydnj@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org, java-patches@gcc.gnu.org
Subject: Re: [PATCH 17/18] introduce block_chainon and use BLOCK_CHAIN more
Date: Fri, 11 Mar 2011 13:15:00 -0000 [thread overview]
Message-ID: <AANLkTi=x2vMP17f3qh_CShR5fAmTxUn5NMG9Q1sxaeaO@mail.gmail.com> (raw)
In-Reply-To: <1299817406-16745-18-git-send-email-froydnj@codesourcery.com>
On Fri, Mar 11, 2011 at 5:23 AM, Nathan Froyd <froydnj@codesourcery.com> wrote:
> 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. It changes places that
> use chainon on BLOCKs to use block_chainon, which works identically to
> chainon except it uses BLOCK_CHAIN. And 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/
> * gcc-interface/utils.c (gnat_poplevel): Use block_chainon.
>
> gcc/
> * function.h (block_chainon): Declare.
> * function.c (block_chainon): Define.
>
> gcc/cp/
> * decl.c (poplevel): Use block_chainon.
>
> gcc/fortran/
> * f95-lang.c (poplevel): Use BLOCK_CHAIN and block_chainon.
>
> gcc/java/
> * 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)
> else if (BLOCK_VARS (block) == NULL_TREE)
> {
> BLOCK_SUBBLOCKS (level->chain->block)
> - = chainon (BLOCK_SUBBLOCKS (block),
> - BLOCK_SUBBLOCKS (level->chain->block));
> + = block_chainon (BLOCK_SUBBLOCKS (block),
> + BLOCK_SUBBLOCKS (level->chain->block));
> BLOCK_CHAIN (block) = free_block_chain;
> free_block_chain = block;
> }
> 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)
> }
> else if (block)
> current_binding_level->blocks
> - = chainon (current_binding_level->blocks, block);
> + = block_chainon (current_binding_level->blocks, block);
>
> /* If we did not make a block for the level just exited,
> any blocks made for inner levels
> @@ -803,7 +803,7 @@ poplevel (int keep, int reverse, int functionbody)
> of something else. */
> else if (subblocks)
> current_binding_level->blocks
> - = chainon (current_binding_level->blocks, subblocks);
> + = block_chainon (current_binding_level->blocks, subblocks);
>
> /* Each and every BLOCK node created here in `poplevel' is important
> (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)
>
> /* Record the BLOCK node just built as the subblock its enclosing scope. */
> for (subblock_node = subblock_chain; subblock_node;
> - subblock_node = TREE_CHAIN (subblock_node))
> + subblock_node = BLOCK_CHAIN (subblock_node))
> BLOCK_SUPERCONTEXT (subblock_node) = block_node;
>
> /* Clear out the meanings of the local variables of this level. */
> @@ -475,7 +475,7 @@ poplevel (int keep, int reverse, int functionbody)
> else if (block_node)
> {
> current_binding_level->blocks
> - = chainon (current_binding_level->blocks, block_node);
> + = block_chainon (current_binding_level->blocks, block_node);
> }
>
> /* If we did not make a block for the level just exited, any blocks made for
> @@ -484,7 +484,7 @@ poplevel (int keep, int reverse, int functionbody)
> else. */
> else if (subblock_chain)
> current_binding_level->blocks
> - = chainon (current_binding_level->blocks, subblock_chain);
> + = block_chainon (current_binding_level->blocks, subblock_chain);
> if (block_node)
> TREE_USED (block_node) = 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)
> return prev;
> }
>
> +/* Concatenate two chains of blocks (chained through BLOCK_CHAIN)
> + by modifying the last node in chain 1 to point to chain 2. */
> +
> +tree
> +block_chainon (tree op1, tree op2)
> +{
> + tree t1;
> +
> + if (!op1)
> + return op2;
> + if (!op2)
> + return op1;
> +
> + for (t1 = op1; BLOCK_CHAIN (t1); t1 = BLOCK_CHAIN (t1))
> + continue;
> + BLOCK_CHAIN (t1) = op2;
> +
> +#ifdef ENABLE_TREE_CHECKING
> + {
> + tree t2;
> + for (t2 = op2; t2; t2 = BLOCK_CHAIN (t2))
> + gcc_assert (t2 != t1);
> + }
> +#endif
> +
> + return op1;
> +}
> +
> /* Count the subblocks of the list starting with BLOCK. If VECTOR is
> non-NULL, list them all into VECTOR, in a depth-first preorder
> traversal of the block tree. Also 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);
>
> extern void clear_block_marks (tree);
> extern tree blocks_nreverse (tree);
> +extern tree block_chainon (tree, tree);
>
> /* Return size needed for stack frame based on slots so far allocated.
> This size counts from zero. It 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)
>
> /* In each subblock, record that this is its superior. */
>
> - for (link = subblocks; link; link = TREE_CHAIN (link))
> + for (link = subblocks; link; link = BLOCK_CHAIN (link))
> BLOCK_SUPERCONTEXT (link) = block;
>
> /* Clear out the meanings of the local variables of this level. */
> @@ -1545,7 +1545,7 @@ poplevel (int keep, int reverse, int functionbody)
> if (block)
> {
> current_binding_level->blocks
> - = chainon (current_binding_level->blocks, block);
> + = block_chainon (current_binding_level->blocks, block);
> }
> /* If we did not make a block for the level just exited,
> any blocks made for inner levels
> @@ -1554,7 +1554,7 @@ poplevel (int keep, int reverse, int functionbody)
> of something else. */
> else if (subblocks)
> current_binding_level->blocks
> - = chainon (current_binding_level->blocks, subblocks);
> + = block_chainon (current_binding_level->blocks, subblocks);
>
> if (bind)
> java_add_stmt (bind);
> --
> 1.7.0.4
>
>
next prev parent reply other threads:[~2011-03-11 13:15 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-11 4:23 [4.7 PATCH 00/18] slim down a number of tree nodes Nathan Froyd
2011-03-11 4:23 ` [PATCH 05/18] remove TREE_CHAIN from CONSTRUCTOR nodes Nathan Froyd
2011-03-11 13:05 ` Richard Guenther
2011-03-11 4:23 ` [PATCH 04/18] remove TREE_CHAIN from SSA_NAME nodes Nathan Froyd
2011-03-11 13:06 ` Richard Guenther
2011-03-11 4:24 ` [PATCH 06/18] define CASE_CHAIN accessor for CASE_LABEL_EXPR Nathan Froyd
2011-03-11 13:07 ` Richard Guenther
2011-03-11 4:24 ` [PATCH 08/18] convert cp *FOR_STMTs to use private scope fields Nathan Froyd
2011-03-11 4:24 ` [PATCH 10/18] convert cp SWITCH_STMTs " Nathan Froyd
2011-03-11 4:24 ` [PATCH 15/18] move REAL_IDENTIFIER_TYPE_VALUE to be a field of lang_identifier Nathan Froyd
2011-03-11 13:40 ` Jason Merrill
2011-03-11 14:04 ` Nathan Froyd
2011-03-11 14:20 ` Nathan Froyd
2011-03-11 15:04 ` Jason Merrill
2011-03-11 16:23 ` Nathan Froyd
2011-03-11 17:17 ` Jason Merrill
2011-03-11 14:41 ` Joseph S. Myers
2011-03-11 4:24 ` [PATCH 01/18] add typed_tree structure Nathan Froyd
2011-03-11 13:05 ` Richard Guenther
2011-03-11 15:21 ` Michael Matz
2011-03-11 4:24 ` [PATCH 13/18] move TS_EXP to be a substructure of TS_TYPED Nathan Froyd
2011-05-11 0:34 ` Nathan Froyd
2011-05-17 17:51 ` [PING][PATCH " Nathan Froyd
2011-05-23 14:58 ` Nathan Froyd
2011-05-23 15:34 ` Richard Guenther
2011-05-24 18:52 ` Nathan Froyd
2011-05-25 9:59 ` Richard Guenther
2011-03-11 4:24 ` [PATCH 07/18] generalize build_case_label to the rest of the compiler Nathan Froyd
2011-03-11 13:01 ` Joseph S. Myers
2011-03-11 13:10 ` Richard Guenther
2011-03-11 14:56 ` Tom Tromey
2011-03-11 4:24 ` [PATCH 03/18] remove TREE_CHAIN from *_CST nodes Nathan Froyd
2011-03-11 13:05 ` Richard Guenther
2011-03-11 4:24 ` [PATCH 16/18] make TS_IDENTIFIER be a substructure of TS_BASE Nathan Froyd
2011-03-11 13:12 ` Richard Guenther
2011-03-11 17:21 ` Nathan Froyd
2011-03-11 4:24 ` [PATCH 14/18] move TS_STATEMENT_LIST to be a substructure of TS_TYPED Nathan Froyd
2011-03-11 6:01 ` Jason Merrill
2011-03-11 12:23 ` Nathan Froyd
2011-03-11 4:30 ` [PATCH 11/18] mark EXPR_PACK_EXPANSION as typed only Nathan Froyd
2011-03-11 4:30 ` [PATCH 09/18] convert cp IF_STMTs to use private scope fields Nathan Froyd
2011-03-11 4:31 ` [PATCH 17/18] introduce block_chainon and use BLOCK_CHAIN more Nathan Froyd
2011-03-11 13:15 ` Richard Guenther [this message]
2011-03-11 13:19 ` Nathan Froyd
2011-03-11 15:14 ` Tom Tromey
2011-03-12 12:23 ` Eric Botcazou
2011-03-11 4:31 ` [PATCH 18/18] make TS_BLOCK a substructure of TS_BASE Nathan Froyd
2011-05-26 18:30 ` Nathan Froyd
2011-03-11 4:31 ` [PATCH 02/18] enforce TREE_CHAIN and TREE_TYPE accesses Nathan Froyd
2011-03-11 8:12 ` Mike Stump
2011-03-11 13:21 ` Richard Guenther
2011-03-11 15:24 ` Tom Tromey
2011-03-12 12:13 ` Eric Botcazou
2011-03-21 13:50 ` Nathan Froyd
2011-03-21 17:50 ` Eric Botcazou
2011-04-13 2:43 ` Nathan Froyd
2011-04-13 2:57 ` Diego Novillo
2011-04-13 4:02 ` Ian Lance Taylor
2011-03-11 4:50 ` [PATCH 12/18] make CASE_LABEL_EXPR not abuse TREE_CHAIN Nathan Froyd
2011-03-11 13:19 ` Richard Guenther
2011-05-10 20:08 ` Nathan Froyd
2011-05-10 20:19 ` Diego Novillo
2011-05-11 9:21 ` Richard Guenther
2011-05-11 19:22 ` H.J. Lu
2011-03-11 8:18 ` [4.7 PATCH 00/18] slim down a number of tree nodes Mike Stump
2011-03-11 16:00 ` Nathan Froyd
2011-03-11 13:25 ` Richard Guenther
2011-03-11 13:42 ` Nathan Froyd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='AANLkTi=x2vMP17f3qh_CShR5fAmTxUn5NMG9Q1sxaeaO@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=fortran@gcc.gnu.org \
--cc=froydnj@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=java-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).