This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Thumb PIC problems


  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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]