Lines Matching full:cgf
263 CodeGenFunction *CGF,
289 return CGM.EmitConstantInit(*var, CGF);
321 static void computeBlockInfo(CodeGenModule &CGM, CodeGenFunction *CGF,
348 assert(CGF && CGF->CurFuncDecl && isa<CXXMethodDecl>(CGF->CurFuncDecl) &&
350 QualType thisType = cast<CXXMethodDecl>(CGF->CurFuncDecl)->getThisType(C);
384 if (llvm::Constant *constant = tryCaptureAsConstant(CGM, CGF, variable)) {
562 static void enterBlockScope(CodeGenFunction &CGF, BlockDecl *block) {
563 assert(CGF.HaveInsertPoint());
567 *new CGBlockInfo(block, CGF.CurFn->getName());
568 blockInfo.NextBlockInfo = CGF.FirstBlockInfo;
569 CGF.FirstBlockInfo = &blockInfo;
573 computeBlockInfo(CGF.CGM, &CGF, blockInfo);
579 blockInfo.LocalAddress = CGF.CreateTempAlloca(blockInfo.StructureType,
609 destroyer = CGF.getDestroyer(dtorKind);
613 Address addr = CGF.Builder.CreateStructGEP(blockInfo.LocalAddress,
622 bool useArrayEHCleanup = CGF.needsEHCleanup(dtorKind);
626 CGF.pushDestroy(cleanupKind, addr, variable->getType(),
630 capture.setCleanup(CGF.EHStack.stable_begin());
1639 void emitCopy(CodeGenFunction &CGF, Address destField,
1641 destField = CGF.Builder.CreateBitCast(destField, CGF.VoidPtrTy);
1643 srcField = CGF.Builder.CreateBitCast(srcField, CGF.VoidPtrPtrTy);
1644 llvm::Value *srcValue = CGF.Builder.CreateLoad(srcField);
1648 llvm::Value *flagsVal = llvm::ConstantInt::get(CGF.Int32Ty, flags);
1649 llvm::Value *fn = CGF.CGM.getBlockObjectAssign();
1652 CGF.EmitNounwindRuntimeCall(fn, args);
1655 void emitDispose(CodeGenFunction &CGF, Address field) override {
1656 field = CGF.Builder.CreateBitCast(field, CGF.Int8PtrTy->getPointerTo(0));
1657 llvm::Value *value = CGF.Builder.CreateLoad(field);
1659 CGF.BuildBlockRelease(value, Flags | BLOCK_BYREF_CALLER);
1672 void emitCopy(CodeGenFunction &CGF, Address destField,
1674 CGF.EmitARCMoveWeak(destField, srcField);
1677 void emitDispose(CodeGenFunction &CGF, Address field) override {
1678 CGF.EmitARCDestroyWeak(field);
1693 void emitCopy(CodeGenFunction &CGF, Address destField,
1698 llvm::Value *value = CGF.Builder.CreateLoad(srcField);
1703 if (CGF.CGM.getCodeGenOpts().OptimizationLevel == 0) {
1704 CGF.Builder.CreateStore(null, destField);
1705 CGF.EmitARCStoreStrongCall(destField, value, /*ignored*/ true);
1706 CGF.EmitARCStoreStrongCall(srcField, null, /*ignored*/ true);
1709 CGF.Builder.CreateStore(value, destField);
1710 CGF.Builder.CreateStore(null, srcField);
1713 void emitDispose(CodeGenFunction &CGF, Address field) override {
1714 CGF.EmitARCDestroyStrong(field, ARCImpreciseLifetime);
1730 void emitCopy(CodeGenFunction &CGF, Address destField,
1735 llvm::Value *oldValue = CGF.Builder.CreateLoad(srcField);
1736 llvm::Value *copy = CGF.EmitARCRetainBlock(oldValue, /*mandatory*/ true);
1737 CGF.Builder.CreateStore(copy, destField);
1740 void emitDispose(CodeGenFunction &CGF, Address field) override {
1741 CGF.EmitARCDestroyStrong(field, ARCImpreciseLifetime);
1762 void emitCopy(CodeGenFunction &CGF, Address destField,
1765 CGF.EmitSynthesizedCXXCopyCtor(destField, srcField, CopyExpr);
1768 void emitDispose(CodeGenFunction &CGF, Address field) override {
1769 EHScopeStack::stable_iterator cleanupDepth = CGF.EHStack.stable_begin();
1770 CGF.PushDestructorCleanup(VarType, field);
1771 CGF.PopCleanupBlocks(cleanupDepth);
1781 generateByrefCopyHelper(CodeGenFunction &CGF, const BlockByrefInfo &byrefInfo,
1783 ASTContext &Context = CGF.getContext();
1788 ImplicitParamDecl dst(CGF.getContext(), nullptr, SourceLocation(), nullptr,
1792 ImplicitParamDecl src(CGF.getContext(), nullptr, SourceLocation(), nullptr,
1797 CGF.CGM.getTypes().arrangeBuiltinFunctionDeclaration(R, args);
1799 llvm::FunctionType *LTy = CGF.CGM.getTypes().GetFunctionType(FI);
1805 "__Block_byref_object_copy_", &CGF.CGM.getModule());
1817 CGF.CGM.SetInternalFunctionAttributes(nullptr, Fn, FI);
1819 CGF.StartFunction(FD, R, Fn, FI, args);
1825 Address destField = CGF.GetAddrOfLocalVar(&dst);
1826 destField = Address(CGF.Builder.CreateLoad(destField),
1828 destField = CGF.Builder.CreateBitCast(destField, byrefPtrType);
1829 destField = CGF.emitBlockByrefAddress(destField, byrefInfo, false,
1833 Address srcField = CGF.GetAddrOfLocalVar(&src);
1834 srcField = Address(CGF.Builder.CreateLoad(srcField),
1836 srcField = CGF.Builder.CreateBitCast(srcField, byrefPtrType);
1837 srcField = CGF.emitBlockByrefAddress(srcField, byrefInfo, false,
1840 generator.emitCopy(CGF, destField, srcField);
1843 CGF.FinishFunction();
1845 return llvm::ConstantExpr::getBitCast(Fn, CGF.Int8PtrTy);
1852 CodeGenFunction CGF(CGM);
1853 return generateByrefCopyHelper(CGF, byrefInfo, generator);
1858 generateByrefDisposeHelper(CodeGenFunction &CGF,
1861 ASTContext &Context = CGF.getContext();
1865 ImplicitParamDecl src(CGF.getContext(), nullptr, SourceLocation(), nullptr,
1870 CGF.CGM.getTypes().arrangeBuiltinFunctionDeclaration(R, args);
1872 llvm::FunctionType *LTy = CGF.CGM.getTypes().GetFunctionType(FI);
1879 &CGF.CGM.getModule());
1891 CGF.CGM.SetInternalFunctionAttributes(nullptr, Fn, FI);
1893 CGF.StartFunction(FD, R, Fn, FI, args);
1896 Address addr = CGF.GetAddrOfLocalVar(&src);
1897 addr = Address(CGF.Builder.CreateLoad(addr), byrefInfo.ByrefAlignment);
1899 addr = CGF.Builder.CreateBitCast(addr, byrefPtrType);
1900 addr = CGF.emitBlockByrefAddress(addr, byrefInfo, false, "object");
1902 generator.emitDispose(CGF, addr);
1905 CGF.FinishFunction();
1907 return llvm::ConstantExpr::getBitCast(Fn, CGF.Int8PtrTy);
1914 CodeGenFunction CGF(CGM);
1915 return generateByrefDisposeHelper(CGF, byrefInfo, generator);
2267 void Emit(CodeGenFunction &CGF, Flags flags) override {
2269 CGF.BuildBlockRelease(Addr, BLOCK_FIELD_IS_BYREF);