diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2024-03-20 07:50:11 +0100 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2024-05-04 10:25:50 +0200 |
commit | e7b6e9663e9b31e681fb0302338bcb4bb306a334 (patch) | |
tree | 8dd0951e6d30d76a678490335f1deb611b19654a | |
parent | 31377eed515506c9e8ba2ac8fa3ab4e743f8c1f3 (diff) | |
download | gcc-e7b6e9663e9b31e681fb0302338bcb4bb306a334.zip gcc-e7b6e9663e9b31e681fb0302338bcb4bb306a334.tar.gz gcc-e7b6e9663e9b31e681fb0302338bcb4bb306a334.tar.bz2 |
Implement operator_identity for prange.
gcc/ChangeLog:
* range-op-mixed.h: Add overloaded declarations for fold_range, op1_range,
lhs_op1_relation, pointers_handled_p.
* range-op-ptr.cc (operator_identity::fold_range): New.
(operator_identity::lhs_op1_relation): New.
(operator_identity::op1_range): New.
(operator_identity::pointers_handled_p): New.
-rw-r--r-- | gcc/range-op-mixed.h | 10 | ||||
-rw-r--r-- | gcc/range-op-ptr.cc | 47 |
2 files changed, 57 insertions, 0 deletions
diff --git a/gcc/range-op-mixed.h b/gcc/range-op-mixed.h index 8163a4b..60aaea9 100644 --- a/gcc/range-op-mixed.h +++ b/gcc/range-op-mixed.h @@ -349,18 +349,28 @@ 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 ATTRIBUTE_UNUSED, const frange &op1, const frange &op2 ATTRIBUTE_UNUSED, relation_trio = TRIO_VARYING) const final override; bool op1_range (irange &r, tree type, const irange &lhs, const irange &op2, relation_trio rel = TRIO_VARYING) const final override; + bool op1_range (prange &r, tree type, + const prange &lhs, const prange &op2, + relation_trio rel = TRIO_VARYING) const final override; bool op1_range (frange &r, tree type ATTRIBUTE_UNUSED, const frange &lhs, const frange &op2 ATTRIBUTE_UNUSED, relation_trio = TRIO_VARYING) const final override; relation_kind lhs_op1_relation (const irange &lhs, const irange &op1, const irange &op2, relation_kind rel) const final override; + relation_kind lhs_op1_relation (const prange &lhs, + const prange &op1, const prange &op2, + relation_kind rel) const final override; + bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override; }; class operator_cst : public range_operator diff --git a/gcc/range-op-ptr.cc b/gcc/range-op-ptr.cc index 560c798..08419bf 100644 --- a/gcc/range-op-ptr.cc +++ b/gcc/range-op-ptr.cc @@ -636,6 +636,53 @@ public: } } op_hybrid_max; +bool +operator_identity::fold_range (prange &r, tree type ATTRIBUTE_UNUSED, + const prange &lh ATTRIBUTE_UNUSED, + const prange &rh ATTRIBUTE_UNUSED, + relation_trio) const +{ + r = lh; + return true; +} + +relation_kind +operator_identity::lhs_op1_relation (const prange &lhs, + const prange &op1 ATTRIBUTE_UNUSED, + const prange &op2 ATTRIBUTE_UNUSED, + relation_kind) const +{ + if (lhs.undefined_p ()) + return VREL_VARYING; + // Simply a copy, so they are equivalent. + return VREL_EQ; +} + +bool +operator_identity::op1_range (prange &r, tree type ATTRIBUTE_UNUSED, + const prange &lhs, + const prange &op2 ATTRIBUTE_UNUSED, + relation_trio) const +{ + r = lhs; + return true; +} + +bool +operator_identity::pointers_handled_p (range_op_dispatch_type type, + unsigned dispatch) const +{ + switch (type) + { + case DISPATCH_FOLD_RANGE: + case DISPATCH_OP1_RANGE: + case DISPATCH_LHS_OP1_RELATION: + return dispatch == RO_PPP; + default: + return true; + } +} + // Initialize any pointer operators to the primary table void |