aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/ASTWriterStmt.cpp
diff options
context:
space:
mode:
authorerichkeane <ekeane@nvidia.com>2025-01-22 12:22:03 -0800
committererichkeane <ekeane@nvidia.com>2025-02-03 07:22:22 -0800
commit99a9133a68b77cb978dd4b0cdbcd67e4edf7bd92 (patch)
treebc17fe1969c036a87d344c7c84afc4781a3c129a /clang/lib/Serialization/ASTWriterStmt.cpp
parentcb2598dda1aae5096a77bc8a9f6679ca1b350e5e (diff)
downloadllvm-99a9133a68b77cb978dd4b0cdbcd67e4edf7bd92.zip
llvm-99a9133a68b77cb978dd4b0cdbcd67e4edf7bd92.tar.gz
llvm-99a9133a68b77cb978dd4b0cdbcd67e4edf7bd92.tar.bz2
[OpenACC] Implement Sema/AST for 'atomic' construct
The atomic construct is a particularly complicated one. The directive itself is pretty simple, it has 5 options for the 'atomic-clause'. However, the associated statement is fairly complicated. 'read' accepts: v = x; 'write' accepts: x = expr; 'update' (or no clause) accepts: x++; x--; ++x; --x; x binop= expr; x = x binop expr; x = expr binop x; 'capture' accepts either a compound statement, or: v = x++; v = x--; v = ++x; v = --x; v = x binop= expr; v = x = x binop expr; v = x = expr binop x; IF 'capture' has a compound statement, it accepts: {v = x; x binop= expr; } {x binop= expr; v = x; } {v = x; x = x binop expr; } {v = x; x = expr binop x; } {x = x binop expr ;v = x; } {x = expr binop x; v = x; } {v = x; x = expr; } {v = x; x++; } {v = x; ++x; } {x++; v = x; } {++x; v = x; } {v = x; x--; } {v = x; --x; } {x--; v = x; } {--x; v = x; } While these are all quite complicated, there is a significant amount of similarity between the 'capture' and 'update' lists, so this patch reuses a lot of the same functions. This patch implements the entirety of 'atomic', creating a new Sema file for the sema for it, as it is fairly sizable.
Diffstat (limited to 'clang/lib/Serialization/ASTWriterStmt.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriterStmt.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp
index e6701c5..e5caf3d 100644
--- a/clang/lib/Serialization/ASTWriterStmt.cpp
+++ b/clang/lib/Serialization/ASTWriterStmt.cpp
@@ -3007,6 +3007,17 @@ void ASTStmtWriter::VisitOpenACCWaitConstruct(OpenACCWaitConstruct *S) {
Code = serialization::STMT_OPENACC_WAIT_CONSTRUCT;
}
+void ASTStmtWriter::VisitOpenACCAtomicConstruct(OpenACCAtomicConstruct *S) {
+ VisitStmt(S);
+ Record.writeEnum(S->Kind);
+ Record.AddSourceRange(S->Range);
+ Record.AddSourceLocation(S->DirectiveLoc);
+ Record.writeEnum(S->getAtomicKind());
+ Record.AddStmt(S->getAssociatedStmt());
+
+ Code = serialization::STMT_OPENACC_ATOMIC_CONSTRUCT;
+}
+
//===----------------------------------------------------------------------===//
// HLSL Constructs/Directives.
//===----------------------------------------------------------------------===//