[PATCH] D18286: [OPENMP] private and firstprivate clauses of teams code generation for nvptx
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 29 20:07:25 PDT 2016
ABataev added a comment.
Thinking more about this patch I think it is a right solution to override void `llvm::Value *emitParallelOrTeamsOutlinedFunction()` and `void emitTeamsCall()` for `CGOpenMPRuntimeNVPTX` class:
llvm::Value *CGOpenMPRuntimeNVPTX::emitParallelOrTeamsOutlinedFunction() {
llvm::Value *OutlinedFn = CGOpenMPRuntime::emitParallelOrTeamsOutlinedFunction();
cast<llvm::Function>(OutlinedFn)->addFnAttr(llvm::Attribute::AlwaysInline);
return OutlinedFn;
}
void CGOpenMPRuntimeNVPTX::emitTeamsCall() {
if (!CGF.HaveInsertPoint())
return;
CodeGenFunction::RunCleanupsScope Scope(CGF);
Address ZeroAddr =
CGF.CreateTempAlloca(CGF.Int32Ty, CharUnits::fromQuantity(4),
/*Name*/ ".zero.addr");
CGF.InitTempAlloca(ZeroAddr, CGF.Builder.getInt32(/*C*/ 0));
llvm::SmallVector<llvm::Value *, 16> OutlinedFnArgs;
OutlinedFnArgs.push_back(ZeroAddr.getPointer());
OutlinedFnArgs.push_back(ZeroAddr.getPointer());
OutlinedFnArgs.append(CapturedVars.begin(), CapturedVars.end());
CGF.EmitCallOrInvoke(OutlinedFn, OutlinedFnArgs);
}
Also, please update patch to the latest revision
Repository:
rL LLVM
http://reviews.llvm.org/D18286
More information about the cfe-commits
mailing list