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()
222 static LValueOrRValue emitSuspendExpression(CodeGenFunction &CGF, CGCoroData &Coro, in emitSuspendExpression() argument
229 CodeGenFunction::OpaqueValueMappingData::bind(CGF, S.getOpaqueValue(), E); in emitSuspendExpression()
231 llvm::make_scope_exit([&] { CommonBinder.unbind(CGF); }); in emitSuspendExpression()
234 BasicBlock *ReadyBlock = CGF.createBasicBlock(Prefix + Twine(".ready")); in emitSuspendExpression()
235 BasicBlock *SuspendBlock = CGF.createBasicBlock(Prefix + Twine(".suspend")); in emitSuspendExpression()
236 BasicBlock *CleanupBlock = CGF.createBasicBlock(Prefix + Twine(".cleanup")); in emitSuspendExpression()
239 CGF.EmitBranchOnBoolExpr(S.getReadyExpr(), ReadyBlock, SuspendBlock, 0); in emitSuspendExpression()
242 CGF.EmitBlock(SuspendBlock); in emitSuspendExpression()
244 auto &Builder = CGF.Builder; in emitSuspendExpression()
245 llvm::Function *CoroSave = CGF.CGM.getIntrinsic(llvm::Intrinsic::coro_save); in emitSuspendExpression()
246 auto *NullPtr = llvm::ConstantPointerNull::get(CGF.CGM.Int8PtrTy); in emitSuspendExpression()
249 auto SuspendWrapper = CodeGenFunction(CGF.CGM).generateAwaitSuspendWrapper( in emitSuspendExpression()
250 CGF.CurFn->getName(), Prefix, S); in emitSuspendExpression()
252 CGF.CurCoro.InSuspendBlock = true; in emitSuspendExpression()
254 assert(CGF.CurCoro.Data && CGF.CurCoro.Data->CoroBegin && in emitSuspendExpression()
259 CGF.getOrCreateOpaqueLValueMapping(S.getOpaqueValue()).getPointer(CGF)); in emitSuspendExpression()
261 SuspendIntrinsicCallArgs.push_back(CGF.CurCoro.Data->CoroBegin); in emitSuspendExpression()
279 llvm::Function *AwaitSuspendIntrinsic = CGF.CGM.getIntrinsic(AwaitSuspendIID); in emitSuspendExpression()
291 CGF.EmitCallOrInvoke(AwaitSuspendIntrinsic, SuspendIntrinsicCallArgs); in emitSuspendExpression()
293 SuspendRet = CGF.EmitNounwindRuntimeCall(AwaitSuspendIntrinsic, in emitSuspendExpression()
297 CGF.CurCoro.InSuspendBlock = false; in emitSuspendExpression()
308 CGF.createBasicBlock(Prefix + Twine(".suspend.bool")); in emitSuspendExpression()
309 CGF.Builder.CreateCondBr(SuspendRet, RealSuspendBlock, ReadyBlock); in emitSuspendExpression()
310 CGF.EmitBlock(RealSuspendBlock); in emitSuspendExpression()
322 CGF.CGM.getIntrinsic(llvm::Intrinsic::coro_suspend); in emitSuspendExpression()
332 CGF.EmitBlock(CleanupBlock); in emitSuspendExpression()
333 CGF.EmitBranchThroughCleanup(Coro.CleanupJD); in emitSuspendExpression()
336 CGF.EmitBlock(ReadyBlock); in emitSuspendExpression()
344 CGF.CreateTempAlloca(Builder.getInt1Ty(), Prefix + Twine("resume.eh")); in emitSuspendExpression()
348 auto *Catch = new (CGF.getContext()) in emitSuspendExpression()
350 auto *TryBody = CompoundStmt::Create(CGF.getContext(), S.getResumeExpr(), in emitSuspendExpression()
352 TryStmt = CXXTryStmt::Create(CGF.getContext(), Loc, TryBody, Catch); in emitSuspendExpression()
353 CGF.EnterCXXTryStmt(*TryStmt); in emitSuspendExpression()
354 CGF.EmitStmt(TryBody); in emitSuspendExpression()
358 CGF.ExitCXXTryStmt(*TryStmt); in emitSuspendExpression()
367 Res.LV = CGF.EmitLValue(S.getResumeExpr()); in emitSuspendExpression()
369 Res.RV = CGF.EmitAnyExpr(S.getResumeExpr(), aggSlot, ignoreResult); in emitSuspendExpression()
557 getBundlesForCoroEnd(CodeGenFunction &CGF) { in getBundlesForCoroEnd() argument
560 if (llvm::Instruction *EHPad = CGF.CurrentFuncletPad) in getBundlesForCoroEnd()
571 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
572 auto &CGM = CGF.CGM; in Emit()
573 auto *NullPtr = llvm::ConstantPointerNull::get(CGF.Int8PtrTy); in Emit()
576 auto Bundles = getBundlesForCoroEnd(CGF); in Emit()
578 CGF.Builder.CreateCall(CoroEndFn, in Emit()
579 {NullPtr, CGF.Builder.getTrue(), in Emit()
585 auto *ResumeBB = CGF.getEHResumeBlock(/*isCleanup=*/true); in Emit()
586 auto *CleanupContBB = CGF.createBasicBlock("cleanup.cont"); in Emit()
587 CGF.Builder.CreateCondBr(CoroEnd, ResumeBB, CleanupContBB); in Emit()
588 CGF.EmitBlock(CleanupContBB); in Emit()
606 void Emit(CodeGenFunction &CGF, Flags) override { in Emit()
610 BasicBlock *SaveInsertBlock = CGF.Builder.GetInsertBlock(); in Emit()
612 auto *FreeBB = CGF.createBasicBlock("coro.free"); in Emit()
613 CGF.EmitBlock(FreeBB); in Emit()
614 CGF.EmitStmt(Deallocate); in Emit()
616 auto *AfterFreeBB = CGF.createBasicBlock("after.coro.free"); in Emit()
617 CGF.EmitBlock(AfterFreeBB); in Emit()
620 auto *CoroFree = CGF.CurCoro.Data->LastCoroFree; in Emit()
622 CGF.CGM.Error(Deallocate->getBeginLoc(), in Emit()
630 CGF.Builder.SetInsertPoint(InsertPt); in Emit()
633 auto *NullPtr = llvm::ConstantPointerNull::get(CGF.Int8PtrTy); in Emit()
634 auto *Cond = CGF.Builder.CreateICmpNE(CoroFree, NullPtr); in Emit()
635 CGF.Builder.CreateCondBr(Cond, FreeBB, AfterFreeBB); in Emit()
639 CGF.Builder.SetInsertPoint(AfterFreeBB); in Emit()
647 CodeGenFunction &CGF; member
656 GetReturnObjectManager(CodeGenFunction &CGF, const CoroutineBodyStmt &S) in GetReturnObjectManager()
657 : CGF(CGF), Builder(CGF.Builder), S(S), GroActiveFlag(Address::invalid()), in GetReturnObjectManager()
682 return CGF.getContext().hasSameType(GroType, CGF.FnRetTy); in GetReturnObjectManager()
704 GroActiveFlag = CGF.CreateTempAlloca(Builder.getInt1Ty(), CharUnits::One(), in EmitGroAlloca()
708 GroEmission = CGF.EmitAutoVarAlloca(*GroVarDecl); in EmitGroAlloca()
713 llvm::MDNode::get(CGF.CGM.getLLVMContext(), {})); in EmitGroAlloca()
716 auto old_top = CGF.EHStack.stable_begin(); in EmitGroAlloca()
717 CGF.EmitAutoVarCleanups(GroEmission); in EmitGroAlloca()
718 auto top = CGF.EHStack.stable_begin(); in EmitGroAlloca()
721 for (auto b = CGF.EHStack.find(top), e = CGF.EHStack.find(old_top); b != e; in EmitGroAlloca()
736 assert(CGF.ReturnValue.isValid() == (bool)S.getReturnStmt()); in EmitGroInit()
746 if (CGF.ReturnValue.isValid()) { in EmitGroInit()
747 CGF.EmitAnyExprToMem(S.getReturnValue(), CGF.ReturnValue, in EmitGroInit()
757 CGF.EmitStmt(S.getResultDecl()); in EmitGroInit()
761 CGF.EmitAutoVarInit(GroEmission); in EmitGroInit()
767 static void emitBodyAndFallthrough(CodeGenFunction &CGF, in emitBodyAndFallthrough() argument
769 CGF.EmitStmt(Body); in emitBodyAndFallthrough()
770 const bool CanFallthrough = CGF.Builder.GetInsertBlock(); in emitBodyAndFallthrough()
773 CGF.EmitStmt(OnFallthrough); in emitBodyAndFallthrough()