#include "fold-const.h"
#include "gimple-range.h"
+void
+irange::accept (const vrange_visitor &v) const
+{
+ v.visit (*this);
+}
+
+void
+unsupported_range::accept (const vrange_visitor &v) const
+{
+ v.visit (*this);
+}
+
// Convenience function only available for integers and pointers.
wide_int
template <typename T> friend bool is_a (vrange &);
friend class Value_Range;
public:
+ virtual void accept (const class vrange_visitor &v) const = 0;
virtual void set (tree, tree, value_range_kind = VR_RANGE);
virtual tree type () const;
virtual bool supports_type_p (tree type) const;
// Misc methods.
virtual bool fits_p (const vrange &r) const override;
virtual void dump (FILE * = stderr) const override;
+ virtual void accept (const vrange_visitor &v) const override;
// Nonzero masks.
wide_int get_nonzero_bits () const;
public:
unsupported_range ();
virtual void dump (FILE *) const override;
+ virtual void accept (const vrange_visitor &v) const override;
};
// is_a<> and as_a<> implementation for vrange.
return v.m_discriminator == VR_IRANGE;
}
+class vrange_visitor
+{
+public:
+ virtual void visit (const irange &) const { }
+ virtual void visit (const unsupported_range &) const { }
+};
+
// This is a special int_range<1> with only one pair, plus
// VR_ANTI_RANGE magic to describe slightly more than can be described
// in one pair. It is described in the code as a "legacy range" (as
bool zero_p () const { return m_vrange->zero_p (); }
wide_int lower_bound () const; // For irange/prange compatability.
wide_int upper_bound () const; // For irange/prange compatability.
+ void accept (const vrange_visitor &v) const { m_vrange->accept (v); }
private:
void init (tree type);
unsupported_range m_unsupported;