* [PATCH 1/3] Replace MD_REDIRECT_BRANCH with TARGET_CAN_FOLLOW_JUMP
@ 2015-01-27 1:56 Kaz Kojima
2015-02-03 23:57 ` [Ping] " Kaz Kojima
0 siblings, 1 reply; 4+ messages in thread
From: Kaz Kojima @ 2015-01-27 1:56 UTC (permalink / raw)
To: gcc-patches
This is an updated patch of the patch proposed by Joern
https://gcc.gnu.org/ml/gcc-patches/2013-04/msg01332.html
which replaces MD_REDIRECT_BRANCH of which SH is the last user
with TARGET_CAN_FOLLOW_JUMP.
--
2015-01-27 Joern Rennecke <joern.rennecke@embecosm.com>
Kaz Kojima <kkojima@gcc.gnu.org>
PR target/64761
* config/sh/sh-protos.h (sh_can_redirect_branch): Don't declare.
* config/sh/sh.c (TARGET_CAN_FOLLOW_JUMP): Redefine.
(sh_can_redirect_branch): Rename to ...
(sh_can_follow_jump): ... this. Constify argument types.
* config/sh/sh.h (MD_CAN_REDIRECT_BRANCH): Don't define.
* doc/tm.texi.in (MD_CAN_REDIRECT_BRANCH): Remove documentation.
* reorg.c (steal_delay_list_from_target): Use targetm.can_follow_jump.
* doc/tm.texi: Regenerate.
diff --git a/config/sh/sh-protos.h b/config/sh/sh-protos.h
index bc2b3b3..a5ffd9c 100644
--- a/config/sh/sh-protos.h
+++ b/config/sh/sh-protos.h
@@ -148,7 +148,6 @@ extern enum tls_model tls_symbolic_operand (rtx, machine_mode);
extern bool system_reg_operand (rtx, machine_mode);
extern bool reg_unused_after (rtx, rtx_insn *);
extern int sh_insn_length_adjustment (rtx_insn *);
-extern bool sh_can_redirect_branch (rtx_insn *, rtx_insn *);
extern void sh_expand_unop_v2sf (enum rtx_code, rtx, rtx);
extern void sh_expand_binop_v2sf (enum rtx_code, rtx, rtx, rtx);
extern bool sh_expand_t_scc (rtx *);
diff --git a/config/sh/sh.c b/config/sh/sh.c
index bde95f6..886ffc3 100644
--- a/config/sh/sh.c
+++ b/config/sh/sh.c
@@ -277,6 +277,7 @@ static int sh_variable_issue (FILE *, int, rtx_insn *, int);
static bool sh_function_ok_for_sibcall (tree, tree);
static bool sh_cannot_modify_jumps_p (void);
+static bool sh_can_follow_jump (const rtx_insn *, const rtx_insn *);
static reg_class_t sh_target_reg_class (void);
static bool sh_optimize_target_register_callee_saved (bool);
static bool sh_ms_bitfield_layout_p (const_tree);
@@ -510,6 +511,8 @@ static const struct attribute_spec sh_attribute_table[] =
#undef TARGET_CANNOT_MODIFY_JUMPS_P
#define TARGET_CANNOT_MODIFY_JUMPS_P sh_cannot_modify_jumps_p
+#undef TARGET_CAN_FOLLOW_JUMP
+#define TARGET_CAN_FOLLOW_JUMP sh_can_follow_jump
#undef TARGET_BRANCH_TARGET_REGISTER_CLASS
#define TARGET_BRANCH_TARGET_REGISTER_CLASS sh_target_reg_class
#undef TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED
@@ -10744,8 +10747,8 @@ mark_constant_pool_use (rtx x)
/* Return true if it's possible to redirect BRANCH1 to the destination
of an unconditional jump BRANCH2. We only want to do this if the
resulting branch will have a short displacement. */
-bool
-sh_can_redirect_branch (rtx_insn *branch1, rtx_insn *branch2)
+static bool
+sh_can_follow_jump (const rtx_insn *branch1, const rtx_insn *branch2)
{
if (flag_expensive_optimizations && simplejump_p (branch2))
{
diff --git a/config/sh/sh.h b/config/sh/sh.h
index 2de7381..a9b7fa0 100644
--- a/config/sh/sh.h
+++ b/config/sh/sh.h
@@ -2245,9 +2245,6 @@ extern int current_function_interrupt;
#define EPILOGUE_USES(REGNO) ((TARGET_SH2E || TARGET_SH4) \
&& (REGNO) == FPSCR_REG)
-#define MD_CAN_REDIRECT_BRANCH(INSN, SEQ) \
- sh_can_redirect_branch ((INSN), (SEQ))
-
#define DWARF_FRAME_RETURN_COLUMN \
(TARGET_SH5 ? DWARF_FRAME_REGNUM (PR_MEDIA_REG) : DWARF_FRAME_REGNUM (PR_REG))
diff --git a/doc/tm.texi.in b/doc/tm.texi.in
index 0cee98a..edad99c 100644
--- a/doc/tm.texi.in
+++ b/doc/tm.texi.in
@@ -7982,17 +7982,6 @@ to by @var{ce_info}.
@hook TARGET_LEGITIMATE_COMBINED_INSN
-@defmac MD_CAN_REDIRECT_BRANCH (@var{branch1}, @var{branch2})
-
-Take a branch insn in @var{branch1} and another in @var{branch2}.
-Return true if redirecting @var{branch1} to the destination of
-@var{branch2} is possible.
-
-On some targets, branches may have a limited range. Optimizing the
-filling of delay slots can result in branches being redirected, and this
-may in turn cause a branch offset to overflow.
-@end defmac
-
@hook TARGET_CAN_FOLLOW_JUMP
@hook TARGET_COMMUTATIVE_P
diff --git a/reorg.c b/reorg.c
index 05b8444..326fa53 100644
--- a/reorg.c
+++ b/reorg.c
@@ -1156,13 +1156,11 @@ steal_delay_list_from_target (rtx_insn *insn, rtx condition, rtx_sequence *seq,
|| ! single_set (seq->insn (0)))
return delay_list;
-#ifdef MD_CAN_REDIRECT_BRANCH
/* On some targets, branches with delay slots can have a limited
displacement. Give the back end a chance to tell us we can't do
this. */
- if (! MD_CAN_REDIRECT_BRANCH (insn, seq->insn (0)))
+ if (! targetm.can_follow_jump (insn, seq->insn (0)))
return delay_list;
-#endif
redundant = XALLOCAVEC (bool, XVECLEN (seq, 0));
for (i = 1; i < seq->len (); i++)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Ping] Re: [PATCH 1/3] Replace MD_REDIRECT_BRANCH with TARGET_CAN_FOLLOW_JUMP
2015-01-27 1:56 [PATCH 1/3] Replace MD_REDIRECT_BRANCH with TARGET_CAN_FOLLOW_JUMP Kaz Kojima
@ 2015-02-03 23:57 ` Kaz Kojima
2015-02-09 22:53 ` Jeff Law
0 siblings, 1 reply; 4+ messages in thread
From: Kaz Kojima @ 2015-02-03 23:57 UTC (permalink / raw)
To: gcc-patches
Kaz Kojima <kkojima@rr.iij4u.or.jp> wrote:
> 2015-01-27 Joern Rennecke <joern.rennecke@embecosm.com>
> Kaz Kojima <kkojima@gcc.gnu.org>
>
> PR target/64761
> * config/sh/sh-protos.h (sh_can_redirect_branch): Don't declare.
> * config/sh/sh.c (TARGET_CAN_FOLLOW_JUMP): Redefine.
> (sh_can_redirect_branch): Rename to ...
> (sh_can_follow_jump): ... this. Constify argument types.
> * config/sh/sh.h (MD_CAN_REDIRECT_BRANCH): Don't define.
> * doc/tm.texi.in (MD_CAN_REDIRECT_BRANCH): Remove documentation.
> * reorg.c (steal_delay_list_from_target): Use targetm.can_follow_jump.
> * doc/tm.texi: Regenerate.
Ping?
https://gcc.gnu.org/ml/gcc-patches/2015-01/msg02345.html
Regards,
kaz
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Ping] Re: [PATCH 1/3] Replace MD_REDIRECT_BRANCH with TARGET_CAN_FOLLOW_JUMP
2015-02-03 23:57 ` [Ping] " Kaz Kojima
@ 2015-02-09 22:53 ` Jeff Law
2015-02-09 23:50 ` Kaz Kojima
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Law @ 2015-02-09 22:53 UTC (permalink / raw)
To: Kaz Kojima, gcc-patches
On 02/03/15 16:57, Kaz Kojima wrote:
> Kaz Kojima <kkojima@rr.iij4u.or.jp> wrote:
>> 2015-01-27 Joern Rennecke <joern.rennecke@embecosm.com>
>> Kaz Kojima <kkojima@gcc.gnu.org>
>>
>> PR target/64761
>> * config/sh/sh-protos.h (sh_can_redirect_branch): Don't declare.
>> * config/sh/sh.c (TARGET_CAN_FOLLOW_JUMP): Redefine.
>> (sh_can_redirect_branch): Rename to ...
>> (sh_can_follow_jump): ... this. Constify argument types.
>> * config/sh/sh.h (MD_CAN_REDIRECT_BRANCH): Don't define.
>> * doc/tm.texi.in (MD_CAN_REDIRECT_BRANCH): Remove documentation.
>> * reorg.c (steal_delay_list_from_target): Use targetm.can_follow_jump.
>> * doc/tm.texi: Regenerate.
>
> Ping?
>
> https://gcc.gnu.org/ml/gcc-patches/2015-01/msg02345.html
Presumably you're pinging due to the reorg/doc changes? Those are fine :-)
Jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Ping] Re: [PATCH 1/3] Replace MD_REDIRECT_BRANCH with TARGET_CAN_FOLLOW_JUMP
2015-02-09 22:53 ` Jeff Law
@ 2015-02-09 23:50 ` Kaz Kojima
0 siblings, 0 replies; 4+ messages in thread
From: Kaz Kojima @ 2015-02-09 23:50 UTC (permalink / raw)
To: law; +Cc: gcc-patches
Jeff Law <law@redhat.com> wrote:
>> Ping?
>>
>> https://gcc.gnu.org/ml/gcc-patches/2015-01/msg02345.html
> Presumably you're pinging due to the reorg/doc changes? Those are
> fine :-)
Thanks! I've committed it as revision 220552.
Regards,
kaz
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-02-09 23:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27 1:56 [PATCH 1/3] Replace MD_REDIRECT_BRANCH with TARGET_CAN_FOLLOW_JUMP Kaz Kojima
2015-02-03 23:57 ` [Ping] " Kaz Kojima
2015-02-09 22:53 ` Jeff Law
2015-02-09 23:50 ` Kaz Kojima
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).