Value_Range base_range (TREE_TYPE (orig_base));
if (get_range_query (cfun)->range_of_expr (base_range, orig_base)
&& !base_range.undefined_p ())
- max = base_range.upper_bound ();
+ max = wi::to_wide (base_range.ubound ());
extreme = fold_convert (unsigned_type, low);
if (TREE_CODE (orig_base) == SSA_NAME
&& TREE_CODE (high) == INTEGER_CST
Value_Range base_range (TREE_TYPE (orig_base));
if (get_range_query (cfun)->range_of_expr (base_range, orig_base)
&& !base_range.undefined_p ())
- min = base_range.lower_bound ();
+ min = wi::to_wide (base_range.lbound ());
extreme = fold_convert (unsigned_type, high);
if (TREE_CODE (orig_base) == SSA_NAME
&& TREE_CODE (low) == INTEGER_CST
v.visit (*this);
}
-// Convenience function only available for integers and pointers.
-
-wide_int
-Value_Range::lower_bound () const
-{
- if (is_a <irange> (*m_vrange))
- return as_a <irange> (*m_vrange).lower_bound ();
- gcc_unreachable ();
-}
-
-// Convenience function only available for integers and pointers.
-
-wide_int
-Value_Range::upper_bound () const
-{
- if (is_a <irange> (*m_vrange))
- return as_a <irange> (*m_vrange).upper_bound ();
- gcc_unreachable ();
-}
-
void
Value_Range::dump (FILE *out) const
{
return *this;
}
+tree
+unsupported_range::lbound () const
+{
+ return NULL;
+}
+
+tree
+unsupported_range::ubound () const
+{
+ return NULL;
+}
+
// Assignment operator for generic ranges. Copying incompatible types
// is not allowed.
set (type, dconst0, frange_val_max (type));
}
+tree
+frange::lbound () const
+{
+ return build_real (type (), lower_bound ());
+}
+
+tree
+frange::ubound () const
+{
+ return build_real (type (), upper_bound ());
+}
+
// Here we copy between any two irange's.
irange &
return true;
}
+tree
+irange::lbound () const
+{
+ return wide_int_to_tree (type (), lower_bound ());
+}
+
+tree
+irange::ubound () const
+{
+ return wide_int_to_tree (type (), upper_bound ());
+}
+
void
irange_bitmask::verify_mask () const
{
virtual void set_nonnegative (tree type) = 0;
virtual bool fits_p (const vrange &r) const = 0;
virtual ~vrange () { }
+ virtual tree lbound () const = 0;
+ virtual tree ubound () const = 0;
bool varying_p () const;
bool undefined_p () const;
wide_int lower_bound (unsigned = 0) const;
wide_int upper_bound (unsigned) const;
wide_int upper_bound () const;
+ virtual tree lbound () const override;
+ virtual tree ubound () const override;
// Predicates.
virtual bool zero_p () const override;
void set_nonnegative (tree type) final override;
bool fits_p (const vrange &) const final override;
unsupported_range& operator= (const vrange &r);
+ tree lbound () const final override;
+ tree ubound () const final override;
};
// The NAN state as an opaque object.
bool operator!= (const frange &r) const { return !(*this == r); }
const REAL_VALUE_TYPE &lower_bound () const;
const REAL_VALUE_TYPE &upper_bound () const;
+ virtual tree lbound () const override;
+ virtual tree ubound () const override;
nan_state get_nan_state () const;
void update_nan ();
void update_nan (bool sign);
void dump (FILE *) const;
static bool supports_type_p (const_tree type);
- // Convenience methods for vrange compatibility.
tree type () { return m_vrange->type (); }
bool varying_p () const { return m_vrange->varying_p (); }
bool undefined_p () const { return m_vrange->undefined_p (); }
{ init (type); return m_vrange->set_nonzero (type); }
bool nonzero_p () const { return m_vrange->nonzero_p (); }
bool zero_p () const { return m_vrange->zero_p (); }
- wide_int lower_bound () const; // For irange/prange comparability.
- wide_int upper_bound () const; // For irange/prange comparability.
+ tree lbound () const { return m_vrange->lbound (); }
+ tree ubound () const { return m_vrange->ubound (); }
void accept (const vrange_visitor &v) const { m_vrange->accept (v); }
private:
void init (tree type);