Lines Matching refs:CGF
218 const EHPersonality &EHPersonality::get(CodeGenFunction &CGF) { in get() argument
219 return get(CGF.CGM, dyn_cast_or_null<FunctionDecl>(CGF.CurCodeDecl)); in get()
336 static llvm::Constant *getCatchAllValue(CodeGenFunction &CGF) { in getCatchAllValue() argument
338 return llvm::ConstantPointerNull::get(CGF.Int8PtrTy); in getCatchAllValue()
347 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
348 CGF.EmitNounwindRuntimeCall(getFreeExceptionFn(CGF.CGM), exn); in Emit()
466 static void emitFilterDispatchBlock(CodeGenFunction &CGF, in emitFilterDispatchBlock() argument
475 CGF.EmitBlockAfterUses(dispatchBlock); in emitFilterDispatchBlock()
481 llvm::Value *selector = CGF.getSelectorFromSlot(); in emitFilterDispatchBlock()
482 llvm::BasicBlock *unexpectedBB = CGF.createBasicBlock("ehspec.unexpected"); in emitFilterDispatchBlock()
484 llvm::Value *zero = CGF.Builder.getInt32(0); in emitFilterDispatchBlock()
486 CGF.Builder.CreateICmpSLT(selector, zero, "ehspec.fails"); in emitFilterDispatchBlock()
487 CGF.Builder.CreateCondBr(failsFilter, unexpectedBB, in emitFilterDispatchBlock()
488 CGF.getEHResumeBlock(false)); in emitFilterDispatchBlock()
490 CGF.EmitBlock(unexpectedBB); in emitFilterDispatchBlock()
497 llvm::Value *exn = CGF.getExceptionFromSlot(); in emitFilterDispatchBlock()
498 CGF.EmitRuntimeCall(getUnexpectedFn(CGF.CGM), exn) in emitFilterDispatchBlock()
500 CGF.Builder.CreateUnreachable(); in emitFilterDispatchBlock()
876 static void emitCatchPadBlock(CodeGenFunction &CGF, EHCatchScope &CatchScope) { in emitCatchPadBlock() argument
880 CGBuilderTy::InsertPoint SavedIP = CGF.Builder.saveIP(); in emitCatchPadBlock()
881 CGF.EmitBlockAfterUses(DispatchBlock); in emitCatchPadBlock()
883 llvm::Value *ParentPad = CGF.CurrentFuncletPad; in emitCatchPadBlock()
885 ParentPad = llvm::ConstantTokenNone::get(CGF.getLLVMContext()); in emitCatchPadBlock()
887 CGF.getEHDispatchBlock(CatchScope.getEnclosingEHScope()); in emitCatchPadBlock()
891 CGF.Builder.CreateCatchSwitch(ParentPad, UnwindBB, NumHandlers); in emitCatchPadBlock()
899 TypeInfo.RTTI = llvm::Constant::getNullValue(CGF.VoidPtrTy); in emitCatchPadBlock()
901 CGF.Builder.SetInsertPoint(Handler.Block); in emitCatchPadBlock()
903 if (EHPersonality::get(CGF).isMSVCXXPersonality()) { in emitCatchPadBlock()
904 CGF.Builder.CreateCatchPad( in emitCatchPadBlock()
905 CatchSwitch, {TypeInfo.RTTI, CGF.Builder.getInt32(TypeInfo.Flags), in emitCatchPadBlock()
906 llvm::Constant::getNullValue(CGF.VoidPtrTy)}); in emitCatchPadBlock()
908 CGF.Builder.CreateCatchPad(CatchSwitch, {TypeInfo.RTTI}); in emitCatchPadBlock()
913 CGF.Builder.restoreIP(SavedIP); in emitCatchPadBlock()
918 static void emitCatchDispatchBlock(CodeGenFunction &CGF, in emitCatchDispatchBlock() argument
920 if (EHPersonality::get(CGF).usesFuncletPads()) in emitCatchDispatchBlock()
921 return emitCatchPadBlock(CGF, catchScope); in emitCatchDispatchBlock()
934 CGBuilderTy::InsertPoint savedIP = CGF.Builder.saveIP(); in emitCatchDispatchBlock()
935 CGF.EmitBlockAfterUses(dispatchBlock); in emitCatchDispatchBlock()
939 CGF.CGM.getIntrinsic(llvm::Intrinsic::eh_typeid_for); in emitCatchDispatchBlock()
942 llvm::Value *selector = CGF.getSelectorFromSlot(); in emitCatchDispatchBlock()
953 typeValue = CGF.Builder.CreateBitCast(typeValue, CGF.Int8PtrTy); in emitCatchDispatchBlock()
962 nextBlock = CGF.getEHDispatchBlock(catchScope.getEnclosingEHScope()); in emitCatchDispatchBlock()
973 nextBlock = CGF.createBasicBlock("catch.fallthrough"); in emitCatchDispatchBlock()
979 CGF.Builder.CreateCall(llvm_eh_typeid_for, typeValue); in emitCatchDispatchBlock()
983 CGF.Builder.CreateICmpEQ(selector, typeIndex, "matches"); in emitCatchDispatchBlock()
984 CGF.Builder.CreateCondBr(matchesTypeIndex, handler.Block, nextBlock); in emitCatchDispatchBlock()
988 CGF.Builder.restoreIP(savedIP); in emitCatchDispatchBlock()
992 CGF.EmitBlock(nextBlock); in emitCatchDispatchBlock()
1102 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
1103 llvm::BasicBlock *EndCatchBB = CGF.createBasicBlock("finally.endcatch"); in Emit()
1105 CGF.createBasicBlock("finally.cleanup.cont"); in Emit()
1108 CGF.Builder.CreateFlagLoad(ForEHVar, "finally.endcatch"); in Emit()
1109 CGF.Builder.CreateCondBr(ShouldEndCatch, EndCatchBB, CleanupContBB); in Emit()
1110 CGF.EmitBlock(EndCatchBB); in Emit()
1111 CGF.EmitRuntimeCallOrInvoke(EndCatchFn); // catch-all, so might throw in Emit()
1112 CGF.EmitBlock(CleanupContBB); in Emit()
1129 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
1132 CGF.EHStack.pushCleanup<CallEndCatchForFinally>(NormalAndEHCleanup, in Emit()
1138 CGF.Builder.CreateLoad(CGF.getNormalCleanupDestSlot(), in Emit()
1142 CGF.EmitStmt(Body); in Emit()
1146 if (CGF.HaveInsertPoint()) { in Emit()
1147 llvm::BasicBlock *RethrowBB = CGF.createBasicBlock("finally.rethrow"); in Emit()
1148 llvm::BasicBlock *ContBB = CGF.createBasicBlock("finally.cont"); in Emit()
1151 CGF.Builder.CreateFlagLoad(ForEHVar, "finally.shouldthrow"); in Emit()
1152 CGF.Builder.CreateCondBr(ShouldRethrow, RethrowBB, ContBB); in Emit()
1154 CGF.EmitBlock(RethrowBB); in Emit()
1156 CGF.EmitRuntimeCallOrInvoke(RethrowFn, in Emit()
1157 CGF.Builder.CreateAlignedLoad(SavedExnVar, CGF.getPointerAlign())); in Emit()
1159 CGF.EmitRuntimeCallOrInvoke(RethrowFn); in Emit()
1161 CGF.Builder.CreateUnreachable(); in Emit()
1163 CGF.EmitBlock(ContBB); in Emit()
1166 CGF.Builder.CreateStore(SavedCleanupDest, in Emit()
1167 CGF.getNormalCleanupDestSlot()); in Emit()
1174 CGBuilderTy::InsertPoint SavedIP = CGF.Builder.saveAndClearIP(); in Emit()
1175 CGF.PopCleanupBlock(); in Emit()
1176 CGF.Builder.restoreIP(SavedIP); in Emit()
1181 CGF.EnsureInsertPoint(); in Emit()
1189 void CodeGenFunction::FinallyInfo::enter(CodeGenFunction &CGF, in enter() argument
1211 SavedExnVar = CGF.CreateTempAlloca(CGF.Int8PtrTy, "finally.exn"); in enter()
1228 RethrowDest = CGF.getJumpDestInCurrentScope(CGF.getUnreachableBlock()); in enter()
1231 ForEHVar = CGF.CreateTempAlloca(CGF.Builder.getInt1Ty(), "finally.for-eh"); in enter()
1232 CGF.Builder.CreateFlagStore(false, ForEHVar); in enter()
1235 CGF.EHStack.pushCleanup<PerformFinally>(NormalCleanup, body, in enter()
1240 llvm::BasicBlock *catchBB = CGF.createBasicBlock("finally.catchall"); in enter()
1241 EHCatchScope *catchScope = CGF.EHStack.pushCatch(1); in enter()
1245 void CodeGenFunction::FinallyInfo::exit(CodeGenFunction &CGF) { in exit() argument
1247 EHCatchScope &catchScope = cast<EHCatchScope>(*CGF.EHStack.begin()); in exit()
1250 CGF.popCatchScope(); in exit()
1256 CGBuilderTy::InsertPoint savedIP = CGF.Builder.saveAndClearIP(); in exit()
1257 CGF.EmitBlock(catchBB); in exit()
1263 exn = CGF.getExceptionFromSlot(); in exit()
1264 CGF.EmitNounwindRuntimeCall(BeginCatchFn, exn); in exit()
1269 if (!exn) exn = CGF.getExceptionFromSlot(); in exit()
1270 CGF.Builder.CreateAlignedStore(exn, SavedExnVar, CGF.getPointerAlign()); in exit()
1274 CGF.Builder.CreateFlagStore(true, ForEHVar); in exit()
1277 CGF.EmitBranchThroughCleanup(RethrowDest); in exit()
1279 CGF.Builder.restoreIP(savedIP); in exit()
1283 CGF.PopCleanupBlock(); in exit()
1413 void Emit(CodeGenFunction &CGF, Flags F) override { in Emit()
1414 ASTContext &Context = CGF.getContext(); in Emit()
1415 CodeGenModule &CGM = CGF.CGM; in Emit()
1422 llvm::Value *FP = CGF.Builder.CreateCall(LocalAddrFn); in Emit()
1424 llvm::ConstantInt::get(CGF.ConvertType(ArgTys[0]), F.isForEHCleanup()); in Emit()
1432 CGF.EmitCall(FnInfo, OutlinedFinally, ReturnValueSlot(), Args); in Emit()