This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Enable EBX for x86 in 32bits PIC code
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Ilya Enkovich <enkovich dot gnu at gmail dot com>, Vladimir Makarov <vmakarov at redhat dot com>, gcc at gnu dot org, gcc-patches <gcc-patches at gcc dot gnu dot org>, Evgeny Stupachenko <evstupac at gmail dot com>, Richard Biener <richard dot guenther at gmail dot com>, Uros Bizjak <ubizjak at gmail dot com>, Petr Machata <pmachata at redhat dot com>
- Date: Mon, 29 Sep 2014 13:08:56 +0200
- Subject: Re: Enable EBX for x86 in 32bits PIC code
- Authentication-results: sourceware.org; auth=none
- References: <540777C0 dot 9050106 at redhat dot com> <20140923135437 dot GD35262 at msticlxl57 dot ims dot intel dot com> <20140923143419 dot GN17454 at tucnak dot redhat dot com> <54219900 dot 6060903 at redhat dot com> <20140923160302 dot GR17454 at tucnak dot redhat dot com> <54219B76 dot 3080607 at redhat dot com> <CAMbmDYZEWx1cQeyWufL3ZDfdcSxNtmc=oc9_vPCJYQHqXmzwVg at mail dot gmail dot com> <5422E2E3 dot 807 at redhat dot com> <CAMbmDYbnCxvLDz7gzXj1H7uwhDNOCHpq2G9AU5i4bUJG_x0hLQ at mail dot gmail dot com> <542335AC dot 9010707 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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 <law@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