on 2021/9/21 下午5:39, Richard Biener wrote:
> On Tue, Sep 21, 2021 at 11:31 AM Martin Jambor <mjam...@suse.cz> wrote:
>>
>> Hi,
>>
>> On Tue, Sep 21 2021, Kewen.Lin wrote:
>>> on 2021/9/17 下午7:26, Martin Jambor wrote:
>>>> On Fri, Sep 17 2021, Kewen.Lin wrote:
>> [...]
>>>>>
>>>>> Sorry that I failed to use 16 bit-fields for this, I figured out that
>>>>> the bit-fields can not be address-taken or passed as non-const reference.
>>>>> The gentype also failed to recognize uint16_t if I used uint16_t directly
>>>>> in ipa-fnsummary.h.  Finally I used unsigned int instead.
>>>>>
>>>>
>>>> well, you could have used:
>>>>
>>>>   unsigned int target_info : 16;
>>>>
>>>> for the field (and uint16_t when passed to hooks).
>>>>
>>>> But I am not sure if it is that crucial.
>>>>
>>>
>>> I may miss something, specifically I tried with:
>>>
>>> 1)
>>>
>>>   unsigned int target_info : 16;
>>>   unsigned inlinable : 1;
>>>   ...
>>>
>>>   update_ipa_fn_target_info (uint16_t &, const gimple *)
>>
>> Yeah, you would have to copy the bit-field into a temporary, pass
>> reference to that in the hook and then copy it back.  At least that is
>> what I meant but since we apparently want unsigned int everywhere, it
>> does not matter.

Ah, I misunderstood you didn't want this way since it seems inefficient.
Will realize it next time since it looks like a tradeoff.  :)

> 
> Or use a by-value interface:
> 
>  uint16_t update_ipa_fn_target_info (uint16_t in, const gimple *stmt);
> 
> with the function returning the (changed) set.

Yeah, I considered this like:

  uint16_t update_ipa_fn_target_info (const uint16_t, const gimple*, bool&)

but thought it might look weird to others at the first glances and gave up
then.  :(

BR,
Kewen

Reply via email to