Lines Matching defs:CGF

267                                             CodeGenFunction *CGF,
288 return CGM.EmitConstantInit(*var, CGF);
331 static void computeBlockInfo(CodeGenModule &CGM, CodeGenFunction *CGF,
358 assert(CGF && CGF->CurFuncDecl && isa<CXXMethodDecl>(CGF->CurFuncDecl) &&
360 QualType thisType = cast<CXXMethodDecl>(CGF->CurFuncDecl)->getThisType(C);
397 if (llvm::Constant *constant = tryCaptureAsConstant(CGM, CGF, variable)) {
558 static void enterBlockScope(CodeGenFunction &CGF, BlockDecl *block) {
559 assert(CGF.HaveInsertPoint());
563 *new CGBlockInfo(block, CGF.CurFn->getName());
564 blockInfo.NextBlockInfo = CGF.FirstBlockInfo;
565 CGF.FirstBlockInfo = &blockInfo;
569 computeBlockInfo(CGF.CGM, &CGF, blockInfo);
576 CGF.CreateTempAlloca(blockInfo.StructureType, "block");
607 destroyer = CGF.getDestroyer(dtorKind);
611 llvm::Value *addr = CGF.Builder.CreateStructGEP(blockInfo.Address,
619 bool useArrayEHCleanup = CGF.needsEHCleanup(dtorKind);
623 CGF.pushDestroy(cleanupKind, addr, variable->getType(),
627 capture.setCleanup(CGF.EHStack.stable_begin());
1597 void emitCopy(CodeGenFunction &CGF, llvm::Value *destField,
1599 destField = CGF.Builder.CreateBitCast(destField, CGF.VoidPtrTy);
1601 srcField = CGF.Builder.CreateBitCast(srcField, CGF.VoidPtrPtrTy);
1602 llvm::Value *srcValue = CGF.Builder.CreateLoad(srcField);
1606 llvm::Value *flagsVal = llvm::ConstantInt::get(CGF.Int32Ty, flags);
1607 llvm::Value *fn = CGF.CGM.getBlockObjectAssign();
1610 CGF.EmitNounwindRuntimeCall(fn, args);
1613 void emitDispose(CodeGenFunction &CGF, llvm::Value *field) {
1614 field = CGF.Builder.CreateBitCast(field, CGF.Int8PtrTy->getPointerTo(0));
1615 llvm::Value *value = CGF.Builder.CreateLoad(field);
1617 CGF.BuildBlockRelease(value, Flags | BLOCK_BYREF_CALLER);
1630 void emitCopy(CodeGenFunction &CGF, llvm::Value *destField,
1632 CGF.EmitARCMoveWeak(destField, srcField);
1635 void emitDispose(CodeGenFunction &CGF, llvm::Value *field) {
1636 CGF.EmitARCDestroyWeak(field);
1651 void emitCopy(CodeGenFunction &CGF, llvm::Value *destField,
1656 llvm::LoadInst *value = CGF.Builder.CreateLoad(srcField);
1662 if (CGF.CGM.getCodeGenOpts().OptimizationLevel == 0) {
1663 llvm::StoreInst *store = CGF.Builder.CreateStore(null, destField);
1665 CGF.EmitARCStoreStrongCall(destField, value, /*ignored*/ true);
1666 CGF.EmitARCStoreStrongCall(srcField, null, /*ignored*/ true);
1669 llvm::StoreInst *store = CGF.Builder.CreateStore(value, destField);
1672 store = CGF.Builder.CreateStore(null, srcField);
1676 void emitDispose(CodeGenFunction &CGF, llvm::Value *field) {
1677 CGF.EmitARCDestroyStrong(field, ARCImpreciseLifetime);
1692 void emitCopy(CodeGenFunction &CGF, llvm::Value *destField,
1697 llvm::LoadInst *oldValue = CGF.Builder.CreateLoad(srcField);
1700 llvm::Value *copy = CGF.EmitARCRetainBlock(oldValue, /*mandatory*/ true);
1702 llvm::StoreInst *store = CGF.Builder.CreateStore(copy, destField);
1706 void emitDispose(CodeGenFunction &CGF, llvm::Value *field) {
1707 CGF.EmitARCDestroyStrong(field, ARCImpreciseLifetime);
1728 void emitCopy(CodeGenFunction &CGF, llvm::Value *destField,
1731 CGF.EmitSynthesizedCXXCopyCtor(destField, srcField, CopyExpr);
1734 void emitDispose(CodeGenFunction &CGF, llvm::Value *field) {
1735 EHScopeStack::stable_iterator cleanupDepth = CGF.EHStack.stable_begin();
1736 CGF.PushDestructorCleanup(VarType, field);
1737 CGF.PopCleanupBlocks(cleanupDepth);
1747 generateByrefCopyHelper(CodeGenFunction &CGF,
1751 ASTContext &Context = CGF.getContext();
1763 CGF.CGM.getTypes().arrangeFunctionDeclaration(R, args,
1767 CodeGenTypes &Types = CGF.CGM.getTypes();
1774 "__Block_byref_object_copy_", &CGF.CGM.getModule());
1787 CGF.maybeInitializeDebugInfo();
1788 CGF.StartFunction(FD, R, Fn, FI, args, SourceLocation());
1794 llvm::Value *destField = CGF.GetAddrOfLocalVar(&dst);
1795 destField = CGF.Builder.CreateLoad(destField);
1796 destField = CGF.Builder.CreateBitCast(destField, byrefPtrType);
1797 destField = CGF.Builder.CreateStructGEP(destField, valueFieldIndex, "x");
1800 llvm::Value *srcField = CGF.GetAddrOfLocalVar(&src);
1801 srcField = CGF.Builder.CreateLoad(srcField);
1802 srcField = CGF.Builder.CreateBitCast(srcField, byrefPtrType);
1803 srcField = CGF.Builder.CreateStructGEP(srcField, valueFieldIndex, "x");
1805 byrefInfo.emitCopy(CGF, destField, srcField);
1808 CGF.FinishFunction();
1810 return llvm::ConstantExpr::getBitCast(Fn, CGF.Int8PtrTy);
1818 CodeGenFunction CGF(CGM);
1819 return generateByrefCopyHelper(CGF, byrefType, byrefValueIndex, info);
1824 generateByrefDisposeHelper(CodeGenFunction &CGF,
1828 ASTContext &Context = CGF.getContext();
1836 CGF.CGM.getTypes().arrangeFunctionDeclaration(R, args,
1840 CodeGenTypes &Types = CGF.CGM.getTypes();
1848 &CGF.CGM.getModule());
1860 CGF.maybeInitializeDebugInfo();
1861 CGF.StartFunction(FD, R, Fn, FI, args, SourceLocation());
1864 llvm::Value *V = CGF.GetAddrOfLocalVar(&src);
1865 V = CGF.Builder.CreateLoad(V);
1866 V = CGF.Builder.CreateBitCast(V, byrefType.getPointerTo(0));
1867 V = CGF.Builder.CreateStructGEP(V, byrefValueIndex, "x");
1869 byrefInfo.emitDispose(CGF, V);
1872 CGF.FinishFunction();
1874 return llvm::ConstantExpr::getBitCast(Fn, CGF.Int8PtrTy);
1882 CodeGenFunction CGF(CGM);
1883 return generateByrefDisposeHelper(CGF, byrefType, byrefValueIndex, info);
2233 void Emit(CodeGenFunction &CGF, Flags flags) {
2235 CGF.BuildBlockRelease(Addr, BLOCK_FIELD_IS_BYREF);