+
+/* Dump OpenMP clause CLAUSE. BUFFER, CLAUSE, SPC and FLAGS are as in
+ dump_generic_node. */
+
+static void
+dump_omp_clause (pretty_printer *buffer, tree clause, int spc, int flags)
+{
+ const char *name;
+
+ switch (OMP_CLAUSE_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_code (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_IF:
+ pp_string (buffer, "if(");
+ dump_generic_node (buffer, OMP_CLAUSE_IF_EXPR (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_NOWAIT:
+ pp_string (buffer, "nowait");
+ break;
+ case OMP_CLAUSE_ORDERED:
+ pp_string (buffer, "ordered");
+ 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;
+ case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE:
+ pp_string (buffer, "firstprivate");
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ pp_character (buffer, ')');
+ 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;
+ case OMP_CLAUSE_SCHEDULE_AUTO:
+ pp_string (buffer, "auto");
+ 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_UNTIED:
+ pp_string (buffer, "untied");
+ break;
+
+ case OMP_CLAUSE_COLLAPSE:
+ pp_string (buffer, "collapse(");
+ dump_generic_node (buffer,
+ OMP_CLAUSE_COLLAPSE_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. */
+
+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;
+ pp_space (buffer);
+ }
+}
+
+
+/* Dump location LOC to BUFFER. */
+
+static void
+dump_location (pretty_printer *buffer, location_t loc)
+{
+ expanded_location xloc = expand_location (loc);
+
+ pp_character (buffer, '[');
+ if (xloc.file)
+ {
+ pp_string (buffer, xloc.file);
+ pp_string (buffer, " : ");
+ }
+ pp_decimal_int (buffer, xloc.line);
+ pp_string (buffer, "] ");
+}
+
+
+/* Dump lexical block BLOCK. BUFFER, SPC and FLAGS are as in
+ dump_generic_node. */
+
+static void
+dump_block_node (pretty_printer *buffer, tree block, int spc, int flags)
+{
+ tree t;
+
+ pp_printf (buffer, "BLOCK #%d ", BLOCK_NUMBER (block));
+
+ if (flags & TDF_ADDRESS)
+ pp_printf (buffer, "[%p] ", (void *) block);
+
+ if (BLOCK_ABSTRACT (block))
+ pp_string (buffer, "[abstract] ");
+
+ if (TREE_ASM_WRITTEN (block))
+ pp_string (buffer, "[written] ");
+
+ if (flags & TDF_SLIM)
+ return;
+
+ if (BLOCK_SOURCE_LOCATION (block))
+ dump_location (buffer, BLOCK_SOURCE_LOCATION (block));
+
+ newline_and_indent (buffer, spc + 2);
+
+ if (BLOCK_SUPERCONTEXT (block))
+ {
+ pp_string (buffer, "SUPERCONTEXT: ");
+ dump_generic_node (buffer, BLOCK_SUPERCONTEXT (block), 0,
+ flags | TDF_SLIM, false);
+ newline_and_indent (buffer, spc + 2);
+ }
+
+ if (BLOCK_SUBBLOCKS (block))
+ {
+ pp_string (buffer, "SUBBLOCKS: ");
+ for (t = BLOCK_SUBBLOCKS (block); t; t = BLOCK_CHAIN (t))
+ {
+ dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
+ pp_string (buffer, " ");
+ }
+ newline_and_indent (buffer, spc + 2);
+ }
+
+ if (BLOCK_CHAIN (block))
+ {
+ pp_string (buffer, "SIBLINGS: ");
+ for (t = BLOCK_CHAIN (block); t; t = BLOCK_CHAIN (t))
+ {
+ dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
+ pp_string (buffer, " ");
+ }
+ newline_and_indent (buffer, spc + 2);
+ }
+
+ if (BLOCK_VARS (block))
+ {
+ pp_string (buffer, "VARS: ");
+ for (t = BLOCK_VARS (block); t; t = TREE_CHAIN (t))
+ {
+ dump_generic_node (buffer, t, 0, flags, false);
+ pp_string (buffer, " ");
+ }
+ newline_and_indent (buffer, spc + 2);
+ }
+
+ if (VEC_length (tree, BLOCK_NONLOCALIZED_VARS (block)) > 0)
+ {
+ unsigned i;
+ VEC(tree,gc) *nlv = BLOCK_NONLOCALIZED_VARS (block);
+
+ pp_string (buffer, "NONLOCALIZED_VARS: ");
+ for (i = 0; VEC_iterate (tree, nlv, i, t); i++)
+ {
+ dump_generic_node (buffer, t, 0, flags, false);
+ pp_string (buffer, " ");
+ }
+ newline_and_indent (buffer, spc + 2);
+ }
+
+ if (BLOCK_ABSTRACT_ORIGIN (block))
+ {
+ pp_string (buffer, "ABSTRACT_ORIGIN: ");
+ dump_generic_node (buffer, BLOCK_ABSTRACT_ORIGIN (block), 0,
+ flags | TDF_SLIM, false);
+ newline_and_indent (buffer, spc + 2);
+ }
+
+ if (BLOCK_FRAGMENT_ORIGIN (block))
+ {
+ pp_string (buffer, "FRAGMENT_ORIGIN: ");
+ dump_generic_node (buffer, BLOCK_FRAGMENT_ORIGIN (block), 0,
+ flags | TDF_SLIM, false);
+ newline_and_indent (buffer, spc + 2);
+ }
+
+ if (BLOCK_FRAGMENT_CHAIN (block))
+ {
+ pp_string (buffer, "FRAGMENT_CHAIN: ");
+ for (t = BLOCK_FRAGMENT_CHAIN (block); t; t = BLOCK_FRAGMENT_CHAIN (t))
+ {
+ dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
+ pp_string (buffer, " ");
+ }
+ newline_and_indent (buffer, spc + 2);
+ }
+}
+
+
+/* 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-pass.h). If IS_STMT is true, the object printed is considered
+ to be a statement and it is terminated by ';' if appropriate. */