aboutsummaryrefslogtreecommitdiff
path: root/gcc/range-op-float.cc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2023-06-09 13:32:25 -0400
committerAndrew MacLeod <amacleod@redhat.com>2023-06-09 20:33:02 -0400
commitf544e7e8a1897b4ddf2ae21c53f9284356373618 (patch)
tree6171590064f2872b0cfc2eb183c0eff62412a23c /gcc/range-op-float.cc
parentd251d14ccd2814920f817a96b691e38c10cc8854 (diff)
downloadgcc-f544e7e8a1897b4ddf2ae21c53f9284356373618.zip
gcc-f544e7e8a1897b4ddf2ae21c53f9284356373618.tar.gz
gcc-f544e7e8a1897b4ddf2ae21c53f9284356373618.tar.bz2
Unify GT_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_gt): Remove. Move prototypes to range-op-mixed.h (operator_gt::fold_range): Rename from foperator_gt. (operator_gt::op1_range): Ditto. (float_table::float_table): Remove GT_EXPR. * range-op-mixed.h (class operator_gt): Combined from integer and float files. * range-op.cc (op_gt): New object. (unified_table::unified_table): Add GT_EXPR. (class operator_gt): Move to range-op-mixed.h. (gt_op1_op2_relation): Fold into operator_gt::op1_op2_relation. (integral_table::integral_table): Remove GT_EXPR. (pointer_table::pointer_table): Remove GT_EXPR. * range-op.h (gt_op1_op2_relation): Delete.
Diffstat (limited to 'gcc/range-op-float.cc')
-rw-r--r--gcc/range-op-float.cc52
1 files changed, 15 insertions, 37 deletions
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index a480f16..2f090e7 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -961,32 +961,10 @@ operator_le::op2_range (frange &r,
return true;
}
-class foperator_gt : 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 gt_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_gt;
-
bool
-foperator_gt::fold_range (irange &r, tree type,
- const frange &op1, const frange &op2,
- relation_trio rel) const
+operator_gt::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_GT))
return true;
@@ -1004,11 +982,11 @@ foperator_gt::fold_range (irange &r, tree type,
}
bool
-foperator_gt::op1_range (frange &r,
- tree type,
- const irange &lhs,
- const frange &op2,
- relation_trio) const
+operator_gt::op1_range (frange &r,
+ tree type,
+ const irange &lhs,
+ const frange &op2,
+ relation_trio) const
{
switch (get_bool_state (r, lhs, type))
{
@@ -1043,11 +1021,11 @@ foperator_gt::op1_range (frange &r,
}
bool
-foperator_gt::op2_range (frange &r,
- tree type,
- const irange &lhs,
- const frange &op1,
- relation_trio) const
+operator_gt::op2_range (frange &r,
+ tree type,
+ const irange &lhs,
+ const frange &op1,
+ relation_trio) const
{
switch (get_bool_state (r, lhs, type))
{
@@ -1723,7 +1701,8 @@ public:
op1_no_nan.clear_nan ();
if (op2.maybe_isnan ())
op2_no_nan.clear_nan ();
- if (!fop_gt.fold_range (r, type, op1_no_nan, op2_no_nan, rel))
+ if (!range_op_handler (GT_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.
@@ -2744,7 +2723,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 (GT_EXPR, fop_gt);
set (GE_EXPR, fop_ge);
set (ABS_EXPR, fop_abs);