public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] Allow targets to check shrink-wrap-separate enabled or not
@ 2023-09-18 18:24 Jeff Law
  0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2023-09-18 18:24 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:820cb3f1dde76b9efe757903e4cda7d07618c956

commit 820cb3f1dde76b9efe757903e4cda7d07618c956
Author: Fei Gao <gaofei@eswincomputing.com>
Date:   Wed Sep 6 09:39:08 2023 +0000

    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
    
    (cherry picked from commit 66d89a43a7b6bafca1d4675744808be53ef2736f)

Diff:
---
 gcc/shrink-wrap.cc | 22 +++++++++++++++-------
 gcc/shrink-wrap.h  |  1 +
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/gcc/shrink-wrap.cc b/gcc/shrink-wrap.cc
index b8d7b557130..28301f04f89 100644
--- a/gcc/shrink-wrap.cc
+++ b/gcc/shrink-wrap.cc
@@ -1776,16 +1776,13 @@ insert_prologue_epilogue_for_components (sbitmap components)
   commit_edge_insertions ();
 }
 
-/* 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)
+bool
+use_shrink_wrapping_separate (void)
 {
-  if (!(SHRINK_WRAPPING_ENABLED
-	&& flag_shrink_wrap_separate
+  if (!(SHRINK_WRAPPING_ENABLED && flag_shrink_wrap_separate
 	&& optimize_function_for_speed_p (cfun)
 	&& targetm.shrink_wrap.get_separate_components))
-    return;
+    return false;
 
   /* We don't handle "strange" functions.  */
   if (cfun->calls_alloca
@@ -1794,6 +1791,17 @@ try_shrink_wrapping_separate (basic_block first_bb)
       || crtl->calls_eh_return
       || crtl->has_nonlocal_goto
       || 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;
 
   /* Ask the target what components there are.  If it returns NULL, don't
diff --git a/gcc/shrink-wrap.h b/gcc/shrink-wrap.h
index 161647711a3..82386c2b712 100644
--- a/gcc/shrink-wrap.h
+++ b/gcc/shrink-wrap.h
@@ -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 void try_shrink_wrapping (edge *entry_edge, rtx_insn *prologue_seq);
 extern void try_shrink_wrapping_separate (basic_block first_bb);
+extern bool use_shrink_wrapping_separate (void);
 #define SHRINK_WRAPPING_ENABLED \
   (flag_shrink_wrap && targetm.have_simple_return ())

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-18 18:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-18 18:24 [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] Allow targets to check shrink-wrap-separate enabled or not Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).