diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2022-10-13 18:03:58 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2022-10-17 09:20:39 -0400 |
commit | b565ac19264a5827162d28537bccc8531c25e817 (patch) | |
tree | 52a1122cf961dd409f02c3eb5c34811ed5e1f3e7 /gcc/range-op.h | |
parent | 04874fedae8074b252abbd70fea68bf3dd0a605b (diff) | |
download | gcc-b565ac19264a5827162d28537bccc8531c25e817.zip gcc-b565ac19264a5827162d28537bccc8531c25e817.tar.gz gcc-b565ac19264a5827162d28537bccc8531c25e817.tar.bz2 |
Add relation_trio class for range-ops.
There are 3 possible relations range-ops might care about, but only the one
most likely to be needed is supplied. This patch provides a new class
relation_trio which allows 3 relations to be passed in a single word.
fold_range (), op1_range (), and op2_range () are adjusted to take a
relation_trio class instead of a relation_kind, then the routine can
extract which relation it wants to work with.
* gimple-range-fold.cc (fold_using_range::range_of_range_op):
Provide relation_trio class.
* gimple-range-gori.cc (gori_compute::refine_using_relation):
Provide relation_trio class.
(gori_compute::refine_using_relation): Ditto.
(gori_compute::compute_operand1_range): Provide lhs_op2 and
op1_op2 relations via relation_trio class.
(gori_compute::compute_operand2_range): Ditto.
* gimple-range-op.cc (gimple_range_op_handler::calc_op1): Use
relation_trio instead of relation_kind.
(gimple_range_op_handler::calc_op2): Ditto.
(*::fold_range): Ditto.
* gimple-range-op.h (gimple_range_op::calc_op1): Adjust prototypes.
(gimple_range_op::calc_op2): Adjust prototypes.
* range-op-float.cc (*::fold_range): Use relation_trio instead of
relation_kind.
(*::op1_range): Ditto.
(*::op2_range): Ditto.
* range-op.cc (*::fold_range): Use relation_trio instead of
relation_kind.
(*::op1_range): Ditto.
(*::op2_range): Ditto.
* range-op.h (class range_operator): Adjust prototypes.
(class range_operator_float): Ditto.
(class range_op_handler): Adjust prototypes.
(relop_early_resolve): Pickup op1_op2 relation from relation_trio.
* value-relation.cc (VREL_LAST): Adjust use to be one past the end of
the enum.
(relation_oracle::validate_relation): Use relation_trio in call
to fold_range.
* value-relation.h (enum relation_kind_t): Add VREL_LAST as
final element.
(class relation_trio): New.
(TRIO_VARYING, TRIO_SHIFT, TRIO_MASK): New.
Diffstat (limited to 'gcc/range-op.h')
-rw-r--r-- | gcc/range-op.h | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/gcc/range-op.h b/gcc/range-op.h index 48adcec..c724989 100644 --- a/gcc/range-op.h +++ b/gcc/range-op.h @@ -53,7 +53,7 @@ public: virtual bool fold_range (irange &r, tree type, const irange &lh, const irange &rh, - relation_kind rel = VREL_VARYING) const; + relation_trio = TRIO_VARYING) const; // Return the range for op[12] in the general case. LHS is the range for // the LHS of the expression, OP[12]is the range for the other @@ -69,11 +69,11 @@ public: virtual bool op1_range (irange &r, tree type, const irange &lhs, const irange &op2, - relation_kind rel = VREL_VARYING) const; + relation_trio = TRIO_VARYING) const; virtual bool op2_range (irange &r, tree type, const irange &lhs, const irange &op1, - relation_kind rel = VREL_VARYING) const; + relation_trio = TRIO_VARYING) const; // The following routines are used to represent relations between the // various operations. If the caller knows where the symbolics are, @@ -116,32 +116,32 @@ public: virtual bool fold_range (frange &r, tree type, const frange &lh, const frange &rh, - relation_kind rel = VREL_VARYING) const; + relation_trio = TRIO_VARYING) const; // Unary operations have the range of the LHS as op2. virtual bool fold_range (irange &r, tree type, const frange &lh, const irange &rh, - relation_kind rel = VREL_VARYING) const; + relation_trio = TRIO_VARYING) const; virtual bool fold_range (irange &r, tree type, const frange &lh, const frange &rh, - relation_kind rel = VREL_VARYING) const; + relation_trio = TRIO_VARYING) const; virtual bool op1_range (frange &r, tree type, const frange &lhs, const frange &op2, - relation_kind rel = VREL_VARYING) const; + relation_trio = TRIO_VARYING) const; virtual bool op1_range (frange &r, tree type, const irange &lhs, const frange &op2, - relation_kind rel = VREL_VARYING) const; + relation_trio = TRIO_VARYING) const; virtual bool op2_range (frange &r, tree type, const frange &lhs, const frange &op1, - relation_kind rel = VREL_VARYING) const; + relation_trio = TRIO_VARYING) const; virtual bool op2_range (frange &r, tree type, const irange &lhs, const frange &op1, - relation_kind rel = VREL_VARYING) const; + relation_trio = TRIO_VARYING) const; virtual relation_kind lhs_op1_relation (const frange &lhs, const frange &op1, @@ -173,15 +173,15 @@ public: bool fold_range (vrange &r, tree type, const vrange &lh, const vrange &rh, - relation_kind rel = VREL_VARYING) const; + relation_trio = TRIO_VARYING) const; bool op1_range (vrange &r, tree type, const vrange &lhs, const vrange &op2, - relation_kind rel = VREL_VARYING) const; + relation_trio = TRIO_VARYING) const; bool op2_range (vrange &r, tree type, const vrange &lhs, const vrange &op1, - relation_kind rel = VREL_VARYING) const; + relation_trio = TRIO_VARYING) const; relation_kind lhs_op1_relation (const vrange &lhs, const vrange &op1, const vrange &op2, @@ -240,9 +240,10 @@ empty_range_varying (vrange &r, tree type, inline bool relop_early_resolve (irange &r, tree type, const vrange &op1, - const vrange &op2, relation_kind rel, + const vrange &op2, relation_trio trio, relation_kind my_rel) { + relation_kind rel = trio.op1_op2 (); // If known relation is a complete subset of this relation, always true. if (relation_union (rel, my_rel) == my_rel) { |