diff options
author | Erich Keane <ekeane@nvidia.com> | 2023-11-17 06:29:02 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-17 06:29:02 -0800 |
commit | ff219ea9ca80f46ff85dbdb94622ffb319a0d237 (patch) | |
tree | 17213428b3e4b11cc4b516b42f02cb7f64f2cb60 /clang/lib/Parse/Parser.cpp | |
parent | 9c0e64999b23046d0b8987a48ddc41a4c6129f9d (diff) | |
download | llvm-ff219ea9ca80f46ff85dbdb94622ffb319a0d237.zip llvm-ff219ea9ca80f46ff85dbdb94622ffb319a0d237.tar.gz llvm-ff219ea9ca80f46ff85dbdb94622ffb319a0d237.tar.bz2 |
[OpenACC] Initial commits to support OpenACC (#70234)
Initial commits to support OpenACC. This patchset:
adds a clang-command line argument '-fopenacc', and starts
to define _OPENACC, albeit to '1' instead of the standardized
value (since we don't properly implement OpenACC yet).
The OpenACC spec defines `_OPENACC` to be equal to the latest standard
implemented. However, since we're not done implementing any standard,
we've defined this by default to be `1`. As it is useful to run our
compiler against existing OpenACC workloads, we're providing a
temporary override flag to change the `_OPENACC` value to be any
entirely digit value, permitting testing against any existing OpenACC
project.
Exactly like the OpenMP parser, the OpenACC pragma parser needs to
consume and reprocess the tokens. This patch sets up the infrastructure
to do so by refactoring the OpenMP version of this into a more general
version that works for OpenACC as well.
Additionally, this adds a few diagnostics and token kinds to get us
started.
Diffstat (limited to 'clang/lib/Parse/Parser.cpp')
-rw-r--r-- | clang/lib/Parse/Parser.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 176d214..41b7462 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -318,6 +318,12 @@ bool Parser::SkipUntil(ArrayRef<tok::TokenKind> Toks, SkipUntilFlags Flags) { return false; ConsumeAnnotationToken(); break; + case tok::annot_pragma_openacc: + case tok::annot_pragma_openacc_end: + // FIXME: Like OpenMP above, we should not be doing this if we're parsing + // an OpenACC Directive. + ConsumeAnnotationToken(); + break; case tok::annot_module_begin: case tok::annot_module_end: case tok::annot_module_include: @@ -851,6 +857,8 @@ Parser::ParseExternalDeclaration(ParsedAttributes &Attrs, AccessSpecifier AS = AS_none; return ParseOpenMPDeclarativeDirectiveWithExtDecl(AS, Attrs); } + case tok::annot_pragma_openacc: + return ParseOpenACCDirective(); case tok::annot_pragma_ms_pointers_to_members: HandlePragmaMSPointersToMembers(); return nullptr; |