diff options
author | Kelvin Li <kkwli0@gmail.com> | 2016-07-05 05:00:15 +0000 |
---|---|---|
committer | Kelvin Li <kkwli0@gmail.com> | 2016-07-05 05:00:15 +0000 |
commit | 4a39add05e01347f7e0683835c27a56bf1c29275 (patch) | |
tree | 8b74095e990246aed86a04d4c5af903c46c82664 /clang/lib/CodeGen | |
parent | 4d3626ed3192400bea0f8de5762715822907eae4 (diff) | |
download | bcm5719-llvm-4a39add05e01347f7e0683835c27a56bf1c29275.tar.gz bcm5719-llvm-4a39add05e01347f7e0683835c27a56bf1c29275.zip |
[OpenMP] Sema and parse for 'distribute parallel for simd'
Summary: This patch is an implementation of sema and parsing for the OpenMP composite pragma 'distribute parallel for simd'.
Differential Revision: http://reviews.llvm.org/D21977
llvm-svn: 274530
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGStmtOpenMP.cpp | 11 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 2 |
3 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 48e99e388a0..5e99f7ee677 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -284,6 +284,10 @@ void CodeGenFunction::EmitStmt(const Stmt *S) { EmitOMPDistributeParallelForDirective( cast<OMPDistributeParallelForDirective>(*S)); break; + case Stmt::OMPDistributeParallelForSimdDirectiveClass: + EmitOMPDistributeParallelForSimdDirective( + cast<OMPDistributeParallelForSimdDirective>(*S)); + break; } } diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index ad4e49d986c..86f0110eacd 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -1877,6 +1877,17 @@ void CodeGenFunction::EmitOMPDistributeParallelForDirective( }); } +void CodeGenFunction::EmitOMPDistributeParallelForSimdDirective( + const OMPDistributeParallelForSimdDirective &S) { + OMPLexicalScope Scope(*this, S, /*AsInlined=*/true); + CGM.getOpenMPRuntime().emitInlinedDirective( + *this, OMPD_distribute_parallel_for_simd, + [&S](CodeGenFunction &CGF, PrePostActionTy &) { + OMPLoopScope PreInitScope(CGF, S); + CGF.EmitStmt( + cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt()); + }); +} /// \brief Emit a helper variable and return corresponding lvalue. static LValue EmitOMPHelperVar(CodeGenFunction &CGF, const DeclRefExpr *Helper) { diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 9d46ff2647c..a1132167c04 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -2499,6 +2499,8 @@ public: void EmitOMPDistributeLoop(const OMPDistributeDirective &S); void EmitOMPDistributeParallelForDirective( const OMPDistributeParallelForDirective &S); + void EmitOMPDistributeParallelForSimdDirective( + const OMPDistributeParallelForSimdDirective &S); /// Emit outlined function for the target directive. static std::pair<llvm::Function * /*OutlinedFn*/, |