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()
209 static LValueOrRValue emitSuspendExpression(CodeGenFunction &CGF, CGCoroData &Coro, in emitSuspendExpression() argument
216 CodeGenFunction::OpaqueValueMappingData::bind(CGF, S.getOpaqueValue(), E); in emitSuspendExpression()
217 auto UnbindOnExit = llvm::make_scope_exit([&] { Binder.unbind(CGF); }); in emitSuspendExpression()
220 BasicBlock *ReadyBlock = CGF.createBasicBlock(Prefix + Twine(".ready")); in emitSuspendExpression()
221 BasicBlock *SuspendBlock = CGF.createBasicBlock(Prefix + Twine(".suspend")); in emitSuspendExpression()
222 BasicBlock *CleanupBlock = CGF.createBasicBlock(Prefix + Twine(".cleanup")); in emitSuspendExpression()
225 CGF.EmitBranchOnBoolExpr(S.getReadyExpr(), ReadyBlock, SuspendBlock, 0); in emitSuspendExpression()
228 CGF.EmitBlock(SuspendBlock); in emitSuspendExpression()
230 auto &Builder = CGF.Builder; in emitSuspendExpression()
231 llvm::Function *CoroSave = CGF.CGM.getIntrinsic(llvm::Intrinsic::coro_save); in emitSuspendExpression()
232 auto *NullPtr = llvm::ConstantPointerNull::get(CGF.CGM.Int8PtrTy); in emitSuspendExpression()
235 CGF.CurCoro.InSuspendBlock = true; in emitSuspendExpression()
236 auto *SuspendRet = CGF.EmitScalarExpr(S.getSuspendExpr()); in emitSuspendExpression()
237 CGF.CurCoro.InSuspendBlock = false; in emitSuspendExpression()
242 CGF.createBasicBlock(Prefix + Twine(".suspend.bool")); in emitSuspendExpression()
243 CGF.Builder.CreateCondBr(SuspendRet, RealSuspendBlock, ReadyBlock); in emitSuspendExpression()
244 CGF.EmitBlock(RealSuspendBlock); in emitSuspendExpression()
250 CGF.CGM.getIntrinsic(llvm::Intrinsic::coro_suspend); in emitSuspendExpression()
260 CGF.EmitBlock(CleanupBlock); in emitSuspendExpression()
261 CGF.EmitBranchThroughCleanup(Coro.CleanupJD); in emitSuspendExpression()
264 CGF.EmitBlock(ReadyBlock); in emitSuspendExpression()
272 CGF.CreateTempAlloca(Builder.getInt1Ty(), Prefix + Twine("resume.eh")); in emitSuspendExpression()
276 auto *Catch = new (CGF.getContext()) in emitSuspendExpression()
278 auto *TryBody = CompoundStmt::Create(CGF.getContext(), S.getResumeExpr(), in emitSuspendExpression()
280 TryStmt = CXXTryStmt::Create(CGF.getContext(), Loc, TryBody, Catch); in emitSuspendExpression()
281 CGF.EnterCXXTryStmt(*TryStmt); in emitSuspendExpression()
282 CGF.EmitStmt(TryBody); in emitSuspendExpression()
286 CGF.ExitCXXTryStmt(*TryStmt); in emitSuspendExpression()
295 Res.LV = CGF.EmitLValue(S.getResumeExpr()); in emitSuspendExpression()
297 Res.RV = CGF.EmitAnyExpr(S.getResumeExpr(), aggSlot, ignoreResult); in emitSuspendExpression()
424 getBundlesForCoroEnd(CodeGenFunction &CGF) { in getBundlesForCoroEnd() argument
427 if (llvm::Instruction *EHPad = CGF.CurrentFuncletPad) in getBundlesForCoroEnd()
438 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
439 auto &CGM = CGF.CGM; in Emit()
440 auto *NullPtr = llvm::ConstantPointerNull::get(CGF.Int8PtrTy); in Emit()
443 auto Bundles = getBundlesForCoroEnd(CGF); in Emit()
445 CGF.Builder.CreateCall(CoroEndFn, in Emit()
446 {NullPtr, CGF.Builder.getTrue(), in Emit()
452 auto *ResumeBB = CGF.getEHResumeBlock(/*isCleanup=*/true); in Emit()
453 auto *CleanupContBB = CGF.createBasicBlock("cleanup.cont"); in Emit()
454 CGF.Builder.CreateCondBr(CoroEnd, ResumeBB, CleanupContBB); in Emit()
455 CGF.EmitBlock(CleanupContBB); in Emit()
473 void Emit(CodeGenFunction &CGF, Flags) override { in Emit()
477 BasicBlock *SaveInsertBlock = CGF.Builder.GetInsertBlock(); in Emit()
479 auto *FreeBB = CGF.createBasicBlock("coro.free"); in Emit()
480 CGF.EmitBlock(FreeBB); in Emit()
481 CGF.EmitStmt(Deallocate); in Emit()
483 auto *AfterFreeBB = CGF.createBasicBlock("after.coro.free"); in Emit()
484 CGF.EmitBlock(AfterFreeBB); in Emit()
487 auto *CoroFree = CGF.CurCoro.Data->LastCoroFree; in Emit()
489 CGF.CGM.Error(Deallocate->getBeginLoc(), in Emit()
497 CGF.Builder.SetInsertPoint(InsertPt); in Emit()
500 auto *NullPtr = llvm::ConstantPointerNull::get(CGF.Int8PtrTy); in Emit()
501 auto *Cond = CGF.Builder.CreateICmpNE(CoroFree, NullPtr); in Emit()
502 CGF.Builder.CreateCondBr(Cond, FreeBB, AfterFreeBB); in Emit()
506 CGF.Builder.SetInsertPoint(AfterFreeBB); in Emit()
514 CodeGenFunction &CGF; member
523 GetReturnObjectManager(CodeGenFunction &CGF, const CoroutineBodyStmt &S) in GetReturnObjectManager()
524 : CGF(CGF), Builder(CGF.Builder), S(S), GroActiveFlag(Address::invalid()), in GetReturnObjectManager()
549 return CGF.getContext().hasSameType(GroType, CGF.FnRetTy); in GetReturnObjectManager()
571 GroActiveFlag = CGF.CreateTempAlloca(Builder.getInt1Ty(), CharUnits::One(), in EmitGroAlloca()
575 GroEmission = CGF.EmitAutoVarAlloca(*GroVarDecl); in EmitGroAlloca()
580 llvm::MDNode::get(CGF.CGM.getLLVMContext(), {})); in EmitGroAlloca()
583 auto old_top = CGF.EHStack.stable_begin(); in EmitGroAlloca()
584 CGF.EmitAutoVarCleanups(GroEmission); in EmitGroAlloca()
585 auto top = CGF.EHStack.stable_begin(); in EmitGroAlloca()
588 for (auto b = CGF.EHStack.find(top), e = CGF.EHStack.find(old_top); b != e; in EmitGroAlloca()
603 assert(CGF.ReturnValue.isValid() == (bool)S.getReturnStmt()); in EmitGroInit()
613 if (CGF.ReturnValue.isValid()) { in EmitGroInit()
614 CGF.EmitAnyExprToMem(S.getReturnValue(), CGF.ReturnValue, in EmitGroInit()
624 CGF.EmitStmt(S.getResultDecl()); in EmitGroInit()
628 CGF.EmitAutoVarInit(GroEmission); in EmitGroInit()
634 static void emitBodyAndFallthrough(CodeGenFunction &CGF, in emitBodyAndFallthrough() argument
636 CGF.EmitStmt(Body); in emitBodyAndFallthrough()
637 const bool CanFallthrough = CGF.Builder.GetInsertBlock(); in emitBodyAndFallthrough()
640 CGF.EmitStmt(OnFallthrough); in emitBodyAndFallthrough()