diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2023-06-09 13:29:15 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2023-06-09 20:33:02 -0400 |
commit | 5b079541006f05e6bd0d50e8bb139120d519b9a5 (patch) | |
tree | 8da4090c98345e0d2dcc2ad5f9706f2018498da2 /gcc/range-op-float.cc | |
parent | eb29c3e1fab9f985144fd4d63f5b86c039c459d0 (diff) | |
download | gcc-5b079541006f05e6bd0d50e8bb139120d519b9a5.zip gcc-5b079541006f05e6bd0d50e8bb139120d519b9a5.tar.gz gcc-5b079541006f05e6bd0d50e8bb139120d519b9a5.tar.bz2 |
Unify LT_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_lt): Remove. Move prototypes
to range-op-mixed.h
(operator_lt::fold_range): Rename from foperator_lt.
(operator_lt::op1_range): Ditto.
(float_table::float_table): Remove LT_EXPR.
* range-op-mixed.h (class operator_lt): Combined from integer
and float files.
* range-op.cc (op_lt): New object.
(unified_table::unified_table): Add LT_EXPR.
(class operator_lt): Move to range-op-mixed.h.
(lt_op1_op2_relation): Fold into
operator_lt::op1_op2_relation.
(integral_table::integral_table): Remove LT_EXPR.
(pointer_table::pointer_table): Remove LT_EXPR.
* range-op.h (lt_op1_op2_relation): Delete.
Diffstat (limited to 'gcc/range-op-float.cc')
-rw-r--r-- | gcc/range-op-float.cc | 52 |
1 files changed, 15 insertions, 37 deletions
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index ec24167..1b0ac9a 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -779,32 +779,10 @@ operator_not_equal::op1_range (frange &r, tree type, return true; } -class foperator_lt : 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 lt_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_lt; - bool -foperator_lt::fold_range (irange &r, tree type, - const frange &op1, const frange &op2, - relation_trio rel) const +operator_lt::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_LT)) return true; @@ -822,11 +800,11 @@ foperator_lt::fold_range (irange &r, tree type, } bool -foperator_lt::op1_range (frange &r, - tree type, - const irange &lhs, - const frange &op2, - relation_trio) const +operator_lt::op1_range (frange &r, + tree type, + const irange &lhs, + const frange &op2, + relation_trio) const { switch (get_bool_state (r, lhs, type)) { @@ -859,11 +837,11 @@ foperator_lt::op1_range (frange &r, } bool -foperator_lt::op2_range (frange &r, - tree type, - const irange &lhs, - const frange &op1, - relation_trio) const +operator_lt::op2_range (frange &r, + tree type, + const irange &lhs, + const frange &op1, + relation_trio) const { switch (get_bool_state (r, lhs, type)) { @@ -1547,7 +1525,8 @@ public: op1_no_nan.clear_nan (); if (op2.maybe_isnan ()) op2_no_nan.clear_nan (); - if (!fop_lt.fold_range (r, type, op1_no_nan, op2_no_nan, rel)) + if (!range_op_handler (LT_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. @@ -2786,7 +2765,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 (LT_EXPR, fop_lt); set (LE_EXPR, fop_le); set (GT_EXPR, fop_gt); set (GE_EXPR, fop_ge); |