[PATCH 2/4] The TARGET_CAN_FOLLOW_JUMP hook takes insns

David Malcolm dmalcolm@redhat.com
Fri Sep 12 20:33:00 GMT 2014

	* config/arc/arc.c (arc_can_follow_jump): Strengthen both params
	from const_rtx to const rtx_insn *.  Update union members from rtx
	to rtx_insn *.
	* doc/tm.texi (TARGET_CAN_FOLLOW_JUMP): Autogenerated change.
	* hooks.c (hook_bool_const_rtx_const_rtx_true): Rename to...
	(hook_bool_const_rtx_insn_const_rtx_insn_true): ...this, and
	strengthen both params from const_rtx to const rtx_insn *.
	* hooks.h (hook_bool_const_rtx_const_rtx_true): Likewise.
	(hook_bool_const_rtx_insn_const_rtx_insn_true): Likewise.
	* reorg.c (follow_jumps): Strengthen param "jump" from rtx to
	rtx_insn *.
	* target.def (can_follow_jump): Strengthen both params from
	const_rtx to const rtx_insn *, and update default implementation
	from hook_bool_const_rtx_const_rtx_true to
 gcc/config/arc/arc.c | 7 ++++---
 gcc/doc/tm.texi      | 2 +-
 gcc/hooks.c          | 6 +++---
 gcc/hooks.h          | 3 ++-
 gcc/reorg.c          | 2 +-
 gcc/target.def       | 4 ++--
 6 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 2f08e7c..9dd19de 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -420,7 +420,8 @@ arc_vector_mode_supported_p (enum machine_mode mode)
 /* TARGET_PRESERVE_RELOAD_P is still awaiting patch re-evaluation / review.  */
 static bool arc_preserve_reload_p (rtx in) ATTRIBUTE_UNUSED;
 static rtx arc_delegitimize_address (rtx);
-static bool arc_can_follow_jump (const_rtx follower, const_rtx followee);
+static bool arc_can_follow_jump (const rtx_insn *follower,
+				 const rtx_insn *followee);
 static rtx frame_insn (rtx);
 static void arc_function_arg_advance (cumulative_args_t, enum machine_mode,
@@ -9214,10 +9215,10 @@ arc_decl_pretend_args (tree decl)
   to redirect two breqs.  */
 static bool
-arc_can_follow_jump (const_rtx follower, const_rtx followee)
+arc_can_follow_jump (const rtx_insn *follower, const rtx_insn *followee)
   /* ??? get_attr_type is declared to take an rtx.  */
-  union { const_rtx c; rtx r; } u;
+  union { const rtx_insn *c; rtx_insn *r; } u;
   u.c = follower;
   if (CROSSING_JUMP_P (followee))
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 685c9b2..1a19dcd 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -10827,7 +10827,7 @@ filling of delay slots can result in branches being redirected, and this
 may in turn cause a branch offset to overflow.
 @end defmac
-@deftypefn {Target Hook} bool TARGET_CAN_FOLLOW_JUMP (const_rtx @var{follower}, const_rtx @var{followee})
+@deftypefn {Target Hook} bool TARGET_CAN_FOLLOW_JUMP (const rtx_insn *@var{follower}, const rtx_insn *@var{followee})
 FOLLOWER and FOLLOWEE are JUMP_INSN instructions;  return true if FOLLOWER may be modified to follow FOLLOWEE;  false, if it can't.  For example, on some targets, certain kinds of branches can't be made to  follow through a hot/cold partitioning.
 @end deftypefn
diff --git a/gcc/hooks.c b/gcc/hooks.c
index 3f11354..6000b98 100644
--- a/gcc/hooks.c
+++ b/gcc/hooks.c
@@ -116,10 +116,10 @@ hook_bool_mode_rtx_true (enum machine_mode mode ATTRIBUTE_UNUSED,
   return true;
-/* Generic hook that takes (rtx, rtx) and returns true.  */
+/* Generic hook that takes (const rtx_insn *, const rtx_insn *) and returns true.  */
-hook_bool_const_rtx_const_rtx_true (const_rtx follower ATTRIBUTE_UNUSED,
-				    const_rtx followee ATTRIBUTE_UNUSED)
+hook_bool_const_rtx_insn_const_rtx_insn_true (const rtx_insn *follower ATTRIBUTE_UNUSED,
+					      const rtx_insn *followee ATTRIBUTE_UNUSED)
   return true;
diff --git a/gcc/hooks.h b/gcc/hooks.h
index 27ad09d..11811c2 100644
--- a/gcc/hooks.h
+++ b/gcc/hooks.h
@@ -36,7 +36,8 @@ extern bool hook_bool_mode_const_rtx_false (enum machine_mode, const_rtx);
 extern bool hook_bool_mode_const_rtx_true (enum machine_mode, const_rtx);
 extern bool hook_bool_mode_rtx_false (enum machine_mode, rtx);
 extern bool hook_bool_mode_rtx_true (enum machine_mode, rtx);
-extern bool hook_bool_const_rtx_const_rtx_true (const_rtx, const_rtx);
+extern bool hook_bool_const_rtx_insn_const_rtx_insn_true (const rtx_insn *,
+							  const rtx_insn *);
 extern bool hook_bool_mode_uhwi_false (enum machine_mode,
 				       unsigned HOST_WIDE_INT);
 extern bool hook_bool_tree_false (tree);
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 28401dd..ee97927 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -2307,7 +2307,7 @@ fill_simple_delay_slots (int non_jumps_p)
    set *CROSSING to true, otherwise set it to false.  */
 static rtx
-follow_jumps (rtx label, rtx jump, bool *crossing)
+follow_jumps (rtx label, rtx_insn *jump, bool *crossing)
   rtx_insn *insn;
   rtx_insn *next;
diff --git a/gcc/target.def b/gcc/target.def
index 3944507..752ef6b 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -2278,8 +2278,8 @@ DEFHOOK
   false, if it can't.\
   For example, on some targets, certain kinds of branches can't be made to\
   follow through a hot/cold partitioning.",
- bool, (const_rtx follower, const_rtx followee),
- hook_bool_const_rtx_const_rtx_true)
+ bool, (const rtx_insn *follower, const rtx_insn *followee),
+ hook_bool_const_rtx_insn_const_rtx_insn_true)
 /* Return a register class for which branch target register
    optimizations should be applied.  */

More information about the Gcc-patches mailing list