[COMMITTED] Keep x_range_query NULL for global ranges.

Andrew MacLeod amacleod@redhat.com
Tue Nov 9 18:29:08 GMT 2021


On 11/9/21 10:28 AM, Jakub Jelinek wrote:
> On Tue, Nov 09, 2021 at 10:23:19AM -0500, Andrew MacLeod wrote:
>> yeah, that doesnt work because range_query is a pure virtual. However, there
>> also does not seem to be any reason why we need to jump thru hoops since
>> get_range_query() doesn't need to be in function.h..   If I relocate it to
>> value-query.h like so it seems to work quite well...   How about this?
> Ah, ok.  Indeed while one can extern global_range_query global_ranges;
> with incomplete global_range_query type, inheritance will not be known.
>
>> --- a/gcc/value-query.h
>> +++ b/gcc/value-query.h
>> @@ -127,6 +127,17 @@ public:
>>   };
>>   
>>   extern global_range_query global_ranges;
>> +inline range_query *get_global_range_query () { return &global_ranges; }
> Formatting, there should be empty line after global_ranges, and
> inline range_query *
> get_global_range_entry ()
> {
>    return &global_ranges;
> }
>
>> +
>> +/* Returns the currently active range access class.  When there is no active
>> +   range class, global ranges are used.  Never returns null.  */
>> +
>> +ATTRIBUTE_RETURNS_NONNULL inline range_query *
>> +get_range_query (const struct function *fun)
>> +{
>> +  return fun->x_range_query ? fun->x_range_query : &global_ranges;
>> +}
>> +
>>   extern value_range gimple_range_global (tree name);
>>   extern bool update_global_range (irange &r, tree name);
>>   
> Ok for trunk with the above nits fixed if it passes bootstrap/regtest,
> thanks.
>
> 	Jakub
>
Bootstraps on x86_64-pc-linux-gnu with no regressions.  Pushed.

Andrew

-------------- next part --------------
A non-text attachment was scrubbed...
Name: query4.diff
Type: text/x-patch
Size: 3652 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20211109/991bf4f4/attachment.bin>


More information about the Gcc-patches mailing list