diff options
author | kkojima <kkojima@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-03-03 23:55:24 +0000 |
---|---|---|
committer | kkojima <kkojima@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-03-03 23:55:24 +0000 |
commit | 5d94eab8c0b33b9534c871d82bec611de8fa0455 (patch) | |
tree | c042ff35dcf37a7e02032ec870f2274f1c18a050 | |
parent | 0cc43f9cb61126a89776ee2b2d39923a9f6a1ed4 (diff) | |
download | gcc-5d94eab8c0b33b9534c871d82bec611de8fa0455.tar.gz |
PR target/65249
* config/sh/sh.md (symGOT_load): Use R0 reg for operands[2] when
called for __stack_chk_guard symbol.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@221166 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/sh/sh.md | 23 |
2 files changed, 22 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ba28a0c4058..4f9ce5cccec 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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 Georg-Johann Lay <avr@gjlay.de> PR target/64331 diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 40e7d45f11b..9327c20030a 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -10164,10 +10164,25 @@ label: "" { rtx mem; + bool stack_chk_guard_p = false; operands[2] = !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 (stack_chk_guard_p && ! reload_in_progress && ! reload_completed) + operands[2] = gen_rtx_REG (Pmode, R0_REG); + if (TARGET_SHMEDIA) { rtx reg = operands[2]; @@ -10195,13 +10210,7 @@ label: 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 matter because this is a rare situation. */ - 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) + if (stack_chk_guard_p) emit_insn (gen_chk_guard_add (operands[3], operands[2])); else emit_move_insn (operands[3], gen_rtx_PLUS (Pmode, operands[2], |