This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Gimplifying Java
- From: Jason Merrill <jason at redhat dot com>
- To: Jeff Sturm <jsturm at one-point dot com>
- Cc: law at redhat dot com, Andrew MacLeod <amacleod at redhat dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 13 Jun 2003 20:12:51 -0400
- Subject: Re: [tree-ssa] Gimplifying Java
- References: <Pine.LNX.4.44.0306131816120.6334-100000@ops2.one-point.com>
Here's a similar patch which I sent Jeff a while back (minus the bits for
threading cleanups). I haven't tested it recently.
2003-06-13 Jason Merrill <jason@redhat.com>
* tree-cfg.c (make_ctrl_stmt_edges): Remove bogus EH edges, change
some edges from ABNORMAL to FALLTHRU.
(remove_useless_stmts_and_vars): Handle TRY_CATCH_EXPR properly.
*** tree-cfg.c.~1~ 2003-06-06 13:27:11.000000000 -0400
--- tree-cfg.c 2003-06-13 20:08:25.000000000 -0400
*************** make_ctrl_stmt_edges (bb)
*** 1092,1107 ****
case TRY_FINALLY_EXPR:
VARRAY_PUSH_TREE (try_finallys, last);
if (first_exec_stmt (&TREE_OPERAND (last, 0)) == NULL)
! make_edge (bb, first_exec_block (&TREE_OPERAND (last, 1)), EDGE_ABNORMAL);
! /* FALL THROUGH */
case TRY_CATCH_EXPR:
{
basic_block target_bb = first_exec_block (&TREE_OPERAND (last, 0));
if (target_bb)
make_edge (bb, target_bb, EDGE_FALLTHRU);
! make_edge (bb, successor_block (bb), EDGE_FALLTHRU);
break;
}
--- 1092,1112 ----
case TRY_FINALLY_EXPR:
VARRAY_PUSH_TREE (try_finallys, last);
if (first_exec_stmt (&TREE_OPERAND (last, 0)) == NULL)
! {
! make_edge (bb, first_exec_block (&TREE_OPERAND (last, 1)), EDGE_FALLTHRU);
! break;
! }
! /* else FALL THROUGH */
case TRY_CATCH_EXPR:
{
basic_block target_bb = first_exec_block (&TREE_OPERAND (last, 0));
if (target_bb)
make_edge (bb, target_bb, EDGE_FALLTHRU);
! else
! make_edge (bb, successor_block (bb), EDGE_FALLTHRU);
!
break;
}
*************** make_ctrl_stmt_edges (bb)
*** 1111,1117 ****
if (target_bb)
make_edge (bb, target_bb, EDGE_FALLTHRU);
! make_edge (bb, successor_block (bb), EDGE_FALLTHRU);
break;
}
--- 1116,1123 ----
if (target_bb)
make_edge (bb, target_bb, EDGE_FALLTHRU);
! else
! make_edge (bb, successor_block (bb), EDGE_FALLTHRU);
break;
}
*************** make_ctrl_stmt_edges (bb)
*** 1120,1127 ****
basic_block target_bb = first_exec_block (&EH_FILTER_FAILURE (last));
if (target_bb)
! make_edge (bb, target_bb, EDGE_ABNORMAL);
! make_edge (bb, successor_block (bb), EDGE_FALLTHRU);
break;
}
--- 1126,1134 ----
basic_block target_bb = first_exec_block (&EH_FILTER_FAILURE (last));
if (target_bb)
! make_edge (bb, target_bb, EDGE_FALLTHRU);
! else
! make_edge (bb, successor_block (bb), EDGE_FALLTHRU);
break;
}
*************** remove_useless_stmts_and_vars (first_p)
*** 1507,1526 ****
/* If the body of a TRY_FINALLY is empty, then we can just
emit the handler without the enclosing TRY_FINALLY.
! If the body of a TRY_CATCH is empty and the handler is
! empty (it had no reachable code either), then we can
! emit an empty statement without the enclosing TRY_CATCH.
In both cases we want to apply this optimization pass
again. */
if (IS_EMPTY_STMT (TREE_OPERAND (*stmt_p, 0)))
{
! if (code == TRY_FINALLY_EXPR
! || IS_EMPTY_STMT (TREE_OPERAND (*stmt_p, 1)))
! {
! *stmt_p = TREE_OPERAND (*stmt_p, 1);
! repeat = 1;
! }
}
}
else if (code == BIND_EXPR)
--- 1514,1531 ----
/* If the body of a TRY_FINALLY is empty, then we can just
emit the handler without the enclosing TRY_FINALLY.
! If the body of a TRY_CATCH is empty, then we can throw the
! whole thing away.
In both cases we want to apply this optimization pass
again. */
if (IS_EMPTY_STMT (TREE_OPERAND (*stmt_p, 0)))
{
! if (code == TRY_FINALLY_EXPR)
! *stmt_p = TREE_OPERAND (*stmt_p, 1);
! else
! *stmt_p = build_empty_stmt ();
! repeat = 1;
}
}
else if (code == BIND_EXPR)