This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: MIPS TLS support
Daniel Jacobowitz <drow@false.org> writes:
> On Wed, Mar 09, 2005 at 10:36:30PM +0000, Richard Sandiford wrote:
>> > + if (Pmode == DImode)
>> > + emit_insn (gen_tls_gd_di (a0, gp, loc));
>> > + else
>> > + emit_insn (gen_tls_gd_si (a0, gp, loc));
>
> This appears to be wrong - before reload, we don't know what register
> the global pointer will be in. I'm pretty confused.
>
> mips_global_pointer checks regs_ever_live[GLOBAL_POINTER_REGNUM], but
> if it returns something besides GLOBAL_POINTER_REGNUM in this case,
> won't the previous uses be bogus?
You should just be able to use pic_offset_table_rtx. It's a shared
rtx, so if the backend decides to change the register, all uses are
automatically affected.
(gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM) would normally return this
anyway if !reload_completed, but it's better to use pic_offset_table_rtx
directly.)
Richard