Lines Matching full:cgf
24 llvm::Value *CGOpenMPRuntimeNVPTX::getNVPTXWarpSize(CodeGenFunction &CGF) {
25 CGBuilderTy &Bld = CGF.Builder;
33 llvm::Value *CGOpenMPRuntimeNVPTX::getNVPTXThreadID(CodeGenFunction &CGF) {
34 CGBuilderTy &Bld = CGF.Builder;
42 llvm::Value *CGOpenMPRuntimeNVPTX::getNVPTXNumThreads(CodeGenFunction &CGF) {
43 CGBuilderTy &Bld = CGF.Builder;
51 void CGOpenMPRuntimeNVPTX::getNVPTXCTABarrier(CodeGenFunction &CGF) {
52 CGBuilderTy &Bld = CGF.Builder;
58 void CGOpenMPRuntimeNVPTX::syncCTAThreads(CodeGenFunction &CGF) {
59 getNVPTXCTABarrier(CGF);
69 llvm::Value *CGOpenMPRuntimeNVPTX::getMasterThreadID(CodeGenFunction &CGF) {
70 CGBuilderTy &Bld = CGF.Builder;
71 llvm::Value *NumThreads = getNVPTXNumThreads(CGF);
74 llvm::Value *Mask = Bld.CreateSub(getNVPTXWarpSize(CGF), Bld.getInt32(1));
136 CodeGenFunction CGF(CGM, /*suppressNewContext=*/true);
137 CGF.StartFunction(GlobalDecl(), Ctx.VoidTy, WST.WorkerFn, *WST.CGFI, {});
138 emitWorkerLoop(CGF, WST);
139 CGF.FinishFunction();
142 void CGOpenMPRuntimeNVPTX::emitWorkerLoop(CodeGenFunction &CGF,
153 CGBuilderTy &Bld = CGF.Builder;
155 llvm::BasicBlock *AwaitBB = CGF.createBasicBlock(".await.work");
156 llvm::BasicBlock *SelectWorkersBB = CGF.createBasicBlock(".select.workers");
157 llvm::BasicBlock *ExecuteBB = CGF.createBasicBlock(".execute.parallel");
158 llvm::BasicBlock *TerminateBB = CGF.createBasicBlock(".terminate.parallel");
159 llvm::BasicBlock *BarrierBB = CGF.createBasicBlock(".barrier.parallel");
160 llvm::BasicBlock *ExitBB = CGF.createBasicBlock(".exit");
162 CGF.EmitBranch(AwaitBB);
165 CGF.EmitBlock(AwaitBB);
167 syncCTAThreads(CGF);
176 CGF.EmitBlock(SelectWorkersBB);
177 llvm::Value *ThreadID = getNVPTXThreadID(CGF);
185 CGF.EmitBlock(ExecuteBB);
189 CGF.EmitBlock(TerminateBB);
190 CGF.EmitBranch(BarrierBB);
193 CGF.EmitBlock(BarrierBB);
195 syncCTAThreads(CGF);
196 CGF.EmitBranch(AwaitBB);
199 CGF.EmitBlock(ExitBB);
203 void CGOpenMPRuntimeNVPTX::emitEntryHeader(CodeGenFunction &CGF,
206 CGBuilderTy &Bld = CGF.Builder;
209 llvm::Value *MasterID = getMasterThreadID(CGF);
211 llvm::Value *ThreadID = getNVPTXThreadID(CGF);
214 llvm::BasicBlock *WorkerCheckBB = CGF.createBasicBlock(".check.for.worker");
215 llvm::BasicBlock *WorkerBB = CGF.createBasicBlock(".worker");
216 llvm::BasicBlock *MasterBB = CGF.createBasicBlock(".master");
217 EST.ExitBB = CGF.createBasicBlock(".exit");
226 CGF.EmitBlock(WorkerCheckBB);
231 CGF.EmitBlock(WorkerBB);
232 CGF.EmitCallOrInvoke(WST.WorkerFn, llvm::None);
233 CGF.EmitBranch(EST.ExitBB);
236 CGF.EmitBlock(MasterBB);
240 llvm::Value *Args[] = {Bld.getInt32(/*OmpHandle=*/0), getNVPTXThreadID(CGF)};
241 CGF.EmitRuntimeCall(createNVPTXRuntimeFunction(OMPRTL_NVPTX__kmpc_kernel_init),
245 void CGOpenMPRuntimeNVPTX::emitEntryFooter(CodeGenFunction &CGF,
247 CGBuilderTy &Bld = CGF.Builder;
248 llvm::BasicBlock *TerminateBB = CGF.createBasicBlock(".termination.notifier");
249 CGF.EmitBranch(TerminateBB);
251 CGF.EmitBlock(TerminateBB);
257 syncCTAThreads(CGF);
259 CGF.EmitBranch(EST.ExitBB);
261 CGF.EmitBlock(EST.ExitBB);
330 void Enter(CodeGenFunction &CGF) override {
331 RT.emitEntryHeader(CGF, EST, WST);
333 void Exit(CodeGenFunction &CGF) override { RT.emitEntryFooter(CGF, EST); }
356 void CGOpenMPRuntimeNVPTX::emitNumTeamsClause(CodeGenFunction &CGF,
379 void CGOpenMPRuntimeNVPTX::emitTeamsCall(CodeGenFunction &CGF,
384 if (!CGF.HaveInsertPoint())
388 CGF.CreateTempAlloca(CGF.Int32Ty, CharUnits::fromQuantity(4),
390 CGF.InitTempAlloca(ZeroAddr, CGF.Builder.getInt32(/*C*/ 0));
395 CGF.EmitCallOrInvoke(OutlinedFn, OutlinedFnArgs);