From: Sandra Loosemore Date: Wed, 5 Sep 2007 14:33:48 +0000 (-0400) Subject: mips.c (mips_legitimize_tls_address): Call sorry if we encounter TLS address in MIPS1... X-Git-Tag: releases/gcc-4.3.0~2868 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=edede0242fe72bf7814fa25da0ddb6a4dd516738;p=thirdparty%2Fgcc.git mips.c (mips_legitimize_tls_address): Call sorry if we encounter TLS address in MIPS16 mode. 2007-09-05 Sandra Loosemore gcc/ * config/mips/mips.c (mips_legitimize_tls_address): Call sorry if we encounter TLS address in MIPS16 mode. (mips_legitimize_const_move): Check cannot_force_const_mem for the (const (plus symbol offset)) case; this forces invalid TLS address in MIPS16 mode to be caught by the above call to sorry. (override_options): Don't reset targetm.have_tls in MIPS16 mode, because that now enables emutls, which is not ABI compatible with native TLS in non-MIPS16 mode. From-SVN: r128133 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cf5891362905..b32119985697 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2007-09-05 Sandra Loosemore + + gcc/ + * config/mips/mips.c (mips_legitimize_tls_address): Call sorry + if we encounter TLS address in MIPS16 mode. + (mips_legitimize_const_move): Check cannot_force_const_mem for + the (const (plus symbol offset)) case; this forces invalid TLS + address in MIPS16 mode to be caught by the above call to sorry. + (override_options): Don't reset targetm.have_tls in MIPS16 mode, + because that now enables emutls, which is not ABI compatible + with native TLS in non-MIPS16 mode. + 2007-09-05 Sandra Loosemore Add target hook invoked when cfun changes. diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 2c2f11eb66a6..937f5904550c 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -2326,6 +2326,12 @@ mips_legitimize_tls_address (rtx loc) rtx dest, insn, v0, v1, tmp1, tmp2, eqv; enum tls_model model; + if (TARGET_MIPS16) + { + sorry ("MIPS16 TLS"); + return gen_reg_rtx (Pmode); + } + v0 = gen_rtx_REG (Pmode, GP_RETURN); v1 = gen_rtx_REG (Pmode, GP_RETURN + 1); @@ -2591,13 +2597,14 @@ mips_legitimize_const_move (enum machine_mode mode, rtx dest, rtx src) return; } - /* If we have (const (plus symbol offset)), load the symbol first - and then add in the offset. This is usually better than forcing - the constant into memory, at least in non-mips16 code. */ + /* If we have (const (plus symbol offset)), and that expression cannot + be forced into memory, load the symbol first and add in the offset. + In non-MIPS16 mode, prefer to do this even if the constant _can_ be + forced into memory, as it usually produces better code. */ split_const (src, &base, &offset); - if (!TARGET_MIPS16 - && offset != const0_rtx - && (can_create_pseudo_p () || SMALL_INT (offset))) + if (offset != const0_rtx + && (targetm.cannot_force_const_mem (src) + || (!TARGET_MIPS16 && can_create_pseudo_p ()))) { base = mips_force_temporary (dest, base); mips_emit_move (dest, mips_add_offset (0, base, INTVAL (offset))); @@ -5600,11 +5607,6 @@ override_options (void) mips_lo_relocs[SYMBOL_HALF] = "%half("; - /* We don't have a thread pointer access instruction on MIPS16, or - appropriate TLS relocations. */ - if (TARGET_MIPS16) - targetm.have_tls = false; - /* Default to working around R4000 errata only if the processor was selected explicitly. */ if ((target_flags_explicit & MASK_FIX_R4000) == 0