[OpenMP] Add initial support for `omp [begin/end] assumes`
authorJohannes Doerfert <johannes@jdoerfert.de>
Mon, 23 Nov 2020 17:48:59 +0000 (11:48 -0600)
committerJohannes Doerfert <johannes@jdoerfert.de>
Thu, 17 Dec 2020 02:02:49 +0000 (20:02 -0600)
commit2e6e4e6aeef71dd8fba038177a34a82b574d2126
tree2090e2d89a91fa58d3555651f04740bf881bc1f8
parentf48dae310866851aaeba9e1271935b543b413113
[OpenMP] Add initial support for `omp [begin/end] assumes`

The `assumes` directive is an OpenMP 5.1 feature that allows the user to
provide assumptions to the optimizer. Assumptions can refer to
directives (`absent` and `contains` clauses), expressions (`holds`
clause), or generic properties (`no_openmp_routines`, `ext_ABCD`, ...).

The `assumes` spelling is used for assumptions in the global scope while
`assume` is used for executable contexts with an associated structured
block.

This patch only implements the global spellings. While clauses with
arguments are "accepted" by the parser, they will simply be ignored for
now. The implementation lowers the assumptions directly to the
`AssumptionAttr`.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D91980
15 files changed:
clang/include/clang/Basic/DiagnosticParseKinds.td
clang/include/clang/Parse/Parser.h
clang/include/clang/Sema/Sema.h
clang/lib/Parse/ParseOpenMP.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaLambda.cpp
clang/lib/Sema/SemaOpenMP.cpp
clang/test/OpenMP/assumes_codegen.cpp [new file with mode: 0644]
clang/test/OpenMP/assumes_include_nvptx.cpp [new file with mode: 0644]
clang/test/OpenMP/assumes_messages.c [new file with mode: 0644]
clang/test/OpenMP/assumes_print.cpp [new file with mode: 0644]
clang/test/OpenMP/assumes_template_print.cpp [new file with mode: 0644]
llvm/include/llvm/Frontend/OpenMP/OMP.td
llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def