diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2015-03-30 05:20:59 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-03-30 05:20:59 +0000 |
commit | b4505a722927a16fbb5dcbec5e3b90ab1d7942dd (patch) | |
tree | 9b097b538bf215a369011a8a901cc88a454de33a /clang/lib/Serialization/ASTWriterStmt.cpp | |
parent | 36df1ca5f1ab42bc92bffc25068edbb924b44a40 (diff) | |
download | bcm5719-llvm-b4505a722927a16fbb5dcbec5e3b90ab1d7942dd.tar.gz bcm5719-llvm-b4505a722927a16fbb5dcbec5e3b90ab1d7942dd.zip |
[OPENMP] Codegen for 'atomic update' construct.
Adds atomic update codegen for the following forms of expressions:
x binop= expr;
x++;
++x;
x--;
--x;
x = x binop expr;
x = expr binop x;
If x and expr are integer and binop is associative or x is a LHS in a RHS of the assignment expression, and atomics are allowed for type of x on the target platform atomicrmw instruction is emitted.
Otherwise compare-and-swap sequence is emitted:
bb:
...
atomic load <x>
cont:
<expected> = phi [ <x>, label %bb ], [ <new_failed>, %cont ]
<desired> = <expected> binop <expr>
<res> = cmpxchg atomic &<x>, desired, expected
<new_failed> = <res>.field1;
br <res>field2, label %exit, label %cont
exit:
...
Differential Revision: http://reviews.llvm.org/D8536
llvm-svn: 233513
Diffstat (limited to 'clang/lib/Serialization/ASTWriterStmt.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriterStmt.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp index 6e647c31950..daebc52c96b 100644 --- a/clang/lib/Serialization/ASTWriterStmt.cpp +++ b/clang/lib/Serialization/ASTWriterStmt.cpp @@ -2005,11 +2005,11 @@ void ASTStmtWriter::VisitOMPAtomicDirective(OMPAtomicDirective *D) { VisitStmt(D); Record.push_back(D->getNumClauses()); VisitOMPExecutableDirective(D); - Record.push_back(D->getOpKind()); Writer.AddStmt(D->getX()); - Writer.AddStmt(D->getXRVal()); Writer.AddStmt(D->getV()); Writer.AddStmt(D->getExpr()); + Writer.AddStmt(D->getUpdateExpr()); + Record.push_back(D->isXLHSInRHSPart() ? 1 : 0); Code = serialization::STMT_OMP_ATOMIC_DIRECTIVE; } |