]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
OpenMP: dispatch + adjust_args tree data structures and front-end interfaces
authorPaul-Antoine Arras <parras@baylibre.com>
Wed, 20 Nov 2024 14:28:57 +0000 (15:28 +0100)
committerPaul-Antoine Arras <parras@baylibre.com>
Wed, 20 Nov 2024 14:31:22 +0000 (15:31 +0100)
This patch introduces the OMP_DISPATCH tree node, as well as two new clauses
`nocontext` and `novariants`. It defines/exposes interfaces that will be
used in subsequent patches that add front-end and middle-end support, but
nothing generates these nodes yet.

gcc/ChangeLog:

* builtin-types.def (BT_FN_PTR_CONST_PTR_INT): New.
* omp-selectors.h (enum omp_ts_code): Add OMP_TRAIT_CONSTRUCT_DISPATCH.
* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_NOVARIANTS and
OMP_CLAUSE_NOCONTEXT.
* tree-pretty-print.cc (dump_omp_clause): Handle OMP_CLAUSE_NOVARIANTS
and OMP_CLAUSE_NOCONTEXT.
(dump_generic_node): Handle OMP_DISPATCH.
* tree.cc (omp_clause_num_ops): Add OMP_CLAUSE_NOVARIANTS and
OMP_CLAUSE_NOCONTEXT.
(omp_clause_code_name): Add "novariants" and "nocontext".
* tree.def (OMP_DISPATCH): New.
* tree.h (OMP_DISPATCH_BODY): New macro.
(OMP_DISPATCH_CLAUSES): New macro.
(OMP_CLAUSE_NOVARIANTS_EXPR): New macro.
(OMP_CLAUSE_NOCONTEXT_EXPR): New macro.

gcc/fortran/ChangeLog:

* types.def (BT_FN_PTR_CONST_PTR_INT): Declare.

gcc/builtin-types.def
gcc/fortran/types.def
gcc/omp-selectors.h
gcc/tree-core.h
gcc/tree-pretty-print.cc
gcc/tree.cc
gcc/tree.def
gcc/tree.h

index 66ce164828fe0b70f2b7a61293db0d5ff2a751df..12f49e01de86700b85f2c31db8739ba28a3d9826 100644 (file)
@@ -684,6 +684,7 @@ DEF_FUNCTION_TYPE_2 (BT_FN_INT_FEXCEPT_T_PTR_INT, BT_INT, BT_FEXCEPT_T_PTR,
 DEF_FUNCTION_TYPE_2 (BT_FN_INT_CONST_FEXCEPT_T_PTR_INT, BT_INT,
                     BT_CONST_FEXCEPT_T_PTR, BT_INT)
 DEF_FUNCTION_TYPE_2 (BT_FN_PTR_CONST_PTR_UINT8, BT_PTR, BT_CONST_PTR, BT_UINT8)
+DEF_FUNCTION_TYPE_2 (BT_FN_PTR_CONST_PTR_INT, BT_PTR, BT_CONST_PTR, BT_INT)
 
 DEF_POINTER_TYPE (BT_PTR_FN_VOID_PTR_PTR, BT_FN_VOID_PTR_PTR)
 
index a69e25206f140015381f3cae8ed790d5788df12c..467393c3f07ade6cbf1150964887f2ec4b6a9adc 100644 (file)
@@ -119,6 +119,7 @@ DEF_FUNCTION_TYPE_2 (BT_FN_BOOL_INT_BOOL, BT_BOOL, BT_INT, BT_BOOL)
 DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_PTRMODE,
                     BT_VOID, BT_PTR, BT_PTRMODE)
 DEF_FUNCTION_TYPE_2 (BT_FN_VOID_CONST_PTR_SIZE, BT_VOID, BT_CONST_PTR, BT_SIZE)
+DEF_FUNCTION_TYPE_2 (BT_FN_PTR_CONST_PTR_INT, BT_PTR, BT_CONST_PTR, BT_INT)
 
 DEF_POINTER_TYPE (BT_PTR_FN_VOID_PTR_PTR, BT_FN_VOID_PTR_PTR)
 
index 730021ea7475ebe569bfe1e56d300815bb5d5c82..447c3b8173fb7d84dcf0015aca0812df6ef44a5d 100644 (file)
@@ -56,6 +56,7 @@ enum omp_ts_code {
   OMP_TRAIT_CONSTRUCT_PARALLEL,
   OMP_TRAIT_CONSTRUCT_FOR,
   OMP_TRAIT_CONSTRUCT_SIMD,
+  OMP_TRAIT_CONSTRUCT_DISPATCH,
   OMP_TRAIT_LAST,
   OMP_TRAIT_INVALID = -1
 };
index dd61ba3c23d369fbf572bb4d1ccd714cae539b19..c7229bd6d7dcb8243399459b7a1eb9a94ec16f7b 100644 (file)
@@ -564,6 +564,13 @@ enum omp_clause_code {
 
   /* OpenACC clause: nohost.  */
   OMP_CLAUSE_NOHOST,
+
+  /* OpenMP clause: novariants (scalar-expression).  */
+  OMP_CLAUSE_NOVARIANTS,
+
+  /* OpenMP clause: nocontext (scalar-expression).  */
+  OMP_CLAUSE_NOCONTEXT,
+
 };
 
 #undef DEFTREESTRUCT
index eab5c60579da3811068e1a0c050e2be0a1f71d9b..5e3553012f3ddcf92eeaa03cc75239103153f533 100644 (file)
@@ -507,6 +507,22 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags)
     case OMP_CLAUSE_EXCLUSIVE:
       name = "exclusive";
       goto print_remap;
+    case OMP_CLAUSE_NOVARIANTS:
+      pp_string (pp, "novariants");
+      pp_left_paren (pp);
+      gcc_assert (OMP_CLAUSE_NOVARIANTS_EXPR (clause));
+      dump_generic_node (pp, OMP_CLAUSE_NOVARIANTS_EXPR (clause), spc, flags,
+                        false);
+      pp_right_paren (pp);
+      break;
+    case OMP_CLAUSE_NOCONTEXT:
+      pp_string (pp, "nocontext");
+      pp_left_paren (pp);
+      gcc_assert (OMP_CLAUSE_NOCONTEXT_EXPR (clause));
+      dump_generic_node (pp, OMP_CLAUSE_NOCONTEXT_EXPR (clause), spc, flags,
+                        false);
+      pp_right_paren (pp);
+      break;
     case OMP_CLAUSE__LOOPTEMP_:
       name = "_looptemp_";
       goto print_remap;
@@ -3970,6 +3986,11 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
       dump_omp_clauses (pp, OMP_SECTIONS_CLAUSES (node), spc, flags);
       goto dump_omp_body;
 
+    case OMP_DISPATCH:
+      pp_string (pp, "#pragma omp dispatch");
+      dump_omp_clauses (pp, OMP_DISPATCH_CLAUSES (node), spc, flags);
+      goto dump_omp_body;
+
     case OMP_SECTION:
       pp_string (pp, "#pragma omp section");
       goto dump_omp_body;
index 7fd8abb3cfd7b91d227a55caf1239d0a246cbbce..1da06c7d4e91da6fcaca765f5b91a9e5e32691b9 100644 (file)
@@ -332,6 +332,8 @@ unsigned const char omp_clause_num_ops[] =
   0, /* OMP_CLAUSE_IF_PRESENT */
   0, /* OMP_CLAUSE_FINALIZE */
   0, /* OMP_CLAUSE_NOHOST */
+  1, /* OMP_CLAUSE_NOVARIANTS */
+  1, /* OMP_CLAUSE_NOCONTEXT */
 };
 
 const char * const omp_clause_code_name[] =
@@ -428,6 +430,8 @@ const char * const omp_clause_code_name[] =
   "if_present",
   "finalize",
   "nohost",
+  "novariants",
+  "nocontext",
 };
 
 /* Unless specific to OpenACC, we tend to internally maintain OpenMP-centric
index dd60d1ecde71a9cd369f97dd9943688aaf92e817..eba6a08dad4545e9b9ff50b28ffafd3d57e5c3f6 100644 (file)
@@ -1306,6 +1306,11 @@ DEFTREECODE (OMP_MASKED, "omp_masked", tcc_statement, 2)
    Operand 1: OMP_SCAN_CLAUSES: List of clauses.  */
 DEFTREECODE (OMP_SCAN, "omp_scan", tcc_statement, 2)
 
+/* OpenMP - #pragma omp dispatch [clause1 ... clauseN]
+   Operand 0: OMP_DISPATCH_BODY: Expression statement including a target call.
+   Operand 1: OMP_DISPATCH_CLAUSES: List of clauses.  */
+DEFTREECODE (OMP_DISPATCH, "omp_dispatch", tcc_statement, 2)
+
 /* OpenMP - #pragma omp section
    Operand 0: OMP_SECTION_BODY: Section body.  */
 DEFTREECODE (OMP_SECTION, "omp_section", tcc_statement, 1)
index 56c0454a598d57c8679719ef86fa77936860565c..6f586180dd1fa76f3d967fd6769f4341109623c0 100644 (file)
@@ -1612,6 +1612,9 @@ class auto_suppress_location_wrappers
 #define OMP_SCAN_BODY(NODE)    TREE_OPERAND (OMP_SCAN_CHECK (NODE), 0)
 #define OMP_SCAN_CLAUSES(NODE) TREE_OPERAND (OMP_SCAN_CHECK (NODE), 1)
 
+#define OMP_DISPATCH_BODY(NODE) TREE_OPERAND (OMP_DISPATCH_CHECK (NODE), 0)
+#define OMP_DISPATCH_CLAUSES(NODE) TREE_OPERAND (OMP_DISPATCH_CHECK (NODE), 1)
+
 #define OMP_CLAUSE_SIZE(NODE)                                          \
   OMP_CLAUSE_OPERAND (OMP_CLAUSE_RANGE_CHECK (OMP_CLAUSE_CHECK (NODE), \
                                              OMP_CLAUSE_FROM,          \
@@ -1759,6 +1762,10 @@ class auto_suppress_location_wrappers
   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PARTIAL), 0)
 #define OMP_CLAUSE_SIZES_LIST(NODE) \
   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SIZES), 0)
+#define OMP_CLAUSE_NOVARIANTS_EXPR(NODE)                                       \
+  OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NOVARIANTS), 0)
+#define OMP_CLAUSE_NOCONTEXT_EXPR(NODE)                                        \
+  OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NOCONTEXT), 0)
 
 #define OMP_CLAUSE_GRAINSIZE_EXPR(NODE) \
   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_GRAINSIZE),0)