diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2023-06-09 13:33:33 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2023-06-09 20:33:02 -0400 |
commit | a0a8f1c735d0ab5af9ecbbf21a783bba78496939 (patch) | |
tree | db3e306536bb780b55369d8593961a0465b5c134 /gcc/range-op-float.cc | |
parent | f544e7e8a1897b4ddf2ae21c53f9284356373618 (diff) | |
download | gcc-a0a8f1c735d0ab5af9ecbbf21a783bba78496939.zip gcc-a0a8f1c735d0ab5af9ecbbf21a783bba78496939.tar.gz gcc-a0a8f1c735d0ab5af9ecbbf21a783bba78496939.tar.bz2 |
Unify GE_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_ge): Remove. Move prototypes
to range-op-mixed.h
(operator_ge::fold_range): Rename from foperator_ge.
(operator_ge::op1_range): Ditto.
(float_table::float_table): Remove GE_EXPR.
* range-op-mixed.h (class operator_ge): Combined from integer
and float files.
* range-op.cc (op_ge): New object.
(unified_table::unified_table): Add GE_EXPR.
(class operator_ge): Move to range-op-mixed.h.
(ge_op1_op2_relation): Fold into
operator_ge::op1_op2_relation.
(integral_table::integral_table): Remove GE_EXPR.
(pointer_table::pointer_table): Remove GE_EXPR.
* range-op.h (ge_op1_op2_relation): Delete.
Diffstat (limited to 'gcc/range-op-float.cc')
-rw-r--r-- | gcc/range-op-float.cc | 54 |
1 files changed, 14 insertions, 40 deletions
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 2f090e7..4faca62 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -1059,32 +1059,10 @@ operator_gt::op2_range (frange &r, return true; } -class foperator_ge : public range_operator -{ - using range_operator::fold_range; - using range_operator::op1_range; - using range_operator::op2_range; - using range_operator::op1_op2_relation; -public: - bool fold_range (irange &r, tree type, - const frange &op1, const frange &op2, - relation_trio = TRIO_VARYING) const final override; - relation_kind op1_op2_relation (const irange &lhs) const final override - { - return ge_op1_op2_relation (lhs); - } - bool op1_range (frange &r, tree type, - const irange &lhs, const frange &op2, - relation_trio = TRIO_VARYING) const final override; - bool op2_range (frange &r, tree type, - const irange &lhs, const frange &op1, - relation_trio = TRIO_VARYING) const final override; -} fop_ge; - bool -foperator_ge::fold_range (irange &r, tree type, - const frange &op1, const frange &op2, - relation_trio rel) const +operator_ge::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_GE)) return true; @@ -1102,11 +1080,11 @@ foperator_ge::fold_range (irange &r, tree type, } bool -foperator_ge::op1_range (frange &r, - tree type, - const irange &lhs, - const frange &op2, - relation_trio) const +operator_ge::op1_range (frange &r, + tree type, + const irange &lhs, + const frange &op2, + relation_trio) const { switch (get_bool_state (r, lhs, type)) { @@ -1137,10 +1115,10 @@ foperator_ge::op1_range (frange &r, } bool -foperator_ge::op2_range (frange &r, tree type, - const irange &lhs, - const frange &op1, - relation_trio) const +operator_ge::op2_range (frange &r, tree type, + const irange &lhs, + const frange &op1, + relation_trio) const { switch (get_bool_state (r, lhs, type)) { @@ -1813,7 +1791,8 @@ public: op1_no_nan.clear_nan (); if (op2.maybe_isnan ()) op2_no_nan.clear_nan (); - if (!fop_ge.fold_range (r, type, op1_no_nan, op2_no_nan, rel)) + if (!range_op_handler (GE_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. @@ -2720,11 +2699,6 @@ float_table::float_table () set (OBJ_TYPE_REF, fop_identity); set (REAL_CST, fop_identity); - // All the relational operators are expected to work, because the - // calculation of ranges on outgoing edges expect the handlers to be - // present. - set (GE_EXPR, fop_ge); - set (ABS_EXPR, fop_abs); set (NEGATE_EXPR, fop_negate); set (PLUS_EXPR, fop_plus); |