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

Reply via email to