From c2bbcb0db139ca738743376d429b0745a9b684d8 Mon Sep 17 00:00:00 2001 From: Kaz Kojima Date: Wed, 8 Jun 2011 03:54:05 +0000 Subject: [PATCH] sh.c (prepare_move_operands): Set pic register appropriately for global and local dynamic tls models even if... * config/sh/sh.c (prepare_move_operands): Set pic register appropriately for global and local dynamic tls models even if flag_pic is unset. From-SVN: r174792 --- gcc/ChangeLog | 6 ++++++ gcc/config/sh/sh.c | 32 +++++++++++++++++++------------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6c1a5c2038c..ff7cd0bbddf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-06-08 Kaz Kojima + + * config/sh/sh.c (prepare_move_operands): Set pic register + appropriately for global and local dynamic tls models even + if flag_pic is unset. + 2011-06-07 Jason Merrill * pretty-print.h (ATTRIBUTE_GCC_PPDIAG): Use GCC_DIAG_STYLE if set. diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index c5fbd569602..f81172545a4 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -1844,12 +1844,30 @@ prepare_move_operands (rtx operands[], enum machine_mode mode) { rtx tga_op1, tga_ret, tmp, tmp2; + if (! flag_pic + && (tls_kind == TLS_MODEL_GLOBAL_DYNAMIC + || tls_kind == TLS_MODEL_LOCAL_DYNAMIC + || tls_kind == TLS_MODEL_INITIAL_EXEC)) + { + /* Don't schedule insns for getting GOT address when + the first scheduling is enabled, to avoid spill + failures for R0. */ + if (flag_schedule_insns) + emit_insn (gen_blockage ()); + emit_insn (gen_GOTaddr2picreg ()); + emit_use (gen_rtx_REG (SImode, PIC_REG)); + if (flag_schedule_insns) + emit_insn (gen_blockage ()); + } + switch (tls_kind) { case TLS_MODEL_GLOBAL_DYNAMIC: tga_ret = gen_rtx_REG (Pmode, R0_REG); emit_call_insn (gen_tls_global_dynamic (tga_ret, op1)); - op1 = tga_ret; + tmp = gen_reg_rtx (Pmode); + emit_move_insn (tmp, tga_ret); + op1 = tmp; break; case TLS_MODEL_LOCAL_DYNAMIC: @@ -1869,18 +1887,6 @@ prepare_move_operands (rtx operands[], enum machine_mode mode) break; case TLS_MODEL_INITIAL_EXEC: - if (! flag_pic) - { - /* Don't schedule insns for getting GOT address when - the first scheduling is enabled, to avoid spill - failures for R0. */ - if (flag_schedule_insns) - emit_insn (gen_blockage ()); - emit_insn (gen_GOTaddr2picreg ()); - emit_use (gen_rtx_REG (SImode, PIC_REG)); - if (flag_schedule_insns) - emit_insn (gen_blockage ()); - } tga_op1 = !can_create_pseudo_p () ? op0 : gen_reg_rtx (Pmode); tmp = gen_sym2GOTTPOFF (op1); emit_insn (gen_tls_initial_exec (tga_op1, tmp)); -- 2.30.2