diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2023-06-09 13:25:49 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2023-06-09 20:33:02 -0400 |
commit | eb29c3e1fab9f985144fd4d63f5b86c039c459d0 (patch) | |
tree | 0388fc7561ba32ac47d4eeb04f5d67a8eb7484d6 /gcc/range-op-float.cc | |
parent | 2dbf1e6146e3f0d6d7b4533ca654ad8c4ee03419 (diff) | |
download | gcc-eb29c3e1fab9f985144fd4d63f5b86c039c459d0.zip gcc-eb29c3e1fab9f985144fd4d63f5b86c039c459d0.tar.gz gcc-eb29c3e1fab9f985144fd4d63f5b86c039c459d0.tar.bz2 |
Unify NE_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_not_equal): Remove. Move prototypes
to range-op-mixed.h
(operator_equal::fold_range): Rename from foperator_not_equal.
(operator_equal::op1_range): Ditto.
(float_table::float_table): Remove NE_EXPR.
* range-op-mixed.h (class operator_not_equal): Combined from integer
and float files.
* range-op.cc (op_equal): New object.
(unified_table::unified_table): Add NE_EXPR.
(class operator_not_equal): Move to range-op-mixed.h.
(not_equal_op1_op2_relation): Fold into
operator_not_equal::op1_op2_relation.
(integral_table::integral_table): Remove NE_EXPR.
(pointer_table::pointer_table): Remove NE_EXPR.
* range-op.h (not_equal_op1_op2_relation): Delete.
Diffstat (limited to 'gcc/range-op-float.cc')
-rw-r--r-- | gcc/range-op-float.cc | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 98636ce..ec24167 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -675,28 +675,10 @@ operator_equal::op1_range (frange &r, tree type, return true; } -class foperator_not_equal : public range_operator -{ - using range_operator::fold_range; - using range_operator::op1_range; - using range_operator::op1_op2_relation; -public: - bool fold_range (irange &r, tree type, - const frange &op1, const frange &op2, - relation_trio rel = TRIO_VARYING) const final override; - relation_kind op1_op2_relation (const irange &lhs) const final override - { - return not_equal_op1_op2_relation (lhs); - } - bool op1_range (frange &r, tree type, - const irange &lhs, const frange &op2, - relation_trio = TRIO_VARYING) const final override; -} fop_not_equal; - bool -foperator_not_equal::fold_range (irange &r, tree type, - const frange &op1, const frange &op2, - relation_trio rel) const +operator_not_equal::fold_range (irange &r, tree type, + const frange &op1, const frange &op2, + relation_trio rel) const { if (frelop_early_resolve (r, type, op1, op2, rel, VREL_NE)) return true; @@ -750,10 +732,10 @@ foperator_not_equal::fold_range (irange &r, tree type, } bool -foperator_not_equal::op1_range (frange &r, tree type, - const irange &lhs, - const frange &op2, - relation_trio trio) const +operator_not_equal::op1_range (frange &r, tree type, + const irange &lhs, + const frange &op2, + relation_trio trio) const { relation_kind rel = trio.op1_op2 (); switch (get_bool_state (r, lhs, type)) @@ -2086,7 +2068,8 @@ public: op1_no_nan.clear_nan (); if (op2.maybe_isnan ()) op2_no_nan.clear_nan (); - if (!fop_not_equal.fold_range (r, type, op1_no_nan, op2_no_nan, rel)) + if (!range_op_handler (NE_EXPR).fold_range (r, type, op1_no_nan, + op2_no_nan, rel)) return false; // The result is the same as the ordered version when the // comparison is true or when the operands cannot be NANs. @@ -2803,7 +2786,6 @@ float_table::float_table () // All the relational operators are expected to work, because the // calculation of ranges on outgoing edges expect the handlers to be // present. - set (NE_EXPR, fop_not_equal); set (LT_EXPR, fop_lt); set (LE_EXPR, fop_le); set (GT_EXPR, fop_gt); |