@@ -37,12 +37,6 @@ 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
@@ -86,52 +80,58 @@ debug (const irange_bitmask &bm)
fprintf (stderr, "\n");
}
-// Default vrange definitions.
+// Definitions for unsupported_range.
+
+void
+unsupported_range::accept (const vrange_visitor &v) const
+{
+ v.visit (*this);
+}
bool
-vrange::contains_p (tree) const
+unsupported_range::contains_p (tree) const
{
return varying_p ();
}
bool
-vrange::singleton_p (tree *) const
+unsupported_range::singleton_p (tree *) const
{
return false;
}
void
-vrange::set (tree min, tree, value_range_kind)
+unsupported_range::set (tree min, tree, value_range_kind)
{
set_varying (TREE_TYPE (min));
}
tree
-vrange::type () const
+unsupported_range::type () const
{
return void_type_node;
}
bool
-vrange::supports_type_p (const_tree) const
+unsupported_range::supports_type_p (const_tree) const
{
return false;
}
void
-vrange::set_undefined ()
+unsupported_range::set_undefined ()
{
m_kind = VR_UNDEFINED;
}
void
-vrange::set_varying (tree)
+unsupported_range::set_varying (tree)
{
m_kind = VR_VARYING;
}
bool
-vrange::union_ (const vrange &r)
+unsupported_range::union_ (const vrange &r)
{
if (r.undefined_p () || varying_p ())
return false;
@@ -145,7 +145,7 @@ vrange::union_ (const vrange &r)
}
bool
-vrange::intersect (const vrange &r)
+unsupported_range::intersect (const vrange &r)
{
if (undefined_p () || r.varying_p ())
return false;
@@ -164,41 +164,53 @@ vrange::intersect (const vrange &r)
}
bool
-vrange::zero_p () const
+unsupported_range::zero_p () const
{
return false;
}
bool
-vrange::nonzero_p () const
+unsupported_range::nonzero_p () const
{
return false;
}
void
-vrange::set_nonzero (tree type)
+unsupported_range::set_nonzero (tree type)
{
set_varying (type);
}
void
-vrange::set_zero (tree type)
+unsupported_range::set_zero (tree type)
{
set_varying (type);
}
void
-vrange::set_nonnegative (tree type)
+unsupported_range::set_nonnegative (tree type)
{
set_varying (type);
}
bool
-vrange::fits_p (const vrange &) const
+unsupported_range::fits_p (const vrange &) const
{
return true;
}
+unsupported_range &
+unsupported_range::operator= (const vrange &r)
+{
+ if (r.undefined_p ())
+ set_undefined ();
+ else if (r.varying_p ())
+ set_varying (void_type_node);
+ else
+ gcc_unreachable ();
+ return *this;
+}
+
// Assignment operator for generic ranges. Copying incompatible types
// is not allowed.
@@ -359,6 +371,12 @@ frange::accept (const vrange_visitor &v) const
v.visit (*this);
}
+bool
+frange::fits_p (const vrange &) const
+{
+ return true;
+}
+
// Flush denormal endpoints to the appropriate 0.0.
void
@@ -80,21 +80,21 @@ class GTY((user)) vrange
friend class range_op_handler;
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 (const_tree type) const;
- virtual void set_varying (tree type);
- virtual void set_undefined ();
- virtual bool union_ (const vrange &);
- virtual bool intersect (const vrange &);
- virtual bool singleton_p (tree *result = NULL) const;
- virtual bool contains_p (tree cst) const;
- virtual bool zero_p () const;
- virtual bool nonzero_p () const;
- virtual void set_nonzero (tree type);
- virtual void set_zero (tree type);
- virtual void set_nonnegative (tree type);
- virtual bool fits_p (const vrange &r) const;
+ virtual void set (tree, tree, value_range_kind = VR_RANGE) = 0;
+ virtual tree type () const = 0;
+ virtual bool supports_type_p (const_tree type) const = 0;
+ virtual void set_varying (tree type) = 0;
+ virtual void set_undefined () = 0;
+ virtual bool union_ (const vrange &) = 0;
+ virtual bool intersect (const vrange &) = 0;
+ virtual bool singleton_p (tree *result = NULL) const = 0;
+ virtual bool contains_p (tree cst) const = 0;
+ virtual bool zero_p () const = 0;
+ virtual bool nonzero_p () const = 0;
+ virtual void set_nonzero (tree type) = 0;
+ virtual void set_zero (tree type) = 0;
+ virtual void set_nonnegative (tree type) = 0;
+ virtual bool fits_p (const vrange &r) const = 0;
bool varying_p () const;
bool undefined_p () const;
@@ -401,11 +401,23 @@ public:
{
set_undefined ();
}
- virtual void set_undefined () final override
- {
- m_kind = VR_UNDEFINED;
- }
- virtual void accept (const vrange_visitor &v) const override;
+ void set (tree min, tree, value_range_kind = VR_RANGE) final override;
+ tree type () const final override;
+ bool supports_type_p (const_tree) const final override;
+ void set_varying (tree) final override;
+ void set_undefined () final override;
+ void accept (const vrange_visitor &v) const final override;
+ bool union_ (const vrange &r) final override;
+ bool intersect (const vrange &r) final override;
+ bool singleton_p (tree * = NULL) const final override;
+ bool contains_p (tree) const final override;
+ bool zero_p () const final override;
+ bool nonzero_p () const final override;
+ void set_nonzero (tree type) final override;
+ void set_zero (tree type) final override;
+ void set_nonnegative (tree type) final override;
+ bool fits_p (const vrange &) const final override;
+ unsupported_range& operator= (const vrange &r);
};
// The NAN state as an opaque object.
@@ -507,6 +519,7 @@ public:
virtual void set_nonzero (tree type) override;
virtual void set_zero (tree type) override;
virtual void set_nonnegative (tree type) override;
+ virtual bool fits_p (const vrange &) const override;
frange& operator= (const frange &);
bool operator== (const frange &) const;
bool operator!= (const frange &r) const { return !(*this == r); }