diff options
author | Jiufu Guo <guojiufu@linux.ibm.com> | 2023-08-30 16:59:16 +0800 |
---|---|---|
committer | guojiufu <guojiufu@linux.ibm.com> | 2023-08-31 09:56:44 +0800 |
commit | 97442a087bed186d96170151c1924344c3370a2b (patch) | |
tree | 7c94ba94ed31f1ac1c6787a8cbd06e8dfd8a51bf /gcc/value-range.h | |
parent | ffb8568abb2b21bb1b82b9f684794fa34804c84d (diff) | |
download | gcc-97442a087bed186d96170151c1924344c3370a2b.zip gcc-97442a087bed186d96170151c1924344c3370a2b.tar.gz gcc-97442a087bed186d96170151c1924344c3370a2b.tar.bz2 |
Add overflow API for plus minus mult on range
In previous reviews, adding overflow APIs to range-op would be useful.
Those APIs could help to check if overflow happens when operating
between two 'range's, like: plus, minus, and mult.
Previous discussions are here:
https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624067.html
https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624701.html
gcc/ChangeLog:
* range-op-mixed.h (operator_plus::overflow_free_p): New declare.
(operator_minus::overflow_free_p): New declare.
(operator_mult::overflow_free_p): New declare.
* range-op.cc (range_op_handler::overflow_free_p): New function.
(range_operator::overflow_free_p): New default function.
(operator_plus::overflow_free_p): New function.
(operator_minus::overflow_free_p): New function.
(operator_mult::overflow_free_p): New function.
* range-op.h (range_op_handler::overflow_free_p): New declare.
(range_operator::overflow_free_p): New declare.
* value-range.cc (irange::nonnegative_p): New function.
(irange::nonpositive_p): New function.
* value-range.h (irange::nonnegative_p): New declare.
(irange::nonpositive_p): New declare.
Diffstat (limited to 'gcc/value-range.h')
-rw-r--r-- | gcc/value-range.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/value-range.h b/gcc/value-range.h index 622b688..6c5be36 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -288,6 +288,8 @@ public: virtual bool singleton_p (tree *result = NULL) const override; bool singleton_p (wide_int &) const; bool contains_p (const wide_int &) const; + bool nonnegative_p () const; + bool nonpositive_p () const; // In-place operators. virtual bool union_ (const vrange &) override; |