Commit ffe14686 by Alan Modra Committed by Alan Modra

function.c (bb_active_p): Delete.

	* function.c (bb_active_p): Delete.
	(dup_block_and_redirect, active_insn_between): New functions.
	(convert_jumps_to_returns, emit_return_for_exit): New functions,
	split out from..
	(thread_prologue_and_epilogue_insns): ..here.  Delete
	shadowing variables.  Don't do prologue register clobber tests
	when shrink wrapping already failed.  Delete all last_bb_active
	code.  Instead compute tail block candidates for duplicating
	exit path.  Remove these from antic set.  Duplicate tails when
	reached from both blocks needing a prologue/epilogue and
	blocks not needing such.
	* ifcvt.c (dead_or_predicable): Test both flag_shrink_wrap and
	HAVE_simple_return.
	* bb-reorder.c (get_uncond_jump_length): Make global.
	* bb-reorder.h (get_uncond_jump_length): Declare.
	* cfgrtl.c (rtl_create_basic_block): Comment typo fix.
	(rtl_split_edge): Likewise.  Warning fix.
	(rtl_duplicate_bb): New function.
	(rtl_cfg_hooks): Enable can_duplicate_block_p and duplicate_block.
	* Makefile.in (function.o): Update dependencies.

From-SVN: r181188
parent dce5eb10
2011-11-09 Alan Modra <amodra@gmail.com>
* function.c (bb_active_p): Delete.
(dup_block_and_redirect, active_insn_between): New functions.
(convert_jumps_to_returns, emit_return_for_exit): New functions,
split out from..
(thread_prologue_and_epilogue_insns): ..here. Delete
shadowing variables. Don't do prologue register clobber tests
when shrink wrapping already failed. Delete all last_bb_active
code. Instead compute tail block candidates for duplicating
exit path. Remove these from antic set. Duplicate tails when
reached from both blocks needing a prologue/epilogue and
blocks not needing such.
* ifcvt.c (dead_or_predicable): Test both flag_shrink_wrap and
HAVE_simple_return.
* bb-reorder.c (get_uncond_jump_length): Make global.
* bb-reorder.h (get_uncond_jump_length): Declare.
* cfgrtl.c (rtl_create_basic_block): Comment typo fix.
(rtl_split_edge): Likewise. Warning fix.
(rtl_duplicate_bb): New function.
(rtl_cfg_hooks): Enable can_duplicate_block_p and duplicate_block.
* Makefile.in (function.o): Update dependencies.
2011-11-08 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Georg-Johann Lay <avr@gjlay.de>
......@@ -2807,7 +2807,8 @@ function.o : function.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_ERROR_
$(OPTABS_H) $(LIBFUNCS_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) \
output.h $(EXCEPT_H) $(HASHTAB_H) $(GGC_H) $(TM_P_H) langhooks.h \
gt-function.h $(TARGET_H) $(BASIC_BLOCK_H) $(INTEGRATE_H) $(PREDICT_H) \
$(TREE_PASS_H) $(DF_H) $(TIMEVAR_H) vecprim.h $(COMMON_TARGET_H)
$(TREE_PASS_H) $(DF_H) $(TIMEVAR_H) vecprim.h $(PARAMS_H) bb-reorder.h \
$(COMMON_TARGET_H)
statistics.o : statistics.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TREE_PASS_H) $(TREE_DUMP_H) $(HASHTAB_H) statistics.h $(FUNCTION_H)
stmt.o : stmt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
......
......@@ -181,7 +181,6 @@ static fibheapkey_t bb_to_key (basic_block);
static bool better_edge_p (const_basic_block, const_edge, int, int, int, int, const_edge);
static void connect_traces (int, struct trace *);
static bool copy_bb_p (const_basic_block, int);
static int get_uncond_jump_length (void);
static bool push_to_next_round_p (const_basic_block, int, int, int, gcov_type);
/* Check to see if bb should be pushed into the next round of trace
......@@ -1193,7 +1192,7 @@ copy_bb_p (const_basic_block bb, int code_may_grow)
/* Return the length of unconditional jump instruction. */
static int
int
get_uncond_jump_length (void)
{
rtx label, jump;
......
......@@ -34,4 +34,6 @@ extern struct target_bb_reorder *this_target_bb_reorder;
#define this_target_bb_reorder (&default_target_bb_reorder)
#endif
extern int get_uncond_jump_length (void);
#endif
......@@ -322,9 +322,9 @@ create_basic_block_structure (rtx head, rtx end, rtx bb_note, basic_block after)
}
/* Create new basic block consisting of instructions in between HEAD and END
and place it to the BB chain after block AFTER. END can be NULL in to
create new empty basic block before HEAD. Both END and HEAD can be NULL to
create basic block at the end of INSN chain. */
and place it to the BB chain after block AFTER. END can be NULL to
create a new empty basic block before HEAD. Both END and HEAD can be
NULL to create basic block at the end of INSN chain. */
static basic_block
rtl_create_basic_block (void *headp, void *endp, basic_block after)
......@@ -1411,8 +1411,8 @@ rtl_split_edge (edge edge_in)
before = NULL_RTX;
/* If this is a fall through edge to the exit block, the blocks might be
not adjacent, and the right place is the after the source. */
if (edge_in->flags & EDGE_FALLTHRU && edge_in->dest == EXIT_BLOCK_PTR)
not adjacent, and the right place is after the source. */
if ((edge_in->flags & EDGE_FALLTHRU) && edge_in->dest == EXIT_BLOCK_PTR)
{
before = NEXT_INSN (BB_END (edge_in->src));
bb = create_basic_block (before, NULL, edge_in->src);
......@@ -3177,6 +3177,21 @@ rtl_can_remove_branch_p (const_edge e)
return true;
}
/* We do not want to declare these functions in a header file, since they
should only be used through the cfghooks interface, and we do not want to
move them here since it would require also moving quite a lot of related
code. They are in cfglayout.c. */
extern bool cfg_layout_can_duplicate_bb_p (const_basic_block);
extern basic_block cfg_layout_duplicate_bb (basic_block);
static basic_block
rtl_duplicate_bb (basic_block bb)
{
bb = cfg_layout_duplicate_bb (bb);
bb->aux = NULL;
return bb;
}
/* Implementation of CFG manipulation for linearized RTL. */
struct cfg_hooks rtl_cfg_hooks = {
"rtl",
......@@ -3193,8 +3208,8 @@ struct cfg_hooks rtl_cfg_hooks = {
rtl_merge_blocks,
rtl_predict_edge,
rtl_predicted_by_p,
NULL, /* can_duplicate_block_p */
NULL, /* duplicate_block */
cfg_layout_can_duplicate_bb_p,
rtl_duplicate_bb,
rtl_split_edge,
rtl_make_forwarder_block,
rtl_tidy_fallthru_edge,
......@@ -3216,13 +3231,6 @@ struct cfg_hooks rtl_cfg_hooks = {
This representation will hopefully become the default one in future
version of the compiler. */
/* We do not want to declare these functions in a header file, since they
should only be used through the cfghooks interface, and we do not want to
move them here since it would require also moving quite a lot of related
code. They are in cfglayout.c. */
extern bool cfg_layout_can_duplicate_bb_p (const_basic_block);
extern basic_block cfg_layout_duplicate_bb (basic_block);
struct cfg_hooks cfg_layout_rtl_cfg_hooks = {
"cfglayout mode",
rtl_verify_flow_info_1,
......
......@@ -4167,13 +4167,14 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb,
if (NONDEBUG_INSN_P (insn))
df_simulate_find_defs (insn, merge_set);
#ifdef HAVE_simple_return
/* If shrink-wrapping, disable this optimization when test_bb is
the first basic block and merge_bb exits. The idea is to not
move code setting up a return register as that may clobber a
register used to pass function parameters, which then must be
saved in caller-saved regs. A caller-saved reg requires the
prologue, killing a shrink-wrap opportunity. */
if ((flag_shrink_wrap && !epilogue_completed)
if ((flag_shrink_wrap && HAVE_simple_return && !epilogue_completed)
&& ENTRY_BLOCK_PTR->next_bb == test_bb
&& single_succ_p (new_dest)
&& single_succ (new_dest) == EXIT_BLOCK_PTR
......@@ -4224,6 +4225,7 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb,
}
BITMAP_FREE (return_regs);
}
#endif
}
no_body:
......
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