Skip to content

Commit 0e15f1d

Browse files
committed
OpenMP: dispatch + adjust_args tree data structures and front-end interfaces
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.
1 parent fa72036 commit 0e15f1d

File tree

8 files changed

+47
-0
lines changed

8 files changed

+47
-0
lines changed

gcc/builtin-types.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ DEF_FUNCTION_TYPE_2 (BT_FN_INT_FEXCEPT_T_PTR_INT, BT_INT, BT_FEXCEPT_T_PTR,
684684
DEF_FUNCTION_TYPE_2 (BT_FN_INT_CONST_FEXCEPT_T_PTR_INT, BT_INT,
685685
BT_CONST_FEXCEPT_T_PTR, BT_INT)
686686
DEF_FUNCTION_TYPE_2 (BT_FN_PTR_CONST_PTR_UINT8, BT_PTR, BT_CONST_PTR, BT_UINT8)
687+
DEF_FUNCTION_TYPE_2 (BT_FN_PTR_CONST_PTR_INT, BT_PTR, BT_CONST_PTR, BT_INT)
687688

688689
DEF_POINTER_TYPE (BT_PTR_FN_VOID_PTR_PTR, BT_FN_VOID_PTR_PTR)
689690

gcc/fortran/types.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ DEF_FUNCTION_TYPE_2 (BT_FN_BOOL_INT_BOOL, BT_BOOL, BT_INT, BT_BOOL)
119119
DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_PTRMODE,
120120
BT_VOID, BT_PTR, BT_PTRMODE)
121121
DEF_FUNCTION_TYPE_2 (BT_FN_VOID_CONST_PTR_SIZE, BT_VOID, BT_CONST_PTR, BT_SIZE)
122+
DEF_FUNCTION_TYPE_2 (BT_FN_PTR_CONST_PTR_INT, BT_PTR, BT_CONST_PTR, BT_INT)
122123

123124
DEF_POINTER_TYPE (BT_PTR_FN_VOID_PTR_PTR, BT_FN_VOID_PTR_PTR)
124125

gcc/omp-selectors.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ enum omp_ts_code {
5656
OMP_TRAIT_CONSTRUCT_PARALLEL,
5757
OMP_TRAIT_CONSTRUCT_FOR,
5858
OMP_TRAIT_CONSTRUCT_SIMD,
59+
OMP_TRAIT_CONSTRUCT_DISPATCH,
5960
OMP_TRAIT_LAST,
6061
OMP_TRAIT_INVALID = -1
6162
};

gcc/tree-core.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,13 @@ enum omp_clause_code {
564564

565565
/* OpenACC clause: nohost. */
566566
OMP_CLAUSE_NOHOST,
567+
568+
/* OpenMP clause: novariants (scalar-expression). */
569+
OMP_CLAUSE_NOVARIANTS,
570+
571+
/* OpenMP clause: nocontext (scalar-expression). */
572+
OMP_CLAUSE_NOCONTEXT,
573+
567574
};
568575

569576
#undef DEFTREESTRUCT

gcc/tree-pretty-print.cc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,22 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags)
507507
case OMP_CLAUSE_EXCLUSIVE:
508508
name = "exclusive";
509509
goto print_remap;
510+
case OMP_CLAUSE_NOVARIANTS:
511+
pp_string (pp, "novariants");
512+
pp_left_paren (pp);
513+
gcc_assert (OMP_CLAUSE_NOVARIANTS_EXPR (clause));
514+
dump_generic_node (pp, OMP_CLAUSE_NOVARIANTS_EXPR (clause), spc, flags,
515+
false);
516+
pp_right_paren (pp);
517+
break;
518+
case OMP_CLAUSE_NOCONTEXT:
519+
pp_string (pp, "nocontext");
520+
pp_left_paren (pp);
521+
gcc_assert (OMP_CLAUSE_NOCONTEXT_EXPR (clause));
522+
dump_generic_node (pp, OMP_CLAUSE_NOCONTEXT_EXPR (clause), spc, flags,
523+
false);
524+
pp_right_paren (pp);
525+
break;
510526
case OMP_CLAUSE__LOOPTEMP_:
511527
name = "_looptemp_";
512528
goto print_remap;
@@ -3970,6 +3986,11 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
39703986
dump_omp_clauses (pp, OMP_SECTIONS_CLAUSES (node), spc, flags);
39713987
goto dump_omp_body;
39723988

3989+
case OMP_DISPATCH:
3990+
pp_string (pp, "#pragma omp dispatch");
3991+
dump_omp_clauses (pp, OMP_DISPATCH_CLAUSES (node), spc, flags);
3992+
goto dump_omp_body;
3993+
39733994
case OMP_SECTION:
39743995
pp_string (pp, "#pragma omp section");
39753996
goto dump_omp_body;

gcc/tree.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ unsigned const char omp_clause_num_ops[] =
332332
0, /* OMP_CLAUSE_IF_PRESENT */
333333
0, /* OMP_CLAUSE_FINALIZE */
334334
0, /* OMP_CLAUSE_NOHOST */
335+
1, /* OMP_CLAUSE_NOVARIANTS */
336+
1, /* OMP_CLAUSE_NOCONTEXT */
335337
};
336338

337339
const char * const omp_clause_code_name[] =
@@ -428,6 +430,8 @@ const char * const omp_clause_code_name[] =
428430
"if_present",
429431
"finalize",
430432
"nohost",
433+
"novariants",
434+
"nocontext",
431435
};
432436

433437
/* Unless specific to OpenACC, we tend to internally maintain OpenMP-centric

gcc/tree.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,11 @@ DEFTREECODE (OMP_MASKED, "omp_masked", tcc_statement, 2)
13061306
Operand 1: OMP_SCAN_CLAUSES: List of clauses. */
13071307
DEFTREECODE (OMP_SCAN, "omp_scan", tcc_statement, 2)
13081308

1309+
/* OpenMP - #pragma omp dispatch [clause1 ... clauseN]
1310+
Operand 0: OMP_DISPATCH_BODY: Expression statement including a target call.
1311+
Operand 1: OMP_DISPATCH_CLAUSES: List of clauses. */
1312+
DEFTREECODE (OMP_DISPATCH, "omp_dispatch", tcc_statement, 2)
1313+
13091314
/* OpenMP - #pragma omp section
13101315
Operand 0: OMP_SECTION_BODY: Section body. */
13111316
DEFTREECODE (OMP_SECTION, "omp_section", tcc_statement, 1)

gcc/tree.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,9 @@ class auto_suppress_location_wrappers
16121612
#define OMP_SCAN_BODY(NODE) TREE_OPERAND (OMP_SCAN_CHECK (NODE), 0)
16131613
#define OMP_SCAN_CLAUSES(NODE) TREE_OPERAND (OMP_SCAN_CHECK (NODE), 1)
16141614

1615+
#define OMP_DISPATCH_BODY(NODE) TREE_OPERAND (OMP_DISPATCH_CHECK (NODE), 0)
1616+
#define OMP_DISPATCH_CLAUSES(NODE) TREE_OPERAND (OMP_DISPATCH_CHECK (NODE), 1)
1617+
16151618
#define OMP_CLAUSE_SIZE(NODE) \
16161619
OMP_CLAUSE_OPERAND (OMP_CLAUSE_RANGE_CHECK (OMP_CLAUSE_CHECK (NODE), \
16171620
OMP_CLAUSE_FROM, \
@@ -1759,6 +1762,10 @@ class auto_suppress_location_wrappers
17591762
OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PARTIAL), 0)
17601763
#define OMP_CLAUSE_SIZES_LIST(NODE) \
17611764
OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SIZES), 0)
1765+
#define OMP_CLAUSE_NOVARIANTS_EXPR(NODE) \
1766+
OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NOVARIANTS), 0)
1767+
#define OMP_CLAUSE_NOCONTEXT_EXPR(NODE) \
1768+
OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NOCONTEXT), 0)
17621769

17631770
#define OMP_CLAUSE_GRAINSIZE_EXPR(NODE) \
17641771
OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_GRAINSIZE),0)

0 commit comments

Comments
 (0)