public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1725] Move operator_max to the unified range-op table.
@ 2023-06-12 15:32 Andrew Macleod
  0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2023-06-12 15:32 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f0278eb04fbd4ebb4efe811e0e1885b1150673db

commit r14-1725-gf0278eb04fbd4ebb4efe811e0e1885b1150673db
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Sat Jun 10 16:10:54 2023 -0400

    Move operator_max to the unified range-op table.
    
    Also remove the integral table.
    
            * range-op-mixed.h (class operator_max): Move from...
            * range-op.cc (unified_table::unified_table): Add MAX_EXPR.
            (get_op_handler): Remove the integral table.
            (class operator_max): Move from here.
            (integral_table::integral_table): Delete.
            * range-op.h (class integral_table): Delete.

Diff:
---
 gcc/range-op-mixed.h | 10 ++++++++++
 gcc/range-op.cc      | 34 ++++++++--------------------------
 gcc/range-op.h       |  9 ---------
 3 files changed, 18 insertions(+), 35 deletions(-)

diff --git a/gcc/range-op-mixed.h b/gcc/range-op-mixed.h
index 7bd9b5e1129..cd137acd0e6 100644
--- a/gcc/range-op-mixed.h
+++ b/gcc/range-op-mixed.h
@@ -607,4 +607,14 @@ private:
 		const wide_int &rh_ub) const final override;
 };
 
+class operator_max : public range_operator
+{
+public:
+  void update_bitmask (irange &r, const irange &lh,
+      const irange &rh) 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 a777fb0d8a3..e83f627a722 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -49,7 +49,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-ssa-ccp.h"
 #include "range-op-mixed.h"
 
-integral_table integral_tree_table;
 pointer_table pointer_tree_table;
 
 // Instantiate a range_op_table for unified operations.
@@ -81,6 +80,7 @@ operator_bitwise_xor op_bitwise_xor;
 operator_bitwise_and op_bitwise_and;
 operator_bitwise_or op_bitwise_or;
 operator_min op_min;
+operator_max op_max;
 
 // Invoke the initialization routines for each class of range.
 
@@ -121,6 +121,7 @@ unified_table::unified_table ()
   set (BIT_AND_EXPR, op_bitwise_and);
   set (BIT_IOR_EXPR, op_bitwise_or);
   set (MIN_EXPR, op_min);
+  set (MAX_EXPR, op_max);
 }
 
 // The tables are hidden and accessed via a simple extern function.
@@ -132,16 +133,7 @@ get_op_handler (enum tree_code code, tree type)
   if (POINTER_TYPE_P (type) && pointer_tree_table[code])
     return pointer_tree_table[code];
 
-  if (unified_tree_table[code])
-    {
-      // Should not be in any other table if it is in the unified table.
-      gcc_checking_assert (!integral_tree_table[code]);
-      return unified_tree_table[code];
-    }
-
-  if (INTEGRAL_TYPE_P (type))
-    return integral_tree_table[code];
-  return NULL;
+  return unified_tree_table[code];
 }
 
 range_op_handler::range_op_handler ()
@@ -2001,17 +1993,12 @@ operator_min::wi_fold (irange &r, tree type,
 }
 
 
-class operator_max : public range_operator
+void
+operator_max::update_bitmask (irange &r, const irange &lh,
+			      const irange &rh) const
 {
-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;
-  void update_bitmask (irange &r, const irange &lh, const irange &rh) const
-    { update_known_bitmask (r, MAX_EXPR, lh, rh); }
-} op_max;
+  update_known_bitmask (r, MAX_EXPR, lh, rh);
+}
 
 void
 operator_max::wi_fold (irange &r, tree type,
@@ -4529,11 +4516,6 @@ pointer_or_operator::wi_fold (irange &r, tree type,
     r.set_varying (type);
 }
 \f
-integral_table::integral_table ()
-{
-  set (MAX_EXPR, op_max);
-}
-
 // Initialize any integral operators to the primary table
 
 void
diff --git a/gcc/range-op.h b/gcc/range-op.h
index 0f5ee41f96c..08c51bace40 100644
--- a/gcc/range-op.h
+++ b/gcc/range-op.h
@@ -299,15 +299,6 @@ range_op_table::set (enum tree_code code, range_operator &op)
   m_range_tree[code] = &op;
 }
 
-// This holds the range op tables
-
-class integral_table : public range_op_table
-{
-public:
-  integral_table ();
-};
-extern integral_table integral_tree_table;
-
 // Instantiate a range op table for pointer operations.
 
 class pointer_table : public range_op_table

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-12 15:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 15:32 [gcc r14-1725] Move operator_max to the unified range-op table 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).