From 2c8a1497c34d993b24a00f9962f72ab05d749471 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Fri, 29 Sep 2006 06:32:58 +0000 Subject: * builtins.c (expand_builtin_setjmp): Delete. (expand_builtin) : Mark as unreachable. : New case. : Likewise. : Likewise. * builtins.def (BUILT_IN_SETJMP_SETUP): New built-in stub. (BUILT_IN_SETJMP_DISPATCHER): Likewise. (BUILT_IN_SETJMP_RECEIVER): Likewise. * gimple-low.c (struct lower_data): New field calls_builtin_setjmp. (lower_function_body): Initialize it to false. If it is set to true at the end of the processing, emit the setjmp dispatcher. (lower_stmt) : Invoke lower_builtin_setjmp if the callee is __builtin_setjmp and set calls_builtin_setjmp to true as well. : Fall through to above case if there is a CALL_EXPR on the rhs of the assignment. (lower_builtin_setjmp): New function. * tree.c (build_common_builtin_nodes): Build BUILT_IN_SETJMP_SETUP, BUILT_IN_SETJMP_DISPATCHER and BUILT_IN_SETJMP_RECEIVER nodes. * tree-cfg.c (make_exit_edges) : Use specific predicate to detect calls that can go to non-local labels. Use specific helper to create the abnormal edges associated with them. : Likewise. (make_abnormal_goto_edges): New function extracted from... (make_goto_expr_edges): ...here. Call it for computed gotos. (simple_goto_p): Minor tweak. (tree_can_make_abnormal_goto): New predicate. (tree_redirect_edge_and_branch): Return zero on all abnormal edges. (tree_purge_dead_abnormal_call_edges): New function. * tree-flow.h (tree_can_make_abnormal_goto): Declare. (tree_purge_dead_abnormal_call_edges): Likewise. (make_abnormal_goto_edges): Likewise. * tree-inline.c (expand_call_inline): Simplify statement frobbing. Purge all dead abnormal edges if the call was in the last statement. * tree-optimize.c (has_abnormal_outgoing_edge_p): New predicate. (execute_fixup_cfg): If there are non-local labels in the function, scan the basic blocks and split them at calls that can go to non-local labels or add missing abnormal call edges. Write down the CFG in the dump file. (pass_fixup_cfg): Remove TODO_dump_func flag. * unwind-sjlj.c: Poison setjmp. * doc/install.texi (enable-sjlj-exceptions): Use more general wording. * doc/tm.texi (DWARF2_UNWIND_INFO): Likewise. (TARGET_UNWIND_TABLES_DEFAULT): Fix typo. (DONT_USE_BUILTIN_SETJMP): Document it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117298 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-inline.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'gcc/tree-inline.c') diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index baca8340486..61b1dab954d 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1930,6 +1930,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data) edge e; block_stmt_iterator bsi, stmt_bsi; bool successfully_inlined = FALSE; + bool purge_dead_abnormal_edges; tree t_step; tree var; @@ -2024,30 +2025,36 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data) #endif /* We will be inlining this callee. */ - id->eh_region = lookup_stmt_eh_region (stmt); /* Split the block holding the CALL_EXPR. */ - e = split_block (bb, stmt); bb = e->src; return_block = e->dest; remove_edge (e); - /* split_block splits before the statement, work around this by moving - the call into the first half_bb. Not pretty, but seems easier than - doing the CFG manipulation by hand when the CALL_EXPR is in the last - statement in BB. */ + /* split_block splits after the statement; work around this by + moving the call into the second block manually. Not pretty, + but seems easier than doing the CFG manipulation by hand + when the CALL_EXPR is in the last statement of BB. */ stmt_bsi = bsi_last (bb); + bsi_remove (&stmt_bsi, false); + + /* If the CALL_EXPR was in the last statement of BB, it may have + been the source of abnormal edges. In this case, schedule + the removal of dead abnormal edges. */ bsi = bsi_start (return_block); - if (!bsi_end_p (bsi)) - bsi_move_before (&stmt_bsi, &bsi); - else + if (bsi_end_p (bsi)) { - tree stmt = bsi_stmt (stmt_bsi); - bsi_remove (&stmt_bsi, false); bsi_insert_after (&bsi, stmt, BSI_NEW_STMT); + purge_dead_abnormal_edges = true; } + else + { + bsi_insert_before (&bsi, stmt, BSI_NEW_STMT); + purge_dead_abnormal_edges = false; + } + stmt_bsi = bsi_start (return_block); /* Build a block containing code to initialize the arguments, the @@ -2147,9 +2154,8 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data) tsi_delink() will leave the iterator in a sane state. */ bsi_remove (&stmt_bsi, true); - bsi_next (&bsi); - if (bsi_end_p (bsi)) - tree_purge_dead_eh_edges (return_block); + if (purge_dead_abnormal_edges) + tree_purge_dead_abnormal_call_edges (return_block); /* If the value of the new expression is ignored, that's OK. We don't warn about this for CALL_EXPRs, so we shouldn't warn about -- cgit v1.2.3