On Mon, May 24, 2021 at 6:44 PM Aldy Hernandez via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
>
>
> On 5/21/21 1:39 PM, Aldy Hernandez wrote:
> > This patch provides a generic API for accessing global ranges.  It is
> > meant to replace get_range_info() and get_ptr_nonnull() with one
> > common interface.  It uses the same API as the ranger (class
> > range_query), so there will now be one API for accessing local and
> > global ranges alike.
> >
> > Follow-up patches will convert all users of get_range_info and
> > get_ptr_nonnull to this API.
> >
> > For get_range_info, instead of:
> >
> >    if (!POINTER_TYPE_P (TREE_TYPE (name)) && SSA_NAME_RANGE_INFO (name))
> >      get_range_info (name, vr);
> >
> > You can now do:
> >
> >    RANGE_QUERY (cfun)->range_of_expr (vr, name, [stmt]);
>
> BTW, we're not wed to the idea of putting the current range object in
> cfun.  The important thing is that the API is consistent across, not
> where it lives.

If the range object is specific for a function (and thus cannot handle
multiple functions in IPA mode) then struct function looks like the correct
place.  Accessing that unconditionally via 'cfun' sounds bad though because
that disallows use from IPA passes.

>
> We're open to suggestions: a global variable, cfun, the pass manager, or
> even a pass property:
>
>    ( PROP_blah | PROP_ranger ), /* properties_required */
>
> I personally like cfun, but we're open to suggestions.
>
> Aldy
>

Reply via email to