Home | History | Annotate | Download | only in CodeGen

Lines Matching refs:CGM

43 static llvm::Constant *buildGlobalBlock(CodeGenModule &CGM,
48 static llvm::Constant *buildCopyHelper(CodeGenModule &CGM,
50 return CodeGenFunction(CGM).GenerateCopyHelperFunction(blockInfo);
54 static llvm::Constant *buildDisposeHelper(CodeGenModule &CGM,
56 return CodeGenFunction(CGM).GenerateDestroyHelperFunction(blockInfo);
60 static llvm::Constant *buildBlockDescriptor(CodeGenModule &CGM,
62 ASTContext &C = CGM.getContext();
64 llvm::Type *ulong = CGM.getTypes().ConvertType(C.UnsignedLongTy);
65 llvm::Type *i8p = CGM.getTypes().ConvertType(C.VoidPtrTy);
82 elements.push_back(buildCopyHelper(CGM, blockInfo));
85 elements.push_back(buildDisposeHelper(CGM, blockInfo));
90 CGM.getContext().getObjCEncodingForBlock(blockInfo.getBlockExpr());
92 CGM.GetAddrOfConstantCString(typeAtEncoding), i8p));
96 elements.push_back(CGM.getObjCRuntime().BuildGCBlockLayout(CGM, blockInfo));
103 new llvm::GlobalVariable(CGM.getModule(), init->getType(), true,
107 return llvm::ConstantExpr::getBitCast(global, CGM.getBlockDescriptorType());
217 static llvm::Constant *tryCaptureAsConstant(CodeGenModule &CGM,
230 if (CGM.getLangOpts().CPlusPlus && !isSafeForCXXConstantCapture(type))
239 return CGM.EmitConstantInit(*var, CGF);
248 static void initializeForBlockHeader(CodeGenModule &CGM, CGBlockInfo &info,
250 ASTContext &C = CGM.getContext();
269 llvm::Type *i8p = CGM.getTypes().ConvertType(C.VoidPtrTy);
270 llvm::Type *intTy = CGM.getTypes().ConvertType(C.IntTy);
275 elementTypes.push_back(CGM.getBlockDescriptorType());
282 static void computeBlockInfo(CodeGenModule &CGM, CodeGenFunction *CGF,
284 ASTContext &C = CGM.getContext();
288 initializeForBlockHeader(CGM, info, elementTypes);
292 llvm::StructType::get(CGM.getLLVMContext(), elementTypes, true);
315 llvm::Type *llvmType = CGM.getTypes().ConvertType(thisType);
317 = CGM.getContext().getTypeInfoInChars(thisType);
335 llvm::Type *llvmType = CGM.getTypes().ConvertType(byRefPtrTy);
337 = CGM.getContext().getTypeInfoInChars(byRefPtrTy);
347 if (llvm::Constant *constant = tryCaptureAsConstant(CGM, CGF, variable)) {
377 } else if (CGM.getLangOpts().CPlusPlus) {
394 CGM.getTypes().ConvertTypeForMem(VT);
402 llvm::StructType::get(CGM.getLLVMContext(), elementTypes, true);
466 elementTypes.push_back(llvm::ArrayType::get(CGM.Int8Ty,
487 llvm::StructType::get(CGM.getLLVMContext(), elementTypes, true);
504 computeBlockInfo(CGF.CGM, &CGF, blockInfo);
611 computeBlockInfo(CGM, this, blockInfo);
629 = CodeGenFunction(CGM).GenerateBlockFunction(CurGD, blockInfo,
636 return buildGlobalBlock(CGM, blockInfo, blockFn);
640 llvm::Constant *isa = CGM.getNSConcreteStackBlock();
644 llvm::Constant *descriptor = buildBlockDescriptor(CGM, blockInfo);
849 llvm::PointerType::getUnqual(CGM.getGenericBlockLiteralType());
875 CGM.getTypes().arrangeFunctionCall(Args, FuncTy);
878 llvm::Type *BlockFTy = CGM.getTypes().GetFunctionType(FnInfo);
948 static llvm::Constant *buildGlobalBlock(CodeGenModule &CGM,
957 fields[0] = CGM.getNSConcreteGlobalBlock();
963 fields[1] = llvm::ConstantInt::get(CGM.IntTy, flags.getBitMask());
966 fields[2] = llvm::Constant::getNullValue(CGM.IntTy);
972 fields[4] = buildBlockDescriptor(CGM, blockInfo);
977 new llvm::GlobalVariable(CGM.getModule(),
987 CGM.getTypes().ConvertType(blockInfo.getBlockExpr()->getType());
1000 if (CGM.getModuleDebugInfo())
1001 DebugInfo = CGM.getModuleDebugInfo();
1022 IdentifierInfo *II = &CGM.getContext().Idents.get(".block_descriptor");
1036 CGM.getTypes().arrangeFunctionDeclaration(fnType->getResultType(), args,
1039 if (CGM.ReturnTypeUsesSRet(fnInfo))
1042 llvm::FunctionType *fnLLVMType = CGM.getTypes().GetFunctionType(fnInfo);
1045 CGM.getBlockMangledName(GD, name, blockDecl);
1048 name.getString(), &CGM.getModule());
1049 CGM.SetInternalFunctionAttributes(blockDecl, fn, fnInfo);
1187 CGM.getTypes().arrangeFunctionDeclaration(C.VoidTy, args,
1193 llvm::FunctionType *LTy = CGM.getTypes().GetFunctionType(FI);
1197 "__copy_helper_block_", &CGM.getModule());
1200 = &CGM.getContext().Idents.get("__copy_helper_block_");
1203 if (CGM.getModuleDebugInfo())
1204 DebugInfo = CGM.getModuleDebugInfo();
1285 Builder.CreateCall3(CGM.getBlockObjectAssign(), dstAddr, srcValue,
1304 CGM.getTypes().arrangeFunctionDeclaration(C.VoidTy, args,
1310 llvm::FunctionType *LTy = CGM.getTypes().GetFunctionType(FI);
1314 "__destroy_helper_block_", &CGM.getModule());
1317 if (CGM.getModuleDebugInfo())
1318 DebugInfo = CGM.getModuleDebugInfo();
1321 = &CGM.getContext().Idents.get("__destroy_helper_block_");
1432 llvm::Value *fn = CGF.CGM.getBlockObjectAssign();
1584 CGF.CGM.getTypes().arrangeFunctionDeclaration(R, args,
1588 CodeGenTypes &Types = CGF.CGM.getTypes();
1595 "__Block_byref_object_copy_", &CGF.CGM.getModule());
1634 static llvm::Constant *buildByrefCopyHelper(CodeGenModule &CGM,
1637 CodeGenFunction CGF(CGM);
1654 CGF.CGM.getTypes().arrangeFunctionDeclaration(R, args,
1658 CodeGenTypes &Types = CGF.CGM.getTypes();
1666 &CGF.CGM.getModule());
1695 static llvm::Constant *buildByrefDisposeHelper(CodeGenModule &CGM,
1698 CodeGenFunction CGF(CGM);
1703 template <class T> static T *buildByrefHelpers(CodeGenModule &CGM,
1709 CharUnits::fromQuantity(CGM.PointerAlignInBytes));
1716 = CGM.ByrefHelpersCache.FindNodeOrInsertPos(id, insertPos);
1719 byrefInfo.CopyHelper = buildByrefCopyHelper(CGM, byrefTy, byrefInfo);
1720 byrefInfo.DisposeHelper = buildByrefDisposeHelper(CGM, byrefTy, byrefInfo);
1722 T *copy = new (CGM.getContext()) T(byrefInfo);
1723 CGM.ByrefHelpersCache.InsertNode(copy, insertPos);
1734 const Expr *copyExpr = CGM.getContext().getBlockVarCopyInits(&var);
1738 return ::buildByrefHelpers(CGM, byrefType, byrefInfo);
1763 return ::buildByrefHelpers(CGM, byrefType, byrefInfo);
1772 return ::buildByrefHelpers(CGM, byrefType, byrefInfo);
1778 return ::buildByrefHelpers(CGM, byrefType, byrefInfo);
1787 } else if (CGM.getContext().isObjCNSObjectType(type) ||
1798 return ::buildByrefHelpers(CGM, byrefType, byrefInfo);
1875 CGM.getTargetData().getTypeAllocSize(Int8PtrTy);
1946 CharUnits byrefSize = CGM.GetTargetTypeStoreSize(byrefType);
1960 llvm::Value *F = CGM.getBlockObjectDispose();
1985 if (CGM.getLangOpts().getGC() == LangOptions::GCOnly)
1992 static void configureBlocksRuntimeObject(CodeGenModule &CGM,
1994 if (!CGM.getLangOpts().BlocksRuntimeOptional) return;