aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-sprintf.c
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2018-10-17 15:59:25 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2018-10-17 15:59:25 +0000
commit54994253d3fc00bcb7d3e9359ff31a81c0e4543a (patch)
tree416281f18a0c359b4d87a5aeac398be374184fb6 /gcc/gimple-ssa-sprintf.c
parent033eb5671769a4c681a44aad08a454e667e08502 (diff)
downloadgcc-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/gimple-ssa-sprintf.c')
-rw-r--r--gcc/gimple-ssa-sprintf.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index 471bfc4..90f028d 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -1052,9 +1052,7 @@ get_int_range (tree arg, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax,
{
/* Try to determine the range of values of the integer argument. */
value_range *vr = vr_values->get_value_range (arg);
- if (vr->type == VR_RANGE
- && TREE_CODE (vr->min) == INTEGER_CST
- && TREE_CODE (vr->max) == INTEGER_CST)
+ if (range_int_cst_p (vr))
{
HOST_WIDE_INT type_min
= (TYPE_UNSIGNED (argtype)
@@ -1063,8 +1061,8 @@ get_int_range (tree arg, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax,
HOST_WIDE_INT type_max = tree_to_uhwi (TYPE_MAX_VALUE (argtype));
- *pmin = TREE_INT_CST_LOW (vr->min);
- *pmax = TREE_INT_CST_LOW (vr->max);
+ *pmin = TREE_INT_CST_LOW (vr->min ());
+ *pmax = TREE_INT_CST_LOW (vr->max ());
if (*pmin < *pmax)
{
@@ -1354,12 +1352,10 @@ format_integer (const directive &dir, tree arg, vr_values *vr_values)
/* Try to determine the range of values of the integer argument
(range information is not available for pointers). */
value_range *vr = vr_values->get_value_range (arg);
- if (vr->type == VR_RANGE
- && TREE_CODE (vr->min) == INTEGER_CST
- && TREE_CODE (vr->max) == INTEGER_CST)
+ if (range_int_cst_p (vr))
{
- argmin = vr->min;
- argmax = vr->max;
+ argmin = vr->min ();
+ argmax = vr->max ();
/* Set KNOWNRANGE if the argument is in a known subrange
of the directive's type and neither width nor precision
@@ -1372,12 +1368,11 @@ format_integer (const directive &dir, tree arg, vr_values *vr_values)
res.argmin = argmin;
res.argmax = argmax;
}
- else if (vr->type == VR_ANTI_RANGE)
+ else if (vr->kind () == VR_ANTI_RANGE)
{
/* Handle anti-ranges if/when bug 71690 is resolved. */
}
- else if (vr->type == VR_VARYING
- || vr->type == VR_UNDEFINED)
+ else if (vr->varying_p () || vr->undefined_p ())
{
/* The argument here may be the result of promoting the actual
argument to int. Try to determine the type of the actual
@@ -3903,12 +3898,10 @@ sprintf_dom_walker::handle_gimple_call (gimple_stmt_iterator *gsi)
and use the greater of the two at level 1 and the smaller
of them at level 2. */
value_range *vr = evrp_range_analyzer.get_value_range (size);
- if (vr->type == VR_RANGE
- && TREE_CODE (vr->min) == INTEGER_CST
- && TREE_CODE (vr->max) == INTEGER_CST)
+ if (range_int_cst_p (vr))
dstsize = (warn_level < 2
- ? TREE_INT_CST_LOW (vr->max)
- : TREE_INT_CST_LOW (vr->min));
+ ? TREE_INT_CST_LOW (vr->max ())
+ : TREE_INT_CST_LOW (vr->min ()));
/* The destination size is not constant. If the function is
bounded (e.g., snprintf) a lower bound of zero doesn't