backport: re PR target/43744 (SH: Error: pcrel too far)

Backport from mainline:
	2010-04-22  Kaz Kojima  <kkojima@gcc.gnu.org>

	PR target/43744
	* config/sh/sh.c (find_barrier): Don't emit a constant pool
	in the middle of insns for casesi_worker_2.

From-SVN: r159088
This commit is contained in:
Kaz Kojima 2010-05-05 22:27:57 +00:00
parent f7d83e2af2
commit d329298828
2 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2010-05-05 Kaz Kojima <kkojima@gcc.gnu.org>
Backport from mainline:
2010-04-22 Kaz Kojima <kkojima@gcc.gnu.org>
PR target/43744
* config/sh/sh.c (find_barrier): Don't emit a constant pool
in the middle of insns for casesi_worker_2.
2010-05-05 Jason Merrill <jason@redhat.com>
PR debug/43370

View File

@ -3884,6 +3884,7 @@ find_barrier (int num_mova, rtx mova, rtx from)
int si_limit;
int hi_limit;
rtx orig = from;
rtx last_symoff = NULL_RTX;
/* For HImode: range is 510, add 4 because pc counts from address of
second instruction after this one, subtract 2 for the jump instruction
@ -4015,6 +4016,16 @@ find_barrier (int num_mova, rtx mova, rtx from)
{
switch (untangle_mova (&num_mova, &mova, from))
{
case 1:
if (flag_pic)
{
rtx src = SET_SRC (PATTERN (from));
if (GET_CODE (src) == CONST
&& GET_CODE (XEXP (src, 0)) == UNSPEC
&& XINT (XEXP (src, 0), 1) == UNSPEC_SYMOFF)
last_symoff = from;
}
break;
case 0: return find_barrier (0, 0, mova);
case 2:
{
@ -4120,6 +4131,12 @@ find_barrier (int num_mova, rtx mova, rtx from)
so we'll make one. */
rtx label = gen_label_rtx ();
/* Don't emit a constant table in the middle of insns for
casesi_worker_2. This is a bit overkill but is enough
because casesi_worker_2 wouldn't appear so frequently. */
if (last_symoff)
from = last_symoff;
/* If we exceeded the range, then we must back up over the last
instruction we looked at. Otherwise, we just need to undo the
NEXT_INSN at the end of the loop. */