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]
Other format: [Raw text]

Re: Inconsistent initialization for pic_offset_table_rtx?


2016-02-09 19:00 GMT+03:00 Bin.Cheng <amker.cheng@gmail.com>:
> On Tue, Feb 9, 2016 at 3:53 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>> 2016-02-09 18:45 GMT+03:00 Richard Earnshaw (lists) <Richard.Earnshaw@arm.com>:
>>> On 09/02/16 14:56, Ilya Enkovich wrote:
>>>>
>>>> I agree it looks inconsistent.  But I don't think PIC_OFFSET_TABLE_REGNUM is
>>>> supposed to return pseudo regno.  Using EBX_REG value for this macro was a
>>>> workaround for problem of NULL pic_offset_table_rtx usage in cost
>>>> functions. I think
>>>> we should try to initialize pic_offset_table_rtx with some pseudo
>>>> register in i386
>>>> target for cost estimation purposes and always return INVALID_REG for
>>>> PIC_OFFSET_TABLE_REGNUM.
>>>>
>>>
>>> The ARM port has been using a pseudo for P_O_T_R for many years now.  It
>>> needs some care to establish it correctly in the prologue when needed,
>>> but otherwise works very well.  It means that leaf functions in
>>> particular can be made much more efficient as they can pick a
>>> call-clobbered register when that's desirable.
>>
>> We may need it from middle-end when estimate statements cost.  So
>> initialization in
>> prologue is not enough (at least for i386 target).  Looks like those
>> cost estimation hooks
>> should take care of PIC register by themselves.
> By cost estimation hooks, do you mean xxx_address_cost here?  Middle
> end itself doesn't know how PIC register is supported by targets.  I
> admit that there is a missing part for PIC register in register
> pressure estimate in IVO.
> IIUC, the hardreg is only used for cost estimation in middle end here,
> and it's only used for the first function in each compilation unit,
> right?  It's overridden into pseudo register when expanding the first
> function anyway?

I understand it in the same way. I'm not sure if any of IPA or local
optimization passes are affected. Those are executed before any
function expansion and therefore will have EBX as PIC register if use
corresponding target hooks.

Ilya

>
> Thanks,
> bin
>>
>> Thanks,
>> Ilya
>>
>>>
>>> R.
>>>
>>>> Thanks,
>>>> Ilya
>>>>
>>>>>


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