From 1d0216c8b79931cffcc5599b8a9a4f6eaf86d2b7 Mon Sep 17 00:00:00 2001
From: Richard Sandiford <rdsandiford@googlemail.com>
Date: Sat, 9 Nov 2013 11:42:16 +0000
Subject: target.def (can_use_doloop_p): New hook.

gcc/
	* target.def (can_use_doloop_p): New hook.
	* doc/tm.texi.in (TARGET_CAN_USE_DOLOOP_P): Add.
	* doc/tm.texi: Regenerate.
	* doc/md.texi (doloop_begin, doloop_end): Update documentation.
	* hooks.h (hook_bool_dint_dint_uint_true): Declare.
	* hooks.c (hook_bool_dint_dint_uint_true): New function.
	* targhooks.h (can_use_doloop_if_innermost): Declare.
	* targhooks.c (can_use_doloop_if_innermost): New function.
	* target.h: Include double-int.h.
	* loop-doloop.c (doloop_optimize): Call targetm.can_use_doloop_p.
	Remove iteration count, maximum iteration count, loop depth and
	enter-at-top inputs from doloop_begin and doloop_end.
	* config/arc/arc.md (doloop_begin, doloop_end): Update for new
	interface.
	* config/arc/arc.c (arc_can_use_doloop_p): New function.
	(TARGET_CAN_USE_DOLOOP_P): Define.
	* config/arm/thumb2.md (doloop_end): Update for new interface.
	* config/arm/arm.c (TARGET_CAN_USE_DOLOOP_P): Define.
	* config/bfin/bfin.md (doloop_end): Update for new interface.
	* config/bfin/bfin.c (bfin_can_use_doloop_p): New function.
	(TARGET_CAN_USE_DOLOOP_P): Define.
	* config/c6x/c6x.md (doloop_end): Update for new interface.
	* config/ia64/ia64.md (doloop_end): Update for new interface.
	* config/ia64/ia64.c (TARGET_CAN_USE_DOLOOP_P): Define.
	* config/mep/mep.md (doloop_begin, doloop_end): Update for new
	interface.
	* config/mep/mep.c (mep_emit_doloop): Likewise.
	(TARGET_CAN_USE_DOLOOP_P): Define.
	* config/rs6000/rs6000.md (doloop_end): Update for new interface.
	* config/rs6000/rs6000.c (TARGET_CAN_USE_DOLOOP_P): Define.
	* config/s390/s390.md (doloop_end): Update for new interface.
	* config/sh/sh.md (doloop_end): Likewise.
	* config/spu/spu.md (doloop_end): Likewise.
	* config/spu/spu.c (TARGET_CAN_USE_DOLOOP_P): Define.
	* config/tilegx/tilegx.md (doloop_end): Update for new interface.
	* config/tilegx/tilegx.c (TARGET_CAN_USE_DOLOOP_P): Define.
	* config/tilepro/tilepro.md (doloop_end): Update for new interface.
	* config/tilepro/tilepro.c (TARGET_CAN_USE_DOLOOP_P): Define.
	* config/v850/v850.md (doloop_begin, doloop_end): Update for new
	interface.
	* config/v850/v850.c (TARGET_CAN_USE_DOLOOP_P): Define.

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

(limited to 'gcc/target.def')

diff --git a/gcc/target.def b/gcc/target.def
index caf1cb6..f6e42a1 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -3597,6 +3597,23 @@ normally defined in @file{libgcc2.c}.",
  tree, (void),
  default_external_stack_protect_fail)
 
+DEFHOOK
+(can_use_doloop_p,
+ "Return true if it is possible to use low-overhead loops (@code{doloop_end}\n\
+and @code{doloop_begin}) for a particular loop.  @var{iterations} gives the\n\
+exact number of iterations, or 0 if not known.  @var{iterations_max} gives\n\
+the maximum number of iterations, or 0 if not known.  @var{loop_depth} is\n\
+the nesting depth of the loop, with 1 for innermost loops, 2 for loops that\n\
+contain innermost loops, and so on.  @var{entered_at_top} is true if the\n\
+loop is only entered from the top.\n\
+\n\
+This hook is only used if @code{doloop_end} is available.  The default\n\
+implementation returns true.  You can use @code{can_use_doloop_if_innermost}\n\
+if the loop must be the innermost, and if there are no other restrictions.",
+ bool, (double_int iterations, double_int iterations_max,
+	unsigned int loop_depth, bool entered_at_top),
+ hook_bool_dint_dint_uint_bool_true)
+
 /* Returns NULL if target supports the insn within a doloop block,
    otherwise it returns an error message.  */
 DEFHOOK
-- 
cgit v1.1

