This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [tree-ssa] redundant eh simplification?
- From: Richard Henderson <rth at redhat dot com>
- To: Jeff Sturm <jsturm at one-point dot com>
- Cc: java-patches at gcc dot gnu dot org
- Date: Thu, 30 Oct 2003 18:08:10 -0800
- Subject: Re: [tree-ssa] redundant eh simplification?
- References: <20031030012333.GC24295@redhat.com> <Pine.LNX.4.44.0310292315400.4289-100000@ops2.one-point.com>
On Wed, Oct 29, 2003 at 11:18:50PM -0500, Jeff Sturm wrote:
> My recollection is that it worked around a failure in the gimplifier. But
> that was months ago. I think we can now remove it if a bootstrap
> succeeds.
And it did. I've committed the following.
r~
* java-gimplify.c (cleanup_compound_expr): Remove.
(cleanup_try_finally_expr): Remove.
(java_gimplify_expr): Don't call them.
(java_gimplify_case_expr): Use create_artificial_label.
(java_gimplify_default_expr): Likewise.
Index: java-gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/java-gimplify.c,v
retrieving revision 1.1.2.7
diff -c -p -d -r1.1.2.7 java-gimplify.c
*** java-gimplify.c 23 Oct 2003 16:45:53 -0000 1.1.2.7
--- java-gimplify.c 31 Oct 2003 02:04:45 -0000
*************** static tree java_gimplify_block (tree);
*** 39,47 ****
static tree java_gimplify_new_array_init (tree);
static tree java_gimplify_try_expr (tree);
- static void cleanup_compound_expr (tree *);
- static void cleanup_try_finally_expr (tree *);
-
static void dump_java_tree (enum tree_dump_index, tree);
/* Convert a Java tree to GENERIC. */
--- 39,44 ----
*************** java_gimplify_expr (tree *expr_p, tree *
*** 116,129 ****
case CLASS_LITERAL:
abort ();
- case COMPOUND_EXPR:
- cleanup_compound_expr (expr_p);
- break;
-
- case TRY_FINALLY_EXPR:
- cleanup_try_finally_expr (expr_p);
- break;
-
default:
return GS_UNHANDLED;
}
--- 113,118 ----
*************** java_gimplify_expr (tree *expr_p, tree *
*** 134,141 ****
static tree
java_gimplify_case_expr (tree expr)
{
! tree label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
! DECL_CONTEXT (label) = current_function_decl;
return build (CASE_LABEL_EXPR, void_type_node,
TREE_OPERAND (expr, 0), NULL_TREE, label);
}
--- 123,129 ----
static tree
java_gimplify_case_expr (tree expr)
{
! tree label = create_artificial_label ();
return build (CASE_LABEL_EXPR, void_type_node,
TREE_OPERAND (expr, 0), NULL_TREE, label);
}
*************** java_gimplify_case_expr (tree expr)
*** 143,150 ****
static tree
java_gimplify_default_expr (tree expr ATTRIBUTE_UNUSED)
{
! tree label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
! DECL_CONTEXT (label) = current_function_decl;
return build (CASE_LABEL_EXPR, void_type_node, NULL_TREE, NULL_TREE, label);
}
--- 131,137 ----
static tree
java_gimplify_default_expr (tree expr ATTRIBUTE_UNUSED)
{
! tree label = create_artificial_label ();
return build (CASE_LABEL_EXPR, void_type_node, NULL_TREE, NULL_TREE, label);
}
*************** java_gimplify_try_expr (tree try_expr)
*** 245,301 ****
handler = TREE_CHAIN (handler);
}
return build (TRY_CATCH_EXPR, void_type_node, body, catch);
- }
-
- /* Ensure that every COMPOUND_EXPR has a type. Also purge any
- COMPOUND_EXPR with one or more empty statements. */
-
- static void
- cleanup_compound_expr (tree *expr_p)
- {
- if (TREE_CODE (TREE_OPERAND (*expr_p, 0)) == COMPOUND_EXPR)
- cleanup_compound_expr (&TREE_OPERAND (*expr_p, 0));
- if (TREE_CODE (TREE_OPERAND (*expr_p, 1)) == COMPOUND_EXPR)
- cleanup_compound_expr (&TREE_OPERAND (*expr_p, 1));
-
- if (TREE_OPERAND (*expr_p, 0) == NULL_TREE
- || IS_EMPTY_STMT (TREE_OPERAND (*expr_p, 0)))
- {
- *expr_p = TREE_OPERAND (*expr_p, 1);
- return;
- }
- if (TREE_OPERAND (*expr_p, 1) == NULL_TREE
- || IS_EMPTY_STMT (TREE_OPERAND (*expr_p, 1)))
- {
- *expr_p = TREE_OPERAND (*expr_p, 0);
- return;
- }
-
- if (TREE_TYPE (*expr_p) == NULL_TREE)
- {
- tree last = TREE_OPERAND (*expr_p, 1);
- TREE_TYPE (*expr_p) = TREE_TYPE (last);
- }
- }
-
- /* Ensure that every TRY_FINALLY_EXPR has at least one non-empty
- statement in both its try and finally blocks. */
-
- static void
- cleanup_try_finally_expr (tree *expr_p)
- {
- if (TREE_OPERAND (*expr_p, 0) == NULL_TREE
- || IS_EMPTY_STMT (TREE_OPERAND (*expr_p, 0)))
- {
- *expr_p = TREE_OPERAND (*expr_p, 1);
- return;
- }
- if (TREE_OPERAND (*expr_p, 1) == NULL_TREE
- || IS_EMPTY_STMT (TREE_OPERAND (*expr_p, 1)))
- {
- *expr_p = TREE_OPERAND (*expr_p, 0);
- return;
- }
}
/* Dump a tree of some kind. This is a convenience wrapper for the
--- 232,237 ----