This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] PATCH: rebuild subblocks for BIND_EXPR
- From: Jeff Sturm <jsturm at one-point dot com>
- To: gcc-patches at gcc dot gnu dot org, <java-patches at gcc dot gnu dot org>
- Date: Fri, 27 Jun 2003 22:56:25 -0400 (EDT)
- Subject: [tree-ssa] PATCH: rebuild subblocks for BIND_EXPR
Java BLOCK nodes don't have the correct subblocks for GIMPLE, causing an
abort in SSA. The following patch rebuilds subblocks using the current
bind expr within gimplify, and enables the Java gimplifier by default.
Tested on i686-pc-linux-gnu. There is a single regression caused by an
unrelated bug in fold. OK?
Jeff
2003-06-27 Jeff Sturm <jsturm@one-point.com>
* java-gimplify.c (java_gimplify_block): Rebuild BLOCK_SUBBLOCKS.
* lang.c (java_init): Remove assignment to flag_disable_gimple.
Index: java-gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/java-gimplify.c,v
retrieving revision 1.1.2.1
diff -c -p -r1.1.2.1 java-gimplify.c
*** java-gimplify.c 21 Jun 2003 18:21:00 -0000 1.1.2.1
--- java-gimplify.c 28 Jun 2003 02:37:16 -0000
*************** java_gimplify_default_expr (tree expr AT
*** 135,150 ****
/* Gimplify BLOCK into a BIND_EXPR. */
static tree
! java_gimplify_block (tree block)
{
! tree decls = BLOCK_VARS (block);
! tree body = BLOCK_EXPR_BODY (block);
/* Don't bother with empty blocks. */
if (IS_EMPTY_STMT (body))
return body;
! return build (BIND_EXPR, TREE_TYPE (block), decls, body, block);
}
/* Gimplify a NEW_ARRAY_INIT node into array/element assignments. */
--- 135,162 ----
/* Gimplify BLOCK into a BIND_EXPR. */
static tree
! java_gimplify_block (tree java_block)
{
! tree decls = BLOCK_VARS (java_block);
! tree body = BLOCK_EXPR_BODY (java_block);
! tree outer = gimple_current_bind_expr ();
! tree block;
/* Don't bother with empty blocks. */
if (IS_EMPTY_STMT (body))
return body;
! /* Make a proper block. Java blocks are unsuitable for BIND_EXPR
! because they use BLOCK_SUBBLOCKS for another purpose. */
! block = make_node (BLOCK);
! BLOCK_VARS (block) = decls;
! if (outer != NULL_TREE)
! {
! outer = BIND_EXPR_BLOCK (outer);
! BLOCK_SUBBLOCKS (outer) = chainon (BLOCK_SUBBLOCKS (outer), block);
! }
!
! return build (BIND_EXPR, TREE_TYPE (java_block), decls, body, block);
}
/* Gimplify a NEW_ARRAY_INIT node into array/element assignments. */
Index: lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/lang.c,v
retrieving revision 1.103.2.14
diff -c -p -r1.103.2.14 lang.c
*** lang.c 21 Jun 2003 18:21:00 -0000 1.103.2.14
--- lang.c 28 Jun 2003 02:37:17 -0000
*************** java_init (void)
*** 525,533 ****
&& force_align_functions_log < 1)
force_align_functions_log = 1;
- /* FIXME: Remove this once the gimplifier is ready. */
- flag_disable_gimple = 1;
-
jcf_path_init ();
jcf_path_seal (version_flag);
--- 525,530 ----