diff options
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/sh/sh.c | 27 |
2 files changed, 30 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7d80636ed2c..bf06aa52453 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-07-09 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/53886 + * config/sh/sh.c (sequence_insn_p): New function. + (find_barrier, sh_insn_length_adjustment): Use it. + 2012-07-09 Iain Sandoe <iain@codesourcery.com> PR target/53283 diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index a53c3be91e9..015e274b13b 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -303,6 +303,7 @@ static int mov_insn_size (enum machine_mode, bool); 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 @@ find_barrier (int num_mova, rtx mova, rtx from) 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 @@ fpscr_set_from_mem (int mode, HARD_REG_SET regs_live) #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 @@ sh_insn_length_adjustment (rtx insn) && 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 @@ sh_insn_length_adjustment (rtx insn) 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. */ |