summaryrefslogtreecommitdiff
path: root/gcc/reorg.c
diff options
context:
space:
mode:
authorkkojima <kkojima@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-29 08:36:38 +0000
committerkkojima <kkojima@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-29 08:36:38 +0000
commit27e4242f6f3a70ffb0c8666aac34a31d1adecc1c (patch)
treea7eeeda3c5d513c3a360d3bc0e6986901a4f154b /gcc/reorg.c
parent5be42fa921560bbdaa277e40df5346e650bf72a2 (diff)
downloadgcc-27e4242f6f3a70ffb0c8666aac34a31d1adecc1c.tar.gz
* reorg.c (relax_delay_slots): Take account of NOTE_INSN_SWITCH_TEXT_SECTIONS
and targetm.can_follow_jump. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220235 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reorg.c')
-rw-r--r--gcc/reorg.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 05b84442f2f..2be34572d99 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -3213,6 +3213,19 @@ label_before_next_insn (rtx x, rtx scan_limit)
return insn;
}
+/* Return TRUE if there is a NOTE_INSN_SWITCH_TEXT_SECTIONS note in between
+ BEG and END. */
+
+static bool
+switch_text_sections_between_p (const rtx_insn *beg, const rtx_insn *end)
+{
+ const rtx_insn *p;
+ for (p = beg; p != end; p = NEXT_INSN (p))
+ if (NOTE_P (p) && NOTE_KIND (p) == NOTE_INSN_SWITCH_TEXT_SECTIONS)
+ return true;
+ return false;
+}
+
/* Once we have tried two ways to fill a delay slot, make a pass over the
code to try to improve the results and to do such things as more jump
@@ -3249,7 +3262,8 @@ relax_delay_slots (rtx_insn *first)
target_label = find_end_label (target_label);
if (target_label && next_active_insn (target_label) == next
- && ! condjump_in_parallel_p (insn))
+ && ! condjump_in_parallel_p (insn)
+ && ! (next && switch_text_sections_between_p (insn, next)))
{
delete_jump (insn);
continue;
@@ -3264,12 +3278,13 @@ relax_delay_slots (rtx_insn *first)
/* See if this jump conditionally branches around an unconditional
jump. If so, invert this jump and point it to the target of the
- second jump. */
+ second jump. Check if it's possible on the target. */
if (next && simplejump_or_return_p (next)
&& any_condjump_p (insn)
&& target_label
&& next_active_insn (target_label) == next_active_insn (next)
- && no_labels_between_p (insn, next))
+ && no_labels_between_p (insn, next)
+ && targetm.can_follow_jump (insn, next))
{
rtx label = JUMP_LABEL (next);