From 508645fd461ceb8b743837e24411df2e17bd3950 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Sat, 10 Jun 2023 16:09:58 -0400 Subject: [PATCH 06/17] Move operator_min to the unified range-op table. * range-op-mixed.h (class operator_min): Move from... * range-op.cc (unified_table::unified_table): Add MIN_EXPR. (class operator_min): Move from here. (integral_table::integral_table): Remove MIN_EXPR. --- gcc/range-op-mixed.h | 11 +++++++++++ gcc/range-op.cc | 18 +++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/gcc/range-op-mixed.h b/gcc/range-op-mixed.h index 8a11d61220c..7bd9b5e1129 100644 --- a/gcc/range-op-mixed.h +++ b/gcc/range-op-mixed.h @@ -596,4 +596,15 @@ private: const wide_int &rh_ub) const final override; }; +class operator_min : public range_operator +{ +public: + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const final override; +private: + void wi_fold (irange &r, tree type, const wide_int &lh_lb, + const wide_int &lh_ub, const wide_int &rh_lb, + const wide_int &rh_ub) const final override; +}; + #endif // GCC_RANGE_OP_MIXED_H diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 07e0c88e209..a777fb0d8a3 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -80,6 +80,7 @@ operator_bitwise_not op_bitwise_not; operator_bitwise_xor op_bitwise_xor; operator_bitwise_and op_bitwise_and; operator_bitwise_or op_bitwise_or; +operator_min op_min; // Invoke the initialization routines for each class of range. @@ -119,6 +120,7 @@ unified_table::unified_table () // speifc version is provided. set (BIT_AND_EXPR, op_bitwise_and); set (BIT_IOR_EXPR, op_bitwise_or); + set (MIN_EXPR, op_min); } // The tables are hidden and accessed via a simple extern function. @@ -1980,17 +1982,12 @@ operator_pointer_diff::op1_op2_relation_effect (irange &lhs_range, tree type, } -class operator_min : public range_operator +void +operator_min::update_bitmask (irange &r, const irange &lh, + const irange &rh) const { -public: - virtual void wi_fold (irange &r, tree type, - const wide_int &lh_lb, - const wide_int &lh_ub, - const wide_int &rh_lb, - const wide_int &rh_ub) const; - void update_bitmask (irange &r, const irange &lh, const irange &rh) const - { update_known_bitmask (r, MIN_EXPR, lh, rh); } -} op_min; + update_known_bitmask (r, MIN_EXPR, lh, rh); +} void operator_min::wi_fold (irange &r, tree type, @@ -4534,7 +4531,6 @@ pointer_or_operator::wi_fold (irange &r, tree type, integral_table::integral_table () { - set (MIN_EXPR, op_min); set (MAX_EXPR, op_max); } -- 2.40.1