2007-09-05 Sandra Loosemore <sandra@codesourcery.com>
+ 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 <sandra@codesourcery.com>
+
Add target hook invoked when cfun changes.
* doc/tm.texi (TARGET_SET_CURRENT_FUNCTION): Document.
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);
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)));
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