diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2014-10-21 03:16:40 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-10-21 03:16:40 +0000 |
commit | 03b340a3a5608eecf447bdbcb0a3b64714e4efd7 (patch) | |
tree | 230ba545e88bcc01901ab44644ff0e79dd2d450b /clang/lib/AST/StmtProfile.cpp | |
parent | 322d0df309b5a01612e3a2dbc194e300d2cd5176 (diff) | |
download | bcm5719-llvm-03b340a3a5608eecf447bdbcb0a3b64714e4efd7.tar.gz bcm5719-llvm-03b340a3a5608eecf447bdbcb0a3b64714e4efd7.zip |
[OPENMP] Codegen for 'private' clause in 'parallel' directive.
This patch generates some helper variables which used as a private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by default (with the default constructor, if any). 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 and implicit barier is set 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/D4752
llvm-svn: 220262
Diffstat (limited to 'clang/lib/AST/StmtProfile.cpp')
-rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index f06c36e0b6f..87e30bb3e35 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -322,12 +322,16 @@ void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {} template<typename T> void OMPClauseProfiler::VisitOMPClauseList(T *Node) { - for (auto *I : Node->varlists()) - Profiler->VisitStmt(I); + for (auto *E : Node->varlists()) { + Profiler->VisitStmt(E); + } } void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) { VisitOMPClauseList(C); + for (auto *E : C->private_copies()) { + Profiler->VisitStmt(E); + } } void OMPClauseProfiler::VisitOMPFirstprivateClause(const OMPFirstprivateClause *C) { |