From b565ac19264a5827162d28537bccc8531c25e817 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 13 Oct 2022 18:03:58 -0400 Subject: 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. --- gcc/gimple-range-fold.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc/gimple-range-fold.cc') diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc index c381ef9..f919237 100644 --- a/gcc/gimple-range-fold.cc +++ b/gcc/gimple-range-fold.cc @@ -578,7 +578,8 @@ fold_using_range::range_of_range_op (vrange &r, fputc ('\n', dump_file); } // Fold range, and register any dependency if available. - if (!handler.fold_range (r, type, range1, range2, rel)) + if (!handler.fold_range (r, type, range1, range2, + relation_trio::op1_op2 (rel))) r.set_varying (type); if (irange::supports_p (type)) relation_fold_and_or (as_a (r), s, src); @@ -597,7 +598,7 @@ fold_using_range::range_of_range_op (vrange &r, } if (gimple_range_ssa_p (op2)) { - rel= handler.lhs_op2_relation (r, range1, range2, rel); + rel = handler.lhs_op2_relation (r, range1, range2, rel); if (rel != VREL_VARYING) src.register_relation (s, rel, lhs, op2); } -- cgit v1.1