Commit 89759031 by Jeff Law Committed by Jeff Law

vr-values.h: New file with vr_values class.

	* vr-values.h: New file with vr_values class.
	* tree-vrp.c: Include vr-values.h
	(vrp_value_range_pool, vrp_equiv_obstack, num_vr_values): Move static
	data objects into the vr_values class.
	(vr_value, values_propagated, vr_phi_edge_counts): Likewise.
	(get_value_range): Make it a member function within vr_values class.
	(set_defs_to_varying, update_value_range, add_equivalence): Likewise.
	(vrp_stmt_computes_nonzero_p, op_with_boolean_value_range_p): Likewise.
	(op_with_constant_singleton_value_range): Likewise.
	(extract_range_for_var_from_comparison_expr): Likewise.
	(extract_range_from_assert, extract_range_from_ssa_name): Likewise.
	(extract_range_from_binary_expr): Likewise.
	(extract_range_from_unary_expr): Likewise.
	(extract_range_from_cond_expr, extrat_range_from_comparison): Likewise.
	(check_for_binary_op_overflow, extract_range_basic): Likewise.
	(extract_range_from_assignment, adjust_range_with_scev): Likewise.
	(dump_all_value_ranges, get_vr_for_comparison): Likewise.
	(compare_name_with_value, compare_names): Likewise.
	(vrp_evaluate_conditional_warnv_with_ops_using_ranges): Likewise.
	(vrp_evaluate_conditional_warnv_with_ops): Likewise.  Remove prototype.
	(vrp_evaluate_conditional, vrp_visit_cond_stmt): Likewise.
	(vrp_visit_switch_stmt, extract_range_from_stmt): Likewise.
	(extract_range_from_phi_node): Likewise.
	(simplify_truth_ops_using_ranges): Likewise.
	(simplify_div_or_mod_using_ranges): Likewise.
	(simplify_min_or_max_using_ranges, simplify_abs_using_ranges): Likewise.
	(simplify_bit_ops_using_ranges, simplify_cond_using_ranges_1): Likewise.
	(simplify_cond_using_ranges_2, simplify_switch_using_ranges): Likewise.
	(simplify_float_conversion_using_ranges): Likewise.
	(simplify_internal_call_using_ranges): Likewise.
	(two_valued_val_range_p, simplify_stmt_using_ranges): Likewise.
	(vrp_visit_assignment_or_call): Likewise.  Smuggle class instance
	poitner via x_vr_values for calls into gimple folder.
	(vrp_initialize_lattice): Make this the vr_values ctor.
	(vrp_free_lattice): Make this the vr_values dtor.
	(set_vr_value): New function.
	(class vrp_prop): Add vr_values data member.  Add various member
	functions as well as member functions that delegate to vr_values.
	(check_array_ref): Make a member function within vrp_prop class.
	(search_for_addr_array, vrp_initialize): Likewise.
	(vrp_finalize): Likewise.  Revamp to avoid direct access to
	vr_value, values_propagated, etc.
	(check_array_bounds): Extract vrp_prop class instance pointer from
	walk info structure.  Use it to call member functions.
	(check_all_array_refs): Make a member function within vrp_prop class.
	Smuggle class instance pointer via walk info structure.
	(x_vr_values): New local static.
	(vrp_valueize): Use x_vr_values to get class instance.
	(vr_valueize_1): Likewise.
	(class vrp_folder): Add vr_values data member.  Add various member
	functions as well as member functions that delegate to vr_values.
	(fold_predicate_in): Make a mber fucntion within vrp_folder class.
	(simplify_stmt_for_jump_threading): Extract smuggled vr_values
	class instance from vr_values.  Use it to call member functions.
	(vrp_dom_walker): Add vr_values data member.
	(vrp_dom_walker::after_dom_children): Smuggle vr_values class
	instance via x_vr_values.
	(identify_jump_threads): Accept vr_values as argument.  Store
	it into the walker structure.
	(evrp_dom_walker): Add vr_values class data member.  Add various
	delegators.
	(evrp_dom_walker::try_find_new_range): Use vr_values data
	member to access the memory allocator.
	(evrp_dom_walker::before_dom_children): Store vr_values class
	instance into the vrp_folder class.
	(evrp_dom_walker::push_value_range): Rework to avoid direct
	access to num_vr_values and vr_value.
	(evrp_dom_walker::pop_value_range): Likewise.
	(execute_early_vrp): Remove call to vrp_initialize_lattice.
	Use vr_values to get to dump_all_value_ranges member function.
	Remove call to vrp_free_lattice.  Call vrp_initialize, vrp_finalize,
	and simplify_cond_using_ranges_2 via vrp_prop class instance.
	Pass vr_values class instance down to identify_jump_threads.
	Remove call to vrp_free_lattice.
	(debug_all_value_ranges): Remove.

From-SVN: r254613
parent f2a7f77b
2017-11-09 Jeff Law <law@redhat.com>
* vr-values.h: New file with vr_values class.
* tree-vrp.c: Include vr-values.h
(vrp_value_range_pool, vrp_equiv_obstack, num_vr_values): Move static
data objects into the vr_values class.
(vr_value, values_propagated, vr_phi_edge_counts): Likewise.
(get_value_range): Make it a member function within vr_values class.
(set_defs_to_varying, update_value_range, add_equivalence): Likewise.
(vrp_stmt_computes_nonzero_p, op_with_boolean_value_range_p): Likewise.
(op_with_constant_singleton_value_range): Likewise.
(extract_range_for_var_from_comparison_expr): Likewise.
(extract_range_from_assert, extract_range_from_ssa_name): Likewise.
(extract_range_from_binary_expr): Likewise.
(extract_range_from_unary_expr): Likewise.
(extract_range_from_cond_expr, extrat_range_from_comparison): Likewise.
(check_for_binary_op_overflow, extract_range_basic): Likewise.
(extract_range_from_assignment, adjust_range_with_scev): Likewise.
(dump_all_value_ranges, get_vr_for_comparison): Likewise.
(compare_name_with_value, compare_names): Likewise.
(vrp_evaluate_conditional_warnv_with_ops_using_ranges): Likewise.
(vrp_evaluate_conditional_warnv_with_ops): Likewise. Remove prototype.
(vrp_evaluate_conditional, vrp_visit_cond_stmt): Likewise.
(vrp_visit_switch_stmt, extract_range_from_stmt): Likewise.
(extract_range_from_phi_node): Likewise.
(simplify_truth_ops_using_ranges): Likewise.
(simplify_div_or_mod_using_ranges): Likewise.
(simplify_min_or_max_using_ranges, simplify_abs_using_ranges): Likewise.
(simplify_bit_ops_using_ranges, simplify_cond_using_ranges_1): Likewise.
(simplify_cond_using_ranges_2, simplify_switch_using_ranges): Likewise.
(simplify_float_conversion_using_ranges): Likewise.
(simplify_internal_call_using_ranges): Likewise.
(two_valued_val_range_p, simplify_stmt_using_ranges): Likewise.
(vrp_visit_assignment_or_call): Likewise. Smuggle class instance
poitner via x_vr_values for calls into gimple folder.
(vrp_initialize_lattice): Make this the vr_values ctor.
(vrp_free_lattice): Make this the vr_values dtor.
(set_vr_value): New function.
(class vrp_prop): Add vr_values data member. Add various member
functions as well as member functions that delegate to vr_values.
(check_array_ref): Make a member function within vrp_prop class.
(search_for_addr_array, vrp_initialize): Likewise.
(vrp_finalize): Likewise. Revamp to avoid direct access to
vr_value, values_propagated, etc.
(check_array_bounds): Extract vrp_prop class instance pointer from
walk info structure. Use it to call member functions.
(check_all_array_refs): Make a member function within vrp_prop class.
Smuggle class instance pointer via walk info structure.
(x_vr_values): New local static.
(vrp_valueize): Use x_vr_values to get class instance.
(vr_valueize_1): Likewise.
(class vrp_folder): Add vr_values data member. Add various member
functions as well as member functions that delegate to vr_values.
(fold_predicate_in): Make a mber fucntion within vrp_folder class.
(simplify_stmt_for_jump_threading): Extract smuggled vr_values
class instance from vr_values. Use it to call member functions.
(vrp_dom_walker): Add vr_values data member.
(vrp_dom_walker::after_dom_children): Smuggle vr_values class
instance via x_vr_values.
(identify_jump_threads): Accept vr_values as argument. Store
it into the walker structure.
(evrp_dom_walker): Add vr_values class data member. Add various
delegators.
(evrp_dom_walker::try_find_new_range): Use vr_values data
member to access the memory allocator.
(evrp_dom_walker::before_dom_children): Store vr_values class
instance into the vrp_folder class.
(evrp_dom_walker::push_value_range): Rework to avoid direct
access to num_vr_values and vr_value.
(evrp_dom_walker::pop_value_range): Likewise.
(execute_early_vrp): Remove call to vrp_initialize_lattice.
Use vr_values to get to dump_all_value_ranges member function.
Remove call to vrp_free_lattice. Call vrp_initialize, vrp_finalize,
and simplify_cond_using_ranges_2 via vrp_prop class instance.
Pass vr_values class instance down to identify_jump_threads.
Remove call to vrp_free_lattice.
(debug_all_value_ranges): Remove.
* tree-vrp.c (vrp_prop): Move class to earlier point in the file.
(vrp_folder): Likewise.
/* Support routines for Value Range Propagation (VRP).
Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_VR_VALUES_H
#define GCC_VR_VALUES_H
/* The VR_VALUES class holds the current view of range information
for all the SSA_NAMEs in the IL.
It can be used to hold context sensitive range information during
a dominator walk or it may be used to hold range information in the
standard VRP pass as ranges are propagated through the lattice to a
steady state.
This information is independent of the range information that gets
attached to SSA_NAMEs. A pass such as VRP may choose to transfer
the global information it produces into global range information that
gets attached to an SSA_NAME. It's unclear how useful that global
information will be in a world where we can compute context sensitive
range information fast or perform on-demand queries. */
class vr_values
{
public:
vr_values (void);
~vr_values (void);
/* Value range array. After propagation, VR_VALUE[I] holds the range
of values that SSA name N_I may take. */
unsigned int num_vr_values;
value_range **vr_value;
bool values_propagated;
/* For a PHI node which sets SSA name N_I, VR_COUNTS[I] holds the
number of executable edges we saw the last time we visited the
node. */
int *vr_phi_edge_counts;
/* Allocation pools for tree-vrp allocations. */
object_allocator<value_range> vrp_value_range_pool;
bitmap_obstack vrp_equiv_obstack;
value_range *get_value_range (const_tree);
void set_vr_value (tree, value_range *);
void set_defs_to_varying (gimple *);
bool update_value_range (const_tree, value_range *);
void add_equivalence (bitmap *, const_tree);
bool vrp_stmt_computes_nonzero (gimple *);
tree op_with_constant_singleton_value_range (tree);
bool op_with_boolean_value_range_p (tree);
bool check_for_binary_op_overflow (enum tree_code, tree, tree, tree, bool *);
void adjust_range_with_scev (value_range *, struct loop *, gimple *, tree);
value_range get_vr_for_comparison (int);
tree compare_name_with_value (enum tree_code, tree, tree, bool *, bool);
tree compare_names (enum tree_code, tree, tree, bool *);
bool two_valued_val_range_p (tree, tree *, tree *);
tree vrp_evaluate_conditional_warnv_with_ops_using_ranges (enum tree_code,
tree, tree,
bool *);
tree vrp_evaluate_conditional_warnv_with_ops (enum tree_code,
tree, tree, bool,
bool *, bool *);
tree vrp_evaluate_conditional (tree_code, tree, tree, gimple *);
void dump_all_value_ranges (FILE *);
void extract_range_for_var_from_comparison_expr (tree, enum tree_code,
tree, tree, value_range *);
void extract_range_from_assert (value_range *, tree);
void extract_range_from_ssa_name (value_range *, tree);
void extract_range_from_binary_expr (value_range *, enum tree_code,
tree, tree, tree);
void extract_range_from_unary_expr (value_range *, enum tree_code,
tree, tree);
void extract_range_from_phi_node (gphi *, value_range *);
void extract_range_from_cond_expr (value_range *, gassign *);
void extract_range_basic (value_range *, gimple *);
void extract_range_from_assignment (value_range *, gassign *);
void extract_range_from_stmt (gimple *, edge *, tree *, value_range *);
void extract_range_from_comparison (value_range *, enum tree_code,
tree, tree, tree);
void vrp_visit_assignment_or_call (gimple*, tree *, value_range *);
void vrp_visit_switch_stmt (gswitch *, edge *);
void vrp_visit_cond_stmt (gcond *, edge *);
bool simplify_truth_ops_using_ranges (gimple_stmt_iterator *, gimple *);
bool simplify_div_or_mod_using_ranges (gimple_stmt_iterator *, gimple *);
bool simplify_abs_using_ranges (gimple_stmt_iterator *, gimple *);
bool simplify_bit_ops_using_ranges (gimple_stmt_iterator *, gimple *);
bool simplify_min_or_max_using_ranges (gimple_stmt_iterator *, gimple *);
bool simplify_cond_using_ranges_1 (gcond *);
void simplify_cond_using_ranges_2 (gcond *);
bool simplify_switch_using_ranges (gswitch *);
bool simplify_float_conversion_using_ranges (gimple_stmt_iterator *,
gimple *);
bool simplify_internal_call_using_ranges (gimple_stmt_iterator *, gimple *);
bool simplify_stmt_using_ranges (gimple_stmt_iterator *);
};
#endif /* GCC_VR_VALUES_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment