From 29cad3b61bc117db0814aa3f0e3ad1f55d495d91 Mon Sep 17 00:00:00 2001
From: jgreenhalgh <jgreenhalgh@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 22 Apr 2013 14:50:32 +0000
Subject: [Mid-end] Add TARGET_GIMPLE_FOLD_BUILTIN target hook.

gcc/

	* coretypes.h (gimple_stmt_iterator_d): Forward declare.
	(gimple_stmt_iterator): New typedef.
	* gimple.h (gimple_stmt_iterator): Rename to...
	(gimple_stmt_iterator_d): ... This.
	* doc/tm.texi.in (TARGET_FOLD_BUILTIN): Detail restriction that
	trees be valid for GIMPLE and GENERIC.
	(TARGET_GIMPLE_FOLD_BUILTIN): New.
	* gimple-fold.c (gimple_fold_call): Call target hook
	gimple_fold_builtin.
	* hooks.c (hook_bool_gsiptr_false): New.
	* hooks.h (hook_bool_gsiptr_false): New.
	* target.def (fold_stmt): New.
	* doc/tm.texi: Regenerate.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198142 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/target.def | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

(limited to 'gcc/target.def')

diff --git a/gcc/target.def b/gcc/target.def
index db742732e34..a8306b25889 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -1289,13 +1289,24 @@ DEFHOOK
  "",
  tree, (unsigned int /*location_t*/ loc, tree fndecl, void *arglist), NULL)
 
-/* Fold a target-specific builtin.  */
+/* Fold a target-specific builtin to a tree valid for both GIMPLE
+   and GENERIC.  */
 DEFHOOK
 (fold_builtin,
  "",
  tree, (tree fndecl, int n_args, tree *argp, bool ignore),
  hook_tree_tree_int_treep_bool_null)
 
+/* Fold a target-specific builtin to a valid GIMPLE tree.  */
+DEFHOOK
+(gimple_fold_builtin,
+ "Fold a call to a machine specific built-in function that was set up\n\
+by @samp{TARGET_INIT_BUILTINS}.  @var{gsi} points to the gimple\n\
+statement holding the function call.  Returns true if any change\n\
+was made to the GIMPLE stream.",
+ bool, (gimple_stmt_iterator *gsi),
+ hook_bool_gsiptr_false)
+
 /* Target hook is used to compare the target attributes in two functions to
    determine which function's features get higher priority.  This is used
    during function multi-versioning to figure out the order in which two
-- 
cgit v1.2.1

