@@ -101,10 +101,10 @@ pointer_plus_operator::wi_fold (irange &r, tree type,
&& !TYPE_OVERFLOW_WRAPS (type)
&& (flag_delete_null_pointer_checks
|| !wi::sign_mask (rh_ub)))
- r = range_nonzero (type);
+ r.set_nonzero (type);
else if (lh_lb == lh_ub && lh_lb == 0
&& rh_lb == rh_ub && rh_lb == 0)
- r = range_zero (type);
+ r.set_zero (type);
else
r.set_varying (type);
}
@@ -150,9 +150,9 @@ pointer_min_max_operator::wi_fold (irange &r, tree type,
// are varying.
if (!wi_includes_zero_p (type, lh_lb, lh_ub)
&& !wi_includes_zero_p (type, rh_lb, rh_ub))
- r = range_nonzero (type);
+ r.set_nonzero (type);
else if (wi_zero_p (type, lh_lb, lh_ub) && wi_zero_p (type, rh_lb, rh_ub))
- r = range_zero (type);
+ r.set_zero (type);
else
r.set_varying (type);
}
@@ -175,7 +175,7 @@ pointer_and_operator::wi_fold (irange &r, tree type,
// For pointer types, we are really only interested in asserting
// whether the expression evaluates to non-NULL.
if (wi_zero_p (type, lh_lb, lh_ub) || wi_zero_p (type, lh_lb, lh_ub))
- r = range_zero (type);
+ r.set_zero (type);
else
r.set_varying (type);
}
@@ -236,9 +236,9 @@ pointer_or_operator::wi_fold (irange &r, tree type,
// whether the expression evaluates to non-NULL.
if (!wi_includes_zero_p (type, lh_lb, lh_ub)
&& !wi_includes_zero_p (type, rh_lb, rh_ub))
- r = range_nonzero (type);
+ r.set_nonzero (type);
else if (wi_zero_p (type, lh_lb, lh_ub) && wi_zero_p (type, rh_lb, rh_ub))
- r = range_zero (type);
+ r.set_zero (type);
else
r.set_varying (type);
}
@@ -4364,9 +4364,11 @@ operator_negate::fold_range (irange &r, tree type,
{
if (empty_range_varying (r, type, lh, rh))
return true;
- // -X is simply 0 - X.
- return range_op_handler (MINUS_EXPR).fold_range (r, type,
- range_zero (type), lh);
+
+// -X is simply 0 - X.
+ int_range<1> zero;
+ zero.set_zero (type);
+ return range_op_handler (MINUS_EXPR).fold_range (r, type, zero, lh);
}
bool
@@ -4391,7 +4393,7 @@ operator_addr_expr::fold_range (irange &r, tree type,
// Return a non-null pointer of the LHS type (passed in op2).
if (lh.zero_p ())
- r = range_zero (type);
+ r.set_zero (type);
else if (lh.undefined_p () || contains_zero_p (lh))
r.set_varying (type);
else
@@ -4675,7 +4677,7 @@ range_op_cast_tests ()
if (TYPE_PRECISION (integer_type_node)
> TYPE_PRECISION (short_integer_type_node))
{
- r0 = range_nonzero (integer_type_node);
+ r0.set_nonzero (integer_type_node);
range_cast (r0, short_integer_type_node);
r1 = int_range<1> (short_integer_type_node,
min_limit (short_integer_type_node),
@@ -4687,7 +4689,7 @@ range_op_cast_tests ()
//
// NONZERO signed 16-bits is [-MIN_16,-1][1, +MAX_16].
// Converting this to 32-bits signed is [-MIN_16,-1][1, +MAX_16].
- r0 = range_nonzero (short_integer_type_node);
+ r0.set_nonzero (short_integer_type_node);
range_cast (r0, integer_type_node);
r1 = int_range<1> (integer_type_node, INT (-32768), INT (-1));
r2 = int_range<1> (integer_type_node, INT (1), INT (32767));
@@ -29,20 +29,6 @@ along with GCC; see the file COPYING3. If not see
#include "ssa.h"
#include "range.h"
-value_range
-range_zero (tree type)
-{
- wide_int zero = wi::zero (TYPE_PRECISION (type));
- return value_range (type, zero, zero);
-}
-
-value_range
-range_nonzero (tree type)
-{
- wide_int zero = wi::zero (TYPE_PRECISION (type));
- return value_range (type, zero, zero, VR_ANTI_RANGE);
-}
-
value_range
range_positives (tree type)
{
@@ -21,8 +21,6 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_RANGE_H
#define GCC_RANGE_H
-value_range range_zero (tree type);
-value_range range_nonzero (tree type);
value_range range_positives (tree type);
value_range range_negatives (tree type);
@@ -2447,7 +2447,8 @@ range_tests_misc ()
ASSERT_TRUE (not_255 == range_uchar (0, 254));
// Test that NOT(0) is [1..255] in 8-bit land.
- int_range<2> not_zero = range_nonzero (unsigned_char_type_node);
+ int_range<2> not_zero;
+ not_zero.set_nonzero (unsigned_char_type_node);
ASSERT_TRUE (not_zero == range_uchar (1, 255));
// Check that [0,127][0x..ffffff80,0x..ffffff]
@@ -2526,7 +2527,7 @@ range_tests_misc ()
ASSERT_TRUE (r0 == r2);
// Test that booleans and their inverse work as expected.
- r0 = range_zero (boolean_type_node);
+ r0.set_zero (boolean_type_node);
ASSERT_TRUE (r0 == range_false ());
r0.invert ();
ASSERT_TRUE (r0 == range_true ());
@@ -2534,7 +2535,7 @@ range_tests_misc ()
// Make sure NULL and non-NULL of pointer types work, and that
// inverses of them are consistent.
tree voidp = build_pointer_type (void_type_node);
- r0 = range_zero (voidp);
+ r0.set_zero (voidp);
r1 = r0;
r0.invert ();
r0.invert ();