Commit 028d81b1 by Aldy Hernandez Committed by Aldy Hernandez

The base class for ranges is currently value_range_base, which is rather long and cumbersome.

The base class for ranges is currently value_range_base, which is
rather long and cumbersome.  It also occurs more often than the derived
class of value_range.  To avoid confusion, and save typing, this
patch does a global rename from value_range to value_range_equiv,
and from value_range_base to value_range.

This way, the base class is simply value_range, and the derived
class is value_range_equiv which explicitly states what it does.

From-SVN: r277847
parent 3619076a
2019-11-05 Aldy Hernandez <aldyh@redhat.com>
* gimple-fold.c, gimple-loop-versioning.cc,
gimple-ssa-evrp-analyze.[ch], gimple-ssa-evrp.c,
gimple-ssa-sprintf.c, ipa-cp.c, ipa-prop.c, ipa-prop.h,
range-op.[hc]*, range.[hc]*, selftest.h, tree-ssa-dom.c,
tree-ssa-strlen.c, tree-ssa-threadedge.c, tree-ssanames.[hc],
tree-vrp.[hc], vr-values.[hc]: Global rename of value_range to
value_range_equiv, and value_range_base to value_range.
2019-11-05 Matthew Malcomson <matthew.malcomson@arm.com> 2019-11-05 Matthew Malcomson <matthew.malcomson@arm.com>
* expr.c (build_personality_function): Fix generated type to * expr.c (build_personality_function): Fix generated type to
...@@ -677,10 +677,10 @@ size_must_be_zero_p (tree size) ...@@ -677,10 +677,10 @@ size_must_be_zero_p (tree size)
/* Compute the value of SSIZE_MAX, the largest positive value that /* Compute the value of SSIZE_MAX, the largest positive value that
can be stored in ssize_t, the signed counterpart of size_t. */ can be stored in ssize_t, the signed counterpart of size_t. */
wide_int ssize_max = wi::lshift (wi::one (prec), prec - 1) - 1; wide_int ssize_max = wi::lshift (wi::one (prec), prec - 1) - 1;
value_range_base valid_range (VR_RANGE, value_range valid_range (VR_RANGE,
build_int_cst (type, 0), build_int_cst (type, 0),
wide_int_to_tree (type, ssize_max)); wide_int_to_tree (type, ssize_max));
value_range_base vr; value_range vr;
get_range_info (size, vr); get_range_info (size, vr);
vr.intersect (&valid_range); vr.intersect (&valid_range);
return vr.zero_p (); return vr.zero_p ();
......
...@@ -1495,7 +1495,7 @@ loop_versioning::prune_loop_conditions (class loop *loop, vr_values *vrs) ...@@ -1495,7 +1495,7 @@ loop_versioning::prune_loop_conditions (class loop *loop, vr_values *vrs)
EXECUTE_IF_SET_IN_BITMAP (&li.unity_names, 0, i, bi) EXECUTE_IF_SET_IN_BITMAP (&li.unity_names, 0, i, bi)
{ {
tree name = ssa_name (i); tree name = ssa_name (i);
const value_range *vr = vrs->get_value_range (name); const value_range_equiv *vr = vrs->get_value_range (name);
if (vr && !vr->may_contain_p (build_one_cst (TREE_TYPE (name)))) if (vr && !vr->may_contain_p (build_one_cst (TREE_TYPE (name))))
{ {
if (dump_enabled_p ()) if (dump_enabled_p ())
......
...@@ -62,7 +62,7 @@ evrp_range_analyzer::evrp_range_analyzer (bool update_global_ranges) ...@@ -62,7 +62,7 @@ evrp_range_analyzer::evrp_range_analyzer (bool update_global_ranges)
void void
evrp_range_analyzer::push_marker () evrp_range_analyzer::push_marker ()
{ {
stack.safe_push (std::make_pair (NULL_TREE, (value_range *)NULL)); stack.safe_push (std::make_pair (NULL_TREE, (value_range_equiv *)NULL));
} }
/* Analyze ranges as we enter basic block BB. */ /* Analyze ranges as we enter basic block BB. */
...@@ -79,12 +79,12 @@ evrp_range_analyzer::enter (basic_block bb) ...@@ -79,12 +79,12 @@ evrp_range_analyzer::enter (basic_block bb)
} }
/* Find new range for NAME such that (OP CODE LIMIT) is true. */ /* Find new range for NAME such that (OP CODE LIMIT) is true. */
value_range * value_range_equiv *
evrp_range_analyzer::try_find_new_range (tree name, evrp_range_analyzer::try_find_new_range (tree name,
tree op, tree_code code, tree limit) tree op, tree_code code, tree limit)
{ {
value_range vr; value_range_equiv vr;
const value_range *old_vr = get_value_range (name); const value_range_equiv *old_vr = get_value_range (name);
/* Discover VR when condition is true. */ /* Discover VR when condition is true. */
vr_values->extract_range_for_var_from_comparison_expr (name, code, op, vr_values->extract_range_for_var_from_comparison_expr (name, code, op,
...@@ -93,11 +93,9 @@ evrp_range_analyzer::try_find_new_range (tree name, ...@@ -93,11 +93,9 @@ evrp_range_analyzer::try_find_new_range (tree name,
PUSH old value in the stack with the old VR. */ PUSH old value in the stack with the old VR. */
if (!vr.undefined_p () && !vr.varying_p ()) if (!vr.undefined_p () && !vr.varying_p ())
{ {
if (old_vr->kind () == vr.kind () if (old_vr->equal_p (vr, /*ignore_equivs=*/true))
&& vrp_operand_equal_p (old_vr->min (), vr.min ())
&& vrp_operand_equal_p (old_vr->max (), vr.max ()))
return NULL; return NULL;
value_range *new_vr = vr_values->allocate_value_range (); value_range_equiv *new_vr = vr_values->allocate_value_range_equiv ();
new_vr->move (&vr); new_vr->move (&vr);
return new_vr; return new_vr;
} }
...@@ -106,7 +104,7 @@ evrp_range_analyzer::try_find_new_range (tree name, ...@@ -106,7 +104,7 @@ evrp_range_analyzer::try_find_new_range (tree name,
/* For LHS record VR in the SSA info. */ /* For LHS record VR in the SSA info. */
void void
evrp_range_analyzer::set_ssa_range_info (tree lhs, value_range *vr) evrp_range_analyzer::set_ssa_range_info (tree lhs, value_range_equiv *vr)
{ {
gcc_assert (m_update_global_ranges); gcc_assert (m_update_global_ranges);
...@@ -187,13 +185,14 @@ evrp_range_analyzer::record_ranges_from_incoming_edge (basic_block bb) ...@@ -187,13 +185,14 @@ evrp_range_analyzer::record_ranges_from_incoming_edge (basic_block bb)
if (TREE_CODE (op1) == SSA_NAME) if (TREE_CODE (op1) == SSA_NAME)
register_edge_assert_for (op1, pred_e, code, op0, op1, asserts); register_edge_assert_for (op1, pred_e, code, op0, op1, asserts);
auto_vec<std::pair<tree, value_range *>, 8> vrs; auto_vec<std::pair<tree, value_range_equiv *>, 8> vrs;
for (unsigned i = 0; i < asserts.length (); ++i) for (unsigned i = 0; i < asserts.length (); ++i)
{ {
value_range *vr = try_find_new_range (asserts[i].name, value_range_equiv *vr
asserts[i].expr, = try_find_new_range (asserts[i].name,
asserts[i].comp_code, asserts[i].expr,
asserts[i].val); asserts[i].comp_code,
asserts[i].val);
if (vr) if (vr)
vrs.safe_push (std::make_pair (asserts[i].name, vr)); vrs.safe_push (std::make_pair (asserts[i].name, vr));
} }
...@@ -209,9 +208,9 @@ evrp_range_analyzer::record_ranges_from_incoming_edge (basic_block bb) ...@@ -209,9 +208,9 @@ evrp_range_analyzer::record_ranges_from_incoming_edge (basic_block bb)
/* But make sure we do not weaken ranges like when /* But make sure we do not weaken ranges like when
getting first [64, +INF] and then ~[0, 0] from getting first [64, +INF] and then ~[0, 0] from
conditions like (s & 0x3cc0) == 0). */ conditions like (s & 0x3cc0) == 0). */
const value_range *old_vr = get_value_range (vrs[i].first); const value_range_equiv *old_vr
value_range_base tem (old_vr->kind (), old_vr->min (), = get_value_range (vrs[i].first);
old_vr->max ()); value_range tem (*old_vr);
tem.intersect (vrs[i].second); tem.intersect (vrs[i].second);
if (tem.equal_p (*old_vr)) if (tem.equal_p (*old_vr))
{ {
...@@ -256,10 +255,10 @@ evrp_range_analyzer::record_ranges_from_phis (basic_block bb) ...@@ -256,10 +255,10 @@ evrp_range_analyzer::record_ranges_from_phis (basic_block bb)
/* Skips floats and other things we can't represent in a /* Skips floats and other things we can't represent in a
range. */ range. */
if (!value_range_base::supports_type_p (TREE_TYPE (lhs))) if (!value_range::supports_type_p (TREE_TYPE (lhs)))
continue; continue;
value_range vr_result; value_range_equiv vr_result;
bool interesting = stmt_interesting_for_vrp (phi); bool interesting = stmt_interesting_for_vrp (phi);
if (!has_unvisited_preds && interesting) if (!has_unvisited_preds && interesting)
vr_values->extract_range_from_phi_node (phi, &vr_result); vr_values->extract_range_from_phi_node (phi, &vr_result);
...@@ -303,7 +302,7 @@ evrp_range_analyzer::record_ranges_from_stmt (gimple *stmt, bool temporary) ...@@ -303,7 +302,7 @@ evrp_range_analyzer::record_ranges_from_stmt (gimple *stmt, bool temporary)
else if (stmt_interesting_for_vrp (stmt)) else if (stmt_interesting_for_vrp (stmt))
{ {
edge taken_edge; edge taken_edge;
value_range vr; value_range_equiv vr;
vr_values->extract_range_from_stmt (stmt, &taken_edge, &output, &vr); vr_values->extract_range_from_stmt (stmt, &taken_edge, &output, &vr);
if (output) if (output)
{ {
...@@ -333,7 +332,8 @@ evrp_range_analyzer::record_ranges_from_stmt (gimple *stmt, bool temporary) ...@@ -333,7 +332,8 @@ evrp_range_analyzer::record_ranges_from_stmt (gimple *stmt, bool temporary)
a new range and push the old range onto the stack. We a new range and push the old range onto the stack. We
also have to be very careful about sharing the underlying also have to be very careful about sharing the underlying
bitmaps. Ugh. */ bitmaps. Ugh. */
value_range *new_vr = vr_values->allocate_value_range (); value_range_equiv *new_vr
= vr_values->allocate_value_range_equiv ();
new_vr->set (vr.kind (), vr.min (), vr.max ()); new_vr->set (vr.kind (), vr.min (), vr.max ());
vr.equiv_clear (); vr.equiv_clear ();
push_value_range (output, new_vr); push_value_range (output, new_vr);
...@@ -379,15 +379,15 @@ evrp_range_analyzer::record_ranges_from_stmt (gimple *stmt, bool temporary) ...@@ -379,15 +379,15 @@ evrp_range_analyzer::record_ranges_from_stmt (gimple *stmt, bool temporary)
/* Add VR when (T COMP_CODE value) condition is /* Add VR when (T COMP_CODE value) condition is
true. */ true. */
value_range *op_range value_range_equiv *op_range
= try_find_new_range (t, t, comp_code, value); = try_find_new_range (t, t, comp_code, value);
if (op_range) if (op_range)
push_value_range (t, op_range); push_value_range (t, op_range);
} }
} }
/* Add VR when (OP COMP_CODE value) condition is true. */ /* Add VR when (OP COMP_CODE value) condition is true. */
value_range *op_range = try_find_new_range (op, op, value_range_equiv *op_range = try_find_new_range (op, op,
comp_code, value); comp_code, value);
if (op_range) if (op_range)
push_value_range (op, op_range); push_value_range (op, op_range);
} }
...@@ -419,7 +419,7 @@ evrp_range_analyzer::leave (basic_block bb ATTRIBUTE_UNUSED) ...@@ -419,7 +419,7 @@ evrp_range_analyzer::leave (basic_block bb ATTRIBUTE_UNUSED)
/* Push the Value Range of VAR to the stack and update it with new VR. */ /* Push the Value Range of VAR to the stack and update it with new VR. */
void void
evrp_range_analyzer::push_value_range (tree var, value_range *vr) evrp_range_analyzer::push_value_range (tree var, value_range_equiv *vr)
{ {
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
...@@ -429,7 +429,7 @@ evrp_range_analyzer::push_value_range (tree var, value_range *vr) ...@@ -429,7 +429,7 @@ evrp_range_analyzer::push_value_range (tree var, value_range *vr)
dump_value_range (dump_file, vr); dump_value_range (dump_file, vr);
fprintf (dump_file, "\n"); fprintf (dump_file, "\n");
} }
value_range *old_vr = vr_values->swap_vr_value (var, vr); value_range_equiv *old_vr = vr_values->swap_vr_value (var, vr);
stack.safe_push (std::make_pair (var, old_vr)); stack.safe_push (std::make_pair (var, old_vr));
} }
...@@ -438,9 +438,9 @@ evrp_range_analyzer::push_value_range (tree var, value_range *vr) ...@@ -438,9 +438,9 @@ evrp_range_analyzer::push_value_range (tree var, value_range *vr)
void void
evrp_range_analyzer::pop_value_range () evrp_range_analyzer::pop_value_range ()
{ {
std::pair<tree, value_range *> e = stack.pop (); std::pair<tree, value_range_equiv *> e = stack.pop ();
tree var = e.first; tree var = e.first;
value_range *vr = e.second; value_range_equiv *vr = e.second;
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
fprintf (dump_file, "popping range for "); fprintf (dump_file, "popping range for ");
...@@ -451,7 +451,7 @@ evrp_range_analyzer::pop_value_range () ...@@ -451,7 +451,7 @@ evrp_range_analyzer::pop_value_range ()
} }
/* We saved off a lattice entry, now give it back and release /* We saved off a lattice entry, now give it back and release
the one we popped. */ the one we popped. */
value_range *popped_vr = vr_values->swap_vr_value (var, vr); value_range_equiv *popped_vr = vr_values->swap_vr_value (var, vr);
if (popped_vr) if (popped_vr)
vr_values->free_value_range (popped_vr); vr_values->free_value_range (popped_vr);
} }
...@@ -37,11 +37,11 @@ class evrp_range_analyzer ...@@ -37,11 +37,11 @@ class evrp_range_analyzer
void record_ranges_from_stmt (gimple *, bool); void record_ranges_from_stmt (gimple *, bool);
/* Main interface to retrieve range information. */ /* Main interface to retrieve range information. */
const value_range *get_value_range (const_tree op) const value_range_equiv *get_value_range (const_tree op)
{ return vr_values->get_value_range (op); } { return vr_values->get_value_range (op); }
/* Record a new unwindable range. */ /* Record a new unwindable range. */
void push_value_range (tree var, value_range *vr); void push_value_range (tree var, value_range_equiv *vr);
/* Dump all the current value ranges. This is primarily /* Dump all the current value ranges. This is primarily
a debugging interface. */ a debugging interface. */
...@@ -63,13 +63,14 @@ class evrp_range_analyzer ...@@ -63,13 +63,14 @@ class evrp_range_analyzer
class vr_values *vr_values; class vr_values *vr_values;
void pop_value_range (); void pop_value_range ();
value_range *try_find_new_range (tree, tree op, tree_code code, tree limit); value_range_equiv *try_find_new_range (tree, tree op, tree_code code,
tree limit);
void record_ranges_from_incoming_edge (basic_block); void record_ranges_from_incoming_edge (basic_block);
void record_ranges_from_phis (basic_block); void record_ranges_from_phis (basic_block);
void set_ssa_range_info (tree, value_range *); void set_ssa_range_info (tree, value_range_equiv *);
/* STACK holds the old VR. */ /* STACK holds the old VR. */
auto_vec<std::pair <tree, value_range *> > stack; auto_vec<std::pair <tree, value_range_equiv *> > stack;
/* True if we are updating global ranges, false otherwise. */ /* True if we are updating global ranges, false otherwise. */
bool m_update_global_ranges; bool m_update_global_ranges;
......
...@@ -109,7 +109,7 @@ evrp_dom_walker::before_dom_children (basic_block bb) ...@@ -109,7 +109,7 @@ evrp_dom_walker::before_dom_children (basic_block bb)
if (virtual_operand_p (lhs)) if (virtual_operand_p (lhs))
continue; continue;
const value_range *vr = evrp_range_analyzer.get_value_range (lhs); const value_range_equiv *vr = evrp_range_analyzer.get_value_range (lhs);
/* Mark PHIs whose lhs we fully propagate for removal. */ /* Mark PHIs whose lhs we fully propagate for removal. */
tree val; tree val;
if (vr->singleton_p (&val) && may_propagate_copy (lhs, val)) if (vr->singleton_p (&val) && may_propagate_copy (lhs, val))
...@@ -158,11 +158,11 @@ evrp_dom_walker::before_dom_children (basic_block bb) ...@@ -158,11 +158,11 @@ evrp_dom_walker::before_dom_children (basic_block bb)
output = get_output_for_vrp (stmt); output = get_output_for_vrp (stmt);
if (output) if (output)
{ {
tree val; const value_range_equiv *vr
const value_range *vr
= evrp_range_analyzer.get_value_range (output); = evrp_range_analyzer.get_value_range (output);
/* Mark stmts whose output we fully propagate for removal. */ /* Mark stmts whose output we fully propagate for removal. */
tree val;
if (vr->singleton_p (&val) if (vr->singleton_p (&val)
&& may_propagate_copy (output, val) && may_propagate_copy (output, val)
&& !stmt_could_throw_p (cfun, stmt) && !stmt_could_throw_p (cfun, stmt)
...@@ -244,7 +244,8 @@ evrp_dom_walker::before_dom_children (basic_block bb) ...@@ -244,7 +244,8 @@ evrp_dom_walker::before_dom_children (basic_block bb)
if (TREE_CODE (arg) != SSA_NAME if (TREE_CODE (arg) != SSA_NAME
|| virtual_operand_p (arg)) || virtual_operand_p (arg))
continue; continue;
const value_range *vr = evrp_range_analyzer.get_value_range (arg); const value_range_equiv
*vr = evrp_range_analyzer.get_value_range (arg);
tree val; tree val;
if (vr->singleton_p (&val) && may_propagate_copy (arg, val)) if (vr->singleton_p (&val) && may_propagate_copy (arg, val))
propagate_value (use_p, val); propagate_value (use_p, val);
......
...@@ -1021,7 +1021,7 @@ get_int_range (tree arg, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax, ...@@ -1021,7 +1021,7 @@ get_int_range (tree arg, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax,
&& TYPE_PRECISION (argtype) <= TYPE_PRECISION (type)) && TYPE_PRECISION (argtype) <= TYPE_PRECISION (type))
{ {
/* Try to determine the range of values of the integer argument. */ /* Try to determine the range of values of the integer argument. */
const value_range *vr const value_range_equiv *vr
= CONST_CAST (class vr_values *, vr_values)->get_value_range (arg); = CONST_CAST (class vr_values *, vr_values)->get_value_range (arg);
if (range_int_cst_p (vr)) if (range_int_cst_p (vr))
...@@ -1323,7 +1323,7 @@ format_integer (const directive &dir, tree arg, const vr_values *vr_values) ...@@ -1323,7 +1323,7 @@ format_integer (const directive &dir, tree arg, const vr_values *vr_values)
{ {
/* Try to determine the range of values of the integer argument /* Try to determine the range of values of the integer argument
(range information is not available for pointers). */ (range information is not available for pointers). */
const value_range *vr const value_range_equiv *vr
= CONST_CAST (class vr_values *, vr_values)->get_value_range (arg); = CONST_CAST (class vr_values *, vr_values)->get_value_range (arg);
if (range_int_cst_p (vr)) if (range_int_cst_p (vr))
...@@ -4087,7 +4087,7 @@ handle_printf_call (gimple_stmt_iterator *gsi, const vr_values *vr_values) ...@@ -4087,7 +4087,7 @@ handle_printf_call (gimple_stmt_iterator *gsi, const vr_values *vr_values)
/* Try to determine the range of values of the argument /* Try to determine the range of values of the argument
and use the greater of the two at level 1 and the smaller and use the greater of the two at level 1 and the smaller
of them at level 2. */ of them at level 2. */
const value_range *vr const value_range_equiv *vr
= CONST_CAST (class vr_values *, vr_values)->get_value_range (size); = CONST_CAST (class vr_values *, vr_values)->get_value_range (size);
if (range_int_cst_p (vr)) if (range_int_cst_p (vr))
......
...@@ -307,18 +307,18 @@ private: ...@@ -307,18 +307,18 @@ private:
class ipcp_vr_lattice class ipcp_vr_lattice
{ {
public: public:
value_range_base m_vr; value_range m_vr;
inline bool bottom_p () const; inline bool bottom_p () const;
inline bool top_p () const; inline bool top_p () const;
inline bool set_to_bottom (); inline bool set_to_bottom ();
bool meet_with (const value_range_base *p_vr); bool meet_with (const value_range *p_vr);
bool meet_with (const ipcp_vr_lattice &other); bool meet_with (const ipcp_vr_lattice &other);
void init () { gcc_assert (m_vr.undefined_p ()); } void init () { gcc_assert (m_vr.undefined_p ()); }
void print (FILE * f); void print (FILE * f);
private: private:
bool meet_with_1 (const value_range_base *other_vr); bool meet_with_1 (const value_range *other_vr);
}; };
/* Structure containing lattices for a parameter itself and for pieces of /* Structure containing lattices for a parameter itself and for pieces of
...@@ -930,7 +930,7 @@ ipcp_vr_lattice::meet_with (const ipcp_vr_lattice &other) ...@@ -930,7 +930,7 @@ ipcp_vr_lattice::meet_with (const ipcp_vr_lattice &other)
lattice. */ lattice. */
bool bool
ipcp_vr_lattice::meet_with (const value_range_base *p_vr) ipcp_vr_lattice::meet_with (const value_range *p_vr)
{ {
return meet_with_1 (p_vr); return meet_with_1 (p_vr);
} }
...@@ -939,7 +939,7 @@ ipcp_vr_lattice::meet_with (const value_range_base *p_vr) ...@@ -939,7 +939,7 @@ ipcp_vr_lattice::meet_with (const value_range_base *p_vr)
OTHER_VR lattice. Return TRUE if anything changed. */ OTHER_VR lattice. Return TRUE if anything changed. */
bool bool
ipcp_vr_lattice::meet_with_1 (const value_range_base *other_vr) ipcp_vr_lattice::meet_with_1 (const value_range *other_vr)
{ {
if (bottom_p ()) if (bottom_p ())
return false; return false;
...@@ -947,7 +947,7 @@ ipcp_vr_lattice::meet_with_1 (const value_range_base *other_vr) ...@@ -947,7 +947,7 @@ ipcp_vr_lattice::meet_with_1 (const value_range_base *other_vr)
if (other_vr->varying_p ()) if (other_vr->varying_p ())
return set_to_bottom (); return set_to_bottom ();
value_range_base save (m_vr); value_range save (m_vr);
m_vr.union_ (other_vr); m_vr.union_ (other_vr);
return !m_vr.equal_p (save); return !m_vr.equal_p (save);
} }
...@@ -1939,8 +1939,8 @@ propagate_bits_across_jump_function (cgraph_edge *cs, int idx, ...@@ -1939,8 +1939,8 @@ propagate_bits_across_jump_function (cgraph_edge *cs, int idx,
the result is a range or an anti-range. */ the result is a range or an anti-range. */
static bool static bool
ipa_vr_operation_and_type_effects (value_range_base *dst_vr, ipa_vr_operation_and_type_effects (value_range *dst_vr,
value_range_base *src_vr, value_range *src_vr,
enum tree_code operation, enum tree_code operation,
tree dst_type, tree src_type) tree dst_type, tree src_type)
{ {
...@@ -1983,7 +1983,7 @@ propagate_vr_across_jump_function (cgraph_edge *cs, ipa_jump_func *jfunc, ...@@ -1983,7 +1983,7 @@ propagate_vr_across_jump_function (cgraph_edge *cs, ipa_jump_func *jfunc,
if (src_lats->m_value_range.bottom_p ()) if (src_lats->m_value_range.bottom_p ())
return dest_lat->set_to_bottom (); return dest_lat->set_to_bottom ();
value_range_base vr; value_range vr;
if (ipa_vr_operation_and_type_effects (&vr, if (ipa_vr_operation_and_type_effects (&vr,
&src_lats->m_value_range.m_vr, &src_lats->m_value_range.m_vr,
operation, param_type, operation, param_type,
...@@ -2000,12 +2000,12 @@ propagate_vr_across_jump_function (cgraph_edge *cs, ipa_jump_func *jfunc, ...@@ -2000,12 +2000,12 @@ propagate_vr_across_jump_function (cgraph_edge *cs, ipa_jump_func *jfunc,
if (TREE_OVERFLOW_P (val)) if (TREE_OVERFLOW_P (val))
val = drop_tree_overflow (val); val = drop_tree_overflow (val);
value_range_base tmpvr (VR_RANGE, val, val); value_range tmpvr (VR_RANGE, val, val);
return dest_lat->meet_with (&tmpvr); return dest_lat->meet_with (&tmpvr);
} }
} }
value_range_base vr; value_range vr;
if (jfunc->m_vr if (jfunc->m_vr
&& ipa_vr_operation_and_type_effects (&vr, jfunc->m_vr, NOP_EXPR, && ipa_vr_operation_and_type_effects (&vr, jfunc->m_vr, NOP_EXPR,
param_type, param_type,
......
...@@ -107,12 +107,12 @@ static GTY ((cache)) hash_table<ipa_bit_ggc_hash_traits> *ipa_bits_hash_table; ...@@ -107,12 +107,12 @@ static GTY ((cache)) hash_table<ipa_bit_ggc_hash_traits> *ipa_bits_hash_table;
/* Traits for a hash table for reusing value_ranges used for IPA. Note that /* Traits for a hash table for reusing value_ranges used for IPA. Note that
the equiv bitmap is not hashed and is expected to be NULL. */ the equiv bitmap is not hashed and is expected to be NULL. */
struct ipa_vr_ggc_hash_traits : public ggc_cache_remove <value_range_base *> struct ipa_vr_ggc_hash_traits : public ggc_cache_remove <value_range *>
{ {
typedef value_range_base *value_type; typedef value_range *value_type;
typedef value_range_base *compare_type; typedef value_range *compare_type;
static hashval_t static hashval_t
hash (const value_range_base *p) hash (const value_range *p)
{ {
inchash::hash hstate (p->kind ()); inchash::hash hstate (p->kind ());
inchash::add_expr (p->min (), hstate); inchash::add_expr (p->min (), hstate);
...@@ -120,29 +120,29 @@ struct ipa_vr_ggc_hash_traits : public ggc_cache_remove <value_range_base *> ...@@ -120,29 +120,29 @@ struct ipa_vr_ggc_hash_traits : public ggc_cache_remove <value_range_base *>
return hstate.end (); return hstate.end ();
} }
static bool static bool
equal (const value_range_base *a, const value_range_base *b) equal (const value_range *a, const value_range *b)
{ {
return a->equal_p (*b); return a->equal_p (*b);
} }
static void static void
mark_empty (value_range_base *&p) mark_empty (value_range *&p)
{ {
p = NULL; p = NULL;
} }
static bool static bool
is_empty (const value_range_base *p) is_empty (const value_range *p)
{ {
return p == NULL; return p == NULL;
} }
static bool static bool
is_deleted (const value_range_base *p) is_deleted (const value_range *p)
{ {
return p == reinterpret_cast<const value_range_base *> (1); return p == reinterpret_cast<const value_range *> (1);
} }
static void static void
mark_deleted (value_range_base *&p) mark_deleted (value_range *&p)
{ {
p = reinterpret_cast<value_range_base *> (1); p = reinterpret_cast<value_range *> (1);
} }
}; };
...@@ -1802,14 +1802,14 @@ ipa_set_jfunc_bits (ipa_jump_func *jf, const widest_int &value, ...@@ -1802,14 +1802,14 @@ ipa_set_jfunc_bits (ipa_jump_func *jf, const widest_int &value,
/* Return a pointer to a value_range just like *TMP, but either find it in /* Return a pointer to a value_range just like *TMP, but either find it in
ipa_vr_hash_table or allocate it in GC memory. TMP->equiv must be NULL. */ ipa_vr_hash_table or allocate it in GC memory. TMP->equiv must be NULL. */
static value_range_base * static value_range *
ipa_get_value_range (value_range_base *tmp) ipa_get_value_range (value_range *tmp)
{ {
value_range_base **slot = ipa_vr_hash_table->find_slot (tmp, INSERT); value_range **slot = ipa_vr_hash_table->find_slot (tmp, INSERT);
if (*slot) if (*slot)
return *slot; return *slot;
value_range_base *vr = ggc_alloc<value_range_base> (); value_range *vr = ggc_alloc<value_range> ();
*vr = *tmp; *vr = *tmp;
*slot = vr; *slot = vr;
...@@ -1820,10 +1820,10 @@ ipa_get_value_range (value_range_base *tmp) ...@@ -1820,10 +1820,10 @@ ipa_get_value_range (value_range_base *tmp)
equiv set. Use hash table in order to avoid creating multiple same copies of equiv set. Use hash table in order to avoid creating multiple same copies of
value_ranges. */ value_ranges. */
static value_range_base * static value_range *
ipa_get_value_range (enum value_range_kind type, tree min, tree max) ipa_get_value_range (enum value_range_kind type, tree min, tree max)
{ {
value_range_base tmp (type, min, max); value_range tmp (type, min, max);
return ipa_get_value_range (&tmp); return ipa_get_value_range (&tmp);
} }
...@@ -1842,7 +1842,7 @@ ipa_set_jfunc_vr (ipa_jump_func *jf, enum value_range_kind type, ...@@ -1842,7 +1842,7 @@ ipa_set_jfunc_vr (ipa_jump_func *jf, enum value_range_kind type,
copy from ipa_vr_hash_table or allocate a new on in GC memory. */ copy from ipa_vr_hash_table or allocate a new on in GC memory. */
static void static void
ipa_set_jfunc_vr (ipa_jump_func *jf, value_range_base *tmp) ipa_set_jfunc_vr (ipa_jump_func *jf, value_range *tmp)
{ {
jf->m_vr = ipa_get_value_range (tmp); jf->m_vr = ipa_get_value_range (tmp);
} }
...@@ -1919,8 +1919,8 @@ ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi, ...@@ -1919,8 +1919,8 @@ ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi,
&& (type = get_range_info (arg, &min, &max)) && (type = get_range_info (arg, &min, &max))
&& (type == VR_RANGE || type == VR_ANTI_RANGE)) && (type == VR_RANGE || type == VR_ANTI_RANGE))
{ {
value_range_base resvr; value_range resvr;
value_range_base tmpvr (type, value_range tmpvr (type,
wide_int_to_tree (TREE_TYPE (arg), min), wide_int_to_tree (TREE_TYPE (arg), min),
wide_int_to_tree (TREE_TYPE (arg), max)); wide_int_to_tree (TREE_TYPE (arg), max));
range_fold_unary_expr (&resvr, NOP_EXPR, param_type, range_fold_unary_expr (&resvr, NOP_EXPR, param_type,
......
...@@ -205,7 +205,7 @@ struct GTY (()) ipa_jump_func ...@@ -205,7 +205,7 @@ struct GTY (()) ipa_jump_func
/* Information about value range, containing valid data only when vr_known is /* Information about value range, containing valid data only when vr_known is
true. The pointed to structure is shared betweed different jump true. The pointed to structure is shared betweed different jump
functions. Use ipa_set_jfunc_vr to set this field. */ functions. Use ipa_set_jfunc_vr to set this field. */
class value_range_base *m_vr; class value_range *m_vr;
enum jump_func_type type; enum jump_func_type type;
/* Represents a value of a jump function. pass_through is used only in jump /* Represents a value of a jump function. pass_through is used only in jump
......
...@@ -50,9 +50,9 @@ class range_operator ...@@ -50,9 +50,9 @@ class range_operator
{ {
public: public:
// Perform an operation between 2 ranges and return it. // Perform an operation between 2 ranges and return it.
virtual value_range_base fold_range (tree type, virtual value_range fold_range (tree type,
const value_range_base &lh, const value_range &lh,
const value_range_base &rh) const; const value_range &rh) const;
// Return the range for op[12] in the general case. LHS is the range for // Return the range for op[12] in the general case. LHS is the range for
// the LHS of the expression, OP[12]is the range for the other // the LHS of the expression, OP[12]is the range for the other
...@@ -65,16 +65,16 @@ public: ...@@ -65,16 +65,16 @@ public:
// //
// i.e. [LHS] = ??? + OP2 // i.e. [LHS] = ??? + OP2
// is re-formed as R = [LHS] - OP2. // is re-formed as R = [LHS] - OP2.
virtual bool op1_range (value_range_base &r, tree type, virtual bool op1_range (value_range &r, tree type,
const value_range_base &lhs, const value_range &lhs,
const value_range_base &op2) const; const value_range &op2) const;
virtual bool op2_range (value_range_base &r, tree type, virtual bool op2_range (value_range &r, tree type,
const value_range_base &lhs, const value_range &lhs,
const value_range_base &op1) const; const value_range &op1) const;
protected: protected:
// Perform an operation between 2 sub-ranges and return it. // Perform an operation between 2 sub-ranges and return it.
virtual value_range_base wi_fold (tree type, virtual value_range wi_fold (tree type,
const wide_int &lh_lb, const wide_int &lh_lb,
const wide_int &lh_ub, const wide_int &lh_ub,
const wide_int &rh_lb, const wide_int &rh_lb,
...@@ -82,7 +82,7 @@ protected: ...@@ -82,7 +82,7 @@ protected:
}; };
extern range_operator *range_op_handler (enum tree_code code, tree type); extern range_operator *range_op_handler (enum tree_code code, tree type);
extern void range_cast (value_range_base &, tree type); extern void range_cast (value_range &, tree type);
extern void wi_set_zero_nonzero_bits (tree type, extern void wi_set_zero_nonzero_bits (tree type,
const wide_int &, const wide_int &, const wide_int &, const wide_int &,
wide_int &maybe_nonzero, wide_int &maybe_nonzero,
......
...@@ -29,61 +29,60 @@ along with GCC; see the file COPYING3. If not see ...@@ -29,61 +29,60 @@ along with GCC; see the file COPYING3. If not see
#include "ssa.h" #include "ssa.h"
#include "range.h" #include "range.h"
value_range_base value_range
range_intersect (const value_range_base &r1, const value_range_base &r2) range_intersect (const value_range &r1, const value_range &r2)
{ {
value_range_base tmp (r1); value_range tmp (r1);
tmp.intersect (r2); tmp.intersect (r2);
return tmp; return tmp;
} }
value_range_base value_range
range_invert (const value_range_base &r1) range_invert (const value_range &r1)
{ {
value_range_base tmp (r1); value_range tmp (r1);
tmp.invert (); tmp.invert ();
return tmp; return tmp;
} }
value_range_base value_range
range_union (const value_range_base &r1, const value_range_base &r2) range_union (const value_range &r1, const value_range &r2)
{ {
value_range_base tmp (r1); value_range tmp (r1);
tmp.union_ (r2); tmp.union_ (r2);
return tmp; return tmp;
} }
value_range_base value_range
range_zero (tree type) range_zero (tree type)
{ {
return value_range_base (build_zero_cst (type), build_zero_cst (type)); return value_range (build_zero_cst (type), build_zero_cst (type));
} }
value_range_base value_range
range_nonzero (tree type) range_nonzero (tree type)
{ {
return value_range_base (VR_ANTI_RANGE, return value_range (VR_ANTI_RANGE,
build_zero_cst (type), build_zero_cst (type)); build_zero_cst (type), build_zero_cst (type));
} }
value_range_base value_range
range_positives (tree type) range_positives (tree type)
{ {
unsigned prec = TYPE_PRECISION (type); unsigned prec = TYPE_PRECISION (type);
signop sign = TYPE_SIGN (type); signop sign = TYPE_SIGN (type);
return value_range_base (type, wi::zero (prec), wi::max_value (prec, sign)); return value_range (type, wi::zero (prec), wi::max_value (prec, sign));
} }
value_range_base value_range
range_negatives (tree type) range_negatives (tree type)
{ {
unsigned prec = TYPE_PRECISION (type); unsigned prec = TYPE_PRECISION (type);
signop sign = TYPE_SIGN (type); signop sign = TYPE_SIGN (type);
value_range_base r; value_range r;
if (sign == UNSIGNED) if (sign == UNSIGNED)
r.set_undefined (); r.set_undefined ();
else else
r = value_range_base (type, wi::min_value (prec, sign), r = value_range (type, wi::min_value (prec, sign), wi::minus_one (prec));
wi::minus_one (prec));
return r; return r;
} }
...@@ -21,13 +21,11 @@ along with GCC; see the file COPYING3. If not see ...@@ -21,13 +21,11 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_RANGE_H #ifndef GCC_RANGE_H
#define GCC_RANGE_H #define GCC_RANGE_H
value_range_base range_zero (tree type); value_range range_zero (tree type);
value_range_base range_nonzero (tree type); value_range range_nonzero (tree type);
value_range_base range_intersect (const value_range_base &, value_range range_intersect (const value_range &, const value_range &);
const value_range_base &); value_range range_union (const value_range &, const value_range &);
value_range_base range_union (const value_range_base &, value_range range_invert (const value_range &);
const value_range_base &); value_range range_positives (tree type);
value_range_base range_invert (const value_range_base &); value_range range_negatives (tree type);
value_range_base range_positives (tree type);
value_range_base range_negatives (tree type);
#endif // GCC_RANGE_H #endif // GCC_RANGE_H
...@@ -260,7 +260,7 @@ extern int num_passes; ...@@ -260,7 +260,7 @@ extern int num_passes;
} /* end of namespace selftest. */ } /* end of namespace selftest. */
/* This is outside of the selftest namespace because it's a friend of /* This is outside of the selftest namespace because it's a friend of
value_range_base. */ value_range. */
extern void range_tests (); extern void range_tests ();
/* Macros for writing tests. */ /* Macros for writing tests. */
......
...@@ -901,7 +901,7 @@ simplify_stmt_for_jump_threading (gimple *stmt, ...@@ -901,7 +901,7 @@ simplify_stmt_for_jump_threading (gimple *stmt,
if (TREE_CODE (op) != SSA_NAME) if (TREE_CODE (op) != SSA_NAME)
return NULL_TREE; return NULL_TREE;
const value_range *vr = x_vr_values->get_value_range (op); const value_range_equiv *vr = x_vr_values->get_value_range (op);
if (vr->undefined_p () if (vr->undefined_p ()
|| vr->varying_p () || vr->varying_p ()
|| vr->symbolic_p ()) || vr->symbolic_p ())
...@@ -963,9 +963,9 @@ simplify_stmt_for_jump_threading (gimple *stmt, ...@@ -963,9 +963,9 @@ simplify_stmt_for_jump_threading (gimple *stmt,
{ {
edge dummy_e; edge dummy_e;
tree dummy_tree; tree dummy_tree;
value_range new_vr; value_range_equiv new_vr;
x_vr_values->extract_range_from_stmt (stmt, &dummy_e, x_vr_values->extract_range_from_stmt (stmt, &dummy_e,
&dummy_tree, &new_vr); &dummy_tree, &new_vr);
tree singleton; tree singleton;
if (new_vr.singleton_p (&singleton)) if (new_vr.singleton_p (&singleton))
return singleton; return singleton;
......
...@@ -225,7 +225,7 @@ compare_nonzero_chars (strinfo *si, unsigned HOST_WIDE_INT off, ...@@ -225,7 +225,7 @@ compare_nonzero_chars (strinfo *si, unsigned HOST_WIDE_INT off,
if (!rvals || TREE_CODE (si->nonzero_chars) != SSA_NAME) if (!rvals || TREE_CODE (si->nonzero_chars) != SSA_NAME)
return -1; return -1;
const value_range *vr const value_range_equiv *vr
= (CONST_CAST (class vr_values *, rvals) = (CONST_CAST (class vr_values *, rvals)
->get_value_range (si->nonzero_chars)); ->get_value_range (si->nonzero_chars));
...@@ -799,7 +799,7 @@ dump_strlen_info (FILE *fp, gimple *stmt, const vr_values *rvals) ...@@ -799,7 +799,7 @@ dump_strlen_info (FILE *fp, gimple *stmt, const vr_values *rvals)
wide_int min, max; wide_int min, max;
if (rvals) if (rvals)
{ {
const value_range *vr const value_range_equiv *vr
= CONST_CAST (class vr_values *, rvals) = CONST_CAST (class vr_values *, rvals)
->get_value_range (si->nonzero_chars); ->get_value_range (si->nonzero_chars);
rng = vr->kind (); rng = vr->kind ();
...@@ -991,7 +991,7 @@ get_range_strlen_dynamic (tree src, c_strlen_data *pdata, bitmap *visited, ...@@ -991,7 +991,7 @@ get_range_strlen_dynamic (tree src, c_strlen_data *pdata, bitmap *visited,
pdata->minlen = si->nonzero_chars; pdata->minlen = si->nonzero_chars;
else if (TREE_CODE (si->nonzero_chars) == SSA_NAME) else if (TREE_CODE (si->nonzero_chars) == SSA_NAME)
{ {
const value_range *vr const value_range_equiv *vr
= CONST_CAST (class vr_values *, rvals) = CONST_CAST (class vr_values *, rvals)
->get_value_range (si->nonzero_chars); ->get_value_range (si->nonzero_chars);
if (vr->kind () == VR_RANGE if (vr->kind () == VR_RANGE
...@@ -1031,7 +1031,7 @@ get_range_strlen_dynamic (tree src, c_strlen_data *pdata, bitmap *visited, ...@@ -1031,7 +1031,7 @@ get_range_strlen_dynamic (tree src, c_strlen_data *pdata, bitmap *visited,
} }
else if (pdata->minlen && TREE_CODE (pdata->minlen) == SSA_NAME) else if (pdata->minlen && TREE_CODE (pdata->minlen) == SSA_NAME)
{ {
const value_range *vr const value_range_equiv *vr
= CONST_CAST (class vr_values *, rvals) = CONST_CAST (class vr_values *, rvals)
->get_value_range (si->nonzero_chars); ->get_value_range (si->nonzero_chars);
if (vr->kind () == VR_RANGE if (vr->kind () == VR_RANGE
...@@ -4040,7 +4040,7 @@ count_nonzero_bytes (tree exp, unsigned HOST_WIDE_INT offset, ...@@ -4040,7 +4040,7 @@ count_nonzero_bytes (tree exp, unsigned HOST_WIDE_INT offset,
&& si->nonzero_chars && si->nonzero_chars
&& TREE_CODE (si->nonzero_chars) == SSA_NAME) && TREE_CODE (si->nonzero_chars) == SSA_NAME)
{ {
const value_range *vr const value_range_equiv *vr
= CONST_CAST (class vr_values *, rvals) = CONST_CAST (class vr_values *, rvals)
->get_value_range (si->nonzero_chars); ->get_value_range (si->nonzero_chars);
if (vr->kind () != VR_RANGE if (vr->kind () != VR_RANGE
......
...@@ -165,8 +165,8 @@ record_temporary_equivalences_from_phis (edge e, ...@@ -165,8 +165,8 @@ record_temporary_equivalences_from_phis (edge e,
/* Get an empty new VR we can pass to update_value_range and save /* Get an empty new VR we can pass to update_value_range and save
away in the VR stack. */ away in the VR stack. */
vr_values *vr_values = evrp_range_analyzer->get_vr_values (); vr_values *vr_values = evrp_range_analyzer->get_vr_values ();
value_range *new_vr = vr_values->allocate_value_range (); value_range_equiv *new_vr = vr_values->allocate_value_range_equiv ();
new (new_vr) value_range (); new (new_vr) value_range_equiv ();
/* There are three cases to consider: /* There are three cases to consider:
......
...@@ -408,7 +408,7 @@ set_range_info (tree name, enum value_range_kind range_type, ...@@ -408,7 +408,7 @@ set_range_info (tree name, enum value_range_kind range_type,
/* Store range information for NAME from a value_range. */ /* Store range information for NAME from a value_range. */
void void
set_range_info (tree name, const value_range_base &vr) set_range_info (tree name, const value_range &vr)
{ {
wide_int min = wi::to_wide (vr.min ()); wide_int min = wi::to_wide (vr.min ());
wide_int max = wi::to_wide (vr.max ()); wide_int max = wi::to_wide (vr.max ());
...@@ -441,7 +441,7 @@ get_range_info (const_tree name, wide_int *min, wide_int *max) ...@@ -441,7 +441,7 @@ get_range_info (const_tree name, wide_int *min, wide_int *max)
in a value_range VR. Returns the value_range_kind. */ in a value_range VR. Returns the value_range_kind. */
enum value_range_kind enum value_range_kind
get_range_info (const_tree name, value_range_base &vr) get_range_info (const_tree name, value_range &vr)
{ {
tree min, max; tree min, max;
wide_int wmin, wmax; wide_int wmin, wmax;
......
...@@ -69,11 +69,11 @@ struct GTY ((variable_size)) range_info_def { ...@@ -69,11 +69,11 @@ struct GTY ((variable_size)) range_info_def {
/* Sets the value range to SSA. */ /* Sets the value range to SSA. */
extern void set_range_info (tree, enum value_range_kind, const wide_int_ref &, extern void set_range_info (tree, enum value_range_kind, const wide_int_ref &,
const wide_int_ref &); const wide_int_ref &);
extern void set_range_info (tree, const value_range_base &); extern void set_range_info (tree, const value_range &);
/* Gets the value range from SSA. */ /* Gets the value range from SSA. */
extern enum value_range_kind get_range_info (const_tree, wide_int *, extern enum value_range_kind get_range_info (const_tree, wide_int *,
wide_int *); wide_int *);
extern enum value_range_kind get_range_info (const_tree, value_range_base &); extern enum value_range_kind get_range_info (const_tree, value_range &);
extern void set_nonzero_bits (tree, const wide_int_ref &); extern void set_nonzero_bits (tree, const wide_int_ref &);
extern wide_int get_nonzero_bits (const_tree); extern wide_int get_nonzero_bits (const_tree);
extern bool ssa_name_has_boolean_range (tree); extern bool ssa_name_has_boolean_range (tree);
......
...@@ -37,17 +37,17 @@ enum value_range_kind ...@@ -37,17 +37,17 @@ enum value_range_kind
/* Range of values that can be associated with an SSA_NAME after VRP /* Range of values that can be associated with an SSA_NAME after VRP
has executed. */ has executed. */
class GTY((for_user)) value_range_base class GTY((for_user)) value_range
{ {
friend void range_tests (); friend void range_tests ();
public: public:
value_range_base (); value_range ();
value_range_base (value_range_kind, tree, tree); value_range (value_range_kind, tree, tree);
value_range_base (tree, tree); value_range (tree, tree);
value_range_base (value_range_kind, value_range (value_range_kind,
tree type, const wide_int &, const wide_int &); tree type, const wide_int &, const wide_int &);
value_range_base (tree type, const wide_int &, const wide_int &); value_range (tree type, const wide_int &, const wide_int &);
value_range_base (tree type); value_range (tree type);
void set (value_range_kind, tree, tree); void set (value_range_kind, tree, tree);
void set (tree); void set (tree);
...@@ -66,14 +66,14 @@ public: ...@@ -66,14 +66,14 @@ public:
void set_varying (tree type); void set_varying (tree type);
void set_undefined (); void set_undefined ();
void union_ (const value_range_base *); void union_ (const value_range *);
void intersect (const value_range_base *); void intersect (const value_range *);
void union_ (const value_range_base &); void union_ (const value_range &);
void intersect (const value_range_base &); void intersect (const value_range &);
bool operator== (const value_range_base &) const; bool operator== (const value_range &) const;
bool operator!= (const value_range_base &) const /* = delete */; bool operator!= (const value_range &) const /* = delete */;
bool equal_p (const value_range_base &) const; bool equal_p (const value_range &) const;
/* Misc methods. */ /* Misc methods. */
tree type () const; tree type () const;
...@@ -85,8 +85,8 @@ public: ...@@ -85,8 +85,8 @@ public:
void dump () const; void dump () const;
static bool supports_type_p (tree); static bool supports_type_p (tree);
value_range_base normalize_symbolics () const; value_range normalize_symbolics () const;
value_range_base normalize_addresses () const; value_range normalize_addresses () const;
static const unsigned int m_max_pairs = 2; static const unsigned int m_max_pairs = 2;
bool contains_p (tree) const; bool contains_p (tree) const;
...@@ -98,46 +98,45 @@ public: ...@@ -98,46 +98,45 @@ public:
protected: protected:
void check (); void check ();
static value_range_base union_helper (const value_range_base *, static value_range union_helper (const value_range *, const value_range *);
const value_range_base *); static value_range intersect_helper (const value_range *,
static value_range_base intersect_helper (const value_range_base *, const value_range *);
const value_range_base *);
enum value_range_kind m_kind; enum value_range_kind m_kind;
tree m_min; tree m_min;
tree m_max; tree m_max;
friend void gt_ggc_mx_value_range_base (void *); friend void gt_ggc_mx_value_range (void *);
friend void gt_pch_p_16value_range_base (void *, void *, friend void gt_pch_p_11value_range (void *, void *,
gt_pointer_operator, void *); gt_pointer_operator, void *);
friend void gt_pch_nx_value_range_base (void *); friend void gt_pch_nx_value_range (void *);
friend void gt_ggc_mx (value_range_base &); friend void gt_ggc_mx (value_range &);
friend void gt_ggc_mx (value_range_base *&); friend void gt_ggc_mx (value_range *&);
friend void gt_pch_nx (value_range_base &); friend void gt_pch_nx (value_range &);
friend void gt_pch_nx (value_range_base *, gt_pointer_operator, void *); friend void gt_pch_nx (value_range *, gt_pointer_operator, void *);
private: private:
int value_inside_range (tree) const; int value_inside_range (tree) const;
}; };
/* Note value_range cannot currently be used with GC memory, only /* Note value_range_equiv cannot currently be used with GC memory,
value_range_base is fully set up for this. */ only value_range is fully set up for this. */
class GTY((user)) value_range : public value_range_base class GTY((user)) value_range_equiv : public value_range
{ {
public: public:
value_range (); value_range_equiv ();
value_range (const value_range_base &); value_range_equiv (const value_range &);
/* Deep-copies equiv bitmap argument. */ /* Deep-copies equiv bitmap argument. */
value_range (value_range_kind, tree, tree, bitmap = NULL); value_range_equiv (value_range_kind, tree, tree, bitmap = NULL);
/* Shallow-copies equiv bitmap. */ /* Shallow-copies equiv bitmap. */
value_range (const value_range &) /* = delete */; value_range_equiv (const value_range_equiv &) /* = delete */;
/* Shallow-copies equiv bitmap. */ /* Shallow-copies equiv bitmap. */
value_range& operator=(const value_range&) /* = delete */; value_range_equiv& operator=(const value_range_equiv &) /* = delete */;
/* Move equiv bitmap from source range. */ /* Move equiv bitmap from source range. */
void move (value_range *); void move (value_range_equiv *);
/* Leaves equiv bitmap alone. */ /* Leaves equiv bitmap alone. */
void update (value_range_kind, tree, tree); void update (value_range_kind, tree, tree);
...@@ -145,11 +144,11 @@ class GTY((user)) value_range : public value_range_base ...@@ -145,11 +144,11 @@ class GTY((user)) value_range : public value_range_base
void set (value_range_kind, tree, tree, bitmap = NULL); void set (value_range_kind, tree, tree, bitmap = NULL);
void set (tree); void set (tree);
bool operator== (const value_range &) const /* = delete */; bool operator== (const value_range_equiv &) const /* = delete */;
bool operator!= (const value_range &) const /* = delete */; bool operator!= (const value_range_equiv &) const /* = delete */;
void intersect (const value_range *); void intersect (const value_range_equiv *);
void union_ (const value_range *); void union_ (const value_range_equiv *);
bool equal_p (const value_range &, bool ignore_equivs) const; bool equal_p (const value_range_equiv &, bool ignore_equivs) const;
/* Types of value ranges. */ /* Types of value ranges. */
void set_undefined (); void set_undefined ();
...@@ -158,10 +157,11 @@ class GTY((user)) value_range : public value_range_base ...@@ -158,10 +157,11 @@ class GTY((user)) value_range : public value_range_base
/* Equivalence bitmap methods. */ /* Equivalence bitmap methods. */
bitmap equiv () const; bitmap equiv () const;
void equiv_clear (); void equiv_clear ();
void equiv_add (const_tree, const value_range *, bitmap_obstack * = NULL); void equiv_add (const_tree, const value_range_equiv *,
bitmap_obstack * = NULL);
/* Misc methods. */ /* Misc methods. */
void deep_copy (const value_range *); void deep_copy (const value_range_equiv *);
void dump (FILE *) const; void dump (FILE *) const;
void dump () const; void dump () const;
...@@ -176,15 +176,15 @@ class GTY((user)) value_range : public value_range_base ...@@ -176,15 +176,15 @@ class GTY((user)) value_range : public value_range_base
}; };
inline inline
value_range_base::value_range_base () value_range::value_range ()
{ {
m_kind = VR_UNDEFINED; m_kind = VR_UNDEFINED;
m_min = m_max = NULL; m_min = m_max = NULL;
} }
inline inline
value_range::value_range () value_range_equiv::value_range_equiv ()
: value_range_base () : value_range ()
{ {
m_equiv = NULL; m_equiv = NULL;
} }
...@@ -192,13 +192,13 @@ value_range::value_range () ...@@ -192,13 +192,13 @@ value_range::value_range ()
/* Return the kind of this range. */ /* Return the kind of this range. */
inline value_range_kind inline value_range_kind
value_range_base::kind () const value_range::kind () const
{ {
return m_kind; return m_kind;
} }
inline bitmap inline bitmap
value_range::equiv () const value_range_equiv::equiv () const
{ {
return m_equiv; return m_equiv;
} }
...@@ -206,7 +206,7 @@ value_range::equiv () const ...@@ -206,7 +206,7 @@ value_range::equiv () const
/* Return the lower bound. */ /* Return the lower bound. */
inline tree inline tree
value_range_base::min () const value_range::min () const
{ {
return m_min; return m_min;
} }
...@@ -214,7 +214,7 @@ value_range_base::min () const ...@@ -214,7 +214,7 @@ value_range_base::min () const
/* Return the upper bound. */ /* Return the upper bound. */
inline tree inline tree
value_range_base::max () const value_range::max () const
{ {
return m_max; return m_max;
} }
...@@ -222,7 +222,7 @@ value_range_base::max () const ...@@ -222,7 +222,7 @@ value_range_base::max () const
/* Return TRUE if range spans the entire possible domain. */ /* Return TRUE if range spans the entire possible domain. */
inline bool inline bool
value_range_base::varying_p () const value_range::varying_p () const
{ {
return m_kind == VR_VARYING; return m_kind == VR_VARYING;
} }
...@@ -230,7 +230,7 @@ value_range_base::varying_p () const ...@@ -230,7 +230,7 @@ value_range_base::varying_p () const
/* Return TRUE if range is undefined (essentially the empty set). */ /* Return TRUE if range is undefined (essentially the empty set). */
inline bool inline bool
value_range_base::undefined_p () const value_range::undefined_p () const
{ {
return m_kind == VR_UNDEFINED; return m_kind == VR_UNDEFINED;
} }
...@@ -238,15 +238,15 @@ value_range_base::undefined_p () const ...@@ -238,15 +238,15 @@ value_range_base::undefined_p () const
/* Return TRUE if range is the constant zero. */ /* Return TRUE if range is the constant zero. */
inline bool inline bool
value_range_base::zero_p () const value_range::zero_p () const
{ {
return (m_kind == VR_RANGE return (m_kind == VR_RANGE
&& integer_zerop (m_min) && integer_zerop (m_min)
&& integer_zerop (m_max)); && integer_zerop (m_max));
} }
extern void dump_value_range (FILE *, const value_range_equiv *);
extern void dump_value_range (FILE *, const value_range *); extern void dump_value_range (FILE *, const value_range *);
extern void dump_value_range (FILE *, const value_range_base *);
struct assert_info struct assert_info
{ {
...@@ -267,7 +267,7 @@ struct assert_info ...@@ -267,7 +267,7 @@ struct assert_info
// Otherwise return FALSE. // Otherwise return FALSE.
inline bool inline bool
value_range_base::supports_type_p (tree type) value_range::supports_type_p (tree type)
{ {
if (type && (INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type))) if (type && (INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type)))
return type; return type;
...@@ -279,7 +279,7 @@ extern void register_edge_assert_for (tree, edge, enum tree_code, ...@@ -279,7 +279,7 @@ extern void register_edge_assert_for (tree, edge, enum tree_code,
extern bool stmt_interesting_for_vrp (gimple *); extern bool stmt_interesting_for_vrp (gimple *);
extern bool infer_value_range (gimple *, tree, tree_code *, tree *); extern bool infer_value_range (gimple *, tree, tree_code *, tree *);
extern bool range_int_cst_p (const value_range_base *); extern bool range_int_cst_p (const value_range *);
extern int compare_values (tree, tree); extern int compare_values (tree, tree);
extern int compare_values_warnv (tree, tree, bool *); extern int compare_values_warnv (tree, tree, bool *);
...@@ -290,11 +290,11 @@ extern bool vrp_val_is_max (const_tree); ...@@ -290,11 +290,11 @@ extern bool vrp_val_is_max (const_tree);
extern tree vrp_val_min (const_tree); extern tree vrp_val_min (const_tree);
extern tree vrp_val_max (const_tree); extern tree vrp_val_max (const_tree);
void range_fold_unary_expr (value_range_base *, enum tree_code, tree type, void range_fold_unary_expr (value_range *, enum tree_code, tree type,
const value_range_base *, tree op0_type); const value_range *, tree op0_type);
void range_fold_binary_expr (value_range_base *, enum tree_code, tree type, void range_fold_binary_expr (value_range *, enum tree_code, tree type,
const value_range_base *, const value_range *,
const value_range_base *); const value_range *);
extern bool vrp_operand_equal_p (const_tree, const_tree); extern bool vrp_operand_equal_p (const_tree, const_tree);
extern enum value_range_kind intersect_range_with_nonzero_bits extern enum value_range_kind intersect_range_with_nonzero_bits
...@@ -310,7 +310,7 @@ extern value_range_kind determine_value_range (tree, wide_int *, wide_int *); ...@@ -310,7 +310,7 @@ extern value_range_kind determine_value_range (tree, wide_int *, wide_int *);
/* Return TRUE if range is nonzero. */ /* Return TRUE if range is nonzero. */
inline bool inline bool
value_range_base::nonzero_p () const value_range::nonzero_p () const
{ {
if (m_kind == VR_ANTI_RANGE if (m_kind == VR_ANTI_RANGE
&& !TYPE_UNSIGNED (type ()) && !TYPE_UNSIGNED (type ())
...@@ -327,7 +327,7 @@ value_range_base::nonzero_p () const ...@@ -327,7 +327,7 @@ value_range_base::nonzero_p () const
/* Return TRUE if *VR includes the value zero. */ /* Return TRUE if *VR includes the value zero. */
inline bool inline bool
range_includes_zero_p (const value_range_base *vr) range_includes_zero_p (const value_range *vr)
{ {
if (vr->undefined_p ()) if (vr->undefined_p ())
return false; return false;
......
...@@ -40,23 +40,25 @@ class vr_values ...@@ -40,23 +40,25 @@ class vr_values
vr_values (void); vr_values (void);
~vr_values (void); ~vr_values (void);
const value_range *get_value_range (const_tree); const value_range_equiv *get_value_range (const_tree);
void set_vr_value (tree, value_range *); void set_vr_value (tree, value_range_equiv *);
value_range *swap_vr_value (tree, value_range *); value_range_equiv *swap_vr_value (tree, value_range_equiv *);
void set_def_to_varying (const_tree); void set_def_to_varying (const_tree);
void set_defs_to_varying (gimple *); void set_defs_to_varying (gimple *);
bool update_value_range (const_tree, value_range *); bool update_value_range (const_tree, value_range_equiv *);
tree op_with_constant_singleton_value_range (tree); tree op_with_constant_singleton_value_range (tree);
void adjust_range_with_scev (value_range *, class loop *, gimple *, tree); void adjust_range_with_scev (value_range_equiv *, class loop *,
gimple *, tree);
tree vrp_evaluate_conditional (tree_code, tree, tree, gimple *); tree vrp_evaluate_conditional (tree_code, tree, tree, gimple *);
void dump_all_value_ranges (FILE *); void dump_all_value_ranges (FILE *);
void extract_range_for_var_from_comparison_expr (tree, enum tree_code, void extract_range_for_var_from_comparison_expr (tree, enum tree_code,
tree, tree, value_range *); tree, tree,
void extract_range_from_phi_node (gphi *, value_range *); value_range_equiv *);
void extract_range_basic (value_range *, gimple *); void extract_range_from_phi_node (gphi *, value_range_equiv *);
void extract_range_from_stmt (gimple *, edge *, tree *, value_range *); void extract_range_basic (value_range_equiv *, gimple *);
void extract_range_from_stmt (gimple *, edge *, tree *, value_range_equiv *);
void vrp_visit_cond_stmt (gcond *, edge *); void vrp_visit_cond_stmt (gcond *, edge *);
...@@ -67,20 +69,20 @@ class vr_values ...@@ -67,20 +69,20 @@ class vr_values
void set_lattice_propagation_complete (void) { values_propagated = true; } void set_lattice_propagation_complete (void) { values_propagated = true; }
/* Allocate a new value_range object. */ /* Allocate a new value_range object. */
value_range *allocate_value_range (void) value_range_equiv *allocate_value_range_equiv (void)
{ return vrp_value_range_pool.allocate (); } { return vrp_value_range_pool.allocate (); }
void free_value_range (value_range *vr) void free_value_range (value_range_equiv *vr)
{ vrp_value_range_pool.remove (vr); } { vrp_value_range_pool.remove (vr); }
/* */ /* */
void cleanup_edges_and_switches (void); void cleanup_edges_and_switches (void);
private: private:
value_range *get_lattice_entry (const_tree); value_range_equiv *get_lattice_entry (const_tree);
bool vrp_stmt_computes_nonzero (gimple *); bool vrp_stmt_computes_nonzero (gimple *);
bool op_with_boolean_value_range_p (tree); bool op_with_boolean_value_range_p (tree);
bool check_for_binary_op_overflow (enum tree_code, tree, tree, tree, bool *); bool check_for_binary_op_overflow (enum tree_code, tree, tree, tree, bool *);
const value_range *get_vr_for_comparison (int, value_range *); const value_range_equiv *get_vr_for_comparison (int, value_range_equiv *);
tree compare_name_with_value (enum tree_code, tree, tree, bool *, bool); tree compare_name_with_value (enum tree_code, tree, tree, bool *, bool);
tree compare_names (enum tree_code, tree, tree, bool *); tree compare_names (enum tree_code, tree, tree, bool *);
bool two_valued_val_range_p (tree, tree *, tree *); bool two_valued_val_range_p (tree, tree *, tree *);
...@@ -90,17 +92,17 @@ class vr_values ...@@ -90,17 +92,17 @@ class vr_values
tree vrp_evaluate_conditional_warnv_with_ops (enum tree_code, tree vrp_evaluate_conditional_warnv_with_ops (enum tree_code,
tree, tree, bool, tree, tree, bool,
bool *, bool *); bool *, bool *);
void extract_range_from_assignment (value_range *, gassign *); void extract_range_from_assignment (value_range_equiv *, gassign *);
void extract_range_from_assert (value_range *, tree); void extract_range_from_assert (value_range_equiv *, tree);
void extract_range_from_ssa_name (value_range *, tree); void extract_range_from_ssa_name (value_range_equiv *, tree);
void extract_range_from_binary_expr (value_range *, enum tree_code, void extract_range_from_binary_expr (value_range_equiv *, enum tree_code,
tree, tree, tree); tree, tree, tree);
void extract_range_from_unary_expr (value_range *, enum tree_code, void extract_range_from_unary_expr (value_range_equiv *, enum tree_code,
tree, tree); tree, tree);
void extract_range_from_cond_expr (value_range *, gassign *); void extract_range_from_cond_expr (value_range_equiv *, gassign *);
void extract_range_from_comparison (value_range *, enum tree_code, void extract_range_from_comparison (value_range_equiv *, enum tree_code,
tree, tree, tree); tree, tree, tree);
void vrp_visit_assignment_or_call (gimple*, tree *, value_range *); void vrp_visit_assignment_or_call (gimple*, tree *, value_range_equiv *);
void vrp_visit_switch_stmt (gswitch *, edge *); void vrp_visit_switch_stmt (gswitch *, edge *);
bool simplify_truth_ops_using_ranges (gimple_stmt_iterator *, gimple *); bool simplify_truth_ops_using_ranges (gimple_stmt_iterator *, gimple *);
bool simplify_div_or_mod_using_ranges (gimple_stmt_iterator *, gimple *); bool simplify_div_or_mod_using_ranges (gimple_stmt_iterator *, gimple *);
...@@ -114,7 +116,7 @@ class vr_values ...@@ -114,7 +116,7 @@ class vr_values
bool simplify_internal_call_using_ranges (gimple_stmt_iterator *, gimple *); bool simplify_internal_call_using_ranges (gimple_stmt_iterator *, gimple *);
/* Allocation pools for value_range objects. */ /* Allocation pools for value_range objects. */
object_allocator<value_range> vrp_value_range_pool; object_allocator<value_range_equiv> vrp_value_range_pool;
/* This probably belongs in the lattice rather than in here. */ /* This probably belongs in the lattice rather than in here. */
bool values_propagated; bool values_propagated;
...@@ -125,7 +127,7 @@ class vr_values ...@@ -125,7 +127,7 @@ class vr_values
/* Value range array. After propagation, VR_VALUE[I] holds the range /* Value range array. After propagation, VR_VALUE[I] holds the range
of values that SSA name N_I may take. */ of values that SSA name N_I may take. */
unsigned int num_vr_values; unsigned int num_vr_values;
value_range **vr_value; value_range_equiv **vr_value;
/* For a PHI node which sets SSA name N_I, VR_COUNTS[I] holds the /* 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 number of executable edges we saw the last time we visited the
......
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