This is the mail archive of the
mailing list for the GCC project.
Re: Enable EBX for x86 in 32bits PIC code
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Evgeny Stupachenko <evstupac at gmail dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, GCC Development <gcc at gcc dot gnu dot org>, Uros Bizjak <ubizjak at gmail dot com>
- Date: Mon, 7 Jul 2014 13:47:50 +0200
- Subject: Re: Enable EBX for x86 in 32bits PIC code
- Authentication-results: sourceware.org; auth=none
- References: <CAOvf_xxsQ_oYGqNAVQ1+BW+CuD3mzebZ2xma0jpF=WfyZMCRCA at mail dot gmail dot com> <CAFiYyc1mFtTezkTJORmJJq+yht=qPSwiN7KDn19+bSuSdaqvMQ at mail dot gmail dot com> <CAOvf_xyeVeg2oB9Xxz8RMEQ6gyfJY5whd9s4ygoAAEaMU9efnA at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Jul 07, 2014 at 03:35:06PM +0400, Evgeny Stupachenko wrote:
> The key problem here is that EBX is not used in register allocation.
> If we relax the restriction on EBX the performance is back, but there
> are several fails.
> Some of them could be fixed.
> However I don't like that way as EBX register is uninitialized at
> register allocation.
That is nothing wrong. The magic registers are to be assumed live from the
beginning until the prologue is emitted.
> Initialization (SET_GOT) appeared only at: "217r.pro_and_epilogue" phase.
> The key point in 2 suggestions is to set EBX register only prior to a
> call (as it is required by ABI). In all other cases it could be any
> other register.
You could use special call insn patterns for calls that need to have ebx
set, where there would be a
(use (match_operand:SI NN "register_operand" "b"))
and pass in the lgot pseudo and leave the register allocator to do its job.
You'd need to remember in which hard register (or memory) the register
allocator wants lgot to be at the start of the first basic block (so that
when prologue is expanded you know where to store it).