diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-20 00:49:13 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-20 00:49:13 +0000 |
commit | 7cb6ef9cb9d0e20a63da12d8a976db77d38c5e39 (patch) | |
tree | 8fe10615c6c1ebde7f73b98b8f2e1d6797bb0b38 /gcc/sibcall.c | |
parent | 0b5e8ccdc811e7a1d5360e2f47d40363a8a77c3e (diff) | |
download | gcc-7cb6ef9cb9d0e20a63da12d8a976db77d38c5e39.tar.gz |
* except.c (current_function_has_exception_handlers): New.
* except.h: Declare it.
* sibcall.c (optimize_sibling_and_tail_recursive_call): Use it.
Combine tests that disable all sibcalls for the function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51054 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sibcall.c')
-rw-r--r-- | gcc/sibcall.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/gcc/sibcall.c b/gcc/sibcall.c index 6c2dc5c0914..5a7997cb038 100644 --- a/gcc/sibcall.c +++ b/gcc/sibcall.c @@ -572,7 +572,7 @@ optimize_sibling_and_tail_recursive_calls () { rtx insn, insns; basic_block alternate_exit = EXIT_BLOCK_PTR; - int current_function_uses_addressof; + bool no_sibcalls_this_function = false; int successful_sibling_call = 0; int replaced_call_placeholder = 0; edge e; @@ -595,6 +595,12 @@ optimize_sibling_and_tail_recursive_calls () if (n_basic_blocks == 0) return; + /* If we are using sjlj exceptions, we may need to add a call to + _Unwind_SjLj_Unregister at exit of the function. Which means + that we cannot do any sibcall transformations. */ + if (USING_SJLJ_EXCEPTIONS && current_function_has_exception_handlers ()) + no_sibcalls_this_function = true; + return_value_pseudo = NULL_RTX; /* Find the exit block. @@ -655,7 +661,7 @@ optimize_sibling_and_tail_recursive_calls () /* If the function uses ADDRESSOF, we can't (easily) determine at this point if the value will end up on the stack. */ - current_function_uses_addressof = sequence_uses_addressof (insns); + no_sibcalls_this_function |= sequence_uses_addressof (insns); /* Walk the insn chain and find any CALL_PLACEHOLDER insns. We need to select one of the insn sequences attached to each CALL_PLACEHOLDER. @@ -685,11 +691,10 @@ optimize_sibling_and_tail_recursive_calls () /* See if there are any reasons we can't perform either sibling or tail call optimizations. We must be careful with stack slots - which are live at potential optimization sites. ??? The first - test is overly conservative and should be replaced. */ - if (frame_offset - /* Can't take address of local var if used by recursive call. */ - || current_function_uses_addressof + which are live at potential optimization sites. */ + if (no_sibcalls_this_function + /* ??? Overly conservative. */ + || frame_offset /* Any function that calls setjmp might have longjmp called from any called function. ??? We really should represent this properly in the CFG so that this needn't be special cased. */ |