Commit b6d10e0b by Kaz Kojima

re PR target/66563 (ICE (segmentation fault) on sh4-linux-gnu)

PR target/66563
* [SH] Add a new operand to GOTaddr2picreg so to avoid CSE.  Modify caller
  of gen_GOTaddr2picreg.

From-SVN: r224925
parent efa165cd
2015-06-24 Kaz Kojima <kkojima@gcc.gnu.org>
PR target/66563
* config/sh/sh.md (GOTaddr2picreg): Add a new operand for
an additional element of the unspec vector. Modify indices
of operands.
(builtin_setjmp_receiver): Pass const0_rtx to gen_GOTaddr2picreg.
* config/sh/sh.c (prepare_move_operands): Pass incremented
const_int to gen_GOTaddr2picreg.
(sh_expand_prologue): Pass const0_rtx to gen_GOTaddr2picreg.
2015-06-24 Alan Lawrence <alan.lawrence@arm.com> 2015-06-24 Alan Lawrence <alan.lawrence@arm.com>
* config/aarch64/aarch64.md (<optab><fcvt_target><GPF:mode>2): * config/aarch64/aarch64.md (<optab><fcvt_target><GPF:mode>2):
......
...@@ -1845,12 +1845,13 @@ prepare_move_operands (rtx operands[], machine_mode mode) ...@@ -1845,12 +1845,13 @@ prepare_move_operands (rtx operands[], machine_mode mode)
|| tls_kind == TLS_MODEL_LOCAL_DYNAMIC || tls_kind == TLS_MODEL_LOCAL_DYNAMIC
|| tls_kind == TLS_MODEL_INITIAL_EXEC)) || tls_kind == TLS_MODEL_INITIAL_EXEC))
{ {
static int got_labelno;
/* Don't schedule insns for getting GOT address when /* Don't schedule insns for getting GOT address when
the first scheduling is enabled, to avoid spill the first scheduling is enabled, to avoid spill
failures for R0. */ failures for R0. */
if (flag_schedule_insns) if (flag_schedule_insns)
emit_insn (gen_blockage ()); emit_insn (gen_blockage ());
emit_insn (gen_GOTaddr2picreg ()); emit_insn (gen_GOTaddr2picreg (GEN_INT (++got_labelno)));
emit_use (gen_rtx_REG (SImode, PIC_REG)); emit_use (gen_rtx_REG (SImode, PIC_REG));
if (flag_schedule_insns) if (flag_schedule_insns)
emit_insn (gen_blockage ()); emit_insn (gen_blockage ());
...@@ -7958,7 +7959,7 @@ sh_expand_prologue (void) ...@@ -7958,7 +7959,7 @@ sh_expand_prologue (void)
} }
if (flag_pic && df_regs_ever_live_p (PIC_OFFSET_TABLE_REGNUM)) if (flag_pic && df_regs_ever_live_p (PIC_OFFSET_TABLE_REGNUM))
emit_insn (gen_GOTaddr2picreg ()); emit_insn (gen_GOTaddr2picreg (const0_rtx));
if (SHMEDIA_REGS_STACK_ADJUST ()) if (SHMEDIA_REGS_STACK_ADJUST ())
{ {
......
...@@ -10592,12 +10592,18 @@ label: ...@@ -10592,12 +10592,18 @@ label:
[(set_attr "in_delay_slot" "no") [(set_attr "in_delay_slot" "no")
(set_attr "type" "arith")]) (set_attr "type" "arith")])
;; Loads of the GOTPC relocation values must not be optimized away
;; by e.g. any kind of CSE and must stay as they are. Although there
;; are other various ways to ensure this, we use an artificial counter
;; operand to generate unique symbols.
(define_expand "GOTaddr2picreg" (define_expand "GOTaddr2picreg"
[(set (reg:SI R0_REG) [(set (reg:SI R0_REG)
(unspec:SI [(const:SI (unspec:SI [(match_dup 1)] UNSPEC_PIC))] (unspec:SI [(const:SI (unspec:SI [(match_dup 2)
UNSPEC_MOVA)) (match_operand:SI 0 "" "")]
(set (match_dup 0) (const:SI (unspec:SI [(match_dup 1)] UNSPEC_PIC))) UNSPEC_PIC))] UNSPEC_MOVA))
(set (match_dup 0) (plus:SI (match_dup 0) (reg:SI R0_REG)))] (set (match_dup 1)
(const:SI (unspec:SI [(match_dup 2) (match_dup 0)] UNSPEC_PIC)))
(set (match_dup 1) (plus:SI (match_dup 1) (reg:SI R0_REG)))]
"" ""
{ {
if (TARGET_VXWORKS_RTP) if (TARGET_VXWORKS_RTP)
...@@ -10608,8 +10614,8 @@ label: ...@@ -10608,8 +10614,8 @@ label:
DONE; DONE;
} }
operands[0] = gen_rtx_REG (Pmode, PIC_REG); operands[1] = gen_rtx_REG (Pmode, PIC_REG);
operands[1] = gen_rtx_SYMBOL_REF (VOIDmode, GOT_SYMBOL_NAME); operands[2] = gen_rtx_SYMBOL_REF (VOIDmode, GOT_SYMBOL_NAME);
if (TARGET_SHMEDIA) if (TARGET_SHMEDIA)
{ {
...@@ -10618,23 +10624,23 @@ label: ...@@ -10618,23 +10624,23 @@ label:
rtx lab = PATTERN (gen_call_site ()); rtx lab = PATTERN (gen_call_site ());
rtx insn, equiv; rtx insn, equiv;
equiv = operands[1]; equiv = operands[2];
operands[1] = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, operands[1], lab), operands[2] = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, operands[2], lab),
UNSPEC_PCREL_SYMOFF); UNSPEC_PCREL_SYMOFF);
operands[1] = gen_rtx_CONST (Pmode, operands[1]); operands[2] = gen_rtx_CONST (Pmode, operands[2]);
if (Pmode == SImode) if (Pmode == SImode)
{ {
emit_insn (gen_movsi_const (pic, operands[1])); emit_insn (gen_movsi_const (pic, operands[2]));
emit_insn (gen_ptrel_si (tr, pic, copy_rtx (lab))); emit_insn (gen_ptrel_si (tr, pic, copy_rtx (lab)));
} }
else else
{ {
emit_insn (gen_movdi_const (pic, operands[1])); emit_insn (gen_movdi_const (pic, operands[2]));
emit_insn (gen_ptrel_di (tr, pic, copy_rtx (lab))); emit_insn (gen_ptrel_di (tr, pic, copy_rtx (lab)));
} }
insn = emit_move_insn (operands[0], tr); insn = emit_move_insn (operands[1], tr);
set_unique_reg_note (insn, REG_EQUAL, equiv); set_unique_reg_note (insn, REG_EQUAL, equiv);
...@@ -10688,7 +10694,7 @@ label: ...@@ -10688,7 +10694,7 @@ label:
[(match_operand 0 "" "")] [(match_operand 0 "" "")]
"flag_pic" "flag_pic"
{ {
emit_insn (gen_GOTaddr2picreg ()); emit_insn (gen_GOTaddr2picreg (const0_rtx));
DONE; DONE;
}) })
......
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