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.
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