diff options
author | Kelvin Li <kkwli0@gmail.com> | 2016-07-14 02:54:56 +0000 |
---|---|---|
committer | Kelvin Li <kkwli0@gmail.com> | 2016-07-14 02:54:56 +0000 |
commit | a579b9196c6eaa1e2a52832e8d0025eaf6160efa (patch) | |
tree | b79099a091e831e165b0e8f19dad2eb29a0fa743 /clang/lib/CodeGen | |
parent | 0bd882295413a2b00a5cc4db712bcf7dddf117b6 (diff) | |
download | bcm5719-llvm-a579b9196c6eaa1e2a52832e8d0025eaf6160efa.tar.gz bcm5719-llvm-a579b9196c6eaa1e2a52832e8d0025eaf6160efa.zip |
[OpenMP] Sema and parsing for 'target parallel for simd' pragma
This patch is to implement sema and parsing for 'target parallel for simd' pragma.
Differential Revision: http://reviews.llvm.org/D22096
llvm-svn: 275365
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGStmtOpenMP.cpp | 12 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 2 |
3 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 6b4452cdb65..13c02f21813 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -291,6 +291,10 @@ void CodeGenFunction::EmitStmt(const Stmt *S) { case Stmt::OMPDistributeSimdDirectiveClass: EmitOMPDistributeSimdDirective(cast<OMPDistributeSimdDirective>(*S)); break; + case Stmt::OMPTargetParallelForSimdDirectiveClass: + EmitOMPTargetParallelForSimdDirective( + cast<OMPTargetParallelForSimdDirective>(*S)); + break; } } diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index 6ccf3e504ad..26f780fdd7d 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -1901,6 +1901,18 @@ void CodeGenFunction::EmitOMPDistributeSimdDirective( }); } +void CodeGenFunction::EmitOMPTargetParallelForSimdDirective( + const OMPTargetParallelForSimdDirective &S) { + OMPLexicalScope Scope(*this, S, /*AsInlined=*/true); + CGM.getOpenMPRuntime().emitInlinedDirective( + *this, OMPD_target_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 08a3b307a4c..45068fa5544 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -2506,6 +2506,8 @@ public: void EmitOMPDistributeParallelForSimdDirective( const OMPDistributeParallelForSimdDirective &S); void EmitOMPDistributeSimdDirective(const OMPDistributeSimdDirective &S); + void EmitOMPTargetParallelForSimdDirective( + const OMPTargetParallelForSimdDirective &S); /// Emit outlined function for the target directive. static std::pair<llvm::Function * /*OutlinedFn*/, |