diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2023-06-09 13:41:28 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2023-06-09 20:33:03 -0400 |
commit | 29dbd7ef69fe1375055ada081af88e3a8919fff0 (patch) | |
tree | c7dc22136fd6a0fc3ae6849e2d4fe07262d66f47 /gcc/range-op.cc | |
parent | 6a4ac393e199a63f39063daa28827f39dab49a07 (diff) | |
download | gcc-29dbd7ef69fe1375055ada081af88e3a8919fff0.zip gcc-29dbd7ef69fe1375055ada081af88e3a8919fff0.tar.gz gcc-29dbd7ef69fe1375055ada081af88e3a8919fff0.tar.bz2 |
Unify PLUS_EXPR range operator
Move the declaration of the class to the range-op-mixed header, add the
floating point prototypes as well, and use it in the new unified table.
* range-op-float.cc (foperator_plus): Remove. Move prototypes
to range-op-mixed.h
(operator_plus::fold_range): Rename from foperator_plus.
(operator_plus::op1_range): Ditto.
(operator_plus::op2_range): Ditto.
(operator_plus::rv_fold): Ditto.
(float_table::float_table): Remove PLUS_EXPR.
* range-op-mixed.h (class operator_plus): Combined from integer
and float files.
* range-op.cc (op_plus): New object.
(unified_table::unified_table): Add PLUS_EXPR.
(class operator_plus): Move to range-op-mixed.h.
(integral_table::integral_table): Remove PLUS_EXPR.
(pointer_table::pointer_table): Remove PLUS_EXPR.
Diffstat (limited to 'gcc/range-op.cc')
-rw-r--r-- | gcc/range-op.cc | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 7d89b63..1dc5c38 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -71,6 +71,7 @@ operator_ge op_ge; operator_identity op_ident; operator_cst op_cst; operator_cast op_cast; +operator_plus op_plus; // Invoke the initialization routines for each class of range. @@ -93,7 +94,7 @@ unified_table::unified_table () set (INTEGER_CST, op_cst); set (NOP_EXPR, op_cast); set (CONVERT_EXPR, op_cast); - + set (PLUS_EXPR, op_plus); } // The tables are hidden and accessed via a simple extern function. @@ -1498,35 +1499,12 @@ operator_ge::op2_range (irange &r, tree type, } -class operator_plus : public range_operator +void +operator_plus::update_bitmask (irange &r, const irange &lh, + const irange &rh) const { - using range_operator::op1_range; - using range_operator::op2_range; - using range_operator::lhs_op1_relation; - using range_operator::lhs_op2_relation; -public: - virtual bool op1_range (irange &r, tree type, - const irange &lhs, - const irange &op2, - relation_trio) const; - virtual bool op2_range (irange &r, tree type, - const irange &lhs, - const irange &op1, - relation_trio) const; - 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; - virtual relation_kind lhs_op1_relation (const irange &lhs, const irange &op1, - const irange &op2, - relation_kind rel) const; - virtual relation_kind lhs_op2_relation (const irange &lhs, const irange &op1, - const irange &op2, - relation_kind rel) const; - void update_bitmask (irange &r, const irange &lh, const irange &rh) const - { update_known_bitmask (r, PLUS_EXPR, lh, rh); } -} op_plus; + update_known_bitmask (r, PLUS_EXPR, lh, rh); +} // Check to see if the range of OP2 indicates anything about the relation // between LHS and OP1. @@ -4717,7 +4695,6 @@ pointer_or_operator::wi_fold (irange &r, tree type, integral_table::integral_table () { - set (PLUS_EXPR, op_plus); set (MINUS_EXPR, op_minus); set (MIN_EXPR, op_min); set (MAX_EXPR, op_max); |