[cfg-branch] fix eh handling
Jan Hubicka
jh@suse.cz
Sun Dec 30 08:54:00 GMT 2001
Sun Dec 30 17:12:33 CET 2001 Jan Hubicka <jh@suse.cz>
* cfgcleanup.c (cleanup_cfg): Do not kill tail recursion label list.
* sibcall.c (optimize_sibling_and_tail_recursive_call): Do not
rebuild cfg; free tail recursive list.
* toplev.c (rest_of_compilation): Dump more of sibcalling;
kill NOTE_INSN_PREDICTION notes.
Index: cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cfgcleanup.c,v
retrieving revision 1.18.2.12
diff -c -3 -p -r1.18.2.12 cfgcleanup.c
*** cfgcleanup.c 2001/12/29 20:56:34 1.18.2.12
--- cfgcleanup.c 2001/12/30 16:10:06
*************** cleanup_cfg (mode)
*** 1653,1659 ****
/* Kill the data we won't maintain. */
free_EXPR_LIST_list (&label_value_list);
- free_EXPR_LIST_list (&tail_recursion_label_list);
timevar_pop (TV_CLEANUP_CFG);
return changed;
--- 1653,1658 ----
Index: sibcall.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/sibcall.c,v
retrieving revision 1.28.2.1
diff -c -3 -p -r1.28.2.1 sibcall.c
*** sibcall.c 2001/11/26 10:54:54 1.28.2.1
--- sibcall.c 2001/12/30 16:10:06
*************** optimize_sibling_and_tail_recursive_call
*** 579,594 ****
insns = get_insns ();
- /* We do not perform these calls when flag_exceptions is true, so this
- is probably a NOP at the current time. However, we may want to support
- sibling and tail recursion optimizations in the future, so let's plan
- ahead and find all the EH labels. */
- find_exception_handler_labels ();
-
- rebuild_jump_labels (insns);
- /* We need cfg information to determine which blocks are succeeded
- only by the epilogue. */
- find_basic_blocks (insns, max_reg_num (), 0);
cleanup_cfg (CLEANUP_PRE_SIBCALL | CLEANUP_PRE_LOOP);
/* If there are no basic blocks, then there is nothing to do. */
--- 579,584 ----
*************** optimize_sibling_and_tail_recursive_call
*** 759,767 ****
/* This information will be invalid after inline expansion. Kill it now. */
free_basic_block_vars (0);
! for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
! if (GET_CODE (insn) == NOTE
! && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_RETURN
! || NOTE_LINE_NUMBER (insn) == NOTE_INSN_PREDICTION))
! delete_insn (insn);
}
--- 749,753 ----
/* This information will be invalid after inline expansion. Kill it now. */
free_basic_block_vars (0);
! free_EXPR_LIST_list (&tail_recursion_label_list);
}
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.537.2.20
diff -c -3 -p -r1.537.2.20 toplev.c
*** toplev.c 2001/12/29 16:53:59 1.537.2.20
--- toplev.c 2001/12/30 16:10:07
*************** rest_of_compilation (decl)
*** 2545,2575 ****
if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
goto exit_rest_of_compilation;
/* Build CFG -- for predictions based on source code. */
insns = get_insns ();
- find_exception_handler_labels ();
rebuild_jump_labels (insns);
find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
cleanup_cfg (CLEANUP_PRE_SIBCALL | CLEANUP_UNREACHABLE_ONLY);
/* Turn NOTE_INSN_PREDICTIONs into branch predictions. */
note_prediction_to_br_prob ();
-
- free_bb_for_insn ();
/* We may have potential sibling or tail recursion sites. Select one
(of possibly multiple) methods of performing the call. */
if (flag_optimize_sibling_calls)
! {
! timevar_push (TV_JUMP);
! open_dump_file (DFI_sibling, decl);
!
! optimize_sibling_and_tail_recursive_calls ();
! close_dump_file (DFI_sibling, print_rtl, get_insns ());
! timevar_pop (TV_JUMP);
! }
/* Complete generation of exception handling code. */
find_exception_handler_labels ();
--- 2545,2581 ----
if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
goto exit_rest_of_compilation;
+ timevar_push (TV_JUMP);
+ open_dump_file (DFI_sibling, decl);
+
/* Build CFG -- for predictions based on source code. */
insns = get_insns ();
rebuild_jump_labels (insns);
+ find_exception_handler_labels ();
find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
cleanup_cfg (CLEANUP_PRE_SIBCALL | CLEANUP_UNREACHABLE_ONLY);
/* Turn NOTE_INSN_PREDICTIONs into branch predictions. */
note_prediction_to_br_prob ();
/* We may have potential sibling or tail recursion sites. Select one
(of possibly multiple) methods of performing the call. */
if (flag_optimize_sibling_calls)
! optimize_sibling_and_tail_recursive_calls ();
!
! close_dump_file (DFI_sibling, print_rtl, get_insns ());
! timevar_pop (TV_JUMP);
! free_bb_for_insn ();
! {
! rtx insn;
! for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
! if (GET_CODE (insn) == NOTE
! && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_RETURN
! || NOTE_LINE_NUMBER (insn) == NOTE_INSN_PREDICTION))
! delete_insn (insn);
! }
/* Complete generation of exception handling code. */
find_exception_handler_labels ();
More information about the Gcc-patches
mailing list