From 82b32adaa7f9cf3be71a9d41d80570b9efb4c2f0 Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Sun, 19 Nov 2023 00:56:47 +0000 Subject: OpenMP: Introduce accessor macros and constructors for context selectors. This patch hides the underlying nested TREE_LIST structure of context selectors behind accessor macros that have more meaningful names than the generic TREE_PURPOSE/TREE_VALUE accessors. There is a slight change to the representation in that the score expression in trait-selectors has a distinguished tag and is separated from the ordinary properties, although internally it is still represented as the first item in the TREE_VALUE of the selector. This patch also renames some local variables with slightly more descriptive names so it is easier to track whether something is a selector-set, selector, or property. gcc/ChangeLog * omp-general.h (OMP_TS_SCORE_NODE): New. (OMP_TSS_ID, OMP_TSS_TRAIT_SELECTORS): New. (OMP_TS_ID, OMP_TS_SCORE, OMP_TS_PROPERTIES): New. (OMP_TP_NAME, OMP_TP_VALUE): New. (make_trait_set_selector): Declare. (make_trait_selector): Declare. (make_trait_property): Declare. (omp_constructor_traits_to_codes): Rename to omp_construct_traits_to_codes. * omp-general.cc (omp_constructor_traits_to_codes): Rename to omp_construct_traits_to_codes. Use new accessors. (omp_check_context_selector): Use new accessors. (make_trait_set_selector): New. (make_trait_selector): New. (make_trait_property): New. (omp_context_name_list_prop): Use new accessors. (omp_context_selector_matches): Use new accessors. (omp_context_selector_props_compare): Use new accessors. (omp_context_selector_set_compare): Use new accessors. (omp_get_context_selector): Use new accessors. (omp_context_compute_score): Use new accessors. * gimplify.cc (omp_construct_selector_matches): Adjust for renaming of omp_constructor_traits_to_codes. gcc/c/ChangeLog * c-parser.cc (c_parser_omp_context_selector): Use new constructors. gcc/cp/ChangeLog * parser.cc (cp_parser_omp_context_selector): Use new constructors. * pt.cc: Include omp-general.h. (tsubst_attribute): Use new context selector accessors and constructors. gcc/fortran/ChangeLog * trans-openmp.cc (gfc_trans_omp_declare_variant): Use new constructors. --- gcc/gimplify.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/gimplify.cc') diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index a6bdcea..f61c8ae 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -14484,8 +14484,8 @@ omp_construct_selector_matches (enum tree_code *constructs, int nconstructs, int variant_nconstructs = 0; if (!target_seen) variant_nconstructs - = omp_constructor_traits_to_codes (TREE_VALUE (attr), - variant_constructs); + = omp_construct_traits_to_codes (TREE_VALUE (attr), + variant_constructs); for (int i = 0; i < variant_nconstructs; i++) { ++cnt; -- cgit v1.1