summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGOpenMPRuntime.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2015-02-05 05:57:51 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2015-02-05 05:57:51 +0000
commit9f797f32e28e3c1f5524c42ff4ee6ff500a4c595 (patch)
tree73c395dc90862a63d668cf8014dc840c7804ca00 /clang/lib/CodeGen/CGOpenMPRuntime.cpp
parentbc9f12e7bcb75fb6e7a2c46ffefa3fc810d7a0b2 (diff)
downloadbcm5719-llvm-9f797f32e28e3c1f5524c42ff4ee6ff500a4c595.tar.gz
bcm5719-llvm-9f797f32e28e3c1f5524c42ff4ee6ff500a4c595.zip
[OPENMP] Codegen for 'taskyield' directive
For 'taskyield' directive emit call to kmp_int32 __kmpc_omp_taskyield(ident_t *, kmp_int32 global_tid, int end_part); runtime function call with end_part arg set to 0 (it is ignored). Differential Revision: http://reviews.llvm.org/D7047 llvm-svn: 228272
Diffstat (limited to 'clang/lib/CodeGen/CGOpenMPRuntime.cpp')
-rw-r--r--clang/lib/CodeGen/CGOpenMPRuntime.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 90bc5dbdb6d..abc609aebb2 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -475,6 +475,15 @@ CGOpenMPRuntime::CreateRuntimeFunction(OpenMPRTLFunction Function) {
RTLFn = CGM.CreateRuntimeFunction(FnTy, /*Name=*/"__kmpc_end_master");
break;
}
+ case OMPRTL__kmpc_omp_taskyield: {
+ // Build kmp_int32 __kmpc_omp_taskyield(ident_t *, kmp_int32 global_tid,
+ // int end_part);
+ llvm::Type *TypeParams[] = {getIdentTyPointerTy(), CGM.Int32Ty, CGM.IntTy};
+ llvm::FunctionType *FnTy =
+ llvm::FunctionType::get(CGM.Int32Ty, TypeParams, /*isVarArg=*/false);
+ RTLFn = CGM.CreateRuntimeFunction(FnTy, /*Name=*/"__kmpc_omp_taskyield");
+ break;
+ }
}
return RTLFn;
}
@@ -786,6 +795,16 @@ void CGOpenMPRuntime::EmitOMPMasterRegion(
});
}
+void CGOpenMPRuntime::EmitOMPTaskyieldCall(CodeGenFunction &CGF,
+ SourceLocation Loc) {
+ // Build call __kmpc_omp_taskyield(loc, thread_id, 0);
+ llvm::Value *Args[] = {
+ EmitOpenMPUpdateLocation(CGF, Loc), GetOpenMPThreadID(CGF, Loc),
+ llvm::ConstantInt::get(CGM.IntTy, /*V=*/0, /*isSigned=*/true)};
+ auto RTLFn = CreateRuntimeFunction(OMPRTL__kmpc_omp_taskyield);
+ CGF.EmitRuntimeCall(RTLFn, Args);
+}
+
void CGOpenMPRuntime::EmitOMPBarrierCall(CodeGenFunction &CGF,
SourceLocation Loc, bool IsExplicit) {
// Build call __kmpc_cancel_barrier(loc, thread_id);
OpenPOWER on IntegriCloud