]> git.ipfire.org Git - thirdparty/gcc.git/commit
OpenMP: New tree nodes for metadirective and dynamic selector support.
authorSandra Loosemore <sloosemore@baylibre.com>
Thu, 26 Dec 2024 18:15:56 +0000 (18:15 +0000)
committerSandra Loosemore <sloosemore@baylibre.com>
Tue, 14 Jan 2025 16:29:27 +0000 (16:29 +0000)
commit210a090e33ec4b51248077b701d432d36ef43fb3
tree1ef25cbf7142679c9afc3cc4a6313cfd1db148da
parent22fe3c05d86b52c35850918bfb21e1f597e1b5c7
OpenMP: New tree nodes for metadirective and dynamic selector support.

This patch adds basic support for three new tree node types that will
be used in subsequent patches to support OpenMP metadirectives and
dynamic selectors.

OMP_METADIRECTIVE is the internal representation of parsed OpenMP
metadirective constructs.  It's produced by the front ends and is expanded
during gimplification.

OMP_NEXT_VARIANT is used as a "magic cookie" for late resolution of
variant constructs that cannot be fully resolved during
gimplification, used to set the controlling variable of a switch
statement that branches to the next alternative once the candidate
list can be filtered and sorted.  These nodes are expanded into
constants in the ompdevlow pass.  In some gimple passes, they need to
be treated as constants.

OMP_TARGET_DEVICE_MATCHES is a similar "magic cookie" used to resolve
the target_device dynamic selector.  It is wrapped in an OpenMP target
construct, and can be resolved to a constant in the ompdevlow pass.

gcc/ChangeLog:
* doc/generic.texi (OpenMP): Document OMP_METADIRECTIVE,
OMP_NEXT_VARIANT, and OMP_TARGET_DEVICE_MATCHES.
* fold-const.cc (operand_compare::hash_operand): Ignore
the new nodes.
* gimple-expr.cc (is_gimple_val): Allow OMP_NEXT_VARIANT
and OMP_TARGET_DEVICE_MATCHES.
* gimple.cc (get_gimple_rhs_num_ops): OMP_NEXT_VARIANT and
OMP_TARGET_DEVICE_MATCHES are both GIMPLE_SINGLE_RHS.
* tree-cfg.cc (tree_node_can_be_shared): Allow sharing of
OMP_NEXT_VARIANT.
* tree-inline.cc (remap_gimple_op_r): Ignore subtrees of
OMP_NEXT_VARIANT.
* tree-pretty-print.cc (dump_generic_node): Handle OMP_METADIRECTIVE,
OMP_NEXT_VARIANT, and OMP_TARGET_DEVICE_MATCHES.
* tree-ssa-operands.cc (operands_scanner::get_expr_operands):
Ignore operands of OMP_NEXT_VARIANT and OMP_TARGET_DEVICE_MATCHES.
* tree.def (OMP_METADIRECTIVE): New.
(OMP_NEXT_VARIANT): New.
(OMP_TARGET_DEVICE_MATCHES): New.
* tree.h (OMP_METADIRECTIVE_VARIANTS): New.
(OMP_METADIRECTIVE_VARIANT_SELECTOR): New.
(OMP_METADIRECTIVE_VARIANT_DIRECTIVE): New.
(OMP_METADIRECTIVE_VARIANT_BODY): New.
(OMP_NEXT_VARIANT_INDEX): New.
(OMP_NEXT_VARIANT_STATE): New.
(OMP_TARGET_DEVICE_MATCHES_SELECTOR): New.
(OMP_TARGET_DEVICE_MATCHES_PROPERTIES): New.

Co-Authored-By: Kwok Cheung Yeung <kcy@codesourcery.com>
Co-Authored-By: Sandra Loosemore <sandra@codesourcery.com>
gcc/doc/generic.texi
gcc/fold-const.cc
gcc/gimple-expr.cc
gcc/gimple.cc
gcc/tree-cfg.cc
gcc/tree-inline.cc
gcc/tree-pretty-print.cc
gcc/tree-ssa-operands.cc
gcc/tree.def
gcc/tree.h