// Pre-cache zero and non-zero values for pointers.
if (POINTER_TYPE_P (t))
{
- int_range<2> nonzero;
+ prange nonzero;
nonzero.set_nonzero (t);
m_range[1] = m_range_allocator->clone (nonzero);
- int_range<2> zero;
+ prange zero;
zero.set_zero (t);
m_range[2] = m_range_allocator->clone (zero);
}
// Process addresses.
if (gimple_code (s) == GIMPLE_ASSIGN
&& gimple_assign_rhs_code (s) == ADDR_EXPR)
- return range_of_address (as_a <irange> (r), s, src);
+ return range_of_address (as_a <prange> (r), s, src);
gimple_range_op_handler handler (s);
if (handler)
// If a range cannot be calculated, set it to VARYING and return true.
bool
-fold_using_range::range_of_address (irange &r, gimple *stmt, fur_source &src)
+fold_using_range::range_of_address (prange &r, gimple *stmt, fur_source &src)
{
gcc_checking_assert (gimple_code (stmt) == GIMPLE_ASSIGN);
gcc_checking_assert (gimple_assign_rhs_code (stmt) == ADDR_EXPR);
fur_source &src);
bool range_of_call (vrange &r, gcall *call, fur_source &src);
bool range_of_cond_expr (vrange &r, gassign* cond, fur_source &src);
- bool range_of_address (irange &r, gimple *s, fur_source &src);
+ bool range_of_address (prange &r, gimple *s, fur_source &src);
bool range_of_phi (vrange &r, gphi *phi, fur_source &src);
void range_of_ssa_name_with_loop_info (vrange &, tree, class loop *, gphi *,
fur_source &src);
{
if (!gimple_range_ssa_p (name))
return;
- int_range<2> nz;
+ prange nz;
nz.set_nonzero (TREE_TYPE (name));
add_range (name, nz);
}
{
public:
using range_operator::fold_range;
- virtual bool fold_range (irange &r, tree type, const irange &,
+ virtual bool fold_range (irange &r, tree type, const prange &,
const irange &, relation_trio) const
{
wide_int max = irange_val_max (ptrdiff_type_node);
void
path_range_query::adjust_for_non_null_uses (basic_block bb)
{
- int_range_max r;
+ prange r;
bitmap_iterator bi;
unsigned i;
where the realloc call is known to have failed are valid.
Ignore pointers that nothing is known about. Those could
have escaped along with their nullness. */
- value_range vr;
+ prange vr;
if (m_ptr_qry.rvals->range_of_expr (vr, realloc_lhs, use_stmt))
{
if (vr.zero_p ())
static inline bool
ipa_supports_p (tree type)
{
- return irange::supports_p (type);
+ return irange::supports_p (type) || prange::supports_p (type);
}
#endif /* IPA_CP_H */
{
set (POINTER_PLUS_EXPR, op_pointer_plus);
set (POINTER_DIFF_EXPR, op_pointer_diff);
- set (BIT_AND_EXPR, op_hybrid_and);
- set (BIT_IOR_EXPR, op_hybrid_or);
- set (MIN_EXPR, op_hybrid_min);
- set (MAX_EXPR, op_hybrid_max);
}
set (MINUS_EXPR, op_minus);
set (NEGATE_EXPR, op_negate);
set (MULT_EXPR, op_mult);
-
- // Occur in both integer and pointer tables, but currently share
- // integral implementation.
set (ADDR_EXPR, op_addr);
set (BIT_NOT_EXPR, op_bitwise_not);
set (BIT_XOR_EXPR, op_bitwise_xor);
-
- // These are in both integer and pointer tables, but pointer has a different
- // implementation.
- // If commented out, there is a hybrid version in range-op-ptr.cc which
- // is used until there is a pointer range class. Then we can simply
- // uncomment the operator here and use the unified version.
-
- // set (BIT_AND_EXPR, op_bitwise_and);
- // set (BIT_IOR_EXPR, op_bitwise_or);
- // set (MIN_EXPR, op_min);
- // set (MAX_EXPR, op_max);
+ set (BIT_AND_EXPR, op_bitwise_and);
+ set (BIT_IOR_EXPR, op_bitwise_or);
+ set (MIN_EXPR, op_min);
+ set (MAX_EXPR, op_max);
}
// Instantiate a default range operator for opcodes with no entry.
struct ptr_info_def *pi;
tree lookup_p = p;
varinfo_t vi;
- value_range vr;
+ prange vr;
get_range_query (DECL_STRUCT_FUNCTION (fndecl))->range_of_expr (vr, p);
bool nonnull = vr.nonzero_p ();
gcc_checking_assert (m_num_ranges == 0);
return;
}
+ gcc_checking_assert (supports_p (type ()));
gcc_checking_assert (m_num_ranges <= m_max_ranges);
// Legacy allowed these to represent VARYING for unknown types.
const wide_int &u = m_base[1];
tree t = m_type;
- if (m_kind == VR_VARYING && t == error_mark_node)
+ if (m_kind == VR_VARYING)
return true;
unsigned prec = TYPE_PRECISION (t);
inline bool
irange::supports_p (const_tree type)
{
- return INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type);
+ return INTEGRAL_TYPE_P (type);
}
inline bool