public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1678] Unify ABS_EXPR range operator
@ 2023-06-10 0:34 Andrew Macleod
0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2023-06-10 0:34 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a1aaaff33a79d1b7613fbf8a17b51321a135f19c
commit r14-1678-ga1aaaff33a79d1b7613fbf8a17b51321a135f19c
Author: Andrew MacLeod <amacleod@redhat.com>
Date: Fri Jun 9 13:42:08 2023 -0400
Unify ABS_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_abs): Remove. Move prototypes
to range-op-mixed.h
(operator_abs::fold_range): Rename from foperator_abs.
(operator_abs::op1_range): Ditto.
(float_table::float_table): Remove ABS_EXPR.
* range-op-mixed.h (class operator_abs): Combined from integer
and float files.
* range-op.cc (op_abs): New object.
(unified_table::unified_table): Add ABS_EXPR.
(class operator_abs): Move to range-op-mixed.h.
(integral_table::integral_table): Remove ABS_EXPR.
(pointer_table::pointer_table): Remove ABS_EXPR.
Diff:
---
gcc/range-op-float.cc | 26 ++++++--------------------
gcc/range-op-mixed.h | 21 +++++++++++++++++++++
gcc/range-op.cc | 18 ++----------------
3 files changed, 29 insertions(+), 36 deletions(-)
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index bd1b79281d0..2b177c3d683 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -1341,23 +1341,10 @@ public:
}
} fop_negate;
-class foperator_abs : public range_operator
-{
- using range_operator::fold_range;
- using range_operator::op1_range;
-public:
- bool fold_range (frange &r, tree type,
- const frange &op1, const frange &,
- relation_trio = TRIO_VARYING) const final override;
- bool op1_range (frange &r, tree type,
- const frange &lhs, const frange &op2,
- relation_trio rel = TRIO_VARYING) const final override;
-} fop_abs;
-
bool
-foperator_abs::fold_range (frange &r, tree type,
- const frange &op1, const frange &op2,
- relation_trio) const
+operator_abs::fold_range (frange &r, tree type,
+ const frange &op1, const frange &op2,
+ relation_trio) const
{
if (empty_range_varying (r, type, op1, op2))
return true;
@@ -1405,9 +1392,9 @@ foperator_abs::fold_range (frange &r, tree type,
}
bool
-foperator_abs::op1_range (frange &r, tree type,
- const frange &lhs, const frange &op2,
- relation_trio) const
+operator_abs::op1_range (frange &r, tree type,
+ const frange &lhs, const frange &op2,
+ relation_trio) const
{
if (empty_range_varying (r, type, lhs, op2))
return true;
@@ -2691,7 +2678,6 @@ private:
float_table::float_table ()
{
- set (ABS_EXPR, fop_abs);
set (NEGATE_EXPR, fop_negate);
set (MINUS_EXPR, fop_minus);
set (MULT_EXPR, fop_mult);
diff --git a/gcc/range-op-mixed.h b/gcc/range-op-mixed.h
index fbfe3f825a3..a942808ff91 100644
--- a/gcc/range-op-mixed.h
+++ b/gcc/range-op-mixed.h
@@ -367,4 +367,25 @@ private:
const REAL_VALUE_TYPE &rh_lb, const REAL_VALUE_TYPE &rh_ub,
relation_kind) const final override;
};
+
+class operator_abs : public range_operator
+{
+ public:
+ using range_operator::fold_range;
+ using range_operator::op1_range;
+ bool fold_range (frange &r, tree type,
+ const frange &op1, const frange &,
+ relation_trio = TRIO_VARYING) const final override;
+
+ bool op1_range (irange &r, tree type, const irange &lhs,
+ const irange &op2, relation_trio) const final override;
+ bool op1_range (frange &r, tree type,
+ const frange &lhs, const frange &op2,
+ relation_trio rel = TRIO_VARYING) const final override;
+private:
+ void wi_fold (irange &r, tree type, const wide_int &lh_lb,
+ const wide_int &lh_ub, const wide_int &rh_lb,
+ const wide_int &rh_ub) const final override;
+
+};
#endif // GCC_RANGE_OP_MIXED_H
diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index 1dc5c38ef63..b4cdaf5af8b 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -72,6 +72,7 @@ operator_identity op_ident;
operator_cst op_cst;
operator_cast op_cast;
operator_plus op_plus;
+operator_abs op_abs;
// Invoke the initialization routines for each class of range.
@@ -95,6 +96,7 @@ unified_table::unified_table ()
set (NOP_EXPR, op_cast);
set (CONVERT_EXPR, op_cast);
set (PLUS_EXPR, op_plus);
+ set (ABS_EXPR, op_abs);
}
// The tables are hidden and accessed via a simple extern function.
@@ -4249,21 +4251,6 @@ operator_unknown::fold_range (irange &r, tree type,
}
-class operator_abs : public range_operator
-{
- using range_operator::op1_range;
- public:
- virtual void wi_fold (irange &r, tree type,
- const wide_int &lh_lb,
- const wide_int &lh_ub,
- const wide_int &rh_lb,
- const wide_int &rh_ub) const;
- virtual bool op1_range (irange &r, tree type,
- const irange &lhs,
- const irange &op2,
- relation_trio) const;
-} op_abs;
-
void
operator_abs::wi_fold (irange &r, tree type,
const wide_int &lh_lb, const wide_int &lh_ub,
@@ -4703,7 +4690,6 @@ integral_table::integral_table ()
set (BIT_IOR_EXPR, op_bitwise_or);
set (BIT_XOR_EXPR, op_bitwise_xor);
set (BIT_NOT_EXPR, op_bitwise_not);
- set (ABS_EXPR, op_abs);
set (NEGATE_EXPR, op_negate);
set (ADDR_EXPR, op_addr);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-10 0:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-10 0:34 [gcc r14-1678] Unify ABS_EXPR range operator Andrew Macleod
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).