diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2023-11-19 00:56:47 +0000 |
---|---|---|
committer | Sandra Loosemore <sandra@codesourcery.com> | 2023-12-19 20:06:58 +0000 |
commit | 82b32adaa7f9cf3be71a9d41d80570b9efb4c2f0 (patch) | |
tree | c22f35d46cbdd0c04ed059cd84afd7d08593668d /gcc/c/c-parser.cc | |
parent | 1502d724df85163b14b04e8f67072ca88eac411d (diff) | |
download | gcc-82b32adaa7f9cf3be71a9d41d80570b9efb4c2f0.zip gcc-82b32adaa7f9cf3be71a9d41d80570b9efb4c2f0.tar.gz gcc-82b32adaa7f9cf3be71a9d41d80570b9efb4c2f0.tar.bz2 |
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.
Diffstat (limited to 'gcc/c/c-parser.cc')
-rw-r--r-- | gcc/c/c-parser.cc | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index a7dc096..a61381e 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -24386,7 +24386,10 @@ static const char *const omp_user_selectors[] = { trait-selector-name[([trait-score:]trait-property[,trait-property[,...]])] trait-score: - score(score-expression) */ + score(score-expression) + + Note that this function returns a list of trait selectors for the + trait-selector-set SET. */ static tree c_parser_omp_context_selector (c_parser *parser, tree set, tree parms) @@ -24405,6 +24408,7 @@ c_parser_omp_context_selector (c_parser *parser, tree set, tree parms) } tree properties = NULL_TREE; + tree scoreval = NULL_TREE; const char *const *selectors = NULL; bool allow_score = true; bool allow_user = false; @@ -24511,8 +24515,7 @@ c_parser_omp_context_selector (c_parser *parser, tree set, tree parms) error_at (token->location, "score argument must be " "non-negative"); else - properties = tree_cons (get_identifier (" score"), - score, properties); + scoreval = score; } token = c_parser_peek_token (parser); } @@ -24525,7 +24528,8 @@ c_parser_omp_context_selector (c_parser *parser, tree set, tree parms) { t = c_parser_expr_no_commas (parser, NULL).value; if (TREE_CODE (t) == STRING_CST) - properties = tree_cons (NULL_TREE, t, properties); + properties = make_trait_property (NULL_TREE, t, + properties); else if (t != error_mark_node) { mark_exp_read (t); @@ -24536,7 +24540,8 @@ c_parser_omp_context_selector (c_parser *parser, tree set, tree parms) "constant integer expression or string " "literal"); else - properties = tree_cons (NULL_TREE, t, properties); + properties = make_trait_property (NULL_TREE, t, + properties); } else return error_mark_node; @@ -24554,7 +24559,8 @@ c_parser_omp_context_selector (c_parser *parser, tree set, tree parms) { tree prop = c_parser_peek_token (parser)->value; c_parser_consume_token (parser); - properties = tree_cons (prop, NULL_TREE, properties); + properties = make_trait_property (prop, NULL_TREE, + properties); } else { @@ -24582,7 +24588,7 @@ c_parser_omp_context_selector (c_parser *parser, tree set, tree parms) return error_mark_node; } - properties = tree_cons (prop, value, properties); + properties = make_trait_property (prop, value, properties); if (c_parser_next_token_is (parser, CPP_COMMA)) c_parser_consume_token (parser); @@ -24602,7 +24608,8 @@ c_parser_omp_context_selector (c_parser *parser, tree set, tree parms) error_at (token->location, "property must be " "constant integer expression"); else - properties = tree_cons (NULL_TREE, t, properties); + properties = make_trait_property (NULL_TREE, t, + properties); } else return error_mark_node; @@ -24640,7 +24647,7 @@ c_parser_omp_context_selector (c_parser *parser, tree set, tree parms) return error_mark_node; } - ret = tree_cons (selector, properties, ret); + ret = make_trait_selector (selector, scoreval, properties, ret); if (c_parser_next_token_is (parser, CPP_COMMA)) c_parser_consume_token (parser); @@ -24716,7 +24723,7 @@ c_parser_omp_context_selector_specification (c_parser *parser, tree parms) if (selectors == error_mark_node) ret = error_mark_node; else if (ret != error_mark_node) - ret = tree_cons (set, selectors, ret); + ret = make_trait_set_selector (set, selectors, ret); braces.skip_until_found_close (parser); |