diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2015-04-13 05:28:11 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-04-13 05:28:11 +0000 |
commit | 671605e85bf2a6e7265db55e6d89f83bc58df2ed (patch) | |
tree | cbe0e715d1e80ecd6d2f5d805d356037399ee0df /clang/lib/CodeGen | |
parent | 379ed3942e447da21c099120b25f41f82b96f044 (diff) | |
download | bcm5719-llvm-671605e85bf2a6e7265db55e6d89f83bc58df2ed.tar.gz bcm5719-llvm-671605e85bf2a6e7265db55e6d89f83bc58df2ed.zip |
[OPENMP] Initial codegen for 'parallel for' directive.
Allows generation of combined 'parallel for' directive that represents 'parallel' region with internal implicit 'for' worksharing region.
Differential Revision: http://reviews.llvm.org/D8631
llvm-svn: 234722
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGStmtOpenMP.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index f46999084b3..c8c0fd6ed28 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -1049,9 +1049,20 @@ void CodeGenFunction::EmitOMPCriticalDirective(const OMPCriticalDirective &S) { *this, S.getDirectiveName().getAsString(), CodeGen, S.getLocStart()); } -void -CodeGenFunction::EmitOMPParallelForDirective(const OMPParallelForDirective &) { - llvm_unreachable("CodeGen for 'omp parallel for' is not supported yet."); +void CodeGenFunction::EmitOMPParallelForDirective( + const OMPParallelForDirective &S) { + // Emit directive as a combined directive that consists of two implicit + // directives: 'parallel' with 'for' directive. + LexicalScope Scope(*this, S.getSourceRange()); + auto &&CodeGen = [&S](CodeGenFunction &CGF) { + CGF.EmitOMPWorksharingLoop(S); + // Emit implicit barrier at the end of parallel region, but this barrier + // is at the end of 'for' directive, so emit it as the implicit barrier for + // this 'for' directive. + CGF.CGM.getOpenMPRuntime().emitBarrierCall(CGF, S.getLocStart(), + OMPD_parallel); + }; + emitCommonOMPParallelDirective(*this, S, CodeGen); } void CodeGenFunction::EmitOMPParallelForSimdDirective( |