From 74b5fcf733823b353b331c0ca30e8b71ba98c9cf Mon Sep 17 00:00:00 2001
From: Kewen Lin <linkw@gcc.gnu.org>
Date: Tue, 18 Jun 2019 05:08:02 +0000
Subject: Add predict_doloop_p target hook

    Add one target hook predict_doloop_p, it return true if we can predict it
    is possible to use a low-overhead loop, it can help ivopts to make some
    better decisions.

    PR middle-end/80791
    * target.def (predict_doloop_p): New hook.
    * targhooks.h (default_predict_doloop_p): New declaration.
    * targhooks.c (default_predict_doloop_p): New function.
    * doc/tm.texi.in (TARGET_PREDICT_DOLOOP_P): New hook.
    * doc/tm.texi: Regenerate.
    * config/rs6000/rs6000.c (rs6000_predict_doloop_p): New function.
    (TARGET_PREDICT_DOLOOP_P): New macro.
    * tree-ssa-loop-ivopts.c (generic_predict_doloop_p): New function.

From-SVN: r272405
---
 gcc/target.def | 9 +++++++++
 1 file changed, 9 insertions(+)

(limited to 'gcc/target.def')

diff --git a/gcc/target.def b/gcc/target.def
index 7d52102..71b6972 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -4236,6 +4236,15 @@ DEFHOOK
 rtx, (machine_mode mode, rtx result, rtx val, rtx failval),
  default_speculation_safe_value)
  
+DEFHOOK
+(predict_doloop_p,
+ "Return true if we can predict it is possible to use a low-overhead loop\n\
+for a particular loop.  The parameter @var{loop} is a pointer to the loop.\n\
+This target hook is required only when the target supports low-overhead\n\
+loops, and will help ivopts to make some decisions.\n\
+The default version of this hook returns false.",
+ bool, (struct loop *loop),
+ default_predict_doloop_p)
 
 DEFHOOK
 (can_use_doloop_p,
-- 
cgit v1.1

