aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2024-03-20 07:55:57 +0100
committerAldy Hernandez <aldyh@redhat.com>2024-05-04 10:25:50 +0200
commita91fd7b4342dbeaf1d2514beaee3af0bb5680b81 (patch)
tree19064d48d855edbdf0a419c97eccc55db142262d
parente7b6e9663e9b31e681fb0302338bcb4bb306a334 (diff)
downloadgcc-a91fd7b4342dbeaf1d2514beaee3af0bb5680b81.zip
gcc-a91fd7b4342dbeaf1d2514beaee3af0bb5680b81.tar.gz
gcc-a91fd7b4342dbeaf1d2514beaee3af0bb5680b81.tar.bz2
Implement operator_cst for prange.
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.
-rw-r--r--gcc/range-op-mixed.h4
-rw-r--r--gcc/range-op-ptr.cc23
2 files changed, 27 insertions, 0 deletions
diff --git a/gcc/range-op-mixed.h b/gcc/range-op-mixed.h
index 60aaea9..04c8acb 100644
--- a/gcc/range-op-mixed.h
+++ b/gcc/range-op-mixed.h
@@ -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;
};
diff --git a/gcc/range-op-ptr.cc b/gcc/range-op-ptr.cc
index 08419bf..e59e278 100644
--- a/gcc/range-op-ptr.cc
+++ b/gcc/range-op-ptr.cc
@@ -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