Commit 4c029f40 by Tom de Vries Committed by Tom de Vries

re PR target/43920 (Choosing conditional execution over conditional branches for…

re PR target/43920 (Choosing conditional execution over conditional branches for code size in some cases.)

2011-04-05  Tom de Vries  <tom@codesourcery.com>

	PR target/43920
	* function.c (emit_use_return_register_into_block): New function.
	(thread_prologue_and_epilogue_insns): Use
	emit_use_return_register_into_block.

From-SVN: r171977
parent 2a562b0a
2011-04-05 Tom de Vries <tom@codesourcery.com> 2011-04-05 Tom de Vries <tom@codesourcery.com>
PR target/43920 PR target/43920
* function.c (emit_use_return_register_into_block): New function.
(thread_prologue_and_epilogue_insns): Use
emit_use_return_register_into_block.
2011-04-05 Tom de Vries <tom@codesourcery.com>
PR target/43920
* cfgcleanup.c (flow_find_cross_jump): Don't count USE or CLOBBER as * cfgcleanup.c (flow_find_cross_jump): Don't count USE or CLOBBER as
insn. insn.
......
...@@ -5262,6 +5262,19 @@ prologue_epilogue_contains (const_rtx insn) ...@@ -5262,6 +5262,19 @@ prologue_epilogue_contains (const_rtx insn)
return 0; return 0;
} }
/* Insert use of return register before the end of BB. */
static void
emit_use_return_register_into_block (basic_block bb)
{
rtx seq;
start_sequence ();
use_return_register ();
seq = get_insns ();
end_sequence ();
emit_insn_before (seq, BB_END (bb));
}
#ifdef HAVE_return #ifdef HAVE_return
/* Insert gen_return at the end of block BB. This also means updating /* Insert gen_return at the end of block BB. This also means updating
block_for_insn appropriately. */ block_for_insn appropriately. */
...@@ -5416,6 +5429,15 @@ thread_prologue_and_epilogue_insns (void) ...@@ -5416,6 +5429,15 @@ thread_prologue_and_epilogue_insns (void)
with a simple return instruction. */ with a simple return instruction. */
if (simplejump_p (jump)) if (simplejump_p (jump))
{ {
/* The use of the return register might be present in the exit
fallthru block. Either:
- removing the use is safe, and we should remove the use in
the exit fallthru block, or
- removing the use is not safe, and we should add it here.
For now, we conservatively choose the latter. Either of the
2 helps in crossjumping. */
emit_use_return_register_into_block (bb);
emit_return_into_block (bb); emit_return_into_block (bb);
delete_insn (jump); delete_insn (jump);
} }
...@@ -5430,6 +5452,9 @@ thread_prologue_and_epilogue_insns (void) ...@@ -5430,6 +5452,9 @@ thread_prologue_and_epilogue_insns (void)
continue; continue;
} }
/* See comment in simple_jump_p case above. */
emit_use_return_register_into_block (bb);
/* If this block has only one successor, it both jumps /* If this block has only one successor, it both jumps
and falls through to the fallthru block, so we can't and falls through to the fallthru block, so we can't
delete the edge. */ delete the edge. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment