aboutsummaryrefslogtreecommitdiff
path: root/gcc/range-op-float.cc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2023-06-09 13:18:39 -0400
committerAndrew MacLeod <amacleod@redhat.com>2023-06-09 20:33:02 -0400
commit2dbf1e6146e3f0d6d7b4533ca654ad8c4ee03419 (patch)
treeb59d94c57d4996d2b5f52e5985231f4929bb3303 /gcc/range-op-float.cc
parent07767389fb390814d9b6142e9d0341b7b9fd1cc2 (diff)
downloadgcc-2dbf1e6146e3f0d6d7b4533ca654ad8c4ee03419.zip
gcc-2dbf1e6146e3f0d6d7b4533ca654ad8c4ee03419.tar.gz
gcc-2dbf1e6146e3f0d6d7b4533ca654ad8c4ee03419.tar.bz2
Unify EQ_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_equal): Remove. Move prototypes to range-op-mixed.h (operator_equal::fold_range): Rename from foperator_equal. (operator_equal::op1_range): Ditto. (float_table::float_table): Remove EQ_EXPR. * range-op-mixed.h (class operator_equal): Combined from integer and float files. * range-op.cc (op_equal): New object. (unified_table::unified_table): Add EQ_EXPR. (class operator_equal): Move to range-op-mixed.h. (equal_op1_op2_relation): Fold into operator_equal::op1_op2_relation. (integral_table::integral_table): Remove EQ_EXPR. (pointer_table::pointer_table): Remove EQ_EXPR. * range-op.h (equal_op1_op2_relation): Delete.
Diffstat (limited to 'gcc/range-op-float.cc')
-rw-r--r--gcc/range-op-float.cc41
1 files changed, 12 insertions, 29 deletions
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index 8659217..98636ce 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -563,35 +563,18 @@ public:
public:
} fop_identity;
-class foperator_equal : public range_operator
+bool
+operator_equal::op2_range (frange &r, tree type,
+ const irange &lhs, const frange &op1,
+ relation_trio rel) const
{
- 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 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;
- bool op2_range (frange &r, tree type,
- const irange &lhs, const frange &op1,
- relation_trio rel = TRIO_VARYING) const final override
- {
- return op1_range (r, type, lhs, op1, rel.swap_op1_op2 ());
- }
-} fop_equal;
+ return op1_range (r, type, lhs, op1, rel.swap_op1_op2 ());
+}
bool
-foperator_equal::fold_range (irange &r, tree type,
- const frange &op1, const frange &op2,
- relation_trio rel) const
+operator_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_EQ))
return true;
@@ -644,7 +627,7 @@ foperator_equal::fold_range (irange &r, tree type,
}
bool
-foperator_equal::op1_range (frange &r, tree type,
+operator_equal::op1_range (frange &r, tree type,
const irange &lhs,
const frange &op2,
relation_trio trio) const
@@ -2021,7 +2004,8 @@ public:
op1_no_nan.clear_nan ();
if (op2.maybe_isnan ())
op2_no_nan.clear_nan ();
- if (!fop_equal.fold_range (r, type, op1_no_nan, op2_no_nan, rel))
+ if (!range_op_handler (EQ_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.
@@ -2819,7 +2803,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 (EQ_EXPR, fop_equal);
set (NE_EXPR, fop_not_equal);
set (LT_EXPR, fop_lt);
set (LE_EXPR, fop_le);