From 4f4bf7c3482598c02bea7fbe9bbcca56ac720313 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Thu, 15 Mar 2018 15:47:20 +0000 Subject: [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 --- clang/lib/CodeGen/CGStmtOpenMP.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'clang/lib/CodeGen/CGStmtOpenMP.cpp') 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; -- cgit v1.2.3