basic-block.h (try_redirect_by_replacing_jump): Declare.

* basic-block.h (try_redirect_by_replacing_jump): Declare.
	* cfgcleanup.c (try_optimize_cfg): Use it.
	* cfgrtl.c (try_redirect_by_replacing_jump): Export.
	(rtl_redirect_edge_and_branch, cfg_layout_redirect_edge_and_branch):
	Kill hack.
	(cfg_layout_merge_blocks): Use try_redirect_by_replacing_jump.

	Revert:
	2004-01-16  Geoffrey Keating  <geoffk@apple.com>

		* cfgrtl.c (try_redirect_by_replacing_jump): Optimize tablejumps
		even after reload, just don't remove the actual jump tables.

From-SVN: r76115
This commit is contained in:
Jan Hubicka 2004-01-18 22:51:30 +01:00 committed by Jan Hubicka
parent 72d89d359c
commit 3348b696a8
4 changed files with 30 additions and 16 deletions

View File

@ -1,3 +1,18 @@
2004-01-18 Jan Hubicka <jh@suse.cz>
* basic-block.h (try_redirect_by_replacing_jump): Declare.
* cfgcleanup.c (try_optimize_cfg): Use it.
* cfgrtl.c (try_redirect_by_replacing_jump): Export.
(rtl_redirect_edge_and_branch, cfg_layout_redirect_edge_and_branch):
Kill hack.
(cfg_layout_merge_blocks): Use try_redirect_by_replacing_jump.
Revert:
2004-01-16 Geoffrey Keating <geoffk@apple.com>
* cfgrtl.c (try_redirect_by_replacing_jump): Optimize tablejumps
even after reload, just don't remove the actual jump tables.
2004-01-18 Kazu Hirata <kazu@cs.umass.edu>
* config/rs6000/rs6000.h (STRICT_ARGUMENT_NAMING): Remove.

View File

@ -640,6 +640,7 @@ extern void iterate_fix_dominators (enum cdi_direction, basic_block *, int);
extern void verify_dominators (enum cdi_direction);
extern basic_block first_dom_son (enum cdi_direction, basic_block);
extern basic_block next_dom_son (enum cdi_direction, basic_block);
extern bool try_redirect_by_replacing_jump (edge, basic_block, bool);
#include "cfghooks.h"

View File

@ -1785,13 +1785,13 @@ try_optimize_cfg (int mode)
/* If B has a single outgoing edge, but uses a
non-trivial jump instruction without side-effects, we
can either delete the jump entirely, or replace it
with a simple unconditional jump. Use
redirect_edge_and_branch to do the dirty work. */
with a simple unconditional jump. */
if (b->succ
&& ! b->succ->succ_next
&& b->succ->dest != EXIT_BLOCK_PTR
&& onlyjump_p (BB_END (b))
&& redirect_edge_and_branch (b->succ, b->succ->dest))
&& try_redirect_by_replacing_jump (b->succ, b->succ->dest,
(mode & CLEANUP_CFGLAYOUT)))
{
update_forwarder_flag (b);
changed_here = true;

View File

@ -687,7 +687,7 @@ block_label (basic_block block)
apply only if all edges now point to the same block. The parameters and
return values are equivalent to redirect_edge_and_branch. */
static bool
bool
try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
{
basic_block src = e->src;
@ -703,7 +703,7 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
if (tmp || !onlyjump_p (insn))
return false;
if ((!optimize || flow2_completed) && tablejump_p (insn, NULL, NULL))
if ((!optimize || reload_completed) && tablejump_p (insn, NULL, NULL))
return false;
/* Avoid removing branch with side effects. */
@ -793,7 +793,7 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
/* Recognize a tablejump that we are converting to a
simple jump and remove its associated CODE_LABEL
and ADDR_VEC or ADDR_DIFF_VEC. */
if (! reload_completed && tablejump_p (insn, &label, &table))
if (tablejump_p (insn, &label, &table))
delete_insn_chain (label, table);
barrier = next_nonnote_insn (BB_END (src));
@ -971,15 +971,13 @@ rtl_redirect_edge_and_branch (edge e, basic_block target)
if (e->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))
return false;
if (e->dest == target)
return true;
if (try_redirect_by_replacing_jump (e, target, false))
return true;
/* Do this fast path late, as we want above code to simplify for cases
where called on single edge leaving basic block containing nontrivial
jump insn. */
else if (e->dest == target)
return false;
else if (!redirect_branch_edge (e, target))
if (!redirect_branch_edge (e, target))
return false;
return true;
@ -2437,11 +2435,11 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest)
if (e->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))
return false;
if (e->src != ENTRY_BLOCK_PTR
&& try_redirect_by_replacing_jump (e, dest, true))
if (e->dest == dest)
return true;
if (e->dest == dest)
if (e->src != ENTRY_BLOCK_PTR
&& try_redirect_by_replacing_jump (e, dest, true))
return true;
if (e->src == ENTRY_BLOCK_PTR
@ -2627,7 +2625,7 @@ cfg_layout_merge_blocks (basic_block a, basic_block b)
/* We should have fallthru edge in a, or we can do dummy redirection to get
it cleaned up. */
if (GET_CODE (BB_END (a)) == JUMP_INSN)
redirect_edge_and_branch (a->succ, b);
try_redirect_by_replacing_jump (a->succ, b, true);
if (GET_CODE (BB_END (a)) == JUMP_INSN)
abort ();