]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Implement operator_cst for prange.
authorAldy Hernandez <aldyh@redhat.com>
Wed, 20 Mar 2024 06:55:57 +0000 (07:55 +0100)
committerAldy Hernandez <aldyh@redhat.com>
Sat, 4 May 2024 08:25:50 +0000 (10:25 +0200)
gcc/ChangeLog:

* range-op-mixed.h: Add overloaded declarations for pointer variants.
* range-op-ptr.cc (operator_cst::fold_range): New.
(operator_cst::pointers_handled_p): New.

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

index 60aaea9563dc979c48babefd9ddf61363bf60f7a..04c8acbd94a6a75b651d134c2404e798a27da975 100644 (file)
@@ -380,9 +380,13 @@ public:
   bool fold_range (irange &r, tree type,
                   const irange &op1, const irange &op2,
                   relation_trio rel = TRIO_VARYING) const final override;
+  bool fold_range (prange &r, tree type,
+                  const prange &op1, const prange &op2,
+                  relation_trio rel = TRIO_VARYING) const final override;
   bool fold_range (frange &r, tree type,
                   const frange &op1, const frange &op2,
                   relation_trio = TRIO_VARYING) const final override;
+  bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
 };
 
 
index 08419bfc79896d9864666e1918eb1b92a16ab62b..e59e278cbd71a7c9ee5b46a57293d8b59915be84 100644 (file)
@@ -683,6 +683,29 @@ operator_identity::pointers_handled_p (range_op_dispatch_type type,
     }
 }
 
+bool
+operator_cst::fold_range (prange &r, tree type ATTRIBUTE_UNUSED,
+                         const prange &lh,
+                         const prange & ATTRIBUTE_UNUSED,
+                         relation_trio) const
+{
+  r = lh;
+  return true;
+}
+
+bool
+operator_cst::pointers_handled_p (range_op_dispatch_type type,
+                                 unsigned dispatch) const
+{
+  switch (type)
+    {
+    case DISPATCH_FOLD_RANGE:
+      return dispatch == RO_PPP;
+    default:
+      return true;
+    }
+}
+
 // Initialize any pointer operators to the primary table
 
 void