Commit ac841cf7 by Kaz Kojima

re PR target/65249 (unable to find a register to spill in class 'R0_REGS' when…

re PR target/65249 (unable to find a register to spill in class 'R0_REGS' when compiling protobuf on sh4)

PR target/65249
* config/sh/sh.md (symGOT_load): Use R0 reg for operands[2] when
  called for __stack_chk_guard symbol.

From-SVN: r221165
parent f6115d44
2015-03-03 Kaz Kojima <kkojima@gcc.gnu.org>
PR target/65249
* config/sh/sh.md (symGOT_load): Use R0 reg for operands[2] when
called for __stack_chk_guard symbol.
2015-03-03 DJ Delorie <dj@redhat.com> 2015-03-03 DJ Delorie <dj@redhat.com>
* config/rl78/rl78-real.md (*addqi_real): Allow SADDR types for * config/rl78/rl78-real.md (*addqi_real): Allow SADDR types for
......
...@@ -10690,10 +10690,26 @@ label: ...@@ -10690,10 +10690,26 @@ label:
"" ""
{ {
rtx mem; rtx mem;
bool stack_chk_guard_p = false;
operands[2] = !can_create_pseudo_p () ? operands[0] : gen_reg_rtx (Pmode); operands[2] = !can_create_pseudo_p () ? operands[0] : gen_reg_rtx (Pmode);
operands[3] = !can_create_pseudo_p () ? operands[0] : gen_reg_rtx (Pmode); operands[3] = !can_create_pseudo_p () ? operands[0] : gen_reg_rtx (Pmode);
if (!TARGET_SHMEDIA
&& flag_stack_protect
&& GET_CODE (operands[1]) == CONST
&& GET_CODE (XEXP (operands[1], 0)) == UNSPEC
&& GET_CODE (XVECEXP (XEXP (operands[1], 0), 0, 0)) == SYMBOL_REF
&& strcmp (XSTR (XVECEXP (XEXP (operands[1], 0), 0, 0), 0),
"__stack_chk_guard") == 0)
stack_chk_guard_p = true;
/* Use R0 to avoid long R0 liveness which stack-protector tends to
produce. */
if (! sh_lra_flag
&& stack_chk_guard_p && ! reload_in_progress && ! reload_completed)
operands[2] = gen_rtx_REG (Pmode, R0_REG);
if (TARGET_SHMEDIA) if (TARGET_SHMEDIA)
{ {
rtx reg = operands[2]; rtx reg = operands[2];
...@@ -10721,13 +10737,7 @@ label: ...@@ -10721,13 +10737,7 @@ label:
insn to avoid combining (set A (plus rX r12)) and (set op0 (mem A)) insn to avoid combining (set A (plus rX r12)) and (set op0 (mem A))
when rX is a GOT address for the guard symbol. Ugly but doesn't when rX is a GOT address for the guard symbol. Ugly but doesn't
matter because this is a rare situation. */ matter because this is a rare situation. */
if (!TARGET_SHMEDIA if (stack_chk_guard_p)
&& flag_stack_protect
&& GET_CODE (operands[1]) == CONST
&& GET_CODE (XEXP (operands[1], 0)) == UNSPEC
&& GET_CODE (XVECEXP (XEXP (operands[1], 0), 0, 0)) == SYMBOL_REF
&& strcmp (XSTR (XVECEXP (XEXP (operands[1], 0), 0, 0), 0),
"__stack_chk_guard") == 0)
emit_insn (gen_chk_guard_add (operands[3], operands[2])); emit_insn (gen_chk_guard_add (operands[3], operands[2]));
else else
emit_move_insn (operands[3], gen_rtx_PLUS (Pmode, operands[2], emit_move_insn (operands[3], gen_rtx_PLUS (Pmode, operands[2],
......
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