]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/vr-values.h
Move simplification of statements using ranges into its own class.
authorAldy Hernandez <aldyh@redhat.com>
Thu, 18 Jun 2020 08:37:14 +0000 (10:37 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Sat, 27 Jun 2020 12:11:41 +0000 (14:11 +0200)
commitfc36b97af05ef74b0889ba49090c2f52f00e0e77
tree56791637843a2bcbb21cd928008a014f163e7a12
parentaed3ab253dada2b7d2ed63cc6a8e15e263d5dd35
Move simplification of statements using ranges into its own class.

This moves all the simplification code from vr_values into a separate
class (simplify_using_ranges).  In doing so, we get rid of a bunch of
dependencies on the internals of vr_values.  The goal is to (a) remove
unnecessary interdependendcies (b) be able to use this engine with any
range infrastructure, as all it needs is a method to get the range for
an SSA name (get_value_range).

I also removed as many dependencies on value_range_equiv as possible,
preferring value_range.  A few value_range_equiv uses remain, but for
cases where equivalences are actually used (folding conditionals, etc).

gcc/ChangeLog:

* gimple-ssa-evrp-analyze.h (vrp_visit_cond_stmt): Use
simplify_using_ranges class.
* gimple-ssa-evrp.c (class evrp_folder): New simplify_using_ranges
field.  Adjust all methods to use new field.
* tree-ssa-dom.c (simplify_stmt_for_jump_threading): Use
simplify_using_ranges class.
* tree-vrp.c (class vrp_folder): New simplify_using_ranges
field.  Adjust all methods to use new field.
(simplify_stmt_for_jump_threading): Use simplify_using_ranges class.
(vrp_prop::vrp_finalize): New vrp_folder argument.
(execute_vrp): Pass folder to vrp_finalize.  Use
simplify_using_ranges class.
Remove cleanup_edges_and_switches call.
* vr-values.c (vr_values::op_with_boolean_value_range_p): Change
value_range_equiv uses to value_range.
(simplify_using_ranges::op_with_boolean_value_range_p): Use
simplify_using_ranges class.
(check_for_binary_op_overflow): Make static.
(vr_values::extract_range_basic): Pass this to
check_for_binary_op_overflow.
(compare_range_with_value): Change value_range_equiv uses to
value_range.
(vr_values::vr_values): Initialize simplifier field.
Remove uses of to_remove_edges and to_update_switch_stmts.
(vr_values::~vr_values): Remove uses of to_remove_edges and
to_update_switch_stmts.
(vr_values::get_vr_for_comparison): Move to simplify_using_ranges
class.
(vr_values::compare_name_with_value): Same.
(vr_values::compare_names): Same.
(vr_values::vrp_evaluate_conditional_warnv_with_ops): Same.
(vr_values::vrp_evaluate_conditional): Same.
(vr_values::vrp_visit_cond_stmt): Same.
(find_case_label_ranges): Change value_range_equiv uses to
value_range.
(vr_values::extract_range_from_stmt): Use simplify_using_ranges class.
(vr_values::simplify_truth_ops_using_ranges): Move to
simplify_using_ranges class.
(vr_values::simplify_div_or_mod_using_ranges): Same.
(vr_values::simplify_min_or_max_using_ranges): Same.
(vr_values::simplify_abs_using_ranges): Same.
(vr_values::simplify_bit_ops_using_ranges): Same.
(test_for_singularity): Change value_range_equiv uses to
value_range.
(range_fits_type_p): Same.
(vr_values::simplify_cond_using_ranges_1): Same.
(vr_values::simplify_cond_using_ranges_2): Make extern.
(vr_values::fold_cond): Move to simplify_using_ranges class.
(vr_values::simplify_switch_using_ranges): Same.
(vr_values::cleanup_edges_and_switches): Same.
(vr_values::simplify_float_conversion_using_ranges): Same.
(vr_values::simplify_internal_call_using_ranges): Same.
(vr_values::two_valued_val_range_p): Same.
(vr_values::simplify_stmt_using_ranges): Move to...
(simplify_using_ranges::simplify): ...here.
* vr-values.h (class vr_values): Move all the simplification of
statements using ranges methods and code from here...
(class simplify_using_ranges): ...to here.
(simplify_cond_using_ranges_2): New extern prototype.
gcc/gimple-ssa-evrp-analyze.h
gcc/gimple-ssa-evrp.c
gcc/tree-ssa-dom.c
gcc/tree-vrp.c
gcc/vr-values.c
gcc/vr-values.h