]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Move operator_bitwise_or to the unified range-op table.
authorAndrew MacLeod <amacleod@redhat.com>
Sat, 10 Jun 2023 20:05:33 +0000 (16:05 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Mon, 12 Jun 2023 14:48:30 +0000 (10:48 -0400)
* range-op-mixed.h (class operator_bitwise_or): Move from...
* range-op.cc (unified_table::unified_table): Add BIT_IOR_EXPR.
(class operator_bitwise_or): Move from here.
(integral_table::integral_table): Remove BIT_IOR_EXPR.

gcc/range-op-mixed.h
gcc/range-op.cc

index b3d51f8a54ef56a34ea36b8fd52a66bea1c8727a..8a11d61220cc1940bf14a5cd3f9f6c2537847bd5 100644 (file)
@@ -577,4 +577,23 @@ private:
                                const irange &op2) const;
 };
 
+class operator_bitwise_or : public range_operator
+{
+public:
+  using range_operator::op1_range;
+  using range_operator::op2_range;
+  bool op1_range (irange &r, tree type,
+                 const irange &lhs, const irange &op2,
+                 relation_trio rel = TRIO_VARYING) const final override;
+  bool op2_range (irange &r, tree type,
+                 const irange &lhs, const irange &op1,
+                 relation_trio rel = TRIO_VARYING) const final override;
+  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
index 57bd95a11515c5144047f9b2fa0209eb2899b11f..07e0c88e2099e6e10c8c637aa54d55a8e25b02e1 100644 (file)
@@ -79,6 +79,7 @@ operator_addr_expr op_addr;
 operator_bitwise_not op_bitwise_not;
 operator_bitwise_xor op_bitwise_xor;
 operator_bitwise_and op_bitwise_and;
+operator_bitwise_or op_bitwise_or;
 
 // Invoke the initialization routines for each class of range.
 
@@ -117,6 +118,7 @@ unified_table::unified_table ()
   // implementation.  These also remain in the pointer table until a pointer
   // speifc version is provided.
   set (BIT_AND_EXPR, op_bitwise_and);
+  set (BIT_IOR_EXPR, op_bitwise_or);
 }
 
 // The tables are hidden and accessed via a simple extern function.
@@ -3608,27 +3610,12 @@ operator_logical_or::op2_range (irange &r, tree type,
 }
 
 
-class operator_bitwise_or : public range_operator
+void
+operator_bitwise_or::update_bitmask (irange &r, const irange &lh,
+                                    const irange &rh) const
 {
-  using range_operator::op1_range;
-  using range_operator::op2_range;
-public:
-  virtual bool op1_range (irange &r, tree type,
-                         const irange &lhs,
-                         const irange &op2,
-                         relation_trio rel = TRIO_VARYING) const;
-  virtual bool op2_range (irange &r, tree type,
-                         const irange &lhs,
-                         const irange &op1,
-                         relation_trio rel = TRIO_VARYING) const;
-  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, BIT_IOR_EXPR, lh, rh); }
-} op_bitwise_or;
+  update_known_bitmask (r, BIT_IOR_EXPR, lh, rh);
+}
 
 void
 operator_bitwise_or::wi_fold (irange &r, tree type,
@@ -4549,7 +4536,6 @@ integral_table::integral_table ()
 {
   set (MIN_EXPR, op_min);
   set (MAX_EXPR, op_max);
-  set (BIT_IOR_EXPR, op_bitwise_or);
 }
 
 // Initialize any integral operators to the primary table