diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2018-10-17 15:59:25 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@gcc.gnu.org> | 2018-10-17 15:59:25 +0000 |
commit | 54994253d3fc00bcb7d3e9359ff31a81c0e4543a (patch) | |
tree | 416281f18a0c359b4d87a5aeac398be374184fb6 /gcc/tree-vrp.h | |
parent | 033eb5671769a4c681a44aad08a454e667e08502 (diff) | |
download | gcc-54994253d3fc00bcb7d3e9359ff31a81c0e4543a.zip gcc-54994253d3fc00bcb7d3e9359ff31a81c0e4543a.tar.gz gcc-54994253d3fc00bcb7d3e9359ff31a81c0e4543a.tar.bz2 |
bitmap.c (bitmap_head::dump): New.
* bitmap.c (bitmap_head::dump): New.
* bitmap.h (bitmap_head): Add dump().
* gimple-ssa-evrp-analyze.c
(evrp_range_analyzer::try_find_new_range): Adjust for value_range API.
(evrp_range_analyzer::set_ssa_range_info): Same.
(evrp_range_analyzer::record_ranges_from_phis): Same.
(evrp_range_analyzer::record_ranges_from_stmt): Same.
* gimple-ssa-evrp.c (evrp_dom_walker::before_dom_children): Same.
* gimple-ssa-sprintf.c (get_int_range): Same.
(format_integer): Same.
(sprintf_dom_walker::handle_gimple_call): Same.
* ipa-cp.c (ipcp_vr_lattice::meet_with_1): Same.
(ipcp_vr_lattice::top_p): Same.
(ipcp_vr_lattice::bottom_p): Same.
(ipcp_vr_lattice::set_to_bottom): Same.
(ipa_vr_operation_and_type_effects): Same.
(propagate_vr_across_jump_function): Same.
(ipcp_store_vr_results): Same.
* ipa-prop.c (struct ipa_vr_ggc_hash_traits): Same.
(ipa_print_node_jump_functions_for_edge): Same.
(ipa_get_value_range): Same.
(ipa_compute_jump_functions_for_edge): Same.
(ipa_write_jump_function): Same.
* tree-ssa-dom.c (simplify_stmt_for_jump_threading): Same.
* tree-ssa-threadedge.c (record_temporary_equivalences_from_phis):
Same.
* vr-values.c (set_value_range_to_nonnegative): Same.
(set_value_range_to_truthvalue): Same.
(vr_values::get_value_range): Same.
(vr_values::set_defs_to_varying): Same.
(vr_values::update_value_range): Same.
(symbolic_range_based_on_p): Same.
(vr_values::op_with_boolean_value_range_p): Same.
(vr_values::extract_range_for_var_from_comparison_expr): Same.
(vr_values::extract_range_from_ssa_name): Same.
(vr_values::extract_range_from_binary_expr): Same.
(vr_values::extract_range_from_unary_expr): Same.
(vr_values::extract_range_from_cond_expr): Same.
(vr_values::extract_range_from_comparison): Same.
(vr_values::check_for_binary_op_overflow): Same.
(vr_values::extract_range_basic): Same.
(vr_values::extract_range_from_assignment): Same.
(compare_ranges): Same.
(compare_range_with_value): Same.
(vr_values::adjust_range_with_scev): Same.
(vrp_valueize): Same.
(vrp_valueize_1): Same.
(vr_values::get_vr_for_comparison): Same.
(vr_values::compare_name_with_value): Same.
(vr_values::compare_names): Same.
(vr_values::vrp_evaluate_conditional): Same.
(find_case_label_ranges): Same.
(vr_values::vrp_visit_switch_stmt): Same.
(vr_values::extract_range_from_phi_node): Same.
(vr_values::simplify_div_or_mod_using_ranges): Same.
(vr_values::simplify_bit_ops_using_ranges): Same.
(test_for_singularity): Same.
(range_fits_type_p): Same.
(vr_values::simplify_cond_using_ranges_1): Same.
(vr_values::simplify_switch_using_ranges): Same.
(vr_values::simplify_float_conversion_using_ranges): Same.
(vr_values::two_valued_val_range_p): Same.
(vr_values::add_equivalence): Move to value_range::equiv_add.
* vr-values.h (vr_values::add_equivalence): Remove.
(VR_INITIALIZER): Remove.
* tree-vrp.c (value_range::set): New.
(value_range::equiv_add): New.
(value_range::value_range): New.
(value_range::deep_copy): New.
(value_range::check): New.
(value_range::equal_p): New.
(value_range::ignore_equivs_equal_p): New.
(value_range::operator==): New.
(value_range::operator!=): New.
(value_range::symbolic_p): New.
(value_range::numeric_p): New.
(value_range::set_undefined): New.
(value_range::set_varying): New.
(value_range::may_contain_p): New.
(value_range::equiv_clear): New.
(value_range::singleton_p): New.
(value_range::intersect): New.
(value_range::dump): New.
(value_range::set_and_canonicalize): New.
(set_value_range): Adjust for value_range API.
(set_value_range_to_undefined): Same.
(set_value_range_to_varying): Same.
(set_and_canonicalize_value_range): Same.
(set_value_range_to_nonnull): Same.
(set_value_range_to_null): Same.
(range_is_null): Same.
(range_is_nonnull): Same.
(range_int_cst_p): Same.
(range_int_cst_singleton_p): Same.
(symbolic_range_p): Same.
(range_includes_zero_p): Same.
(value_range_constant_singleton): Same.
(vrp_set_zero_nonzero_bits): Same.
(ranges_from_anti_range): Same.
(extract_range_into_wide_ints): Same.
(extract_range_from_multiplicative_op): Same.
(set_value_range_with_overflow): Same.
(extract_range_from_binary_expr_1): Same.
(extract_range_from_unary_expr): Same.
(dump_value_range): Same.
(debug_value_range): Same.
(vrp_prop::check_array_ref): Same.
(vrp_prop::check_mem_ref): Same.
(vrp_prop::vrp_initialize): Same.
(vrp_prop::visit_stmt): Same.
(intersect_ranges): Same.
(vrp_prop::visit_phi): Same.
(vrp_prop::vrp_finalize): Same.
(determine_value_range_1): Same.
(determine_value_range): Same.
(vrp_intersect_ranges_1): Rename to...
(vrp_intersect_1): this.
(vrp_intersect_ranges): Rename to...
(value_range::intersect_helper): ...this.
(vrp_meet_1): Rename to...
(value_range::union_helper): ...this.
(vrp_meet): Rename to...
(value_range::union_): ...this.
(copy_value_range): Remove.
* tree-vrp.h (struct value_range): Rewrite into a proper class.
(value_range::vrtype): New.
(value_range::type): New.
(value_range::equiv): New.
(value_range::min): New.
(value_range::max): New.
(value_range::varying_p): New.
(value_range::undefined_p): New.
(value_range::null_p): New.
(value_range::equiv_add): New.
(copy_value_range): Remove.
From-SVN: r265241
Diffstat (limited to 'gcc/tree-vrp.h')
-rw-r--r-- | gcc/tree-vrp.h | 164 |
1 files changed, 130 insertions, 34 deletions
diff --git a/gcc/tree-vrp.h b/gcc/tree-vrp.h index 655cf05..c251329 100644 --- a/gcc/tree-vrp.h +++ b/gcc/tree-vrp.h @@ -20,42 +20,143 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_TREE_VRP_H #define GCC_TREE_VRP_H -/* Type of value ranges. See value_range below for a - description of these types. */ -enum value_range_type { VR_UNDEFINED, VR_RANGE, - VR_ANTI_RANGE, VR_VARYING, VR_LAST }; +/* Types of value ranges. */ +enum value_range_kind +{ + /* Empty range. */ + VR_UNDEFINED, + /* Range spans the entire domain. */ + VR_VARYING, + /* Range is [MIN, MAX]. */ + VR_RANGE, + /* Range is ~[MIN, MAX]. */ + VR_ANTI_RANGE, + /* Range is a nice guy. */ + VR_LAST +}; /* Range of values that can be associated with an SSA_NAME after VRP has executed. */ -struct GTY((for_user)) value_range +class GTY((for_user)) value_range { - /* Lattice value represented by this range. */ - enum value_range_type type; + public: + value_range (); + value_range (value_range_kind, tree, tree, bitmap = NULL); + void update (value_range_kind, tree, tree); + bool operator== (const value_range &) const; + bool operator!= (const value_range &) const; + void intersect (const value_range *); + void union_ (const value_range *); + + /* Types of value ranges. */ + bool undefined_p () const; + bool varying_p () const; + bool symbolic_p () const; + bool constant_p () const; + void set_undefined (); + void set_varying (); + + /* Equivalence bitmap methods. */ + bitmap equiv () const; + void equiv_clear (); + void equiv_add (const_tree, const value_range *, bitmap_obstack * = NULL); + + /* Misc methods. */ + tree type () const; + bool null_p () const; + bool may_contain_p (tree) const; + bool singleton_p (tree *result = NULL) const; + void deep_copy (const value_range *); + bool ignore_equivs_equal_p (const value_range &) const; + void set_and_canonicalize (enum value_range_kind, tree, tree, bitmap); + void dump (FILE *) const; + void dump () const; + + enum value_range_kind kind () const; + tree min () const; + tree max () const; + + private: + void set (value_range_kind, tree, tree, bitmap); + void check (); + bool equal_p (const value_range &, bool ignore_equivs) const; + void intersect_helper (value_range *, const value_range *); + void union_helper (value_range *, const value_range *); + + enum value_range_kind m_kind; + public: + /* These should be private, but GTY is a piece of crap. */ + tree m_min; + tree m_max; + /* Set of SSA names whose value ranges are equivalent to this one. + This set is only valid when TYPE is VR_RANGE or VR_ANTI_RANGE. */ + bitmap m_equiv; +}; - /* Minimum and maximum values represented by this range. These - values should be interpreted as follows: +inline +value_range::value_range () +{ + m_kind = VR_UNDEFINED; + m_min = m_max = NULL; + m_equiv = NULL; +} - - If TYPE is VR_UNDEFINED or VR_VARYING then MIN and MAX must - be NULL. +/* Return the kind of this range. */ - - If TYPE == VR_RANGE then MIN holds the minimum value and - MAX holds the maximum value of the range [MIN, MAX]. +inline value_range_kind +value_range::kind () const +{ + return m_kind; +} - - If TYPE == ANTI_RANGE the variable is known to NOT - take any values in the range [MIN, MAX]. */ - tree min; - tree max; +inline bitmap +value_range::equiv () const +{ + return m_equiv; +} - /* Set of SSA names whose value ranges are equivalent to this one. - This set is only valid when TYPE is VR_RANGE or VR_ANTI_RANGE. */ - bitmap equiv; +/* Return the lower bound. */ - /* Dump value range to stderr. */ - void dump () const; -}; +inline tree +value_range::min () const +{ + return m_min; +} + +/* Return the upper bound. */ + +inline tree +value_range::max () const +{ + return m_max; +} + +/* Return TRUE if range spans the entire possible domain. */ + +inline bool +value_range::varying_p () const +{ + return m_kind == VR_VARYING; +} + +/* Return TRUE if range is undefined (essentially the empty set). */ + +inline bool +value_range::undefined_p () const +{ + return m_kind == VR_UNDEFINED; +} + +/* Return TRUE if range is the constant zero. */ + +inline bool +value_range::null_p () const +{ + return (m_kind == VR_RANGE + && integer_zerop (m_min) + && integer_zerop (m_max)); +} -extern void vrp_intersect_ranges (value_range *vr0, const value_range *vr1); -extern void vrp_meet (value_range *vr0, const value_range *vr1); extern void dump_value_range (FILE *, const value_range *); extern void extract_range_from_unary_expr (value_range *vr, enum tree_code code, @@ -64,8 +165,8 @@ extern void extract_range_from_unary_expr (value_range *vr, tree op0_type); extern bool vrp_operand_equal_p (const_tree, const_tree); -extern enum value_range_type intersect_range_with_nonzero_bits - (enum value_range_type, wide_int *, wide_int *, const wide_int &, signop); +extern enum value_range_kind intersect_range_with_nonzero_bits + (enum value_range_kind, wide_int *, wide_int *, const wide_int &, signop); struct assert_info { @@ -90,19 +191,14 @@ extern bool range_includes_zero_p (const value_range *); extern bool infer_value_range (gimple *, tree, tree_code *, tree *); extern void set_value_range_to_nonnull (value_range *, tree); -extern void set_value_range (value_range *, enum value_range_type, tree, +extern void set_value_range (value_range *, enum value_range_kind, tree, tree, bitmap); -extern void set_and_canonicalize_value_range (value_range *, - enum value_range_type, - tree, tree, bitmap); extern bool vrp_bitmap_equal_p (const_bitmap, const_bitmap); extern tree value_range_constant_singleton (const value_range *); -extern bool symbolic_range_p (const value_range *); extern int compare_values (tree, tree); extern int compare_values_warnv (tree, tree, bool *); extern bool vrp_val_is_min (const_tree); extern bool vrp_val_is_max (const_tree); -extern void copy_value_range (value_range *, const value_range *); extern void set_value_range_to_value (value_range *, tree, bitmap); extern void extract_range_from_binary_expr_1 (value_range *, enum tree_code, tree, const value_range *, @@ -121,5 +217,5 @@ extern bool range_int_cst_singleton_p (const value_range *); extern int value_inside_range (tree, tree, tree); extern tree get_single_symbol (tree, bool *, tree *); extern void maybe_set_nonzero_bits (edge, tree); -extern value_range_type determine_value_range (tree, wide_int *, wide_int *); +extern value_range_kind determine_value_range (tree, wide_int *, wide_int *); #endif /* GCC_TREE_VRP_H */ |