Commit 83d88a6d by Oleg Endo

re PR target/53886 (Seg fault in sh_insn_length_adjustment)

	PR target/53886
	* config/sh/sh.c (sequence_insn_p): New function.
	(find_barrier, sh_insn_length_adjustment): Use it.

From-SVN: r189394
parent 924ef62b
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
......
......@@ -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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment