summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriterStmt.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-10-08 14:01:46 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-10-08 14:01:46 +0000
commit4a5bb772c362afeb3586b84edc3c2d0eeae31327 (patch)
treef0ae2b39368baf6bc62b8d52d9b55df12462773b /clang/lib/Serialization/ASTWriterStmt.cpp
parent34cb659103fd1818c0509daf958863f974cf7985 (diff)
downloadbcm5719-llvm-4a5bb772c362afeb3586b84edc3c2d0eeae31327.tar.gz
bcm5719-llvm-4a5bb772c362afeb3586b84edc3c2d0eeae31327.zip
[OPENMP] Codegen for 'firstprivate' clause.
This patch generates some helper variables that used as private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by copy using values of the original variables (with the copy constructor, if any). For arrays, initializator is generated for single element and in the codegen procedure this initial value is automatically propagated between all elements of the private copy. In outlined function, references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables an implicit barier is generated by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables. Differential Revision: http://reviews.llvm.org/D5140 llvm-svn: 219306
Diffstat (limited to 'clang/lib/Serialization/ASTWriterStmt.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriterStmt.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp
index 80d42b8ae5f..a963d6b875a 100644
--- a/clang/lib/Serialization/ASTWriterStmt.cpp
+++ b/clang/lib/Serialization/ASTWriterStmt.cpp
@@ -1761,8 +1761,15 @@ void OMPClauseWriter::VisitOMPPrivateClause(OMPPrivateClause *C) {
void OMPClauseWriter::VisitOMPFirstprivateClause(OMPFirstprivateClause *C) {
Record.push_back(C->varlist_size());
Writer->Writer.AddSourceLocation(C->getLParenLoc(), Record);
- for (auto *VE : C->varlists())
+ for (auto *VE : C->varlists()) {
+ Writer->Writer.AddStmt(VE);
+ }
+ for (auto *VE : C->private_copies()) {
Writer->Writer.AddStmt(VE);
+ }
+ for (auto *VE : C->inits()) {
+ Writer->Writer.AddStmt(VE);
+ }
}
void OMPClauseWriter::VisitOMPLastprivateClause(OMPLastprivateClause *C) {
OpenPOWER on IntegriCloud