Lines Matching refs:CGF

89 static void createCoroData(CodeGenFunction &CGF,  in createCoroData()  argument
95 CGF.CGM.Error(CoroIdExpr->getBeginLoc(), in createCoroData()
98 CGF.CGM.Error(CoroIdExpr->getBeginLoc(), in createCoroData()
175 static LValueOrRValue emitSuspendExpression(CodeGenFunction &CGF, CGCoroData &Coro, in emitSuspendExpression() argument
182 CodeGenFunction::OpaqueValueMappingData::bind(CGF, S.getOpaqueValue(), E); in emitSuspendExpression()
183 auto UnbindOnExit = llvm::make_scope_exit([&] { Binder.unbind(CGF); }); in emitSuspendExpression()
186 BasicBlock *ReadyBlock = CGF.createBasicBlock(Prefix + Twine(".ready")); in emitSuspendExpression()
187 BasicBlock *SuspendBlock = CGF.createBasicBlock(Prefix + Twine(".suspend")); in emitSuspendExpression()
188 BasicBlock *CleanupBlock = CGF.createBasicBlock(Prefix + Twine(".cleanup")); in emitSuspendExpression()
191 CGF.EmitBranchOnBoolExpr(S.getReadyExpr(), ReadyBlock, SuspendBlock, 0); in emitSuspendExpression()
194 CGF.EmitBlock(SuspendBlock); in emitSuspendExpression()
196 auto &Builder = CGF.Builder; in emitSuspendExpression()
197 llvm::Function *CoroSave = CGF.CGM.getIntrinsic(llvm::Intrinsic::coro_save); in emitSuspendExpression()
198 auto *NullPtr = llvm::ConstantPointerNull::get(CGF.CGM.Int8PtrTy); in emitSuspendExpression()
201 auto *SuspendRet = CGF.EmitScalarExpr(S.getSuspendExpr()); in emitSuspendExpression()
205 CGF.createBasicBlock(Prefix + Twine(".suspend.bool")); in emitSuspendExpression()
206 CGF.Builder.CreateCondBr(SuspendRet, RealSuspendBlock, ReadyBlock); in emitSuspendExpression()
207 CGF.EmitBlock(RealSuspendBlock); in emitSuspendExpression()
213 CGF.CGM.getIntrinsic(llvm::Intrinsic::coro_suspend); in emitSuspendExpression()
223 CGF.EmitBlock(CleanupBlock); in emitSuspendExpression()
224 CGF.EmitBranchThroughCleanup(Coro.CleanupJD); in emitSuspendExpression()
227 CGF.EmitBlock(ReadyBlock); in emitSuspendExpression()
235 CGF.CreateTempAlloca(Builder.getInt1Ty(), Prefix + Twine("resume.eh")); in emitSuspendExpression()
239 auto *Catch = new (CGF.getContext()) in emitSuspendExpression()
241 auto *TryBody = CompoundStmt::Create(CGF.getContext(), S.getResumeExpr(), in emitSuspendExpression()
243 TryStmt = CXXTryStmt::Create(CGF.getContext(), Loc, TryBody, Catch); in emitSuspendExpression()
244 CGF.EnterCXXTryStmt(*TryStmt); in emitSuspendExpression()
249 Res.LV = CGF.EmitLValue(S.getResumeExpr()); in emitSuspendExpression()
251 Res.RV = CGF.EmitAnyExpr(S.getResumeExpr(), aggSlot, ignoreResult); in emitSuspendExpression()
255 CGF.ExitCXXTryStmt(*TryStmt); in emitSuspendExpression()
383 getBundlesForCoroEnd(CodeGenFunction &CGF) { in getBundlesForCoroEnd() argument
386 if (llvm::Instruction *EHPad = CGF.CurrentFuncletPad) in getBundlesForCoroEnd()
397 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
398 auto &CGM = CGF.CGM; in Emit()
399 auto *NullPtr = llvm::ConstantPointerNull::get(CGF.Int8PtrTy); in Emit()
402 auto Bundles = getBundlesForCoroEnd(CGF); in Emit()
403 auto *CoroEnd = CGF.Builder.CreateCall( in Emit()
404 CoroEndFn, {NullPtr, CGF.Builder.getTrue()}, Bundles); in Emit()
408 auto *ResumeBB = CGF.getEHResumeBlock(/*isCleanup=*/true); in Emit()
409 auto *CleanupContBB = CGF.createBasicBlock("cleanup.cont"); in Emit()
410 CGF.Builder.CreateCondBr(CoroEnd, ResumeBB, CleanupContBB); in Emit()
411 CGF.EmitBlock(CleanupContBB); in Emit()
429 void Emit(CodeGenFunction &CGF, Flags) override { in Emit()
433 BasicBlock *SaveInsertBlock = CGF.Builder.GetInsertBlock(); in Emit()
435 auto *FreeBB = CGF.createBasicBlock("coro.free"); in Emit()
436 CGF.EmitBlock(FreeBB); in Emit()
437 CGF.EmitStmt(Deallocate); in Emit()
439 auto *AfterFreeBB = CGF.createBasicBlock("after.coro.free"); in Emit()
440 CGF.EmitBlock(AfterFreeBB); in Emit()
443 auto *CoroFree = CGF.CurCoro.Data->LastCoroFree; in Emit()
445 CGF.CGM.Error(Deallocate->getBeginLoc(), in Emit()
453 CGF.Builder.SetInsertPoint(InsertPt); in Emit()
456 auto *NullPtr = llvm::ConstantPointerNull::get(CGF.Int8PtrTy); in Emit()
457 auto *Cond = CGF.Builder.CreateICmpNE(CoroFree, NullPtr); in Emit()
458 CGF.Builder.CreateCondBr(Cond, FreeBB, AfterFreeBB); in Emit()
462 CGF.Builder.SetInsertPoint(AfterFreeBB); in Emit()
468 static void emitBodyAndFallthrough(CodeGenFunction &CGF, in emitBodyAndFallthrough() argument
470 CGF.EmitStmt(Body); in emitBodyAndFallthrough()
471 const bool CanFallthrough = CGF.Builder.GetInsertBlock(); in emitBodyAndFallthrough()
474 CGF.EmitStmt(OnFallthrough); in emitBodyAndFallthrough()