This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Thumb PIC problems
- To: gcc at gcc dot gnu dot org
- Subject: Thumb PIC problems
- From: Dmitry Pugachev <dima_p at auriga dot ru>
- Date: Wed, 18 Oct 2000 11:38:12 +0400
- Organization: Auriga Inc.
Hi! I have a question concerning the PIC support for Thumb. Well, it's
not Thumb-specific, but I encountered it while trying to compile Thumb
code. There (in thumb.c) is a definition for the PIC register to be r10
(sl), and, being a high register, it cannot be directly loaded with a
memory content (_GLOBAL_OFFSET_TABLE_ reference). But the
thumb_finalize_pic() function emits such a load, and I thought that the
reload phaze should split that insn to use a temporary low register for
the transfer. But it does not (because it won't split hard register
moves?). I wonder, what is the correct way to make it use a temporary
reg? I tried to replace the direct load with the following code:
{
rtx r = gen_reg_rtx (Pmode);
emit_insn (gen_pic_load_addr (r, pic_rtx));
emit_move_insn (pic_offset_table_rtx, r);
}
but it had no effect as the two instructions were collapsed into one,
producing the incorrect load.
Inserting emit_insn (gen_rtx_USE (VOIDmode, r)) between them helps, but
is it the correct fix?...
Thanks in advance.
/Dmitry