aboutsummaryrefslogtreecommitdiff
path: root/gcc/value-range.h
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2023-03-02 15:43:20 +0100
committerAldy Hernandez <aldyh@redhat.com>2023-04-26 10:35:53 +0200
commit5bdc5155138abeb244be1690998b359152445be6 (patch)
tree6bbf380ec8df5c81aa0e690fdab291186a689287 /gcc/value-range.h
parent964b02cb26df1016d036de6720e9d4decf87cc6f (diff)
downloadgcc-5bdc5155138abeb244be1690998b359152445be6.zip
gcc-5bdc5155138abeb244be1690998b359152445be6.tar.gz
gcc-5bdc5155138abeb244be1690998b359152445be6.tar.bz2
Convert users of legacy API to get_legacy_range() function.
This patch converts the users of the legacy API to a function called get_legacy_range() which will return the pieces of the soon to be removed API (min, max, and kind). This is a temporary measure while these users are converted. In upcoming patches I will convert most users, but most of the middle-end warning uses will remain. Naive attempts to remove them showed that a lot of these uses are quite dependant on the anti-range idiom, and converting them to the new API broke the tests, even when the conversion was conceptually correct. Perhaps someone who understands these passes could take a stab at it. In the meantime, the legacy uses can be trivially found by grepping for get_legacy_range. gcc/ChangeLog: * builtins.cc (determine_block_size): Convert use of legacy API to get_legacy_range. * gimple-array-bounds.cc (check_out_of_bounds_and_warn): Same. (array_bounds_checker::check_array_ref): Same. * gimple-ssa-warn-restrict.cc (builtin_memref::extend_offset_range): Same. * ipa-cp.cc (ipcp_store_vr_results): Same. * ipa-fnsummary.cc (set_switch_stmt_execution_predicate): Same. * ipa-prop.cc (struct ipa_vr_ggc_hash_traits): Same. (ipa_write_jump_function): Same. * pointer-query.cc (get_size_range): Same. * tree-data-ref.cc (split_constant_offset): Same. * tree-ssa-strlen.cc (get_range): Same. (maybe_diag_stxncpy_trunc): Same. (strlen_pass::get_len_or_size): Same. (strlen_pass::count_nonzero_bytes_addr): Same. * tree-vect-patterns.cc (vect_get_range_info): Same. * value-range.cc (irange::maybe_anti_range): Remove. (get_legacy_range): New. (irange::copy_to_legacy): Use get_legacy_range. (ranges_from_anti_range): Same. * value-range.h (class irange): Remove maybe_anti_range. (get_legacy_range): New. * vr-values.cc (check_for_binary_op_overflow): Convert use of legacy API to get_legacy_range. (compare_ranges): Same. (compare_range_with_value): Same. (bounds_of_var_in_loop): Same. (find_case_label_ranges): Same. (simplify_using_ranges::simplify_switch_using_ranges): Same.
Diffstat (limited to 'gcc/value-range.h')
-rw-r--r--gcc/value-range.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/value-range.h b/gcc/value-range.h
index 2442f8e..c1474a7 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -118,6 +118,7 @@ namespace inchash
class GTY((user)) irange : public vrange
{
+ friend value_range_kind get_legacy_range (const irange &, tree &, tree &);
friend class vrange_allocator;
friend class irange_storage_slot; // For legacy_mode_p checks.
public:
@@ -197,7 +198,6 @@ protected:
wide_int legacy_lower_bound (unsigned = 0) const;
wide_int legacy_upper_bound (unsigned) const;
int value_inside_range (tree) const;
- bool maybe_anti_range () const;
void copy_to_legacy (const irange &);
void copy_legacy_to_multi_range (const irange &);
@@ -672,6 +672,7 @@ irange::legacy_mode_p () const
extern bool range_has_numeric_bounds_p (const irange *);
extern bool ranges_from_anti_range (const value_range *,
value_range *, value_range *);
+extern value_range_kind get_legacy_range (const irange &, tree &min, tree &max);
extern void dump_value_range (FILE *, const vrange *);
extern bool vrp_val_is_min (const_tree);
extern bool vrp_val_is_max (const_tree);