Allow targets to check shrink-wrap-separate enabled or not

No functional changes but restructure and expose use_shrink_wrapping_separate
to the TARGETs.

gcc/ChangeLog:

	* shrink-wrap.cc (try_shrink_wrapping_separate):call
	use_shrink_wrapping_separate.
	(use_shrink_wrapping_separate): wrap the condition
	check in use_shrink_wrapping_separate.
	* shrink-wrap.h (use_shrink_wrapping_separate): add to extern
This commit is contained in:
Fei Gao 2023-09-06 09:39:08 +00:00 committed by Kito Cheng
parent fb4b53d964
commit 66d89a43a7
2 changed files with 16 additions and 7 deletions

View file

@ -1776,16 +1776,13 @@ insert_prologue_epilogue_for_components (sbitmap components)
commit_edge_insertions (); commit_edge_insertions ();
} }
/* The main entry point to this subpass. FIRST_BB is where the prologue bool
would be normally put. */ use_shrink_wrapping_separate (void)
void
try_shrink_wrapping_separate (basic_block first_bb)
{ {
if (!(SHRINK_WRAPPING_ENABLED if (!(SHRINK_WRAPPING_ENABLED && flag_shrink_wrap_separate
&& flag_shrink_wrap_separate
&& optimize_function_for_speed_p (cfun) && optimize_function_for_speed_p (cfun)
&& targetm.shrink_wrap.get_separate_components)) && targetm.shrink_wrap.get_separate_components))
return; return false;
/* We don't handle "strange" functions. */ /* We don't handle "strange" functions. */
if (cfun->calls_alloca if (cfun->calls_alloca
@ -1794,6 +1791,17 @@ try_shrink_wrapping_separate (basic_block first_bb)
|| crtl->calls_eh_return || crtl->calls_eh_return
|| crtl->has_nonlocal_goto || crtl->has_nonlocal_goto
|| crtl->saves_all_registers) || crtl->saves_all_registers)
return false;
return true;
}
/* The main entry point to this subpass. FIRST_BB is where the prologue
would be normally put. */
void
try_shrink_wrapping_separate (basic_block first_bb)
{
if (!use_shrink_wrapping_separate ())
return; return;
/* Ask the target what components there are. If it returns NULL, don't /* Ask the target what components there are. If it returns NULL, don't

View file

@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
extern bool requires_stack_frame_p (rtx_insn *, HARD_REG_SET, HARD_REG_SET); extern bool requires_stack_frame_p (rtx_insn *, HARD_REG_SET, HARD_REG_SET);
extern void try_shrink_wrapping (edge *entry_edge, rtx_insn *prologue_seq); extern void try_shrink_wrapping (edge *entry_edge, rtx_insn *prologue_seq);
extern void try_shrink_wrapping_separate (basic_block first_bb); extern void try_shrink_wrapping_separate (basic_block first_bb);
extern bool use_shrink_wrapping_separate (void);
#define SHRINK_WRAPPING_ENABLED \ #define SHRINK_WRAPPING_ENABLED \
(flag_shrink_wrap && targetm.have_simple_return ()) (flag_shrink_wrap && targetm.have_simple_return ())