Lines Matching defs:CGM
24 static const SwiftABIInfo &getSwiftABIInfo(CodeGenModule &CGM) {
25 return CGM.getTargetCodeGenInfo().getSwiftABIInfo();
57 static CharUnits getTypeStoreSize(CodeGenModule &CGM, llvm::Type *type) {
58 return CharUnits::fromQuantity(CGM.getDataLayout().getTypeStoreSize(type));
61 static CharUnits getTypeAllocSize(CodeGenModule &CGM, llvm::Type *type) {
62 return CharUnits::fromQuantity(CGM.getDataLayout().getTypeAllocSize(type));
76 auto arrayType = CGM.getContext().getAsConstantArrayType(type);
80 auto eltSize = CGM.getContext().getTypeSizeInChars(eltType);
88 auto eltSize = CGM.getContext().getTypeSizeInChars(eltType);
89 auto eltLLVMType = CGM.getTypes().ConvertType(eltType);
96 addOpaqueData(begin, begin + CGM.getContext().getTypeSizeInChars(type));
101 auto atomicSize = CGM.getContext().getTypeSizeInChars(atomicType);
102 auto valueSize = CGM.getContext().getTypeSizeInChars(valueType);
115 auto *llvmType = CGM.getTypes().ConvertType(type);
121 addTypedData(record, begin, CGM.getContext().getASTRecordLayout(record));
147 addTypedData(CGM.Int8PtrTy, begin);
160 addTypedData(CGM.Int8PtrTy, begin + layout.getVBPtrOffset());
171 begin + CGM.getContext().toCharUnitsFromBits(fieldOffsetInBits));
189 auto &ctx = CGM.getContext();
210 addTypedData(type, begin, begin + getTypeStoreSize(CGM, type));
216 assert(getTypeStoreSize(CGM, type) == end - begin);
221 legalizeVectorType(CGM, end - begin, vecTy, componentTys);
227 auto componentSize = getTypeStoreSize(CGM, componentTy);
238 if (!isLegalIntegerType(CGM, intTy))
249 if (!begin.isZero() && !begin.isMultipleOf(getNaturalAlignment(CGM, type))) {
253 auto split = splitLegalVectorType(CGM, end - begin, vecTy);
258 assert(eltSize == getTypeStoreSize(CGM, eltTy));
278 assert(!type || begin.isMultipleOf(getNaturalAlignment(CGM, type)));
340 assert(eltSize == getTypeStoreSize(CGM, eltTy));
403 auto split = splitLegalVectorType(CGM, Entries[index].getWidth(), vecTy);
406 CharUnits eltSize = getTypeStoreSize(CGM, eltTy);
478 const CharUnits chunkSize = getMaximumVoluntaryIntegerSize(CGM);
548 llvm::IntegerType::get(CGM.getLLVMContext(),
549 CGM.getContext().toBits(unitSize));
573 auto &ctx = CGM.getLLVMContext();
596 CGM.getDataLayout().getABITypeAlign(entry.Type))))
601 lastEnd = entry.Begin + getTypeAllocSize(CGM, entry.Type);
635 return getSwiftABIInfo(CGM).shouldPassIndirectly(Entries.back().Type,
644 return getSwiftABIInfo(CGM).shouldPassIndirectly(componentTys, asReturnValue);
647 bool swiftcall::shouldPassIndirectly(CodeGenModule &CGM,
650 return getSwiftABIInfo(CGM).shouldPassIndirectly(componentTys, asReturnValue);
653 CharUnits swiftcall::getMaximumVoluntaryIntegerSize(CodeGenModule &CGM) {
655 return CGM.getContext().toCharUnitsFromBits(
656 CGM.getContext().getTargetInfo().getPointerWidth(LangAS::Default));
659 CharUnits swiftcall::getNaturalAlignment(CodeGenModule &CGM, llvm::Type *type) {
662 auto size = (unsigned long long) getTypeStoreSize(CGM, type).getQuantity();
664 assert(CGM.getDataLayout().getABITypeAlign(type) <= size);
668 bool swiftcall::isLegalIntegerType(CodeGenModule &CGM,
681 return CGM.getContext().getTargetInfo().hasInt128Type();
688 bool swiftcall::isLegalVectorType(CodeGenModule &CGM, CharUnits vectorSize,
691 CGM, vectorSize, vectorTy->getElementType(),
695 bool swiftcall::isLegalVectorType(CodeGenModule &CGM, CharUnits vectorSize,
698 return getSwiftABIInfo(CGM).isLegalVectorType(vectorSize, eltTy, numElts);
702 swiftcall::splitLegalVectorType(CodeGenModule &CGM, CharUnits vectorSize,
709 if (isLegalVectorType(CGM, vectorSize / 2, eltTy, numElts / 2))
716 void swiftcall::legalizeVectorType(CodeGenModule &CGM, CharUnits origVectorSize,
720 if (isLegalVectorType(CGM, origVectorSize, origVectorTy)) {
754 if (!isLegalVectorType(CGM, candidateSize, eltTy, candidateNumElts)) {
773 isLegalVectorType(CGM, eltSize * numElts, eltTy, numElts)) {
790 bool swiftcall::mustPassRecordIndirectly(CodeGenModule &CGM,
811 static ABIArgInfo classifyType(CodeGenModule &CGM, CanQualType type,
815 auto &layout = CGM.getContext().getASTRecordLayout(record);
817 if (mustPassRecordIndirectly(CGM, record))
820 SwiftAggLowering lowering(CGM);
835 SwiftAggLowering lowering(CGM);
839 CharUnits alignment = CGM.getContext().getTypeAlignInChars(type);
856 ABIArgInfo swiftcall::classifyReturnType(CodeGenModule &CGM, CanQualType type) {
857 return classifyType(CGM, type, /*forReturn*/ true);
860 ABIArgInfo swiftcall::classifyArgumentType(CodeGenModule &CGM,
862 return classifyType(CGM, type, /*forReturn*/ false);
865 void swiftcall::computeABIInfo(CodeGenModule &CGM, CGFunctionInfo &FI) {
867 retInfo = classifyReturnType(CGM, FI.getReturnType());
871 argInfo.info = classifyArgumentType(CGM, argInfo.type);
876 bool swiftcall::isSwiftErrorLoweredInRegister(CodeGenModule &CGM) {
877 return getSwiftABIInfo(CGM).isSwiftErrorInRegister();