This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Enable EBX for x86 in 32bits PIC code
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Evgeny Stupachenko <evstupac at gmail dot com>, Richard Biener <richard dot guenther at gmail dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Mon, 7 Jul 2014 18:41:40 +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> <20140707114750 dot GB31640 at tucnak dot redhat dot com>
On Mon, Jul 7, 2014 at 1:47 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> 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).
You can probably use get_hard_reg_initial_val for this.
Uros.