This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Subcodes for OMP_CLAUSE_*. C++ version.
- From: Diego Novillo <dnovillo at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, Richard Henderson <rth at redhat dot com>
- Date: Thu, 26 Jan 2006 16:04:02 -0500
- Subject: Subcodes for OMP_CLAUSE_*. C++ version.
I will need this after merging mainline into gomp. This adapts the C++
bits to use the new OMP_CLAUSE_* subcodes. OK for gomp?
Tested on x86.
2006-01-26 Diego Novillo <dnovillo@redhat.com>
* cp-tree.h (CP_OMP_CLAUSE_INFO): Use TREE_TYPE instead
of TREE_BLOCK.
* pt.c: Use OMP_CLAUSE_CODE and OMP_CLAUSE_OPERAND
instead of TREE_CODE/TREE_OPERAND.
* semantics.c: Likewise.
* parser.c: Likewise.
Index: cp-tree.h
===================================================================
--- cp-tree.h (revision 110255)
+++ cp-tree.h (working copy)
@@ -2972,8 +2972,8 @@ extern void decl_shadowed_for_var_insert
hold code (or code fragments) related to ctors, dtors, and op=.
See semantics.c for details. */
#define CP_OMP_CLAUSE_INFO(NODE) \
- TREE_BLOCK (TREE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \
- OMP_CLAUSE_COPYPRIVATE))
+ TREE_TYPE (OMP_CLAUSE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \
+ OMP_CLAUSE_COPYPRIVATE))
/* These macros provide convenient access to the various _STMT nodes
created when parsing template declarations. */
Index: pt.c
===================================================================
--- pt.c (revision 110255)
+++ pt.c (working copy)
@@ -8113,7 +8113,7 @@ tsubst_omp_clauses (tree clauses, tree a
OMP_CLAUSE_CHAIN (nc) = new_clauses;
new_clauses = nc;
- switch (TREE_CODE (nc))
+ switch (OMP_CLAUSE_CODE (nc))
{
case OMP_CLAUSE_PRIVATE:
case OMP_CLAUSE_SHARED:
@@ -8125,8 +8125,8 @@ tsubst_omp_clauses (tree clauses, tree a
case OMP_CLAUSE_IF:
case OMP_CLAUSE_NUM_THREADS:
case OMP_CLAUSE_SCHEDULE:
- TREE_OPERAND (nc, 0)
- = tsubst_expr (TREE_OPERAND (oc, 0), args, complain, in_decl);
+ OMP_CLAUSE_OPERAND (nc, 0)
+ = tsubst_expr (OMP_CLAUSE_OPERAND (oc, 0), args, complain, in_decl);
break;
case OMP_CLAUSE_NOWAIT:
case OMP_CLAUSE_ORDERED:
Index: semantics.c
===================================================================
--- semantics.c (revision 110255)
+++ semantics.c (working copy)
@@ -3245,7 +3242,7 @@ finish_omp_clauses (tree clauses)
{
bool remove = false;
- switch (TREE_CODE (c))
+ switch (OMP_CLAUSE_CODE (c))
{
case OMP_CLAUSE_SHARED:
name = "shared";
@@ -3371,7 +3368,7 @@ finish_omp_clauses (tree clauses)
for (pc = &clauses, c = clauses; c ; c = *pc)
{
- enum tree_code c_kind = TREE_CODE (c);
+ enum tree_code c_kind = OMP_CLAUSE_CODE (c);
bool remove = false;
bool need_complete_non_reference = false;
bool need_default_ctor = false;
Index: parser.c
===================================================================
--- parser.c (revision 110255)
+++ parser.c (working copy)
@@ -17688,7 +17691,7 @@ check_no_duplicate_clause (tree clauses,
tree c;
for (c = clauses; c ; c = OMP_CLAUSE_CHAIN (c))
- if (TREE_CODE (c) == code)
+ if (OMP_CLAUSE_CODE (c) == code)
{
error ("too many %qs clauses", name);
break;
@@ -17710,7 +17713,7 @@ check_no_duplicate_clause (tree clauses,
return the list created. */
static tree
-cp_parser_omp_var_list_no_open (cp_parser *parser, enum tree_code kind,
+cp_parser_omp_var_list_no_open (cp_parser *parser, enum omp_clause_code kind,
tree list)
{
while (1)
@@ -17729,7 +17732,7 @@ cp_parser_omp_var_list_no_open (cp_parse
cp_parser_name_lookup_error (parser, name, decl, NULL);
else if (kind != 0)
{
- tree u = make_node (kind);
+ tree u = build_omp_clause (kind);
OMP_CLAUSE_DECL (u) = decl;
OMP_CLAUSE_CHAIN (u) = list;
list = u;
@@ -17765,7 +17768,7 @@ cp_parser_omp_var_list_no_open (cp_parse
common case for omp clauses. */
static tree
-cp_parser_omp_var_list (cp_parser *parser, enum tree_code kind, tree list)
+cp_parser_omp_var_list (cp_parser *parser, enum omp_clause_code kind, tree list)
{
if (cp_parser_require (parser, CPP_OPEN_PAREN, "`('"))
return cp_parser_omp_var_list_no_open (parser, kind, list);
@@ -17823,7 +17826,7 @@ cp_parser_omp_clause_default (cp_parser
return list;
check_no_duplicate_clause (list, OMP_CLAUSE_DEFAULT, "default");
- c = make_node (OMP_CLAUSE_DEFAULT);
+ c = build_omp_clause (OMP_CLAUSE_DEFAULT);
OMP_CLAUSE_CHAIN (c) = list;
OMP_CLAUSE_DEFAULT_KIND (c) = kind;
@@ -17851,7 +17854,7 @@ cp_parser_omp_clause_if (cp_parser *pars
check_no_duplicate_clause (list, OMP_CLAUSE_IF, "if");
- c = make_node (OMP_CLAUSE_IF);
+ c = build_omp_clause (OMP_CLAUSE_IF);
OMP_CLAUSE_IF_EXPR (c) = t;
OMP_CLAUSE_CHAIN (c) = list;
@@ -17868,7 +17871,7 @@ cp_parser_omp_clause_nowait (cp_parser *
check_no_duplicate_clause (list, OMP_CLAUSE_NOWAIT, "nowait");
- c = make_node (OMP_CLAUSE_NOWAIT);
+ c = build_omp_clause (OMP_CLAUSE_NOWAIT);
OMP_CLAUSE_CHAIN (c) = list;
return c;
}
@@ -17894,7 +17897,7 @@ cp_parser_omp_clause_num_threads (cp_par
check_no_duplicate_clause (list, OMP_CLAUSE_NUM_THREADS, "num_threads");
- c = make_node (OMP_CLAUSE_NUM_THREADS);
+ c = build_omp_clause (OMP_CLAUSE_NUM_THREADS);
OMP_CLAUSE_NUM_THREADS_EXPR (c) = t;
OMP_CLAUSE_CHAIN (c) = list;
@@ -17911,7 +17914,7 @@ cp_parser_omp_clause_ordered (cp_parser
check_no_duplicate_clause (list, OMP_CLAUSE_ORDERED, "ordered");
- c = make_node (OMP_CLAUSE_ORDERED);
+ c = build_omp_clause (OMP_CLAUSE_ORDERED);
OMP_CLAUSE_CHAIN (c) = list;
return c;
}
@@ -17993,7 +17996,7 @@ cp_parser_omp_clause_schedule (cp_parser
if (!cp_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
return list;
- c = make_node (OMP_CLAUSE_SCHEDULE);
+ c = build_omp_clause (OMP_CLAUSE_SCHEDULE);
if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
{
@@ -18082,8 +18085,7 @@ cp_parser_omp_all_clauses (cp_parser *pa
switch (c_kind)
{
case PRAGMA_OMP_CLAUSE_COPYIN:
- clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE_COPYIN,
- clauses);
+ clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE_COPYIN, clauses);
c_name = "copyin";
break;
case PRAGMA_OMP_CLAUSE_COPYPRIVATE: