===================================================================
@@ -303,6 +303,7 @@
static int max_mov_insn_displacement (enum machine_mode, bool);
static int mov_insn_alignment_mask (enum machine_mode, bool);
static HOST_WIDE_INT disp_addr_displacement (rtx);
+static bool sequence_insn_p (rtx);
static void sh_init_sync_libfuncs (void) ATTRIBUTE_UNUSED;
@@ -4794,7 +4795,7 @@
delay slot scheduler. */
if (JUMP_P (from) && !JUMP_TABLE_DATA_P (from)
&& get_attr_type (from) == TYPE_CBRANCH
- && GET_CODE (PATTERN (NEXT_INSN (PREV_INSN (from)))) != SEQUENCE)
+ && ! sequence_insn_p (from))
inc += 2;
if (found_si)
@@ -9661,6 +9662,26 @@
#define IS_ASM_LOGICAL_LINE_SEPARATOR(C, STR) ((C) == ';')
#endif
+static bool
+sequence_insn_p (rtx insn)
+{
+ rtx prev, next, pat;
+
+ prev = PREV_INSN (insn);
+ if (prev == NULL)
+ return false;
+
+ next = NEXT_INSN (prev);
+ if (next == NULL)
+ return false;
+
+ pat = PATTERN (next);
+ if (pat == NULL)
+ return false;
+
+ return GET_CODE (pat) == SEQUENCE;
+}
+
int
sh_insn_length_adjustment (rtx insn)
{
@@ -9671,7 +9692,7 @@
&& GET_CODE (PATTERN (insn)) != CLOBBER)
|| CALL_P (insn)
|| (JUMP_P (insn) && !JUMP_TABLE_DATA_P (insn)))
- && GET_CODE (PATTERN (NEXT_INSN (PREV_INSN (insn)))) != SEQUENCE
+ && ! sequence_insn_p (insn)
&& get_attr_needs_delay_slot (insn) == NEEDS_DELAY_SLOT_YES)
return 2;
@@ -9680,7 +9701,7 @@
if (sh_cpu_attr == CPU_SH2E
&& JUMP_P (insn) && !JUMP_TABLE_DATA_P (insn)
&& get_attr_type (insn) == TYPE_CBRANCH
- && GET_CODE (PATTERN (NEXT_INSN (PREV_INSN (insn)))) != SEQUENCE)
+ && ! sequence_insn_p (insn))
return 2;
/* sh-dsp parallel processing insn take four bytes instead of two. */