+2006-01-25 Diego Novillo <dnovillo@redhat.com>
+
+ * tree.h (TREE_RANGE_CHECK): Fix range predicate.
+ (TREE_BLOCK): Add call to EXPR_CHECK.
+
+2006-01-25 Diego Novillo <dnovillo@redhat.com>
+
+ PR 25886
+ * tree-dump.c (dequeue_and_dump): Handle OMP_CLAUSE.
+ * tree-pretty-print.c (dump_omp_clause): Extract from ...
+ (dump_omp_clauses): ... here.
+ (dump_generic_node): Handle OMP_CLAUSE.
+ * tree.c (omp_clause_num_ops): New.
+ (omp_clause_code_name): New.
+ (tree_code_size): Handle OMP_CLAUSE.
+ (tree_size): Likewise.
+ (make_node): Document handling of OMP_CLAUSE.
+ (tree_node_structure): Handle OMP_CLAUSE.
+ (omp_clause_check_failed): New.
+ (omp_clause_range_check_failed): New.
+ (omp_clause_operand_check_failed): New.
+ (build_omp_clause): New.
+ (walk_tree): Adjust handling of OMP_CLAUSE_* nodes.
+ * tree.h (enum omp_clause_code): Declare.
+ (OMP_CLAUSE_SUBCODE): Define.
+ (OMP_CLAUSE_RANGE_CHECK): Define.
+ (OMP_CLAUSE_ELT_CHECK): Define.
+ (omp_clause_check_failed): Declare.
+ (omp_clause_operand_check_failed): Declare.
+ (omp_clause_range_check_failed): Declare.
+ (OMP_CLAUSE_CHAIN): Do not use TREE_RANGE_CHECK.
+ (OMP_CLAUSE_OPERAND): Use OMP_CLAUSE_RANGE_CHECK.
+ (OMP_CLAUSE_PRIVATE_DEBUG): Use OMP_CLAUSE_SUBCODE_CHECK.
+ (OMP_CLAUSE_LASTPRIVATE): Likewise.
+ (OMP_CLAUSE_IF_EXPR): Likewise.
+ (OMP_CLAUSE_NUM_THREADS_EXPR): Likewise.
+ (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR): Likewise.
+ (OMP_CLAUSE_REDUCTION_CODE): Likewise.
+ (OMP_CLAUSE_REDUCTION_INIT): Likewise.
+ (OMP_CLAUSE_REDUCTION_MERGE): Likewise.
+ (OMP_CLAUSE_REDUCTION_PLACEHOLDER): Likewise.
+ Use tree_node.omp_clause.subcode instead of TREE_COMPLEXITY.
+ (OMP_CLAUSE_SCHEDULE_KIND): Likewise.
+ (OMP_CLAUSE_DEFAULT_KIND): Likewise.
+ (OMP_CLAUSE_CODE): Define.
+ (OMP_CLAUSE_SET_CODE): Define.
+ (OMP_CLAUSE_CODE): Define.
+ (OMP_CLAUSE_OPERAND): Define.
+ (struct tree_omp_clause): Declare.
+ (union tree_node): Add field 'omp_clause'.
+ * treestruct.def (TS_OMP_CLAUSE): Define.
+ * tree.def (OMP_CLAUSE_PRIVATE, OMP_CLAUSE_SHARED
+ OMP_CLAUSE_FIRSTPRIVATE, OMP_CLAUSE_LASTPRIVATE,
+ OMP_CLAUSE_REDUCTION, OMP_CLAUSE_COPYIN,
+ OMP_CLAUSE_COPYPRIVATE, OMP_CLAUSE_IF,
+ OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE,
+ OMP_CLAUSE_NOWAIT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_DEFAULT): Remove.
+ (OMP_CLAUSE): Define.
+ * print-tree.c (print_node): Handle OMP_CLAUSE.
+ * omp-low.c: Adapt all uses of OMP_CLAUSE_* nodes.
+ * c-typeck.c: Likewise.
+ * gimplify.c: Likewise.
+ * c-omp.c: Likewise.
+ * tree-nested.c: Likewise.
+ * tree-inline.c: Likewise.
+ * c-parser.c: Likewise.
+ * gimple-low.c (lower_omp_directive): Do not set TREE_BLOCK on
+ clauses.
+
2006-01-25 Roger Sayle <roger@eyesopen.com>
PR rtl-optimization/25703
tree next;
*par_clauses = NULL;
- *ws_clauses = make_node (OMP_CLAUSE_NOWAIT);
+ *ws_clauses = build_omp_clause (OMP_CLAUSE_NOWAIT);
for (; clauses ; clauses = next)
{
next = OMP_CLAUSE_CHAIN (clauses);
- switch (TREE_CODE (clauses))
+ switch (OMP_CLAUSE_CODE (clauses))
{
case OMP_CLAUSE_PRIVATE:
case OMP_CLAUSE_SHARED:
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;
return the list created. */
static tree
-c_parser_omp_variable_list (c_parser *parser, enum tree_code kind, tree list)
+c_parser_omp_variable_list (c_parser *parser, enum omp_clause_code kind,
+ tree list)
{
if (c_parser_next_token_is_not (parser, CPP_NAME)
|| c_parser_peek_token (parser)->id_kind != C_ID_ID)
;
else if (kind != 0)
{
- tree u = make_node (kind);
+ tree u = build_omp_clause (kind);
OMP_CLAUSE_DECL (u) = t;
OMP_CLAUSE_CHAIN (u) = list;
list = u;
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;
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;
list = c;
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;
}
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;
list = c;
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;
}
if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
return list;
- c = make_node (OMP_CLAUSE_SCHEDULE);
+ c = build_omp_clause (OMP_CLAUSE_SCHEDULE);
if (c_parser_next_token_is (parser, CPP_NAME))
{
bool need_complete = false;
bool need_implicitly_determined = false;
- switch (TREE_CODE (c))
+ switch (OMP_CLAUSE_CODE (c))
{
case OMP_CLAUSE_SHARED:
name = "shared";
? OMP_CLAUSES (stmt)
: NULL_TREE;
- for (; clause; clause = OMP_CLAUSE_CHAIN (clause))
- TREE_BLOCK (clause) = TREE_BLOCK (stmt);
-
lower_stmt_body (OMP_BODY (stmt), data);
tsi_link_before (tsi, stmt, TSI_SAME_STMT);
tsi_link_before (tsi, OMP_BODY (stmt), TSI_SAME_STMT);
unsigned int flags;
tree decl;
- switch (TREE_CODE (c))
+ switch (OMP_CLAUSE_CODE (c))
{
case OMP_CLAUSE_PRIVATE:
flags = GOVD_PRIVATE | GOVD_EXPLICIT;
case OMP_CLAUSE_SCHEDULE:
case OMP_CLAUSE_IF:
case OMP_CLAUSE_NUM_THREADS:
- gs = gimplify_expr (&TREE_OPERAND (c, 0), pre_p, NULL,
+ gs = gimplify_expr (&OMP_CLAUSE_OPERAND (c, 0), pre_p, NULL,
is_gimple_val, fb_rvalue);
if (gs == GS_ERROR)
remove = true;
tree *list_p = (tree *) data;
tree decl = (tree) n->key;
unsigned flags = n->value;
- enum tree_code code;
+ enum omp_clause_code code;
tree clause;
bool private_debug;
else
gcc_unreachable ();
- clause = build1 (code, void_type_node, decl);
+ clause = build_omp_clause (code);
+ OMP_CLAUSE_DECL (clause) = decl;
OMP_CLAUSE_CHAIN (clause) = *list_p;
if (private_debug)
OMP_CLAUSE_PRIVATE_DEBUG (clause) = 1;
splay_tree_node n;
bool remove = false;
- switch (TREE_CODE (c))
+ switch (OMP_CLAUSE_CODE (c))
{
case OMP_CLAUSE_PRIVATE:
case OMP_CLAUSE_SHARED:
remove = !(n->value & GOVD_SEEN);
if (! remove)
{
- bool shared = TREE_CODE (c) == OMP_CLAUSE_SHARED;
+ bool shared = OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED;
if ((n->value & GOVD_DEBUG_PRIVATE)
|| lang_hooks.decls.omp_private_debug_clause (decl, shared))
{
gcc_assert ((n->value & GOVD_DEBUG_PRIVATE) == 0
|| ((n->value & GOVD_DATA_SHARE_CLASS)
== GOVD_PRIVATE));
- TREE_SET_CODE (c, OMP_CLAUSE_PRIVATE);
+ OMP_CLAUSE_SET_CODE (c, OMP_CLAUSE_PRIVATE);
OMP_CLAUSE_PRIVATE_DEBUG (c) = 1;
}
}
find_omp_clause (tree clauses, enum tree_code kind)
{
for (; clauses ; clauses = OMP_CLAUSE_CHAIN (clauses))
- if (TREE_CODE (clauses) == kind)
+ if (OMP_CLAUSE_CODE (clauses) == kind)
return clauses;
return NULL_TREE;
fd->chunk_size = NULL_TREE;
for (t = OMP_FOR_CLAUSES (for_stmt); t ; t = OMP_CLAUSE_CHAIN (t))
- switch (TREE_CODE (t))
+ switch (OMP_CLAUSE_CODE (t))
{
case OMP_CLAUSE_NOWAIT:
fd->have_nowait = true;
{
bool by_ref;
- switch (TREE_CODE (c))
+ switch (OMP_CLAUSE_CODE (c))
{
case OMP_CLAUSE_PRIVATE:
decl = OMP_CLAUSE_DECL (c);
break;
}
/* We don't need to copy const scalar vars back. */
- TREE_SET_CODE (c, OMP_CLAUSE_FIRSTPRIVATE);
+ OMP_CLAUSE_SET_CODE (c, OMP_CLAUSE_FIRSTPRIVATE);
goto do_private;
case OMP_CLAUSE_LASTPRIVATE:
case OMP_CLAUSE_NUM_THREADS:
case OMP_CLAUSE_SCHEDULE:
if (ctx->outer)
- scan_omp (&TREE_OPERAND (c, 0), ctx->outer);
+ scan_omp (&OMP_CLAUSE_OPERAND (c, 0), ctx->outer);
break;
case OMP_CLAUSE_NOWAIT:
for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
{
- switch (TREE_CODE (c))
+ switch (OMP_CLAUSE_CODE (c))
{
case OMP_CLAUSE_LASTPRIVATE:
/* Let the corresponding firstprivate clause create
if (is_variable_sized (decl))
install_var_local (decl, ctx);
fixup_remapped_decl (decl, ctx,
- TREE_CODE (c) == OMP_CLAUSE_PRIVATE
+ OMP_CLAUSE_CODE (c) == OMP_CLAUSE_PRIVATE
&& OMP_CLAUSE_PRIVATE_DEBUG (c));
- if (TREE_CODE (c) == OMP_CLAUSE_REDUCTION
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
&& OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
scan_array_reductions = true;
break;
if (scan_array_reductions)
for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
- if (TREE_CODE (c) == OMP_CLAUSE_REDUCTION
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
&& OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
{
scan_omp (&OMP_CLAUSE_REDUCTION_INIT (c), ctx);
{
for (c = clauses; c ; c = OMP_CLAUSE_CHAIN (c))
{
- enum tree_code c_kind = TREE_CODE (c);
+ enum omp_clause_code c_kind = OMP_CLAUSE_CODE (c);
tree var, new_var;
bool by_ref;
else if (pass != 0)
continue;
- switch (TREE_CODE (c))
+ switch (OMP_CLAUSE_CODE (c))
{
case OMP_CLAUSE_SHARED:
/* Set up the DECL_VALUE_EXPR for shared variables now. This
{
tree var, new_var;
- if (TREE_CODE (c) != OMP_CLAUSE_LASTPRIVATE)
+ if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_LASTPRIVATE)
continue;
var = OMP_CLAUSE_DECL (c);
/* First see if there is exactly one reduction clause. Use OMP_ATOMIC
update in that case, otherwise use a lock. */
for (c = clauses; c && count < 2; c = OMP_CLAUSE_CHAIN (c))
- if (TREE_CODE (c) == OMP_CLAUSE_REDUCTION)
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION)
{
if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
{
tree var, ref, new_var;
enum tree_code code;
- if (TREE_CODE (c) != OMP_CLAUSE_REDUCTION)
+ if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_REDUCTION)
continue;
var = OMP_CLAUSE_DECL (c);
tree var, ref, x;
bool by_ref;
- if (TREE_CODE (c) != OMP_CLAUSE_COPYPRIVATE)
+ if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_COPYPRIVATE)
continue;
var = OMP_CLAUSE_DECL (c);
tree val, ref, x, var;
bool by_ref, do_in = false, do_out = false;
- switch (TREE_CODE (c))
+ switch (OMP_CLAUSE_CODE (c))
{
case OMP_CLAUSE_FIRSTPRIVATE:
case OMP_CLAUSE_COPYIN:
continue;
by_ref = use_pointer_for_field (val, false);
- switch (TREE_CODE (c))
+ switch (OMP_CLAUSE_CODE (c))
{
case OMP_CLAUSE_FIRSTPRIVATE:
case OMP_CLAUSE_COPYIN:
}
break;
+ case OMP_CLAUSE:
+ {
+ int i;
+ fprintf (file, " %s",
+ omp_clause_code_name[OMP_CLAUSE_CODE (node)]);
+ for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (node)]; i++)
+ {
+ indent_to (file, indent + 4);
+ fprintf (file, "op %d:", i);
+ print_node_brief (file, "", OMP_CLAUSE_OPERAND (node, i), 0);
+ }
+ }
+ break;
+
default:
if (EXCEPTIONAL_CLASS_P (node))
lang_hooks.print_xnode (file, node, indent);
dump_child ("labl", TREE_OPERAND (t,2));
}
break;
+ case OMP_CLAUSE:
+ {
+ int i;
+ fprintf (di->stream, "%s\n", omp_clause_code_name[OMP_CLAUSE_CODE (t)]);
+ for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (t)]; i++)
+ dump_child ("op: ", OMP_CLAUSE_OPERAND (t, i));
+ }
+ break;
default:
/* There are no additional fields to print. */
break;
case OMP_ORDERED:
case OMP_CRITICAL:
case OMP_ATOMIC:
- case OMP_CLAUSE_PRIVATE:
- case OMP_CLAUSE_SHARED:
- case OMP_CLAUSE_FIRSTPRIVATE:
- case OMP_CLAUSE_LASTPRIVATE:
- case OMP_CLAUSE_REDUCTION:
- case OMP_CLAUSE_COPYIN:
- case OMP_CLAUSE_COPYPRIVATE:
- case OMP_CLAUSE_IF:
- case OMP_CLAUSE_NUM_THREADS:
- case OMP_CLAUSE_SCHEDULE:
- case OMP_CLAUSE_NOWAIT:
- case OMP_CLAUSE_ORDERED:
- case OMP_CLAUSE_DEFAULT:
+ case OMP_CLAUSE:
case OMP_RETURN_EXPR:
break;
walk_tree to walk into the chain as well. */
if (code == PARM_DECL
|| code == TREE_LIST
- /* OpenMP clauses are linked through TREE_CHAIN. */
- || code == OMP_CLAUSE_PRIVATE
- || code == OMP_CLAUSE_SHARED
- || code == OMP_CLAUSE_FIRSTPRIVATE
- || code == OMP_CLAUSE_LASTPRIVATE
- || code == OMP_CLAUSE_REDUCTION
- || code == OMP_CLAUSE_COPYIN
- || code == OMP_CLAUSE_COPYPRIVATE
- || code == OMP_CLAUSE_IF
- || code == OMP_CLAUSE_NUM_THREADS
- || code == OMP_CLAUSE_SCHEDULE
- || code == OMP_CLAUSE_NOWAIT
- || code == OMP_CLAUSE_ORDERED
- || code == OMP_CLAUSE_DEFAULT)
+ || code == OMP_CLAUSE)
TREE_CHAIN (*tp) = chain;
/* For now, we don't update BLOCKs when we make copies. So, we
save_suppress = info->suppress_expansion;
if (convert_nonlocal_omp_clauses (&OMP_PARALLEL_CLAUSES (t), wi))
{
- tree c;
- c = get_chain_decl (info);
- c = build1 (OMP_CLAUSE_FIRSTPRIVATE, void_type_node, c);
+ tree c, decl;
+ decl = get_chain_decl (info);
+ c = build_omp_clause (OMP_CLAUSE_FIRSTPRIVATE);
+ OMP_CLAUSE_DECL (c) = decl;
OMP_CLAUSE_CHAIN (c) = OMP_PARALLEL_CLAUSES (t);
OMP_PARALLEL_CLAUSES (t) = c;
}
for (clause = *pclauses; clause ; clause = OMP_CLAUSE_CHAIN (clause))
{
- switch (TREE_CODE (clause))
+ switch (OMP_CLAUSE_CODE (clause))
{
case OMP_CLAUSE_PRIVATE:
case OMP_CLAUSE_FIRSTPRIVATE:
case OMP_CLAUSE_NUM_THREADS:
wi->val_only = true;
wi->is_lhs = false;
- convert_nonlocal_reference (&TREE_OPERAND (clause, 0), &dummy, wi);
+ convert_nonlocal_reference (&OMP_CLAUSE_OPERAND (clause, 0), &dummy,
+ wi);
break;
case OMP_CLAUSE_NOWAIT:
{
tree c;
(void) get_frame_type (info);
- c = build1 (OMP_CLAUSE_SHARED, void_type_node, info->frame_decl);
+ c = build_omp_clause (OMP_CLAUSE_SHARED);
+ OMP_CLAUSE_DECL (c) = info->frame_decl;
OMP_CLAUSE_CHAIN (c) = OMP_PARALLEL_CLAUSES (t);
OMP_PARALLEL_CLAUSES (t) = c;
}
for (clause = *pclauses; clause ; clause = OMP_CLAUSE_CHAIN (clause))
{
- switch (TREE_CODE (clause))
+ switch (OMP_CLAUSE_CODE (clause))
{
case OMP_CLAUSE_PRIVATE:
case OMP_CLAUSE_FIRSTPRIVATE:
case OMP_CLAUSE_NUM_THREADS:
wi->val_only = true;
wi->is_lhs = false;
- convert_local_reference (&TREE_OPERAND (clause, 0), &dummy, wi);
+ convert_local_reference (&OMP_CLAUSE_OPERAND (clause, 0), &dummy, wi);
break;
case OMP_CLAUSE_NOWAIT:
pp_character (buffer, ']');
}
-/* Dump the list of OpenMP clauses. */
+
+/* Dump OpenMP clause CLAUSE. BUFFER, CLAUSE, SPC and FLAGS are as in
+ dump_generic_node. */
static void
-dump_omp_clauses (pretty_printer *buffer, tree clause, int spc, int flags)
+dump_omp_clause (pretty_printer *buffer, tree clause, int spc, int flags)
{
const char *name;
- if (clause == NULL)
- return;
-
- pp_space (buffer);
- while (1)
+ switch (OMP_CLAUSE_CODE (clause))
{
- switch (TREE_CODE (clause))
- {
- case OMP_CLAUSE_PRIVATE:
- name = "private";
- goto print_remap;
- case OMP_CLAUSE_SHARED:
- name = "shared";
- goto print_remap;
- case OMP_CLAUSE_FIRSTPRIVATE:
- name = "firstprivate";
- goto print_remap;
- case OMP_CLAUSE_LASTPRIVATE:
- name = "lastprivate";
- goto print_remap;
- case OMP_CLAUSE_COPYIN:
- name = "copyin";
- goto print_remap;
- case OMP_CLAUSE_COPYPRIVATE:
- name = "copyprivate";
- goto print_remap;
- print_remap:
- pp_string (buffer, name);
- pp_character (buffer, '(');
- dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
- spc, flags, false);
- pp_character (buffer, ')');
- break;
-
- case OMP_CLAUSE_REDUCTION:
- pp_string (buffer, "reduction(");
- pp_string (buffer, op_symbol_1 (OMP_CLAUSE_REDUCTION_CODE (clause)));
- pp_character (buffer, ':');
- dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
- spc, flags, false);
- pp_character (buffer, ')');
- break;
+ case OMP_CLAUSE_PRIVATE:
+ name = "private";
+ goto print_remap;
+ case OMP_CLAUSE_SHARED:
+ name = "shared";
+ goto print_remap;
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ name = "firstprivate";
+ goto print_remap;
+ case OMP_CLAUSE_LASTPRIVATE:
+ name = "lastprivate";
+ goto print_remap;
+ case OMP_CLAUSE_COPYIN:
+ name = "copyin";
+ goto print_remap;
+ case OMP_CLAUSE_COPYPRIVATE:
+ name = "copyprivate";
+ goto print_remap;
+ print_remap:
+ pp_string (buffer, name);
+ pp_character (buffer, '(');
+ dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
+ spc, flags, false);
+ pp_character (buffer, ')');
+ break;
- case OMP_CLAUSE_IF:
- pp_string (buffer, "if(");
- dump_generic_node (buffer, OMP_CLAUSE_IF_EXPR (clause),
- spc, flags, false);
- pp_character (buffer, ')');
- break;
+ case OMP_CLAUSE_REDUCTION:
+ pp_string (buffer, "reduction(");
+ pp_string (buffer, op_symbol_1 (OMP_CLAUSE_REDUCTION_CODE (clause)));
+ pp_character (buffer, ':');
+ dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
+ spc, flags, false);
+ pp_character (buffer, ')');
+ break;
- case OMP_CLAUSE_NUM_THREADS:
- pp_string (buffer, "num_threads(");
- dump_generic_node (buffer, OMP_CLAUSE_NUM_THREADS_EXPR (clause),
- spc, flags, false);
- pp_character (buffer, ')');
- break;
+ case OMP_CLAUSE_IF:
+ pp_string (buffer, "if(");
+ dump_generic_node (buffer, OMP_CLAUSE_IF_EXPR (clause),
+ spc, flags, false);
+ pp_character (buffer, ')');
+ break;
- case OMP_CLAUSE_NOWAIT:
- pp_string (buffer, "nowait");
- break;
- case OMP_CLAUSE_ORDERED:
- pp_string (buffer, "ordered");
- break;
+ case OMP_CLAUSE_NUM_THREADS:
+ pp_string (buffer, "num_threads(");
+ dump_generic_node (buffer, OMP_CLAUSE_NUM_THREADS_EXPR (clause),
+ spc, flags, false);
+ pp_character (buffer, ')');
+ break;
- case OMP_CLAUSE_DEFAULT:
- pp_string (buffer, "default(");
- switch (OMP_CLAUSE_DEFAULT_KIND (clause))
- {
- case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
- break;
- case OMP_CLAUSE_DEFAULT_SHARED:
- pp_string (buffer, "shared");
- break;
- case OMP_CLAUSE_DEFAULT_NONE:
- pp_string (buffer, "none");
- break;
- case OMP_CLAUSE_DEFAULT_PRIVATE:
- pp_string (buffer, "private");
- break;
- default:
- gcc_unreachable ();
- }
- pp_character (buffer, ')');
- break;
+ case OMP_CLAUSE_NOWAIT:
+ pp_string (buffer, "nowait");
+ break;
+ case OMP_CLAUSE_ORDERED:
+ pp_string (buffer, "ordered");
+ break;
- case OMP_CLAUSE_SCHEDULE:
- pp_string (buffer, "schedule(");
- switch (OMP_CLAUSE_SCHEDULE_KIND (clause))
- {
- case OMP_CLAUSE_SCHEDULE_STATIC:
- pp_string (buffer, "static");
- break;
- case OMP_CLAUSE_SCHEDULE_DYNAMIC:
- pp_string (buffer, "dynamic");
- break;
- case OMP_CLAUSE_SCHEDULE_GUIDED:
- pp_string (buffer, "guided");
- break;
- case OMP_CLAUSE_SCHEDULE_RUNTIME:
- pp_string (buffer, "runtime");
- break;
- default:
- gcc_unreachable ();
- }
- if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause))
- {
- pp_character (buffer, ',');
- dump_generic_node (buffer,
- OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause),
- spc, flags, false);
- }
- pp_character (buffer, ')');
- break;
+ case OMP_CLAUSE_DEFAULT:
+ pp_string (buffer, "default(");
+ switch (OMP_CLAUSE_DEFAULT_KIND (clause))
+ {
+ case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
+ break;
+ case OMP_CLAUSE_DEFAULT_SHARED:
+ pp_string (buffer, "shared");
+ break;
+ case OMP_CLAUSE_DEFAULT_NONE:
+ pp_string (buffer, "none");
+ break;
+ case OMP_CLAUSE_DEFAULT_PRIVATE:
+ pp_string (buffer, "private");
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ pp_character (buffer, ')');
+ break;
- default:
- /* Should never happen. */
- dump_generic_node (buffer, clause, spc, flags, false);
- break;
+ case OMP_CLAUSE_SCHEDULE:
+ pp_string (buffer, "schedule(");
+ switch (OMP_CLAUSE_SCHEDULE_KIND (clause))
+ {
+ case OMP_CLAUSE_SCHEDULE_STATIC:
+ pp_string (buffer, "static");
+ break;
+ case OMP_CLAUSE_SCHEDULE_DYNAMIC:
+ pp_string (buffer, "dynamic");
+ break;
+ case OMP_CLAUSE_SCHEDULE_GUIDED:
+ pp_string (buffer, "guided");
+ break;
+ case OMP_CLAUSE_SCHEDULE_RUNTIME:
+ pp_string (buffer, "runtime");
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause))
+ {
+ pp_character (buffer, ',');
+ dump_generic_node (buffer,
+ OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause),
+ spc, flags, false);
}
+ pp_character (buffer, ')');
+ break;
+
+ default:
+ /* Should never happen. */
+ dump_generic_node (buffer, clause, spc, flags, false);
+ break;
+ }
+}
+
+/* Dump the list of OpenMP clauses. BUFFER, SPC and FLAGS are as in
+ dump_generic_node. */
+
+static void
+dump_omp_clauses (pretty_printer *buffer, tree clause, int spc, int flags)
+{
+ if (clause == NULL)
+ return;
+
+ pp_space (buffer);
+ while (1)
+ {
+ dump_omp_clause (buffer, clause, spc, flags);
clause = OMP_CLAUSE_CHAIN (clause);
if (clause == NULL)
return;
}
}
+
/* Dump the node NODE on the pretty_printer BUFFER, SPC spaces of indent.
FLAGS specifies details to show in the dump (see TDF_* in tree.h). If
IS_STMT is true, the object printed is considered to be a statement
is_expr = false;
break;
+ case OMP_CLAUSE:
+ dump_omp_clause (buffer, node, spc, flags);
+ is_expr = false;
+ break;
+
case REDUC_MAX_EXPR:
pp_string (buffer, " REDUC_MAX_EXPR < ");
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
"constructors",
"random kinds",
"lang_decl kinds",
- "lang_type kinds"
+ "lang_type kinds",
+ "omp clauses"
};
#endif /* GATHER_STATISTICS */
tree integer_types[itk_none];
unsigned char tree_contains_struct[256][64];
+
+/* Number of operands for each OpenMP clause. */
+unsigned const char omp_clause_num_ops[] =
+{
+ 0, /* OMP_CLAUSE_ERROR */
+ 1, /* OMP_CLAUSE_PRIVATE */
+ 1, /* OMP_CLAUSE_SHARED */
+ 1, /* OMP_CLAUSE_FIRSTPRIVATE */
+ 1, /* OMP_CLAUSE_LASTPRIVATE */
+ 4, /* OMP_CLAUSE_REDUCTION */
+ 1, /* OMP_CLAUSE_COPYIN */
+ 1, /* OMP_CLAUSE_COPYPRIVATE */
+ 1, /* OMP_CLAUSE_IF */
+ 1, /* OMP_CLAUSE_NUM_THREADS */
+ 1, /* OMP_CLAUSE_SCHEDULE */
+ 0, /* OMP_CLAUSE_NOWAIT */
+ 0, /* OMP_CLAUSE_ORDERED */
+ 0 /* OMP_CLAUSE_DEFAULT */
+};
+
+const char * const omp_clause_code_name[] =
+{
+ "error_clause",
+ "private",
+ "shared",
+ "firstprivate",
+ "lastprivate",
+ "reduction",
+ "copyin",
+ "copyprivate",
+ "if",
+ "num_threads",
+ "schedule",
+ "nowait",
+ "ordered",
+ "default"
+};
\f
/* Init tree.c. */
void
init_ttree (void)
{
-
/* Initialize the hash table of types. */
type_hash_table = htab_create_ggc (TYPE_HASH_INITIAL_SIZE, type_hash_hash,
type_hash_eq, 0);
case PLACEHOLDER_EXPR: return sizeof (struct tree_common);
case TREE_VEC:
+ case OMP_CLAUSE:
case PHI_NODE: gcc_unreachable ();
case SSA_NAME: return sizeof (struct tree_ssa_name);
case STRING_CST:
return sizeof (struct tree_string) + TREE_STRING_LENGTH (node) - 1;
+ case OMP_CLAUSE:
+ return (sizeof (struct tree_omp_clause)
+ + (omp_clause_num_ops[OMP_CLAUSE_CODE (node)] - 1)
+ * sizeof (tree));
+
default:
return tree_code_size (code);
}
/* Return a newly allocated node of code CODE. For decl and type
nodes, some other fields are initialized. The rest of the node is
- initialized to zero. This function cannot be used for PHI_NODE or
- TREE_VEC nodes, which is enforced by asserts in tree_code_size.
+ initialized to zero. This function cannot be used for PHI_NODE,
+ TREE_VEC or OMP_CLAUSE nodes, which is enforced by asserts in
+ tree_code_size.
Achoo! I got a code in the node. */
case CONSTRUCTOR: return TS_CONSTRUCTOR;
case TREE_BINFO: return TS_BINFO;
case VALUE_HANDLE: return TS_VALUE_HANDLE;
+ case OMP_CLAUSE: return TS_OMP_CLAUSE;
default:
gcc_unreachable ();
tree_code_name[TREE_CODE (node)], function, trim_filename (file), line);
}
+
+/* Similar to tree_check_failed but applied to OMP_CLAUSE codes. */
+
+void
+omp_clause_check_failed (const tree node, const char *file, int line,
+ const char *function, enum omp_clause_code code)
+{
+ internal_error ("tree check: expected omp_clause %s, have %s in %s, at %s:%d",
+ omp_clause_code_name[code], tree_code_name[TREE_CODE (node)],
+ function, trim_filename (file), line);
+}
+
+
+/* Similar to tree_range_check_failed but applied to OMP_CLAUSE codes. */
+
+void
+omp_clause_range_check_failed (const tree node, const char *file, int line,
+ const char *function, enum omp_clause_code c1,
+ enum omp_clause_code c2)
+{
+ char *buffer;
+ unsigned length = 0;
+ enum omp_clause_code c;
+
+ for (c = c1; c <= c2; ++c)
+ length += 4 + strlen (omp_clause_code_name[c]);
+
+ length += strlen ("expected ");
+ buffer = alloca (length);
+ length = 0;
+
+ for (c = c1; c <= c2; ++c)
+ {
+ const char *prefix = length ? " or " : "expected ";
+
+ strcpy (buffer + length, prefix);
+ length += strlen (prefix);
+ strcpy (buffer + length, omp_clause_code_name[c]);
+ length += strlen (omp_clause_code_name[c]);
+ }
+
+ internal_error ("tree check: %s, have %s in %s, at %s:%d",
+ buffer, omp_clause_code_name[TREE_CODE (node)],
+ function, trim_filename (file), line);
+}
+
+
#undef DEFTREESTRUCT
#define DEFTREESTRUCT(VAL, NAME) NAME,
idx + 1, tree_code_name[code], TREE_CODE_LENGTH (code),
function, trim_filename (file), line);
}
+
+/* Similar to above, except that the check is for the number of
+ operands of an OMP_CLAUSE node. */
+
+void
+omp_clause_operand_check_failed (int idx, tree t, const char *file,
+ int line, const char *function)
+{
+ internal_error
+ ("tree check: accessed operand %d of omp_clause %s with %d operands "
+ "in %s, at %s:%d", idx + 1, omp_clause_code_name[OMP_CLAUSE_CODE (t)],
+ omp_clause_num_ops [OMP_CLAUSE_CODE (t)], function,
+ trim_filename (file), line);
+}
#endif /* ENABLE_TREE_CHECKING */
\f
/* Create a new vector type node holding SUBPARTS units of type INNERTYPE,
}
+/* Build an OpenMP clause with code CODE. */
+
+tree
+build_omp_clause (enum omp_clause_code code)
+{
+ tree t;
+ int size, length;
+
+ length = omp_clause_num_ops[code];
+ size = (sizeof (struct tree_omp_clause) + (length - 1) * sizeof (tree));
+
+ t = ggc_alloc (size);
+ memset (t, 0, size);
+ TREE_SET_CODE (t, OMP_CLAUSE);
+ OMP_CLAUSE_SET_CODE (t, code);
+
+#ifdef GATHER_STATISTICS
+ tree_node_counts[(int) omp_clause_kind]++;
+ tree_node_sizes[(int) omp_clause_kind] += size;
+#endif
+
+ return t;
+}
+
+
/* Returns true if it is possible to prove that the index of
an array access REF (an ARRAY_REF expression) falls into the
array bounds. */
/* But we still need to check our siblings. */
if (code == TREE_LIST)
WALK_SUBTREE_TAIL (TREE_CHAIN (*tp));
- else if (code >= OMP_CLAUSE_PRIVATE && code <= OMP_CLAUSE_DEFAULT)
+ else if (code == OMP_CLAUSE)
WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp));
else
return NULL_TREE;
}
break;
- case OMP_CLAUSE_PRIVATE:
- case OMP_CLAUSE_SHARED:
- case OMP_CLAUSE_FIRSTPRIVATE:
- case OMP_CLAUSE_LASTPRIVATE:
- case OMP_CLAUSE_COPYIN:
- case OMP_CLAUSE_COPYPRIVATE:
- case OMP_CLAUSE_IF:
- case OMP_CLAUSE_NUM_THREADS:
- case OMP_CLAUSE_SCHEDULE:
- WALK_SUBTREE (TREE_OPERAND (*tp, 0));
- /* FALLTHRU */
-
- case OMP_CLAUSE_NOWAIT:
- case OMP_CLAUSE_ORDERED:
- case OMP_CLAUSE_DEFAULT:
- WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp));
+ case OMP_CLAUSE:
+ switch (OMP_CLAUSE_CODE (*tp))
+ {
+ case OMP_CLAUSE_PRIVATE:
+ case OMP_CLAUSE_SHARED:
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ case OMP_CLAUSE_LASTPRIVATE:
+ case OMP_CLAUSE_COPYIN:
+ case OMP_CLAUSE_COPYPRIVATE:
+ case OMP_CLAUSE_IF:
+ case OMP_CLAUSE_NUM_THREADS:
+ case OMP_CLAUSE_SCHEDULE:
+ WALK_SUBTREE (OMP_CLAUSE_OPERAND (*tp, 0));
+ /* FALLTHRU */
+
+ case OMP_CLAUSE_NOWAIT:
+ case OMP_CLAUSE_ORDERED:
+ case OMP_CLAUSE_DEFAULT:
+ WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp));
+
+ case OMP_CLAUSE_REDUCTION:
+ {
+ int i;
+ for (i = 0; i < 4; i++)
+ WALK_SUBTREE (OMP_CLAUSE_OPERAND (*tp, i));
+ WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp));
+ }
- case OMP_CLAUSE_REDUCTION:
- {
- int i;
- for (i = 0; i < 4; i++)
- WALK_SUBTREE (TREE_OPERAND (*tp, i));
- WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp));
- }
+ default:
+ gcc_unreachable ();
+ }
+ break;
case TARGET_EXPR:
{
build_fold_indirect_ref of the address. */
DEFTREECODE (OMP_ATOMIC, "omp_atomic", tcc_statement, 2)
-/* The ordering of the codes between OMP_CLAUSE_PRIVATE and
- OMP_CLAUSE_DEFAULT is exposed to TREE_RANGE_CHECK. */
-/* OpenMP clause: private (variable_list). */
-DEFTREECODE (OMP_CLAUSE_PRIVATE, "private", tcc_expression, 1)
-
-/* OpenMP clause: shared (variable_list). */
-DEFTREECODE (OMP_CLAUSE_SHARED, "shared", tcc_expression, 1)
-
-/* OpenMP clause: firstprivate (variable_list). */
-DEFTREECODE (OMP_CLAUSE_FIRSTPRIVATE, "firstprivate", tcc_expression, 1)
-
-/* OpenMP clause: lastprivate (variable_list). */
-DEFTREECODE (OMP_CLAUSE_LASTPRIVATE, "lastprivate", tcc_expression, 1)
-
-/* OpenMP clause: reduction (operator:variable_list).
- OMP_CLAUSE_REDUCTION_CODE: The tree_code of the operator.
- Operand 1: OMP_CLAUSE_REDUCTION_INIT: Stmt-list to initialize the var.
- Operand 2: OMP_CLAUSE_REDUCTION_MERGE:
- Stmt-list to merge private var into the shared one.
- Operand 3: OMP_CLAUSE_REDUCTION_PLACEHOLDER:
- A dummy VAR_DECL placeholder used in OMP_CLAUSE_REDUCTION_MERGE. */
-DEFTREECODE (OMP_CLAUSE_REDUCTION, "reduction", tcc_expression, 4)
-
-/* OpenMP clause: copyin (variable_list). */
-DEFTREECODE (OMP_CLAUSE_COPYIN, "copyin", tcc_expression, 1)
-
-/* OpenMP clause: copyprivate (variable_list). */
-DEFTREECODE (OMP_CLAUSE_COPYPRIVATE, "copyprivate", tcc_expression, 1)
-
-/* OpenMP clause: if (scalar-expression). */
-DEFTREECODE (OMP_CLAUSE_IF, "if", tcc_expression, 1)
-
-/* OpenMP clause: num_threads (integer-expression). */
-DEFTREECODE (OMP_CLAUSE_NUM_THREADS, "num_threads", tcc_expression, 1)
-
-/* OpenMP clause: schedule. */
-DEFTREECODE (OMP_CLAUSE_SCHEDULE, "schedule", tcc_expression, 1)
-
-/* OpenMP clause: nowait. */
-DEFTREECODE (OMP_CLAUSE_NOWAIT, "nowait", tcc_expression, 0)
-
-/* OpenMP clause: ordered. */
-DEFTREECODE (OMP_CLAUSE_ORDERED, "ordered", tcc_expression, 0)
-
-/* OpenMP clause: default. */
-DEFTREECODE (OMP_CLAUSE_DEFAULT, "default", tcc_expression, 0)
+/* OpenMP clauses. */
+DEFTREECODE (OMP_CLAUSE, "omp_clause", tcc_exceptional, 0)
/* Return from an OpenMP directive. */
DEFTREECODE (OMP_RETURN_EXPR, "omp_return", tcc_statement, 0)
extern GTY(()) tree built_in_decls[(int) END_BUILTINS];
extern GTY(()) tree implicit_built_in_decls[(int) END_BUILTINS];
\f
+/* In an OMP_CLAUSE node. */
+
+/* Number of operands and names for each clause. */
+extern unsigned const char omp_clause_num_ops[];
+extern const char * const omp_clause_code_name[];
+
+/* Clause codes. Do not reorder, as this is used to index into the tables
+ omp_clause_num_ops and omp_clause_code_name. */
+enum omp_clause_code
+{
+ /* Clause zero is special-cased inside the parser
+ (c_parser_omp_variable_list). */
+ OMP_CLAUSE_ERROR = 0,
+
+ /* OpenMP clause: private (variable_list). */
+ OMP_CLAUSE_PRIVATE,
+
+ /* OpenMP clause: shared (variable_list). */
+ OMP_CLAUSE_SHARED,
+
+ /* OpenMP clause: firstprivate (variable_list). */
+ OMP_CLAUSE_FIRSTPRIVATE,
+
+ /* OpenMP clause: lastprivate (variable_list). */
+ OMP_CLAUSE_LASTPRIVATE,
+
+ /* OpenMP clause: reduction (operator:variable_list).
+ OMP_CLAUSE_REDUCTION_CODE: The tree_code of the operator.
+ Operand 1: OMP_CLAUSE_REDUCTION_INIT: Stmt-list to initialize the var.
+ Operand 2: OMP_CLAUSE_REDUCTION_MERGE: Stmt-list to merge private var
+ into the shared one.
+ Operand 3: OMP_CLAUSE_REDUCTION_PLACEHOLDER: A dummy VAR_DECL
+ placeholder used in OMP_CLAUSE_REDUCTION_MERGE. */
+ OMP_CLAUSE_REDUCTION,
+
+ /* OpenMP clause: copyin (variable_list). */
+ OMP_CLAUSE_COPYIN,
+
+ /* OpenMP clause: copyprivate (variable_list). */
+ OMP_CLAUSE_COPYPRIVATE,
+
+ /* OpenMP clause: if (scalar-expression). */
+ OMP_CLAUSE_IF,
+
+ /* OpenMP clause: num_threads (integer-expression). */
+ OMP_CLAUSE_NUM_THREADS,
+
+ /* OpenMP clause: schedule. */
+ OMP_CLAUSE_SCHEDULE,
+
+ /* OpenMP clause: nowait. */
+ OMP_CLAUSE_NOWAIT,
+
+ /* OpenMP clause: ordered. */
+ OMP_CLAUSE_ORDERED,
+
+ /* OpenMP clause: default. */
+ OMP_CLAUSE_DEFAULT
+};
+\f
/* The definition of tree nodes fills the next several pages. */
/* A tree node can represent a data type, a variable, an expression
#define TREE_RANGE_CHECK(T, CODE1, CODE2) __extension__ \
({ const tree __t = (T); \
- if (TREE_CODE (__t) < (CODE1) && TREE_CODE (__t) > (CODE2)) \
+ if (TREE_CODE (__t) < (CODE1) || TREE_CODE (__t) > (CODE2)) \
tree_range_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, \
(CODE1), (CODE2)); \
__t; })
+#define OMP_CLAUSE_SUBCODE_CHECK(T, CODE) __extension__ \
+({ const tree __t = (T); \
+ if (TREE_CODE (__t) != OMP_CLAUSE) \
+ tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, \
+ OMP_CLAUSE, 0); \
+ if (__t->omp_clause.code != (CODE)) \
+ omp_clause_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, \
+ (CODE)); \
+ __t; })
+
+#define OMP_CLAUSE_RANGE_CHECK(T, CODE1, CODE2) __extension__ \
+({ const tree __t = (T); \
+ if (TREE_CODE (__t) != OMP_CLAUSE) \
+ tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, \
+ OMP_CLAUSE, 0); \
+ if ((int) __t->omp_clause.code < (int) (CODE1) \
+ || (int) __t->omp_clause.code > (int) (CODE2)) \
+ omp_clause_range_check_failed (__t, __FILE__, __LINE__, \
+ __FUNCTION__, (CODE1), (CODE2)); \
+ __t; })
+
/* These checks have to be special cased. */
#define EXPR_CHECK(T) __extension__ \
({ const tree __t = (T); \
__FILE__, __LINE__, __FUNCTION__); \
&__t->phi.a[__i]; }))
+#define OMP_CLAUSE_ELT_CHECK(t, i) __extension__ \
+(*({const tree __t = t; \
+ const int __i = (i); \
+ if (TREE_CODE (__t) != OMP_CLAUSE) \
+ tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, \
+ OMP_CLAUSE, 0); \
+ if (__i < 0 || __i >= omp_clause_num_ops [__t->omp_clause.code]) \
+ omp_clause_operand_check_failed (__i, __t, __FILE__, __LINE__, \
+ __FUNCTION__); \
+ &__t->omp_clause.ops[__i]; }))
+
/* Special checks for TREE_OPERANDs. */
#define TREE_OPERAND_CHECK(T, I) __extension__ \
(*({const tree __t = EXPR_CHECK (T); \
extern void tree_operand_check_failed (int, enum tree_code,
const char *, int, const char *)
ATTRIBUTE_NORETURN;
+extern void omp_clause_check_failed (const tree, const char *, int,
+ const char *, enum omp_clause_code)
+ ATTRIBUTE_NORETURN;
+extern void omp_clause_operand_check_failed (int, tree, const char *,
+ int, const char *)
+ ATTRIBUTE_NORETURN;
+extern void omp_clause_range_check_failed (const tree, const char *, int,
+ const char *, enum omp_clause_code,
+ enum omp_clause_code)
+ ATTRIBUTE_NORETURN;
#else /* not ENABLE_TREE_CHECKING, or not gcc */
#define TREE_OPERAND_CHECK_CODE(T, CODE, I) ((T)->exp.operands[I])
#define TREE_RTL_OPERAND_CHECK(T, CODE, I) (*(rtx *) &((T)->exp.operands[I]))
#define PHI_NODE_ELT_CHECK(T, i) ((T)->phi.a[i])
+#define OMP_CLAUSE_ELT_CHECK(T, i) ((T)->omp_clause.ops[i])
+#define OMP_CLAUSE_RANGE_CHECK(T, CODE1, CODE2) (T)
#endif
-#define TREE_BLOCK(NODE) ((NODE)->exp.block)
+#define TREE_BLOCK(NODE) (EXPR_CHECK (NODE)->exp.block)
#include "tree-check.h"
#define OMP_CRITICAL_BODY(NODE) TREE_OPERAND (OMP_CRITICAL_CHECK (NODE), 0)
#define OMP_CRITICAL_NAME(NODE) TREE_OPERAND (OMP_CRITICAL_CHECK (NODE), 1)
-#define OMP_CLAUSE_CHAIN(NODE) \
- TREE_CHAIN (TREE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, OMP_CLAUSE_DEFAULT))
-#define OMP_CLAUSE_DECL(NODE) \
- TREE_OPERAND (TREE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \
- OMP_CLAUSE_COPYPRIVATE), 0)
+#define OMP_CLAUSE_CHAIN(NODE) TREE_CHAIN (OMP_CLAUSE_CHECK (NODE))
+#define OMP_CLAUSE_DECL(NODE) \
+ OMP_CLAUSE_OPERAND (OMP_CLAUSE_RANGE_CHECK (OMP_CLAUSE_CHECK (NODE), \
+ OMP_CLAUSE_PRIVATE, \
+ OMP_CLAUSE_COPYPRIVATE), 0)
/* True on a PRIVATE clause if its decl is kept around for debugging
information only and its DECL_VALUE_EXPR is supposed to point
to what it has been remapped to. */
#define OMP_CLAUSE_PRIVATE_DEBUG(NODE) \
- TREE_PUBLIC (OMP_CLAUSE_PRIVATE_CHECK (NODE))
+ TREE_PUBLIC (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PRIVATE))
/* True on a LASTPRIVATE clause if a FIRSTPRIVATE clause for the same
decl is present in the chain. */
#define OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE(NODE) \
- TREE_PUBLIC (OMP_CLAUSE_LASTPRIVATE_CHECK (NODE))
+ TREE_PUBLIC (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LASTPRIVATE))
#define OMP_CLAUSE_IF_EXPR(NODE) \
- TREE_OPERAND (OMP_CLAUSE_IF_CHECK (NODE), 0)
+ OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_IF), 0)
#define OMP_CLAUSE_NUM_THREADS_EXPR(NODE) \
- TREE_OPERAND (OMP_CLAUSE_NUM_THREADS_CHECK (NODE), 0)
+ OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_THREADS),0)
#define OMP_CLAUSE_SCHEDULE_CHUNK_EXPR(NODE) \
- TREE_OPERAND (OMP_CLAUSE_SCHEDULE_CHECK (NODE), 0)
+ OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SCHEDULE), 0)
#define OMP_CLAUSE_REDUCTION_CODE(NODE) \
- (OMP_CLAUSE_REDUCTION_CHECK (NODE)->exp.complexity)
+ (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION)->omp_clause.subcode.reduction_code)
#define OMP_CLAUSE_REDUCTION_INIT(NODE) \
- TREE_OPERAND (OMP_CLAUSE_REDUCTION_CHECK (NODE), 1)
+ OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 1)
#define OMP_CLAUSE_REDUCTION_MERGE(NODE) \
- TREE_OPERAND (OMP_CLAUSE_REDUCTION_CHECK (NODE), 2)
+ OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 2)
#define OMP_CLAUSE_REDUCTION_PLACEHOLDER(NODE) \
- TREE_OPERAND (OMP_CLAUSE_REDUCTION_CHECK (NODE), 3)
+ OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 3)
enum omp_clause_schedule_kind
{
};
#define OMP_CLAUSE_SCHEDULE_KIND(NODE) \
- (OMP_CLAUSE_SCHEDULE_CHECK (NODE)->exp.complexity)
+ (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SCHEDULE)->omp_clause.subcode.schedule_kind)
enum omp_clause_default_kind
{
};
#define OMP_CLAUSE_DEFAULT_KIND(NODE) \
- (OMP_CLAUSE_DEFAULT_CHECK (NODE)->exp.complexity)
+ (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_DEFAULT)->omp_clause.subcode.default_kind)
struct tree_exp GTY(())
{
struct phi_arg_d GTY ((length ("((tree)&%h)->phi.num_args"))) a[1];
};
\f
+#define OMP_CLAUSE_CODE(NODE) \
+ (OMP_CLAUSE_CHECK (NODE))->omp_clause.code
+
+#define OMP_CLAUSE_SET_CODE(NODE, CODE) \
+ ((OMP_CLAUSE_CHECK (NODE))->omp_clause.code = (CODE))
+
+#define OMP_CLAUSE_CODE(NODE) \
+ (OMP_CLAUSE_CHECK (NODE))->omp_clause.code
+
+#define OMP_CLAUSE_OPERAND(NODE, I) \
+ OMP_CLAUSE_ELT_CHECK (NODE, I)
+
+struct tree_omp_clause GTY(())
+{
+ struct tree_common common;
+ enum omp_clause_code code;
+ union omp_clause_subcode {
+ enum omp_clause_default_kind default_kind;
+ enum omp_clause_schedule_kind schedule_kind;
+ enum tree_code reduction_code;
+ } GTY ((skip)) subcode;
+ tree GTY ((length ("omp_clause_num_ops[TREE_CODE ((tree)&%h)]"))) ops[1];
+};
+\f
struct varray_head_tag;
struct tree_value_handle GTY ((tag ("TS_VALUE_HANDLE"))) value_handle;
struct tree_constructor GTY ((tag ("TS_CONSTRUCTOR"))) constructor;
struct tree_memory_tag GTY ((tag ("TS_MEMORY_TAG"))) mtag;
+ struct tree_omp_clause GTY ((tag ("TS_OMP_CLAUSE"))) omp_clause;
};
\f
/* Standard named or nameless data types of the C compiler. */
extern void annotate_with_locus (tree, location_t);
#endif
extern tree build_empty_stmt (void);
+extern tree build_omp_clause (enum omp_clause_code);
/* Construct various nodes representing data types. */
x_kind,
lang_decl,
lang_type,
+ omp_clause_kind,
all_kinds
} tree_node_kind;
DEFTREESTRUCT(TS_VALUE_HANDLE, "value handle")
DEFTREESTRUCT(TS_CONSTRUCTOR, "constructor")
DEFTREESTRUCT(TS_MEMORY_TAG, "memory tag")
+DEFTREESTRUCT(TS_OMP_CLAUSE, "omp clause")