diff options
author | Samuel Antao <sfantao@us.ibm.com> | 2016-04-27 23:14:30 +0000 |
---|---|---|
committer | Samuel Antao <sfantao@us.ibm.com> | 2016-04-27 23:14:30 +0000 |
commit | 8dd6628743c4bb0bf5111cd1acd85c11418afb38 (patch) | |
tree | 123a67d809ab6dbff5b4c20b055fb547cc963191 /clang/lib/CodeGen/CGStmtOpenMP.cpp | |
parent | facf45a82f66df27ab2d9874c3cc80556ea66857 (diff) | |
download | bcm5719-llvm-8dd6628743c4bb0bf5111cd1acd85c11418afb38.tar.gz bcm5719-llvm-8dd6628743c4bb0bf5111cd1acd85c11418afb38.zip |
[OpenMP] Code generation for target exit data directive
Summary:
This patch adds support for the target exit data directive code generation.
Given that, apart from the employed runtime call, target exit data requires the same code generation pattern as target enter data, the OpenMP codegen entry point was renamed and reused for both.
Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev
Subscribers: cfe-commits, fraggamuffin, caomhin
Differential Revision: http://reviews.llvm.org/D17369
llvm-svn: 267814
Diffstat (limited to 'clang/lib/CodeGen/CGStmtOpenMP.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGStmtOpenMP.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index 14c9fa161e4..9a9fdfcb7f4 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -3287,12 +3287,29 @@ void CodeGenFunction::EmitOMPTargetEnterDataDirective( if (auto *C = S.getSingleClause<OMPDeviceClause>()) Device = C->getDevice(); - CGM.getOpenMPRuntime().emitTargetEnterDataCall(*this, S, IfCond, Device); + CGM.getOpenMPRuntime().emitTargetEnterOrExitDataCall(*this, S, IfCond, + Device); } void CodeGenFunction::EmitOMPTargetExitDataDirective( const OMPTargetExitDataDirective &S) { - // TODO: codegen for target exit data. + // If we don't have target devices, don't bother emitting the data mapping + // code. + if (CGM.getLangOpts().OMPTargetTriples.empty()) + return; + + // Check if we have any if clause associated with the directive. + const Expr *IfCond = nullptr; + if (auto *C = S.getSingleClause<OMPIfClause>()) + IfCond = C->getCondition(); + + // Check if we have any device clause associated with the directive. + const Expr *Device = nullptr; + if (auto *C = S.getSingleClause<OMPDeviceClause>()) + Device = C->getDevice(); + + CGM.getOpenMPRuntime().emitTargetEnterOrExitDataCall(*this, S, IfCond, + Device); } void CodeGenFunction::EmitOMPTargetParallelDirective( |