* [patch committed] [SH] Allow non-pic local and global dynamic tls models
@ 2011-06-08 6:23 Kaz Kojima
0 siblings, 0 replies; only message in thread
From: Kaz Kojima @ 2011-06-08 6:23 UTC (permalink / raw)
To: gcc-patches
Hi,
The attached patch allows SH target to use local and global dynamic
tls models without -fpic/-fpie. Tested on sh4-unknown-linux-gnu
with no new failures. Applied on trunk.
Regards,
kaz
--
2011-06-08 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.c (prepare_move_operands): Set pic register
appropriately for global and local dynamic tls models even
if flag_pic is unset.
--- ORIG/trunk/gcc/config/sh/sh.c 2011-06-02 09:41:16.000000000 +0900
+++ trunk/gcc/config/sh/sh.c 2011-06-07 22:32:02.000000000 +0900
@@ -1844,12 +1844,30 @@ prepare_move_operands (rtx operands[], e
{
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[], e
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));
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-08 3:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-08 6:23 [patch committed] [SH] Allow non-pic local and global dynamic tls models Kaz Kojima
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).