On Wed, Sep 24, 2014 at 03:20:44PM -0600, Jeff Law wrote: > On 09/24/14 14:32, Ilya Enkovich wrote: > >2014-09-24 19:27 GMT+04:00 Jeff Law <l...@redhat.com>: > >>On 09/24/14 00:56, Ilya Enkovich wrote: > > >>> > >>>After register allocation we have no idea where GOT address is and > >>>therefore delegitimize_address target hook becomes less efficient and > >>>cannot remove UNSPECs. That's what I see now when build GCC with patch > >>>applied: > >> > >>In theory this shouldn't be too hard to fix. > >> > >>I haven't looked at the code, but it might be something looking explicitly > >>for ebx by register #, or something similar. Which case within > >>delegitimize_address isn't firing as it should after your changes? > > > >It is the case I had to fix: > > > >@@ -14415,7 +14433,8 @@ ix86_delegitimize_address (rtx x) > > ... > > movl foo@GOTOFF(%ecx), %edx > > in which case we return (%ecx - %ebx) + foo. */ > >- if (pic_offset_table_rtx) > >+ if (pic_offset_table_rtx > >+ && (!reload_completed || !ix86_use_pseudo_pic_reg ())) > > result = gen_rtx_PLUS (Pmode, gen_rtx_MINUS (Pmode, copy_rtx > > (addend), > > pic_offset_table_rtx), > > result); > > > >Originally if there is a UNSPEC_GOTOFFSET but no EBX usage then we > >just remove this UNSPEC and substract EBX value. With pseudo PIC reg > >we should use PIC register instead of EBX but it is unclear what to > >use after register allocation. > What's the RTL before & after allocation? Feel free to just pass along the > dump files for sum_r4 that you referenced in a prior message.
I wonder if during/after reload we just couldn't look at ORIGINAL_REGNO of hard regs if ix86_use_pseudo_pic_reg. Or is that the other case, where you don't have any PIC register replacement around, and want to subtract something? Perhaps in that case we could just subtract the value of _GLOBAL_OFFSET_TABLE_ symbol if we have nothing better around. Jakub