aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/omp-general.cc2
-rw-r--r--gcc/omp-general.h1
-rw-r--r--gcc/tree-cfg.cc9
-rw-r--r--gcc/tree-pretty-print.cc75
-rw-r--r--gcc/tree-pretty-print.h1
5 files changed, 87 insertions, 1 deletions
diff --git a/gcc/omp-general.cc b/gcc/omp-general.cc
index 233f235..65990df 100644
--- a/gcc/omp-general.cc
+++ b/gcc/omp-general.cc
@@ -1234,7 +1234,7 @@ struct omp_ts_info omp_ts_map[] =
/* Return a name from PROP, a property in selectors accepting
name lists. */
-static const char *
+const char *
omp_context_name_list_prop (tree prop)
{
gcc_assert (OMP_TP_NAME (prop) == OMP_TP_NAMELIST_NODE);
diff --git a/gcc/omp-general.h b/gcc/omp-general.h
index 66ed490..3c2b221 100644
--- a/gcc/omp-general.h
+++ b/gcc/omp-general.h
@@ -164,6 +164,7 @@ extern gimple *omp_build_barrier (tree lhs);
extern tree find_combined_omp_for (tree *, int *, void *);
extern poly_uint64 omp_max_vf (void);
extern int omp_max_simt_vf (void);
+extern const char *omp_context_name_list_prop (tree);
extern void omp_construct_traits_to_codes (tree, int, enum tree_code *);
extern tree omp_check_context_selector (location_t loc, tree ctx);
extern void omp_mark_declare_variant (location_t loc, tree variant,
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index d784b91..1ab18fa 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -8291,6 +8291,15 @@ dump_function_to_file (tree fndecl, FILE *file, dump_flags_t flags)
if (strstr (IDENTIFIER_POINTER (name), "no_sanitize"))
print_no_sanitize_attr_value (file, TREE_VALUE (chain));
+ else if (!strcmp (IDENTIFIER_POINTER (name),
+ "omp declare variant base"))
+ {
+ tree a = TREE_VALUE (chain);
+ print_generic_expr (file, TREE_PURPOSE (a), dump_flags);
+ fprintf (file, " match ");
+ print_omp_context_selector (file, TREE_VALUE (a),
+ dump_flags);
+ }
else
print_generic_expr (file, TREE_VALUE (chain), dump_flags);
fprintf (file, ")");
diff --git a/gcc/tree-pretty-print.cc b/gcc/tree-pretty-print.cc
index 46e1439..2848652 100644
--- a/gcc/tree-pretty-print.cc
+++ b/gcc/tree-pretty-print.cc
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "gomp-constants.h"
#include "gimple.h"
#include "fold-const.h"
+#include "omp-general.h"
/* Routines in this file get invoked via the default tree printer
used by diagnostics and thus they are called from pp_printf which
@@ -1497,6 +1498,80 @@ dump_omp_clauses (pretty_printer *pp, tree clause, int spc, dump_flags_t flags,
}
}
+/* Dump an OpenMP context selector CTX to PP. */
+static void
+dump_omp_context_selector (pretty_printer *pp, tree ctx, int spc,
+ dump_flags_t flags)
+{
+ for (tree set = ctx; set && set != error_mark_node; set = TREE_CHAIN (set))
+ {
+ pp_string (pp, OMP_TSS_NAME (set));
+ pp_string (pp, " = {");
+ for (tree sel = OMP_TSS_TRAIT_SELECTORS (set);
+ sel && sel != error_mark_node; sel = TREE_CHAIN (sel))
+ {
+ if (OMP_TS_CODE (sel) == OMP_TRAIT_INVALID)
+ pp_string (pp, "<unknown selector>");
+ else
+ pp_string (pp, OMP_TS_NAME (sel));
+ tree score = OMP_TS_SCORE (sel);
+ tree props = OMP_TS_PROPERTIES (sel);
+ if (props)
+ {
+ pp_string (pp, " (");
+ if (score)
+ {
+ pp_string (pp, "score(");
+ dump_generic_node (pp, score, spc + 4, flags, false);
+ pp_string (pp, "): ");
+ }
+ for (tree prop = props; prop; prop = TREE_CHAIN (prop))
+ {
+ if (OMP_TP_NAME (prop) == OMP_TP_NAMELIST_NODE)
+ {
+ const char *str = omp_context_name_list_prop (prop);
+ pp_string (pp, "\"");
+ pretty_print_string (pp, str, strlen (str) + 1);
+ pp_string (pp, "\"");
+ }
+ else if (OMP_TP_NAME (prop))
+ dump_generic_node (pp, OMP_TP_NAME (prop), spc + 4,
+ flags, false);
+ else if (OMP_TP_VALUE (prop))
+ dump_generic_node (pp, OMP_TP_VALUE (prop), spc + 4,
+ flags, false);
+ if (TREE_CHAIN (prop))
+ {
+ pp_comma (pp);
+ pp_space (pp);
+ }
+ }
+ pp_string (pp, ")");
+ }
+ if (TREE_CHAIN (sel))
+ {
+ pp_comma (pp);
+ pp_space (pp);
+ }
+ }
+ pp_string (pp, "}");
+ if (TREE_CHAIN (set))
+ {
+ pp_comma (pp);
+ newline_and_indent (pp, spc);
+ }
+ }
+}
+
+/* Wrapper for above, used for "declare variant". Compare to
+ print_generic_expr. */
+void
+print_omp_context_selector (FILE *file, tree t, dump_flags_t flags)
+{
+ maybe_init_pretty_print (file);
+ dump_omp_context_selector (tree_pp, t, 0, flags);
+ pp_flush (tree_pp);
+}
/* Dump location LOC to PP. */
diff --git a/gcc/tree-pretty-print.h b/gcc/tree-pretty-print.h
index 12bae05..3a02ebd 100644
--- a/gcc/tree-pretty-print.h
+++ b/gcc/tree-pretty-print.h
@@ -45,6 +45,7 @@ extern void dump_omp_atomic_memory_order (pretty_printer *,
enum omp_memory_order);
extern void dump_omp_loop_non_rect_expr (pretty_printer *, tree, int,
dump_flags_t);
+extern void print_omp_context_selector (FILE *, tree, dump_flags_t);
extern int dump_generic_node (pretty_printer *, tree, int, dump_flags_t, bool);
extern void print_declaration (pretty_printer *, tree, int, dump_flags_t);
extern int op_code_prio (enum tree_code);