summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmtOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2018-03-15 15:47:20 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2018-03-15 15:47:20 +0000
commit4f4bf7c3482598c02bea7fbe9bbcca56ac720313 (patch)
tree9d22d71fca84678cbb814b489d172fb2d714b35d /clang/lib/CodeGen/CGStmtOpenMP.cpp
parent1110c4d33675f4351c080e621dbf8ee298ef13ae (diff)
downloadbcm5719-llvm-4f4bf7c3482598c02bea7fbe9bbcca56ac720313.tar.gz
bcm5719-llvm-4f4bf7c3482598c02bea7fbe9bbcca56ac720313.zip
[OPENMP] Codegen for `omp declare target` construct.
Added initial codegen for device side of declarations inside `omp declare target` construct + codegen for implicit `declare target` functions, which are used in the target regions. llvm-svn: 327636
Diffstat (limited to 'clang/lib/CodeGen/CGStmtOpenMP.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmtOpenMP.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 7d2093bdf60..9d077a2be16 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -3914,6 +3914,16 @@ static void emitCommonOMPTargetDirective(CodeGenFunction &CGF,
assert(isOpenMPTargetExecutionDirective(S.getDirectiveKind()));
CodeGenModule &CGM = CGF.CGM;
+ // On device emit this construct as inlined code.
+ if (CGM.getLangOpts().OpenMPIsDevice) {
+ OMPLexicalScope Scope(CGF, S, OMPD_target);
+ CGM.getOpenMPRuntime().emitInlinedDirective(
+ CGF, OMPD_target, [&S](CodeGenFunction &CGF, PrePostActionTy &) {
+ CGF.EmitStmt(S.getCapturedStmt(OMPD_target)->getCapturedStmt());
+ });
+ return;
+ }
+
llvm::Function *Fn = nullptr;
llvm::Constant *FnID = nullptr;
OpenPOWER on IntegriCloud