Lines Matching refs:Ty

56 static ABIArgInfo coerceToIntArray(QualType Ty,  in coerceToIntArray()  argument
60 const uint64_t Size = Context.getTypeSize(Ty); in coerceToIntArray()
61 const uint64_t Alignment = Context.getTypeAlign(Ty); in coerceToIntArray()
85 ABIArgInfo ABIInfo::getNaturalAlignIndirect(QualType Ty, bool ByVal, in getNaturalAlignIndirect() argument
88 return ABIArgInfo::getIndirect(getContext().getTypeAlignInChars(Ty), ByVal, in getNaturalAlignIndirect()
93 ABIInfo::getNaturalAlignIndirectInReg(QualType Ty, bool Realign) const { in getNaturalAlignIndirectInReg() argument
94 return ABIArgInfo::getIndirectInReg(getContext().getTypeAlignInChars(Ty), in getNaturalAlignIndirectInReg()
99 QualType Ty) const { in EmitMSVAArg()
108 bool ABIInfo::isPromotableIntegerTypeForABI(QualType Ty) const { in isPromotableIntegerTypeForABI()
109 if (getContext().isPromotableIntegerType(Ty)) in isPromotableIntegerTypeForABI()
112 if (const auto *EIT = Ty->getAs<BitIntType>()) in isPromotableIntegerTypeForABI()
188 QualType Ty = FI.getReturnType(); in classifyReturnType() local
190 if (const auto *RT = Ty->getAs<RecordType>()) in classifyReturnType()
193 FI.getReturnInfo() = Info.getNaturalAlignIndirect(Ty); in classifyReturnType()
202 static QualType useFirstFieldIfTransparentUnion(QualType Ty) { in useFirstFieldIfTransparentUnion() argument
203 if (const RecordType *UT = Ty->getAsUnionType()) { in useFirstFieldIfTransparentUnion()
210 return Ty; in useFirstFieldIfTransparentUnion()
239 bool ABIInfo::isHomogeneousAggregateBaseType(QualType Ty) const { in isHomogeneousAggregateBaseType()
259 if (llvm::Type *Ty = getCoerceToType()) in dump() local
260 Ty->print(OS); in dump()
418 QualType Ty, CharUnits SlotSize, in complexTempStructure() argument
441 Address Temp = CGF.CreateMemTemp(Ty, "vacplx"); in complexTempStructure()
442 CGF.EmitStoreOfComplex({Real, Imag}, CGF.MakeAddrLValue(Temp, Ty), in complexTempStructure()
695 Address EmitVAArgInstr(CodeGenFunction &CGF, Address VAListAddr, QualType Ty, in EmitVAArgInstr() argument
715 auto TyInfo = CGF.getContext().getTypeInfoInChars(Ty); in EmitVAArgInstr()
718 llvm::Type *ElementTy = CGF.ConvertTypeForMem(Ty); in EmitVAArgInstr()
736 Address Temp = CGF.CreateMemTemp(Ty, "varet"); in EmitVAArgInstr()
738 CGF.ConvertTypeForMem(Ty)); in EmitVAArgInstr()
763 QualType Ty) const override { in EmitVAArg()
764 return EmitVAArgInstr(CGF, VAListAddr, Ty, classifyArgumentType(Ty)); in EmitVAArg()
774 ABIArgInfo DefaultABIInfo::classifyArgumentType(QualType Ty) const { in classifyArgumentType()
775 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyArgumentType()
777 if (isAggregateTypeForABI(Ty)) { in classifyArgumentType()
780 if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) in classifyArgumentType()
781 return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); in classifyArgumentType()
783 return getNaturalAlignIndirect(Ty); in classifyArgumentType()
787 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in classifyArgumentType()
788 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
791 if (const auto *EIT = Ty->getAs<BitIntType>()) in classifyArgumentType()
796 return getNaturalAlignIndirect(Ty); in classifyArgumentType()
798 return (isPromotableIntegerTypeForABI(Ty) ? ABIArgInfo::getExtend(Ty) in classifyArgumentType()
847 ABIArgInfo classifyArgumentType(QualType Ty) const;
860 QualType Ty) const override;
905 ABIArgInfo WebAssemblyABIInfo::classifyArgumentType(QualType Ty) const { in classifyArgumentType()
906 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyArgumentType()
908 if (isAggregateTypeForABI(Ty)) { in classifyArgumentType()
911 if (auto RAA = getRecordArgABI(Ty, getCXXABI())) in classifyArgumentType()
912 return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); in classifyArgumentType()
914 if (isEmptyRecord(getContext(), Ty, true)) in classifyArgumentType()
919 if (const Type *SeltTy = isSingleElementStruct(Ty, getContext())) in classifyArgumentType()
923 const RecordType *RT = Ty->getAs<RecordType>(); in classifyArgumentType()
938 return defaultInfo.classifyArgumentType(Ty); in classifyArgumentType()
965 QualType Ty) const { in EmitVAArg()
966 bool IsIndirect = isAggregateTypeForABI(Ty) && in EmitVAArg()
967 !isEmptyRecord(getContext(), Ty, true) && in EmitVAArg()
968 !isSingleElementStruct(Ty, getContext()); in EmitVAArg()
969 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, IsIndirect, in EmitVAArg()
970 getContext().getTypeInfoInChars(Ty), in EmitVAArg()
991 Address VAListAddr, QualType Ty) const override;
1009 QualType Ty) const { in EmitVAArg()
1016 return EmitVAArgInstr(CGF, VAListAddr, Ty, ABIArgInfo::getDirect()); in EmitVAArg()
1020 ABIArgInfo PNaClABIInfo::classifyArgumentType(QualType Ty) const { in classifyArgumentType()
1021 if (isAggregateTypeForABI(Ty)) { in classifyArgumentType()
1022 if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) in classifyArgumentType()
1023 return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); in classifyArgumentType()
1024 return getNaturalAlignIndirect(Ty); in classifyArgumentType()
1025 } else if (const EnumType *EnumTy = Ty->getAs<EnumType>()) { in classifyArgumentType()
1027 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
1028 } else if (Ty->isFloatingType()) { in classifyArgumentType()
1031 } else if (const auto *EIT = Ty->getAs<BitIntType>()) { in classifyArgumentType()
1035 return getNaturalAlignIndirect(Ty); in classifyArgumentType()
1039 return (isPromotableIntegerTypeForABI(Ty) ? ABIArgInfo::getExtend(Ty) in classifyArgumentType()
1076 llvm::Type* Ty) { in X86AdjustInlineAsmType() argument
1080 if (IsMMXCons && Ty->isVectorTy()) { in X86AdjustInlineAsmType()
1081 if (cast<llvm::VectorType>(Ty)->getPrimitiveSizeInBits().getFixedValue() != in X86AdjustInlineAsmType()
1091 return Ty; in X86AdjustInlineAsmType()
1096 static bool isX86VectorTypeForVectorCall(ASTContext &Context, QualType Ty) { in isX86VectorTypeForVectorCall() argument
1097 if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) { in isX86VectorTypeForVectorCall()
1106 } else if (const VectorType *VT = Ty->getAs<VectorType>()) { in isX86VectorTypeForVectorCall()
1166 bool isHomogeneousAggregateBaseType(QualType Ty) const override { in isHomogeneousAggregateBaseType()
1168 return isX86VectorTypeForVectorCall(getContext(), Ty); in isHomogeneousAggregateBaseType()
1171 bool isHomogeneousAggregateSmallEnough(const Type *Ty, in isHomogeneousAggregateSmallEnough() argument
1177 bool shouldReturnTypeInRegister(QualType Ty, ASTContext &Context) const;
1181 ABIArgInfo getIndirectResult(QualType Ty, bool ByVal, CCState &State) const;
1183 ABIArgInfo getIndirectReturnResult(QualType Ty, CCState &State) const;
1186 unsigned getTypeStackAlignInBytes(QualType Ty, unsigned Align) const;
1188 Class classify(QualType Ty) const;
1194 bool updateFreeRegs(QualType Ty, CCState &State) const;
1196 bool shouldAggregateUseDirect(QualType Ty, CCState &State, bool &InReg,
1198 bool shouldPrimitiveUseInReg(QualType Ty, CCState &State) const;
1200 bool canExpandIndirectArgument(QualType Ty) const;
1215 QualType Ty) const override;
1272 llvm::Type* Ty) const override { in adjustInlineAsmType()
1273 return X86AdjustInlineAsmType(CGF, Constraint, Ty); in adjustInlineAsmType()
1386 bool X86_32ABIInfo::shouldReturnTypeInRegister(QualType Ty, in shouldReturnTypeInRegister() argument
1388 uint64_t Size = Context.getTypeSize(Ty); in shouldReturnTypeInRegister()
1395 if (Ty->isVectorType()) { in shouldReturnTypeInRegister()
1406 if (Ty->getAs<BuiltinType>() || Ty->hasPointerRepresentation() || in shouldReturnTypeInRegister()
1407 Ty->isAnyComplexType() || Ty->isEnumeralType() || in shouldReturnTypeInRegister()
1408 Ty->isBlockPointerType() || Ty->isMemberPointerType()) in shouldReturnTypeInRegister()
1412 if (const ConstantArrayType *AT = Context.getAsConstantArrayType(Ty)) in shouldReturnTypeInRegister()
1416 const RecordType *RT = Ty->getAs<RecordType>(); in shouldReturnTypeInRegister()
1435 static bool is32Or64BitBasicType(QualType Ty, ASTContext &Context) { in is32Or64BitBasicType() argument
1437 if (const ComplexType *CTy = Ty->getAs<ComplexType>()) in is32Or64BitBasicType()
1438 Ty = CTy->getElementType(); in is32Or64BitBasicType()
1443 if (!Ty->getAs<BuiltinType>() && !Ty->hasPointerRepresentation() && in is32Or64BitBasicType()
1444 !Ty->isEnumeralType() && !Ty->isBlockPointerType()) in is32Or64BitBasicType()
1447 uint64_t Size = Context.getTypeSize(Ty); in is32Or64BitBasicType()
1488 bool X86_32ABIInfo::canExpandIndirectArgument(QualType Ty) const { in canExpandIndirectArgument()
1490 const RecordType *RT = Ty->getAs<RecordType>(); in canExpandIndirectArgument()
1514 return Size == getContext().getTypeSize(Ty); in canExpandIndirectArgument()
1625 static bool isSIMDVectorType(ASTContext &Context, QualType Ty) { in isSIMDVectorType() argument
1626 return Ty->getAs<VectorType>() && Context.getTypeSize(Ty) == 128; in isSIMDVectorType()
1629 static bool isRecordWithSIMDVectorType(ASTContext &Context, QualType Ty) { in isRecordWithSIMDVectorType() argument
1630 const RecordType *RT = Ty->getAs<RecordType>(); in isRecordWithSIMDVectorType()
1654 unsigned X86_32ABIInfo::getTypeStackAlignInBytes(QualType Ty, in getTypeStackAlignInBytes() argument
1666 if (Ty->isVectorType() && (Align == 16 || Align == 32 || Align == 64)) in getTypeStackAlignInBytes()
1676 if (Align >= 16 && (isSIMDVectorType(getContext(), Ty) || in getTypeStackAlignInBytes()
1677 isRecordWithSIMDVectorType(getContext(), Ty))) in getTypeStackAlignInBytes()
1683 ABIArgInfo X86_32ABIInfo::getIndirectResult(QualType Ty, bool ByVal, in getIndirectResult() argument
1689 return getNaturalAlignIndirectInReg(Ty); in getIndirectResult()
1691 return getNaturalAlignIndirect(Ty, false); in getIndirectResult()
1695 unsigned TypeAlign = getContext().getTypeAlign(Ty) / 8; in getIndirectResult()
1696 unsigned StackAlign = getTypeStackAlignInBytes(Ty, TypeAlign); in getIndirectResult()
1707 X86_32ABIInfo::Class X86_32ABIInfo::classify(QualType Ty) const { in classify()
1708 const Type *T = isSingleElementStruct(Ty, getContext()); in classify()
1710 T = Ty.getTypePtr(); in classify()
1720 bool X86_32ABIInfo::updateFreeRegs(QualType Ty, CCState &State) const { in updateFreeRegs() argument
1722 Class C = classify(Ty); in updateFreeRegs()
1727 unsigned Size = getContext().getTypeSize(Ty); in updateFreeRegs()
1751 bool X86_32ABIInfo::shouldAggregateUseDirect(QualType Ty, CCState &State, in shouldAggregateUseDirect() argument
1757 if (IsWin32StructABI && isAggregateTypeForABI(Ty)) in shouldAggregateUseDirect()
1763 if (!updateFreeRegs(Ty, State)) in shouldAggregateUseDirect()
1772 if (getContext().getTypeSize(Ty) <= 32 && State.FreeRegs) in shouldAggregateUseDirect()
1781 bool X86_32ABIInfo::shouldPrimitiveUseInReg(QualType Ty, CCState &State) const { in shouldPrimitiveUseInReg() argument
1782 bool IsPtrOrInt = (getContext().getTypeSize(Ty) <= 32) && in shouldPrimitiveUseInReg()
1783 (Ty->isIntegralOrEnumerationType() || Ty->isPointerType() || in shouldPrimitiveUseInReg()
1784 Ty->isReferenceType()); in shouldPrimitiveUseInReg()
1790 if (!updateFreeRegs(Ty, State)) in shouldPrimitiveUseInReg()
1814 const QualType &Ty = Args[I].type; in runVectorCallFirstPass() local
1815 if ((Ty->isVectorType() || Ty->isBuiltinType()) && in runVectorCallFirstPass()
1816 isHomogeneousAggregate(Ty, Base, NumElts)) { in runVectorCallFirstPass()
1826 ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty, in classifyArgumentType() argument
1833 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyArgumentType()
1834 TypeInfo TI = getContext().getTypeInfo(Ty); in classifyArgumentType()
1837 const RecordType *RT = Ty->getAs<RecordType>(); in classifyArgumentType()
1841 return getIndirectResult(Ty, false, State); in classifyArgumentType()
1853 isHomogeneousAggregate(Ty, Base, NumElts)) { in classifyArgumentType()
1862 if (Ty->isBuiltinType() || Ty->isVectorType()) in classifyArgumentType()
1866 return getIndirectResult(Ty, /*ByVal=*/false, State); in classifyArgumentType()
1869 if (isAggregateTypeForABI(Ty)) { in classifyArgumentType()
1873 return getIndirectResult(Ty, true, State); in classifyArgumentType()
1876 if (!IsWin32StructABI && isEmptyRecord(getContext(), Ty, true)) in classifyArgumentType()
1883 if (shouldAggregateUseDirect(Ty, State, InReg, NeedsPadding)) { in classifyArgumentType()
1897 return getIndirectResult(Ty, /*ByVal=*/false, State); in classifyArgumentType()
1906 canExpandIndirectArgument(Ty)) in classifyArgumentType()
1910 return getIndirectResult(Ty, true, State); in classifyArgumentType()
1913 if (const VectorType *VT = Ty->getAs<VectorType>()) { in classifyArgumentType()
1922 return getIndirectResult(Ty, /*ByVal=*/false, State); in classifyArgumentType()
1934 if (IsX86_MMXType(CGT.ConvertType(Ty))) in classifyArgumentType()
1941 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in classifyArgumentType()
1942 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
1944 bool InReg = shouldPrimitiveUseInReg(Ty, State); in classifyArgumentType()
1946 if (isPromotableIntegerTypeForABI(Ty)) { in classifyArgumentType()
1948 return ABIArgInfo::getExtendInReg(Ty); in classifyArgumentType()
1949 return ABIArgInfo::getExtend(Ty); in classifyArgumentType()
1952 if (const auto *EIT = Ty->getAs<BitIntType>()) { in classifyArgumentType()
1958 return getIndirectResult(Ty, /*ByVal=*/false, State); in classifyArgumentType()
2053 llvm::Type *Ty = llvm::Type::getInt8Ty(getVMContext()); in addFieldToArgStruct() local
2054 Ty = llvm::ArrayType::get(Ty, NumBytes.getQuantity()); in addFieldToArgStruct()
2055 FrameFields.push_back(Ty); in addFieldToArgStruct()
2125 Address VAListAddr, QualType Ty) const { in EmitVAArg()
2127 auto TypeInfo = getContext().getTypeInfoInChars(Ty); in EmitVAArg()
2134 getTypeStackAlignInBytes(Ty, TypeInfo.Align.getQuantity())); in EmitVAArg()
2136 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, /*Indirect*/ false, in EmitVAArg()
2330 llvm::Type *GetByteVectorType(QualType Ty) const;
2340 ABIArgInfo getIndirectReturnResult(QualType Ty) const;
2347 ABIArgInfo getIndirectResult(QualType Ty, unsigned freeIntRegs) const;
2351 ABIArgInfo classifyArgumentType(QualType Ty, unsigned freeIntRegs,
2356 ABIArgInfo classifyRegCallStructType(QualType Ty, unsigned &NeededInt,
2360 ABIArgInfo classifyRegCallStructTypeImpl(QualType Ty, unsigned &NeededInt,
2364 bool IsIllegalVectorType(QualType Ty) const;
2426 QualType Ty) const override;
2428 QualType Ty) const override;
2445 QualType Ty) const override;
2447 bool isHomogeneousAggregateBaseType(QualType Ty) const override { in isHomogeneousAggregateBaseType()
2449 return isX86VectorTypeForVectorCall(getContext(), Ty); in isHomogeneousAggregateBaseType()
2452 bool isHomogeneousAggregateSmallEnough(const Type *Ty, in isHomogeneousAggregateSmallEnough() argument
2459 ABIArgInfo classify(QualType Ty, unsigned &FreeSSERegs, bool IsReturnType,
2461 ABIArgInfo reclassifyHvaArgForVectorCall(QualType Ty, unsigned &FreeSSERegs,
2501 llvm::Type* Ty) const override { in adjustInlineAsmType()
2502 return X86AdjustInlineAsmType(CGF, Constraint, Ty); in adjustInlineAsmType()
2517 if (getABIInfo().isPassedUsingAVXType(it->Ty)) { in isNoProtoCallVariadic()
2577 QualType Ty, StringRef Feature, in checkAVXParamFeature() argument
2583 << IsArgument << Ty << Feature; in checkAVXParamFeature()
2588 << IsArgument << Ty << Feature; in checkAVXParamFeature()
2598 const llvm::StringMap<bool> &CalleeMap, QualType Ty, in checkAVXParam() argument
2600 uint64_t Size = Ctx.getTypeSize(Ty); in checkAVXParam()
2602 return checkAVXParamFeature(Diag, CallLoc, CallerMap, CalleeMap, Ty, in checkAVXParam()
2606 return checkAVXParamFeature(Diag, CallLoc, CallerMap, CalleeMap, Ty, "avx", in checkAVXParam()
2632 QualType Ty = Arg.getType(); in checkFunctionCallABI() local
2636 Ty = Callee->getParamDecl(ArgIndex)->getType(); in checkFunctionCallABI()
2639 CalleeMap, Ty, /*IsArgument*/ true)) in checkFunctionCallABI()
2843 void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase, Class &Lo, in classify() argument
2858 if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) { in classify()
2889 if (const EnumType *ET = Ty->getAs<EnumType>()) { in classify()
2895 if (Ty->hasPointerRepresentation()) { in classify()
2900 if (Ty->isMemberPointerType()) { in classify()
2901 if (Ty->isMemberFunctionPointerType()) { in classify()
2923 if (const VectorType *VT = Ty->getAs<VectorType>()) { in classify()
2991 if (const ComplexType *CT = Ty->getAs<ComplexType>()) { in classify()
2994 uint64_t Size = getContext().getTypeSize(Ty); in classify()
3027 if (const auto *EITy = Ty->getAs<BitIntType>()) { in classify()
3036 if (const ConstantArrayType *AT = getContext().getAsConstantArrayType(Ty)) { in classify()
3039 uint64_t Size = getContext().getTypeSize(Ty); in classify()
3083 if (const RecordType *RT = Ty->getAs<RecordType>()) { in classify()
3084 uint64_t Size = getContext().getTypeSize(Ty); in classify()
3212 ABIArgInfo X86_64ABIInfo::getIndirectReturnResult(QualType Ty) const { in getIndirectReturnResult()
3215 if (!isAggregateTypeForABI(Ty)) { in getIndirectReturnResult()
3217 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in getIndirectReturnResult()
3218 Ty = EnumTy->getDecl()->getIntegerType(); in getIndirectReturnResult()
3220 if (Ty->isBitIntType()) in getIndirectReturnResult()
3221 return getNaturalAlignIndirect(Ty); in getIndirectReturnResult()
3223 return (isPromotableIntegerTypeForABI(Ty) ? ABIArgInfo::getExtend(Ty) in getIndirectReturnResult()
3227 return getNaturalAlignIndirect(Ty); in getIndirectReturnResult()
3230 bool X86_64ABIInfo::IsIllegalVectorType(QualType Ty) const { in IsIllegalVectorType()
3231 if (const VectorType *VecTy = Ty->getAs<VectorType>()) { in IsIllegalVectorType()
3246 ABIArgInfo X86_64ABIInfo::getIndirectResult(QualType Ty, in getIndirectResult() argument
3256 if (!isAggregateTypeForABI(Ty) && !IsIllegalVectorType(Ty) && in getIndirectResult()
3257 !Ty->isBitIntType()) { in getIndirectResult()
3259 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in getIndirectResult()
3260 Ty = EnumTy->getDecl()->getIntegerType(); in getIndirectResult()
3262 return (isPromotableIntegerTypeForABI(Ty) ? ABIArgInfo::getExtend(Ty) in getIndirectResult()
3266 if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) in getIndirectResult()
3267 return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); in getIndirectResult()
3271 unsigned Align = std::max(getContext().getTypeAlign(Ty) / 8, 8U); in getIndirectResult()
3295 uint64_t Size = getContext().getTypeSize(Ty); in getIndirectResult()
3309 llvm::Type *X86_64ABIInfo::GetByteVectorType(QualType Ty) const { in GetByteVectorType()
3312 if (const Type *InnerTy = isSingleElementStruct(Ty, getContext())) in GetByteVectorType()
3313 Ty = QualType(InnerTy, 0); in GetByteVectorType()
3315 llvm::Type *IRType = CGT.ConvertType(Ty); in GetByteVectorType()
3322 uint64_t Size = getContext().getTypeSize(Ty); in GetByteVectorType()
3334 uint64_t Size = getContext().getTypeSize(Ty); in GetByteVectorType()
3350 static bool BitsContainNoUserData(QualType Ty, unsigned StartBit, in BitsContainNoUserData() argument
3355 unsigned TySize = (unsigned)Context.getTypeSize(Ty); in BitsContainNoUserData()
3359 if (const ConstantArrayType *AT = Context.getAsConstantArrayType(Ty)) { in BitsContainNoUserData()
3378 if (const RecordType *RT = Ty->getAs<RecordType>()) { in BitsContainNoUserData()
3753 X86_64ABIInfo::classifyArgumentType(QualType Ty, unsigned freeIntRegs, in classifyArgumentType() argument
3756 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyArgumentType()
3759 classify(Ty, 0, Lo, Hi, isNamedArg, IsRegCall); in classifyArgumentType()
3787 if (getRecordArgABI(Ty, getCXXABI()) == CGCXXABI::RAA_Indirect) in classifyArgumentType()
3789 return getIndirectResult(Ty, freeIntRegs); in classifyArgumentType()
3802 ResType = GetINTEGERTypeAtOffset(CGT.ConvertType(Ty), 0, Ty, 0); in classifyArgumentType()
3808 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in classifyArgumentType()
3809 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
3811 if (Ty->isIntegralOrEnumerationType() && in classifyArgumentType()
3812 isPromotableIntegerTypeForABI(Ty)) in classifyArgumentType()
3813 return ABIArgInfo::getExtend(Ty); in classifyArgumentType()
3822 llvm::Type *IRType = CGT.ConvertType(Ty); in classifyArgumentType()
3823 ResType = GetSSETypeAtOffset(IRType, 0, Ty, 0); in classifyArgumentType()
3844 HighPart = GetINTEGERTypeAtOffset(CGT.ConvertType(Ty), 8, Ty, 8); in classifyArgumentType()
3854 HighPart = GetSSETypeAtOffset(CGT.ConvertType(Ty), 8, Ty, 8); in classifyArgumentType()
3867 ResType = GetByteVectorType(Ty); in classifyArgumentType()
3881 X86_64ABIInfo::classifyRegCallStructTypeImpl(QualType Ty, unsigned &NeededInt, in classifyRegCallStructTypeImpl() argument
3884 auto RT = Ty->getAs<RecordType>(); in classifyRegCallStructTypeImpl()
3888 return getIndirectReturnResult(Ty); in classifyRegCallStructTypeImpl()
3894 return getIndirectReturnResult(Ty); in classifyRegCallStructTypeImpl()
3902 return getIndirectReturnResult(Ty); in classifyRegCallStructTypeImpl()
3914 return getIndirectReturnResult(Ty); in classifyRegCallStructTypeImpl()
3922 return getIndirectReturnResult(Ty); in classifyRegCallStructTypeImpl()
3938 X86_64ABIInfo::classifyRegCallStructType(QualType Ty, unsigned &NeededInt, in classifyRegCallStructType() argument
3946 return classifyRegCallStructTypeImpl(Ty, NeededInt, NeededSSE, in classifyRegCallStructType()
4034 Address VAListAddr, QualType Ty) { in EmitX86_64VAArgFromMemory() argument
4044 CharUnits Align = CGF.getContext().getTypeAlignInChars(Ty); in EmitX86_64VAArgFromMemory()
4051 llvm::Type *LTy = CGF.ConvertTypeForMem(Ty); in EmitX86_64VAArgFromMemory()
4061 uint64_t SizeInBytes = (CGF.getContext().getTypeSize(Ty) + 7) / 8; in EmitX86_64VAArgFromMemory()
4073 QualType Ty) const { in EmitVAArg()
4083 Ty = getContext().getCanonicalType(Ty); in EmitVAArg()
4084 ABIArgInfo AI = classifyArgumentType(Ty, 0, neededInt, neededSSE, in EmitVAArg()
4090 return EmitX86_64VAArgFromMemory(CGF, VAListAddr, Ty); in EmitVAArg()
4141 llvm::Type *LTy = CGF.ConvertTypeForMem(Ty); in EmitVAArg()
4150 Address Tmp = CGF.CreateMemTemp(Ty); in EmitVAArg()
4186 auto TInfo = getContext().getTypeInfoInChars(Ty); in EmitVAArg()
4193 Address Tmp = CGF.CreateMemTemp(Ty); in EmitVAArg()
4220 Address Tmp = CGF.CreateMemTemp(Ty); in EmitVAArg()
4250 Address MemAddr = EmitX86_64VAArgFromMemory(CGF, VAListAddr, Ty); in EmitVAArg()
4261 QualType Ty) const { in EmitMSVAArg()
4264 uint64_t Width = getContext().getTypeSize(Ty); in EmitMSVAArg()
4267 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, IsIndirect, in EmitMSVAArg()
4268 CGF.getContext().getTypeInfoInChars(Ty), in EmitMSVAArg()
4274 QualType Ty, unsigned &FreeSSERegs, const ABIArgInfo &current) const { in reclassifyHvaArgForVectorCall() argument
4278 if (!Ty->isBuiltinType() && !Ty->isVectorType() && in reclassifyHvaArgForVectorCall()
4279 isHomogeneousAggregate(Ty, Base, NumElts) && FreeSSERegs >= NumElts) { in reclassifyHvaArgForVectorCall()
4286 ABIArgInfo WinX86_64ABIInfo::classify(QualType Ty, unsigned &FreeSSERegs, in classify() argument
4290 if (Ty->isVoidType()) in classify()
4293 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in classify()
4294 Ty = EnumTy->getDecl()->getIntegerType(); in classify()
4296 TypeInfo Info = getContext().getTypeInfo(Ty); in classify()
4300 const RecordType *RT = Ty->getAs<RecordType>(); in classify()
4304 return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); in classify()
4308 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in classify()
4317 isHomogeneousAggregate(Ty, Base, NumElts)) { in classify()
4321 if (IsReturnType || Ty->isBuiltinType() || Ty->isVectorType()) in classify()
4328 (IsReturnType || Ty->isBuiltinType() || Ty->isVectorType())) { in classify()
4333 } else if (!Ty->isBuiltinType() && !Ty->isVectorType()) { in classify()
4340 if (Ty->isMemberPointerType()) { in classify()
4343 llvm::Type *LLTy = CGT.ConvertType(Ty); in classify()
4348 if (RT || Ty->isAnyComplexType() || Ty->isMemberPointerType()) { in classify()
4352 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in classify()
4358 if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) { in classify()
4363 return ABIArgInfo::getExtend(Ty); in classify()
4393 if (Ty->isBitIntType()) { in classify()
4463 QualType Ty) const { in EmitVAArg()
4466 uint64_t Width = getContext().getTypeSize(Ty); in EmitVAArg()
4469 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, IsIndirect, in EmitVAArg()
4470 CGF.getContext().getTypeInfoInChars(Ty), in EmitVAArg()
4542 CharUnits getParamTypeAlignment(QualType Ty) const;
4548 bool isPromotableTypeForABI(QualType Ty) const;
4551 ABIArgInfo classifyArgumentType(QualType Ty) const;
4562 QualType Ty) const override;
4583 bool AIXABIInfo::isPromotableTypeForABI(QualType Ty) const { in isPromotableTypeForABI()
4585 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in isPromotableTypeForABI()
4586 Ty = EnumTy->getDecl()->getIntegerType(); in isPromotableTypeForABI()
4589 if (getContext().isPromotableIntegerType(Ty)) in isPromotableTypeForABI()
4598 if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) in isPromotableTypeForABI()
4627 ABIArgInfo AIXABIInfo::classifyArgumentType(QualType Ty) const { in classifyArgumentType()
4628 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyArgumentType()
4630 if (Ty->isAnyComplexType()) in classifyArgumentType()
4633 if (Ty->isVectorType()) in classifyArgumentType()
4636 if (isAggregateTypeForABI(Ty)) { in classifyArgumentType()
4639 if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) in classifyArgumentType()
4640 return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); in classifyArgumentType()
4642 CharUnits CCAlign = getParamTypeAlignment(Ty); in classifyArgumentType()
4643 CharUnits TyAlign = getContext().getTypeAlignInChars(Ty); in classifyArgumentType()
4649 return (isPromotableTypeForABI(Ty) ? ABIArgInfo::getExtend(Ty) in classifyArgumentType()
4653 CharUnits AIXABIInfo::getParamTypeAlignment(QualType Ty) const { in getParamTypeAlignment()
4655 if (const ComplexType *CTy = Ty->getAs<ComplexType>()) in getParamTypeAlignment()
4656 Ty = CTy->getElementType(); in getParamTypeAlignment()
4658 if (Ty->isVectorType()) in getParamTypeAlignment()
4662 if (isRecordWithSIMDVectorType(getContext(), Ty)) in getParamTypeAlignment()
4669 QualType Ty) const { in EmitVAArg()
4671 auto TypeInfo = getContext().getTypeInfoInChars(Ty); in EmitVAArg()
4672 TypeInfo.Align = getParamTypeAlignment(Ty); in EmitVAArg()
4683 if (const ComplexType *CTy = Ty->getAs<ComplexType>()) { in EmitVAArg()
4686 return complexTempStructure(CGF, VAListAddr, Ty, SlotSize, EltSize, CTy); in EmitVAArg()
4689 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, /*Indirect*/ false, TypeInfo, in EmitVAArg()
4705 CharUnits getParamTypeAlignment(QualType Ty) const;
4723 QualType Ty) const override;
4746 CharUnits PPC32_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty) const { in getParamTypeAlignment()
4748 if (const ComplexType *CTy = Ty->getAs<ComplexType>()) in getParamTypeAlignment()
4749 Ty = CTy->getElementType(); in getParamTypeAlignment()
4751 if (Ty->isVectorType()) in getParamTypeAlignment()
4752 return CharUnits::fromQuantity(getContext().getTypeSize(Ty) == 128 ? 16 in getParamTypeAlignment()
4758 if (const Type *EltType = isSingleElementStruct(Ty, getContext())) { in getParamTypeAlignment()
4801 QualType Ty) const { in EmitVAArg()
4803 auto TI = getContext().getTypeInfoInChars(Ty); in EmitVAArg()
4804 TI.Align = getParamTypeAlignment(Ty); in EmitVAArg()
4807 return emitVoidPtrVAArg(CGF, VAList, Ty, in EmitVAArg()
4808 classifyArgumentType(Ty).isIndirect(), TI, SlotSize, in EmitVAArg()
4813 if (const ComplexType *CTy = Ty->getAs<ComplexType>()) { in EmitVAArg()
4827 bool isI64 = Ty->isIntegerType() && getContext().getTypeSize(Ty) == 64; in EmitVAArg()
4828 bool isInt = !Ty->isFloatingType(); in EmitVAArg()
4829 bool isF64 = Ty->isFloatingType() && getContext().getTypeSize(Ty) == 64; in EmitVAArg()
4833 bool isIndirect = isAggregateTypeForABI(Ty); in EmitVAArg()
4862 llvm::Type *DirectTy = CGF.ConvertType(Ty), *ElementTy = DirectTy; in EmitVAArg()
4912 auto TypeInfo = CGF.getContext().getTypeInfoInChars(Ty); in EmitVAArg()
4923 CharUnits Align = CGF.getContext().getTypeAlignInChars(Ty); in EmitVAArg()
4947 getContext().getTypeAlignInChars(Ty)); in EmitVAArg()
5000 bool isPromotableTypeForABI(QualType Ty) const;
5001 CharUnits getParamTypeAlignment(QualType Ty) const;
5004 ABIArgInfo classifyArgumentType(QualType Ty) const;
5006 bool isHomogeneousAggregateBaseType(QualType Ty) const override;
5007 bool isHomogeneousAggregateSmallEnough(const Type *Ty,
5038 QualType Ty) const override;
5080 PPC64_SVR4_ABIInfo::isPromotableTypeForABI(QualType Ty) const { in isPromotableTypeForABI()
5082 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in isPromotableTypeForABI()
5083 Ty = EnumTy->getDecl()->getIntegerType(); in isPromotableTypeForABI()
5086 if (isPromotableIntegerTypeForABI(Ty)) in isPromotableTypeForABI()
5091 if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) in isPromotableTypeForABI()
5100 if (const auto *EIT = Ty->getAs<BitIntType>()) in isPromotableTypeForABI()
5109 CharUnits PPC64_SVR4_ABIInfo::getParamTypeAlignment(QualType Ty) const { in getParamTypeAlignment()
5111 if (const ComplexType *CTy = Ty->getAs<ComplexType>()) in getParamTypeAlignment()
5112 Ty = CTy->getElementType(); in getParamTypeAlignment()
5114 auto FloatUsesVector = [this](QualType Ty){ in getParamTypeAlignment() argument
5115 return Ty->isRealFloatingType() && &getContext().getFloatTypeSemantics( in getParamTypeAlignment()
5116 Ty) == &llvm::APFloat::IEEEquad(); in getParamTypeAlignment()
5121 if (Ty->isVectorType()) { in getParamTypeAlignment()
5122 return CharUnits::fromQuantity(getContext().getTypeSize(Ty) == 128 ? 16 : 8); in getParamTypeAlignment()
5123 } else if (FloatUsesVector(Ty)) { in getParamTypeAlignment()
5133 const Type *EltType = isSingleElementStruct(Ty, getContext()); in getParamTypeAlignment()
5145 isAggregateTypeForABI(Ty) && isHomogeneousAggregate(Ty, Base, Members)) in getParamTypeAlignment()
5157 if (isAggregateTypeForABI(Ty) && getContext().getTypeAlign(Ty) >= 128) { in getParamTypeAlignment()
5167 bool ABIInfo::isHomogeneousAggregate(QualType Ty, const Type *&Base, in isHomogeneousAggregate() argument
5169 if (const ConstantArrayType *AT = getContext().getAsConstantArrayType(Ty)) { in isHomogeneousAggregate()
5176 } else if (const RecordType *RT = Ty->getAs<RecordType>()) { in isHomogeneousAggregate()
5231 getContext().getTypeSize(Ty)) in isHomogeneousAggregate()
5235 if (const ComplexType *CT = Ty->getAs<ComplexType>()) { in isHomogeneousAggregate()
5237 Ty = CT->getElementType(); in isHomogeneousAggregate()
5241 if (!isHomogeneousAggregateBaseType(Ty)) in isHomogeneousAggregate()
5247 const Type *TyPtr = Ty.getTypePtr(); in isHomogeneousAggregate()
5269 bool PPC64_SVR4_ABIInfo::isHomogeneousAggregateBaseType(QualType Ty) const { in isHomogeneousAggregateBaseType()
5272 if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) { in isHomogeneousAggregateBaseType()
5284 if (const VectorType *VT = Ty->getAs<VectorType>()) { in isHomogeneousAggregateBaseType()
5306 PPC64_SVR4_ABIInfo::classifyArgumentType(QualType Ty) const { in classifyArgumentType()
5307 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyArgumentType()
5309 if (Ty->isAnyComplexType()) in classifyArgumentType()
5314 if (Ty->isVectorType()) { in classifyArgumentType()
5315 uint64_t Size = getContext().getTypeSize(Ty); in classifyArgumentType()
5317 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in classifyArgumentType()
5324 if (const auto *EIT = Ty->getAs<BitIntType>()) in classifyArgumentType()
5326 return getNaturalAlignIndirect(Ty, /*ByVal=*/true); in classifyArgumentType()
5328 if (isAggregateTypeForABI(Ty)) { in classifyArgumentType()
5329 if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) in classifyArgumentType()
5330 return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); in classifyArgumentType()
5332 uint64_t ABIAlign = getParamTypeAlignment(Ty).getQuantity(); in classifyArgumentType()
5333 uint64_t TyAlign = getContext().getTypeAlignInChars(Ty).getQuantity(); in classifyArgumentType()
5339 isHomogeneousAggregate(Ty, Base, Members)) { in classifyArgumentType()
5349 uint64_t Bits = getContext().getTypeSize(Ty); in classifyArgumentType()
5376 return (isPromotableTypeForABI(Ty) ? ABIArgInfo::getExtend(Ty) in classifyArgumentType()
5441 QualType Ty) const { in EmitVAArg()
5442 auto TypeInfo = getContext().getTypeInfoInChars(Ty); in EmitVAArg()
5443 TypeInfo.Align = getParamTypeAlignment(Ty); in EmitVAArg()
5453 if (const ComplexType *CTy = Ty->getAs<ComplexType>()) { in EmitVAArg()
5456 return complexTempStructure(CGF, VAListAddr, Ty, SlotSize, EltSize, CTy); in EmitVAArg()
5472 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, /*Indirect*/ false, TypeInfo, in EmitVAArg()
5519 ABIArgInfo coerceIllegalVector(QualType Ty) const;
5520 bool isHomogeneousAggregateBaseType(QualType Ty) const override;
5521 bool isHomogeneousAggregateSmallEnough(const Type *Ty,
5525 bool isIllegalVectorType(QualType Ty) const;
5537 Address EmitDarwinVAArg(Address VAListAddr, QualType Ty,
5540 Address EmitAAPCSVAArg(Address VAListAddr, QualType Ty,
5544 QualType Ty) const override { in EmitVAArg()
5545 llvm::Type *BaseTy = CGF.ConvertType(Ty); in EmitVAArg()
5550 return Kind == Win64 ? EmitMSVAArg(CGF, VAListAddr, Ty) in EmitVAArg()
5551 : isDarwinPCS() ? EmitDarwinVAArg(VAListAddr, Ty, CGF) in EmitVAArg()
5552 : EmitAAPCSVAArg(VAListAddr, Ty, CGF); in EmitVAArg()
5556 QualType Ty) const override;
5626 llvm::Type *Ty) const override { in isScalarizableAsmOperand()
5628 auto *ST = dyn_cast<llvm::StructType>(Ty); in isScalarizableAsmOperand()
5636 return TargetCodeGenInfo::isScalarizableAsmOperand(CGF, Ty); in isScalarizableAsmOperand()
5668 ABIArgInfo AArch64ABIInfo::coerceIllegalVector(QualType Ty) const { in coerceIllegalVector()
5669 assert(Ty->isVectorType() && "expected vector type!"); in coerceIllegalVector()
5671 const auto *VT = Ty->castAs<VectorType>(); in coerceIllegalVector()
5729 uint64_t Size = getContext().getTypeSize(Ty); in coerceIllegalVector()
5749 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in coerceIllegalVector()
5753 AArch64ABIInfo::classifyArgumentType(QualType Ty, bool IsVariadic, in classifyArgumentType() argument
5755 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyArgumentType()
5758 if (isIllegalVectorType(Ty)) in classifyArgumentType()
5759 return coerceIllegalVector(Ty); in classifyArgumentType()
5761 if (!isAggregateTypeForABI(Ty)) { in classifyArgumentType()
5763 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in classifyArgumentType()
5764 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
5766 if (const auto *EIT = Ty->getAs<BitIntType>()) in classifyArgumentType()
5768 return getNaturalAlignIndirect(Ty); in classifyArgumentType()
5770 return (isPromotableIntegerTypeForABI(Ty) && isDarwinPCS() in classifyArgumentType()
5771 ? ABIArgInfo::getExtend(Ty) in classifyArgumentType()
5777 if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) { in classifyArgumentType()
5778 return getNaturalAlignIndirect(Ty, /*ByVal=*/RAA == in classifyArgumentType()
5784 uint64_t Size = getContext().getTypeSize(Ty); in classifyArgumentType()
5785 bool IsEmpty = isEmptyRecord(getContext(), Ty, true); in classifyArgumentType()
5804 if (!IsWinVariadic && isHomogeneousAggregate(Ty, Base, Members)) { in classifyArgumentType()
5812 getContext().getTypeUnadjustedAlignInChars(Ty).getQuantity(); in classifyArgumentType()
5825 return coerceToIntArray(Ty, getContext(), getVMContext()); in classifyArgumentType()
5829 Alignment = getContext().getTypeUnadjustedAlign(Ty); in classifyArgumentType()
5833 std::max(getContext().getTypeAlign(Ty), in classifyArgumentType()
5846 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in classifyArgumentType()
5925 bool AArch64ABIInfo::isIllegalVectorType(QualType Ty) const { in isIllegalVectorType()
5926 if (const VectorType *VT = Ty->getAs<VectorType>()) { in isIllegalVectorType()
5964 bool AArch64ABIInfo::isHomogeneousAggregateBaseType(QualType Ty) const { in isHomogeneousAggregateBaseType()
5969 if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) { in isHomogeneousAggregateBaseType()
5972 } else if (const VectorType *VT = Ty->getAs<VectorType>()) { in isHomogeneousAggregateBaseType()
5995 Address AArch64ABIInfo::EmitAAPCSVAArg(Address VAListAddr, QualType Ty, in EmitAAPCSVAArg() argument
5997 ABIArgInfo AI = classifyArgumentType(Ty, /*IsVariadic=*/true, in EmitAAPCSVAArg()
6006 return CGF.Builder.CreateElementBitCast(Addr, CGF.ConvertTypeForMem(Ty)); in EmitAAPCSVAArg()
6011 llvm::Type *BaseTy = CGF.ConvertType(Ty); in EmitAAPCSVAArg()
6040 CharUnits TySize = getContext().getTypeSizeInChars(Ty); in EmitAAPCSVAArg()
6041 CharUnits TyAlign = getContext().getTypeUnadjustedAlignInChars(Ty); in EmitAAPCSVAArg()
6125 llvm::Type *MemTy = CGF.ConvertTypeForMem(Ty), *ElementTy = MemTy; in EmitAAPCSVAArg()
6135 bool IsHFA = isHomogeneousAggregate(Ty, Base, NumMembers); in EmitAAPCSVAArg()
6173 (IsHFA || !isAggregateTypeForABI(Ty)) && in EmitAAPCSVAArg()
6226 if (CGF.CGM.getDataLayout().isBigEndian() && !isAggregateTypeForABI(Ty) && in EmitAAPCSVAArg()
6251 Address AArch64ABIInfo::EmitDarwinVAArg(Address VAListAddr, QualType Ty, in EmitDarwinVAArg() argument
6256 if (!isAggregateTypeForABI(Ty) && !isIllegalVectorType(Ty)) in EmitDarwinVAArg()
6257 return EmitVAArgInstr(CGF, VAListAddr, Ty, ABIArgInfo::getDirect()); in EmitDarwinVAArg()
6263 if (isEmptyRecord(getContext(), Ty, true)) { in EmitDarwinVAArg()
6266 Addr = CGF.Builder.CreateElementBitCast(Addr, CGF.ConvertTypeForMem(Ty)); in EmitDarwinVAArg()
6272 auto TyInfo = getContext().getTypeInfoInChars(Ty); in EmitDarwinVAArg()
6280 IsIndirect = !isHomogeneousAggregate(Ty, Base, Members); in EmitDarwinVAArg()
6283 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, IsIndirect, in EmitDarwinVAArg()
6288 QualType Ty) const { in EmitMSVAArg()
6292 if (isAggregateTypeForABI(Ty) && getContext().getTypeSize(Ty) > 128) in EmitMSVAArg()
6295 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, IsIndirect, in EmitMSVAArg()
6296 CGF.getContext().getTypeInfoInChars(Ty), in EmitMSVAArg()
6364 ABIArgInfo classifyHomogeneousAggregate(QualType Ty, const Type *Base,
6366 ABIArgInfo coerceIllegalVector(QualType Ty) const;
6367 bool isIllegalVectorType(QualType Ty) const;
6368 bool containsAnyFP16Vectors(QualType Ty) const;
6370 bool isHomogeneousAggregateBaseType(QualType Ty) const override;
6371 bool isHomogeneousAggregateSmallEnough(const Type *Ty,
6380 QualType Ty) const override;
6585 ABIArgInfo ARMABIInfo::coerceIllegalVector(QualType Ty) const { in coerceIllegalVector()
6586 uint64_t Size = getContext().getTypeSize(Ty); in coerceIllegalVector()
6597 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in coerceIllegalVector()
6600 ABIArgInfo ARMABIInfo::classifyHomogeneousAggregate(QualType Ty, in classifyHomogeneousAggregate() argument
6607 if (!getTarget().hasLegalHalfType() && containsAnyFP16Vectors(Ty)) { in classifyHomogeneousAggregate()
6611 llvm::Type *Ty = llvm::ArrayType::get(NewVecTy, Members); in classifyHomogeneousAggregate() local
6612 return ABIArgInfo::getDirect(Ty, 0, nullptr, false); in classifyHomogeneousAggregate()
6620 Align = getContext().getTypeUnadjustedAlignInChars(Ty).getQuantity(); in classifyHomogeneousAggregate()
6627 ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, bool isVariadic, in classifyArgumentType() argument
6640 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyArgumentType()
6643 if (isIllegalVectorType(Ty)) in classifyArgumentType()
6644 return coerceIllegalVector(Ty); in classifyArgumentType()
6646 if (!isAggregateTypeForABI(Ty)) { in classifyArgumentType()
6648 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) { in classifyArgumentType()
6649 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
6652 if (const auto *EIT = Ty->getAs<BitIntType>()) in classifyArgumentType()
6654 return getNaturalAlignIndirect(Ty, /*ByVal=*/true); in classifyArgumentType()
6656 return (isPromotableIntegerTypeForABI(Ty) ? ABIArgInfo::getExtend(Ty) in classifyArgumentType()
6660 if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) { in classifyArgumentType()
6661 return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); in classifyArgumentType()
6665 if (isEmptyRecord(getContext(), Ty, true)) in classifyArgumentType()
6673 if (isHomogeneousAggregate(Ty, Base, Members)) in classifyArgumentType()
6674 return classifyHomogeneousAggregate(Ty, Base, Members); in classifyArgumentType()
6681 if (isHomogeneousAggregate(Ty, Base, Members)) { in classifyArgumentType()
6683 llvm::Type *Ty = in classifyArgumentType() local
6685 return ABIArgInfo::getDirect(Ty, 0, nullptr, false); in classifyArgumentType()
6690 getContext().getTypeSizeInChars(Ty) > CharUnits::fromQuantity(16)) { in classifyArgumentType()
6695 CharUnits::fromQuantity(getContext().getTypeAlign(Ty) / 8), false); in classifyArgumentType()
6706 TyAlign = getContext().getTypeUnadjustedAlignInChars(Ty).getQuantity(); in classifyArgumentType()
6709 TyAlign = getContext().getTypeAlignInChars(Ty).getQuantity(); in classifyArgumentType()
6711 if (getContext().getTypeSizeInChars(Ty) > CharUnits::fromQuantity(64)) { in classifyArgumentType()
6721 return coerceToIntArray(Ty, getContext(), getVMContext()); in classifyArgumentType()
6731 SizeRegs = (getContext().getTypeSize(Ty) + 31) / 32; in classifyArgumentType()
6734 SizeRegs = (getContext().getTypeSize(Ty) + 63) / 64; in classifyArgumentType()
6740 static bool isIntegerLikeType(QualType Ty, ASTContext &Context, in isIntegerLikeType() argument
6746 uint64_t Size = Context.getTypeSize(Ty); in isIntegerLikeType()
6753 if (Ty->isVectorType()) in isIntegerLikeType()
6757 if (Ty->isRealFloatingType()) in isIntegerLikeType()
6761 if (Ty->getAs<BuiltinType>() || Ty->isPointerType()) in isIntegerLikeType()
6765 if (const ComplexType *CT = Ty->getAs<ComplexType>()) in isIntegerLikeType()
6772 const RecordType *RT = Ty->getAs<RecordType>(); in isIntegerLikeType()
6933 bool ARMABIInfo::isIllegalVectorType(QualType Ty) const { in isIllegalVectorType()
6934 if (const VectorType *VT = Ty->getAs<VectorType> ()) { in isIllegalVectorType()
6972 bool ARMABIInfo::containsAnyFP16Vectors(QualType Ty) const { in containsAnyFP16Vectors()
6973 if (const ConstantArrayType *AT = getContext().getAsConstantArrayType(Ty)) { in containsAnyFP16Vectors()
6978 } else if (const RecordType *RT = Ty->getAs<RecordType>()) { in containsAnyFP16Vectors()
6995 if (const VectorType *VT = Ty->getAs<VectorType>()) in containsAnyFP16Vectors()
7016 bool ARMABIInfo::isHomogeneousAggregateBaseType(QualType Ty) const { in isHomogeneousAggregateBaseType()
7019 if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) { in isHomogeneousAggregateBaseType()
7024 } else if (const VectorType *VT = Ty->getAs<VectorType>()) { in isHomogeneousAggregateBaseType()
7057 QualType Ty) const { in EmitVAArg()
7061 if (isEmptyRecord(getContext(), Ty, true)) { in EmitVAArg()
7065 return CGF.Builder.CreateElementBitCast(Addr, CGF.ConvertTypeForMem(Ty)); in EmitVAArg()
7068 CharUnits TySize = getContext().getTypeSizeInChars(Ty); in EmitVAArg()
7069 CharUnits TyAlignForABI = getContext().getTypeUnadjustedAlignInChars(Ty); in EmitVAArg()
7075 if (TySize > CharUnits::fromQuantity(16) && isIllegalVectorType(Ty)) { in EmitVAArg()
7082 !isHomogeneousAggregate(Ty, Base, Members)) { in EmitVAArg()
7102 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, IsIndirect, TyInfo, in EmitVAArg()
7122 ABIArgInfo classifyArgumentType(QualType Ty) const;
7126 QualType Ty) const override;
7128 ABIArgInfo coerceToIntArrayWithLimit(QualType Ty, unsigned MaxSize) const;
7226 ABIArgInfo NVPTXABIInfo::coerceToIntArrayWithLimit(QualType Ty, in coerceToIntArrayWithLimit() argument
7229 const uint64_t Size = getContext().getTypeSize(Ty); in coerceToIntArrayWithLimit()
7230 const uint64_t Alignment = getContext().getTypeAlign(Ty); in coerceToIntArrayWithLimit()
7257 ABIArgInfo NVPTXABIInfo::classifyArgumentType(QualType Ty) const { in classifyArgumentType()
7259 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in classifyArgumentType()
7260 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
7263 if (isAggregateTypeForABI(Ty)) { in classifyArgumentType()
7267 if (Ty->isCUDADeviceBuiltinSurfaceType()) in classifyArgumentType()
7270 if (Ty->isCUDADeviceBuiltinTextureType()) in classifyArgumentType()
7274 return getNaturalAlignIndirect(Ty, /* byval */ true); in classifyArgumentType()
7277 if (const auto *EIT = Ty->getAs<BitIntType>()) { in classifyArgumentType()
7281 return getNaturalAlignIndirect(Ty, /* byval */ true); in classifyArgumentType()
7284 return (isPromotableIntegerTypeForABI(Ty) ? ABIArgInfo::getExtend(Ty) in classifyArgumentType()
7302 QualType Ty) const { in EmitVAArg()
7404 bool isPromotableIntegerTypeForABI(QualType Ty) const;
7405 bool isCompoundType(QualType Ty) const;
7406 bool isVectorArgumentType(QualType Ty) const;
7407 bool isFPArgumentType(QualType Ty) const;
7408 QualType GetSingleElementType(QualType Ty) const;
7415 QualType Ty) const override;
7434 bool isVectorTypeBased(const Type *Ty, bool IsParam) const;
7450 void handleExternallyVisibleObjABI(const Type *Ty, CodeGen::CodeGenModule &M, in handleExternallyVisibleObjABI() argument
7452 if (!HasVisibleVecABIFlag && isVectorTypeBased(Ty, IsParam)) { in handleExternallyVisibleObjABI()
7486 llvm::Type *Ty = V->getType(); in testFPKind() local
7487 if (Ty->isFloatTy() || Ty->isDoubleTy() || Ty->isFP128Ty()) { in testFPKind()
7491 llvm::Intrinsic::getDeclaration(&M, llvm::Intrinsic::s390_tdc, Ty); in testFPKind()
7522 bool SystemZABIInfo::isPromotableIntegerTypeForABI(QualType Ty) const { in isPromotableIntegerTypeForABI()
7524 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in isPromotableIntegerTypeForABI()
7525 Ty = EnumTy->getDecl()->getIntegerType(); in isPromotableIntegerTypeForABI()
7528 if (ABIInfo::isPromotableIntegerTypeForABI(Ty)) in isPromotableIntegerTypeForABI()
7531 if (const auto *EIT = Ty->getAs<BitIntType>()) in isPromotableIntegerTypeForABI()
7536 if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) in isPromotableIntegerTypeForABI()
7547 bool SystemZABIInfo::isCompoundType(QualType Ty) const { in isCompoundType()
7548 return (Ty->isAnyComplexType() || in isCompoundType()
7549 Ty->isVectorType() || in isCompoundType()
7550 isAggregateTypeForABI(Ty)); in isCompoundType()
7553 bool SystemZABIInfo::isVectorArgumentType(QualType Ty) const { in isVectorArgumentType()
7555 Ty->isVectorType() && in isVectorArgumentType()
7556 getContext().getTypeSize(Ty) <= 128); in isVectorArgumentType()
7559 bool SystemZABIInfo::isFPArgumentType(QualType Ty) const { in isFPArgumentType()
7563 if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) in isFPArgumentType()
7575 QualType SystemZABIInfo::GetSingleElementType(QualType Ty) const { in GetSingleElementType()
7576 const RecordType *RT = Ty->getAs<RecordType>(); in GetSingleElementType()
7593 return Ty; in GetSingleElementType()
7610 return Ty; in GetSingleElementType()
7620 return Ty; in GetSingleElementType()
7624 QualType Ty) const { in EmitVAArg()
7639 Ty = getContext().getCanonicalType(Ty); in EmitVAArg()
7640 auto TyInfo = getContext().getTypeInfoInChars(Ty); in EmitVAArg()
7641 llvm::Type *ArgTy = CGF.ConvertTypeForMem(Ty); in EmitVAArg()
7643 ABIArgInfo AI = classifyArgumentType(Ty); in EmitVAArg()
7649 SZCGI.handleExternallyVisibleObjABI(Ty.getTypePtr(), CGT.getCGM(), in EmitVAArg()
7795 ABIArgInfo SystemZABIInfo::classifyArgumentType(QualType Ty) const { in classifyArgumentType()
7797 if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) in classifyArgumentType()
7798 return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); in classifyArgumentType()
7801 if (isPromotableIntegerTypeForABI(Ty)) in classifyArgumentType()
7802 return ABIArgInfo::getExtend(Ty); in classifyArgumentType()
7807 uint64_t Size = getContext().getTypeSize(Ty); in classifyArgumentType()
7808 QualType SingleElementTy = GetSingleElementType(Ty); in classifyArgumentType()
7815 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in classifyArgumentType()
7818 if (const RecordType *RT = Ty->getAs<RecordType>()) { in classifyArgumentType()
7823 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in classifyArgumentType()
7839 if (isCompoundType(Ty)) in classifyArgumentType()
7840 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in classifyArgumentType()
7863 bool SystemZTargetCodeGenInfo::isVectorTypeBased(const Type *Ty, in isVectorTypeBased() argument
7865 if (!SeenTypes.insert(Ty).second) in isVectorTypeBased()
7874 getABIInfo().GetSingleElementType(QualType(Ty, 0)).getTypePtr(); in isVectorTypeBased()
7875 bool SingleVecEltStruct = SingleEltTy != Ty && SingleEltTy->isVectorType() && in isVectorTypeBased()
7876 Ctx.getTypeSize(SingleEltTy) == Ctx.getTypeSize(Ty); in isVectorTypeBased()
7877 if (Ty->isVectorType() || SingleVecEltStruct) in isVectorTypeBased()
7878 return Ctx.getTypeSize(Ty) / 8 <= 16; in isVectorTypeBased()
7882 while (Ty->isPointerType() || Ty->isArrayType()) in isVectorTypeBased()
7883 Ty = Ty->getPointeeOrArrayElementType(); in isVectorTypeBased()
7886 if (Ty->isVectorType() && Ctx.getTypeSize(Ty) / 8 >= 16) in isVectorTypeBased()
7889 if (const auto *RecordTy = Ty->getAs<RecordType>()) { in isVectorTypeBased()
7901 if (const auto *FT = Ty->getAs<FunctionType>()) in isVectorTypeBased()
7904 if (const FunctionProtoType *Proto = Ty->getAs<FunctionProtoType>()) in isVectorTypeBased()
7952 QualType Ty) const override { in EmitVAArg()
7953 return EmitVAArgInstr(CGF, VAListAddr, Ty, classifyArgumentType(Ty)); in EmitVAArg()
7999 llvm::Type* HandleAggregates(QualType Ty, uint64_t TySize) const;
8011 QualType Ty) const override;
8012 ABIArgInfo extendType(QualType Ty) const;
8101 llvm::Type* MipsABIInfo::HandleAggregates(QualType Ty, uint64_t TySize) const { in HandleAggregates() argument
8109 if (Ty->isComplexType()) in HandleAggregates()
8110 return CGT.ConvertType(Ty); in HandleAggregates()
8112 const RecordType *RT = Ty->getAs<RecordType>(); in HandleAggregates()
8132 const QualType Ty = i->getType(); in HandleAggregates() local
8133 const BuiltinType *BT = Ty->getAs<BuiltinType>(); in HandleAggregates()
8166 MipsABIInfo::classifyArgumentType(QualType Ty, uint64_t &Offset) const { in classifyArgumentType() argument
8167 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyArgumentType()
8170 uint64_t TySize = getContext().getTypeSize(Ty); in classifyArgumentType()
8171 uint64_t Align = getContext().getTypeAlign(Ty) / 8; in classifyArgumentType()
8178 if (isAggregateTypeForABI(Ty) || Ty->isVectorType()) { in classifyArgumentType()
8183 if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) { in classifyArgumentType()
8185 return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); in classifyArgumentType()
8192 ABIArgInfo::getDirect(HandleAggregates(Ty, TySize), 0, in classifyArgumentType()
8199 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in classifyArgumentType()
8200 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
8203 if (const auto *EIT = Ty->getAs<BitIntType>()) in classifyArgumentType()
8207 return getNaturalAlignIndirect(Ty); in classifyArgumentType()
8210 if (Ty->isIntegralOrEnumerationType()) in classifyArgumentType()
8211 return extendType(Ty); in classifyArgumentType()
8324 QualType Ty = OrigTy; in EmitVAArg() local
8331 if ((Ty->isIntegerType() && in EmitVAArg()
8332 getContext().getIntWidth(Ty) < SlotSizeInBits) || in EmitVAArg()
8333 (Ty->isPointerType() && PtrWidth < SlotSizeInBits)) { in EmitVAArg()
8335 Ty = getContext().getIntTypeForBitwidth(SlotSizeInBits, in EmitVAArg()
8336 Ty->isSignedIntegerType()); in EmitVAArg()
8339 auto TyInfo = getContext().getTypeInfoInChars(Ty); in EmitVAArg()
8349 Address Addr = emitVoidPtrVAArg(CGF, VAListAddr, Ty, /*indirect*/ false, in EmitVAArg()
8373 ABIArgInfo MipsABIInfo::extendType(QualType Ty) const { in extendType()
8374 int TySize = getContext().getTypeSize(Ty); in extendType()
8377 if (Ty->isUnsignedIntegerOrEnumerationType() && TySize == 32) in extendType()
8378 return ABIArgInfo::getSignExtend(Ty); in extendType()
8380 return ABIArgInfo::getExtend(Ty); in extendType()
8468 ABIArgInfo classifyReturnType(QualType Ty, bool &LargeRet) const { in classifyReturnType() argument
8473 if (isAggregateTypeForABI(Ty) && in classifyReturnType()
8474 getContext().getTypeSize(Ty) <= RetRegs * 8) in classifyReturnType()
8478 if (getContext().getTypeSize(Ty) > RetRegs * 8) { in classifyReturnType()
8480 return getNaturalAlignIndirect(Ty); in classifyReturnType()
8484 if (Ty->isIntegralOrEnumerationType() && getContext().getTypeSize(Ty) <= 8) in classifyReturnType()
8487 return DefaultABIInfo::classifyReturnType(Ty); in classifyReturnType()
8490 ABIArgInfo classifyArgumentType(QualType Ty, unsigned &NumRegs) const { in classifyArgumentType() argument
8491 unsigned TySize = getContext().getTypeSize(Ty); in classifyArgumentType()
8496 return ABIArgInfo::getExtend(Ty); in classifyArgumentType()
8664 QualType Ty) const override;
8666 QualType Ty) const;
8668 QualType Ty) const;
8670 QualType Ty) const;
8727 ABIArgInfo HexagonABIInfo::classifyArgumentType(QualType Ty, in classifyArgumentType() argument
8729 if (!isAggregateTypeForABI(Ty)) { in classifyArgumentType()
8731 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in classifyArgumentType()
8732 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
8734 uint64_t Size = getContext().getTypeSize(Ty); in classifyArgumentType()
8738 if (Size > 64 && Ty->isBitIntType()) in classifyArgumentType()
8739 return getNaturalAlignIndirect(Ty, /*ByVal=*/true); in classifyArgumentType()
8741 return isPromotableIntegerTypeForABI(Ty) ? ABIArgInfo::getExtend(Ty) in classifyArgumentType()
8745 if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) in classifyArgumentType()
8746 return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); in classifyArgumentType()
8749 if (isEmptyRecord(getContext(), Ty, true)) in classifyArgumentType()
8752 uint64_t Size = getContext().getTypeSize(Ty); in classifyArgumentType()
8753 unsigned Align = getContext().getTypeAlign(Ty); in classifyArgumentType()
8756 return getNaturalAlignIndirect(Ty, /*ByVal=*/true); in classifyArgumentType()
8766 return DefaultABIInfo::classifyArgumentType(Ty); in classifyArgumentType()
8817 QualType Ty) const { in EmitVAArgFromMemory()
8824 uint64_t Align = CGF.getContext().getTypeAlign(Ty) / 8; in EmitVAArgFromMemory()
8848 llvm::Type *PTy = CGF.ConvertTypeForMem(Ty); in EmitVAArgFromMemory()
8855 uint64_t Offset = llvm::alignTo(CGF.getContext().getTypeSize(Ty) / 8, 4); in EmitVAArgFromMemory()
8868 QualType Ty) const { in EmitVAArgForHexagon()
8875 uint64_t TyAlign = CGF.getContext().getTypeAlign(Ty) / 8; in EmitVAArgForHexagon()
8885 CGF.ConvertType(Ty)); in EmitVAArgForHexagon()
8887 uint64_t Offset = llvm::alignTo(CGF.getContext().getTypeSize(Ty) / 8, 4); in EmitVAArgForHexagon()
8897 QualType Ty) const { in EmitVAArgForHexagonLinux()
8898 int ArgSize = CGF.getContext().getTypeSize(Ty) / 8; in EmitVAArgForHexagonLinux()
8901 return EmitVAArgFromMemory(CGF, VAListAddr, Ty); in EmitVAArgForHexagonLinux()
8908 Ty = CGF.getContext().getCanonicalType(Ty); in EmitVAArgForHexagonLinux()
8909 (void)classifyArgumentType(Ty, &RegsLeft); in EmitVAArgForHexagonLinux()
8918 ArgSize = (CGF.getContext().getTypeSize(Ty) <= 32) ? 4 : 8; in EmitVAArgForHexagonLinux()
8919 int ArgAlign = (CGF.getContext().getTypeSize(Ty) <= 32) ? 4 : 8; in EmitVAArgForHexagonLinux()
8975 llvm::Type *PTy = CGF.ConvertType(Ty); in EmitVAArgForHexagonLinux()
9028 llvm::Type *OverflowPTy = CGF.ConvertTypeForMem(Ty); in EmitVAArgForHexagonLinux()
9038 llvm::Type *MemTy = CGF.ConvertTypeForMem(Ty); in EmitVAArgForHexagonLinux()
9048 QualType Ty) const { in EmitVAArg()
9051 return EmitVAArgForHexagonLinux(CGF, VAListAddr, Ty); in EmitVAArg()
9053 return EmitVAArgForHexagon(CGF, VAListAddr, Ty); in EmitVAArg()
9065 bool shouldUseInReg(QualType Ty, CCState &State) const;
9083 ABIArgInfo getIndirectResult(QualType Ty, bool ByVal, CCState &State) const;
9088 bool LanaiABIInfo::shouldUseInReg(QualType Ty, CCState &State) const { in shouldUseInReg() argument
9089 unsigned Size = getContext().getTypeSize(Ty); in shouldUseInReg()
9105 ABIArgInfo LanaiABIInfo::getIndirectResult(QualType Ty, bool ByVal, in getIndirectResult() argument
9110 return getNaturalAlignIndirectInReg(Ty); in getIndirectResult()
9112 return getNaturalAlignIndirect(Ty, false); in getIndirectResult()
9117 unsigned TypeAlign = getContext().getTypeAlign(Ty) / 8; in getIndirectResult()
9123 ABIArgInfo LanaiABIInfo::classifyArgumentType(QualType Ty, in classifyArgumentType() argument
9126 const RecordType *RT = Ty->getAs<RecordType>(); in classifyArgumentType()
9130 return getIndirectResult(Ty, /*ByVal=*/false, State); in classifyArgumentType()
9132 return getNaturalAlignIndirect(Ty, /*ByVal=*/true); in classifyArgumentType()
9136 if (isAggregateTypeForABI(Ty)) { in classifyArgumentType()
9139 return getIndirectResult(Ty, /*ByVal=*/true, State); in classifyArgumentType()
9142 if (isEmptyRecord(getContext(), Ty, true)) in classifyArgumentType()
9146 unsigned SizeInRegs = (getContext().getTypeSize(Ty) + 31) / 32; in classifyArgumentType()
9156 return getIndirectResult(Ty, true, State); in classifyArgumentType()
9160 if (const auto *EnumTy = Ty->getAs<EnumType>()) in classifyArgumentType()
9161 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
9163 bool InReg = shouldUseInReg(Ty, State); in classifyArgumentType()
9166 if (const auto *EIT = Ty->getAs<BitIntType>()) in classifyArgumentType()
9168 return getIndirectResult(Ty, /*ByVal=*/true, State); in classifyArgumentType()
9170 if (isPromotableIntegerTypeForABI(Ty)) { in classifyArgumentType()
9173 return ABIArgInfo::getExtend(Ty); in classifyArgumentType()
9198 unsigned numRegsForType(QualType Ty) const;
9200 bool isHomogeneousAggregateBaseType(QualType Ty) const override;
9205 llvm::Type *coerceKernelArgumentType(llvm::Type *Ty, unsigned FromAS, in coerceKernelArgumentType() argument
9208 auto *PtrTy = llvm::dyn_cast<llvm::PointerType>(Ty); in coerceKernelArgumentType()
9211 return Ty; in coerceKernelArgumentType()
9219 ABIArgInfo classifyKernelArgumentType(QualType Ty) const;
9220 ABIArgInfo classifyArgumentType(QualType Ty, unsigned &NumRegsLeft) const;
9224 QualType Ty) const override;
9227 bool AMDGPUABIInfo::isHomogeneousAggregateBaseType(QualType Ty) const { in isHomogeneousAggregateBaseType()
9240 unsigned AMDGPUABIInfo::numRegsForType(QualType Ty) const { in numRegsForType()
9243 if (const VectorType *VT = Ty->getAs<VectorType>()) { in numRegsForType()
9257 if (const RecordType *RT = Ty->getAs<RecordType>()) { in numRegsForType()
9269 return (getContext().getTypeSize(Ty) + 31) / 32; in numRegsForType()
9289 QualType Ty) const { in EmitVAArg()
9336 ABIArgInfo AMDGPUABIInfo::classifyKernelArgumentType(QualType Ty) const { in classifyKernelArgumentType()
9337 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyKernelArgumentType()
9341 if (const Type *SeltTy = isSingleElementStruct(Ty, getContext())) in classifyKernelArgumentType()
9342 Ty = QualType(SeltTy, 0); in classifyKernelArgumentType()
9344 llvm::Type *OrigLTy = CGT.ConvertType(Ty); in classifyKernelArgumentType()
9359 isAggregateTypeForABI(Ty)) { in classifyKernelArgumentType()
9361 getContext().getTypeAlignInChars(Ty), in classifyKernelArgumentType()
9372 ABIArgInfo AMDGPUABIInfo::classifyArgumentType(QualType Ty, in classifyArgumentType() argument
9376 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyArgumentType()
9378 if (isAggregateTypeForABI(Ty)) { in classifyArgumentType()
9381 if (auto RAA = getRecordArgABI(Ty, getCXXABI())) in classifyArgumentType()
9382 return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); in classifyArgumentType()
9385 if (isEmptyRecord(getContext(), Ty, true)) in classifyArgumentType()
9391 if (const Type *SeltTy = isSingleElementStruct(Ty, getContext())) in classifyArgumentType()
9394 if (const RecordType *RT = Ty->getAs<RecordType>()) { in classifyArgumentType()
9397 return DefaultABIInfo::classifyArgumentType(Ty); in classifyArgumentType()
9401 uint64_t Size = getContext().getTypeSize(Ty); in classifyArgumentType()
9418 unsigned NumRegs = numRegsForType(Ty); in classifyArgumentType()
9427 ABIArgInfo ArgInfo = DefaultABIInfo::classifyArgumentType(Ty); in classifyArgumentType()
9429 unsigned NumRegs = numRegsForType(Ty); in classifyArgumentType()
9708 SparcV8ABIInfo::classifyReturnType(QualType Ty) const { in classifyReturnType()
9709 if (Ty->isAnyComplexType()) { in classifyReturnType()
9713 return DefaultABIInfo::classifyReturnType(Ty); in classifyReturnType()
9789 QualType Ty) const override;
9839 void addFloat(uint64_t Offset, llvm::Type *Ty, unsigned Bits) { in addFloat()
9847 Elems.push_back(Ty); in addFloat()
9884 bool isUsableType(llvm::StructType *Ty) const { in isUsableType()
9885 return llvm::ArrayRef(Elems) == Ty->elements(); in isUsableType()
9900 SparcV9ABIInfo::classifyType(QualType Ty, unsigned SizeLimit) const { in classifyType() argument
9901 if (Ty->isVoidType()) in classifyType()
9904 uint64_t Size = getContext().getTypeSize(Ty); in classifyType()
9909 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in classifyType()
9912 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in classifyType()
9913 Ty = EnumTy->getDecl()->getIntegerType(); in classifyType()
9916 if (Size < 64 && Ty->isIntegerType()) in classifyType()
9917 return ABIArgInfo::getExtend(Ty); in classifyType()
9919 if (const auto *EIT = Ty->getAs<BitIntType>()) in classifyType()
9921 return ABIArgInfo::getExtend(Ty); in classifyType()
9924 if (!isAggregateTypeForABI(Ty)) in classifyType()
9929 if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) in classifyType()
9930 return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); in classifyType()
9934 llvm::StructType *StrTy = dyn_cast<llvm::StructType>(CGT.ConvertType(Ty)); in classifyType()
9952 QualType Ty) const { in EmitVAArg()
9953 ABIArgInfo AI = classifyType(Ty, 16 * 8); in EmitVAArg()
9954 llvm::Type *ArgTy = CGT.ConvertType(Ty); in EmitVAArg()
9965 auto TypeInfo = getContext().getTypeInfoInChars(Ty); in EmitVAArg()
10084 QualType Ty) const override;
10086 void updateState(const ABIArgInfo &Info, QualType Ty, CCState &State) const { in updateState() argument
10092 unsigned sz = (getContext().getTypeSize(Ty) + 31) / 32; in updateState()
10114 ABIArgInfo getIndirectByRef(QualType Ty, bool HasFreeRegs) const;
10115 ABIArgInfo getIndirectByValue(QualType Ty) const;
10116 ABIArgInfo classifyArgumentType(QualType Ty, uint8_t FreeRegs) const;
10127 ABIArgInfo ARCABIInfo::getIndirectByRef(QualType Ty, bool HasFreeRegs) const { in getIndirectByRef() argument
10128 return HasFreeRegs ? getNaturalAlignIndirectInReg(Ty) : in getIndirectByRef()
10129 getNaturalAlignIndirect(Ty, false); in getIndirectByRef()
10132 ABIArgInfo ARCABIInfo::getIndirectByValue(QualType Ty) const { in getIndirectByValue()
10135 unsigned TypeAlign = getContext().getTypeAlign(Ty) / 8; in getIndirectByValue()
10141 QualType Ty) const { in EmitVAArg()
10142 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, /*indirect*/ false, in EmitVAArg()
10143 getContext().getTypeInfoInChars(Ty), in EmitVAArg()
10147 ABIArgInfo ARCABIInfo::classifyArgumentType(QualType Ty, in classifyArgumentType() argument
10150 const RecordType *RT = Ty->getAs<RecordType>(); in classifyArgumentType()
10154 return getIndirectByRef(Ty, FreeRegs > 0); in classifyArgumentType()
10157 return getIndirectByValue(Ty); in classifyArgumentType()
10161 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in classifyArgumentType()
10162 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
10164 auto SizeInRegs = llvm::alignTo(getContext().getTypeSize(Ty), 32) / 32; in classifyArgumentType()
10166 if (isAggregateTypeForABI(Ty)) { in classifyArgumentType()
10169 return getIndirectByValue(Ty); in classifyArgumentType()
10172 if (isEmptyRecord(getContext(), Ty, true)) in classifyArgumentType()
10186 if (const auto *EIT = Ty->getAs<BitIntType>()) in classifyArgumentType()
10188 return getIndirectByValue(Ty); in classifyArgumentType()
10190 return isPromotableIntegerTypeForABI(Ty) in classifyArgumentType()
10191 ? (FreeRegs >= SizeInRegs ? ABIArgInfo::getExtendInReg(Ty) in classifyArgumentType()
10192 : ABIArgInfo::getExtend(Ty)) in classifyArgumentType()
10313 QualType Ty) const override;
10334 QualType Ty) const { in EmitVAArg()
10343 ABIArgInfo AI = classifyArgumentType(Ty); in EmitVAArg()
10344 CharUnits TypeAlign = getContext().getTypeAlignInChars(Ty); in EmitVAArg()
10345 llvm::Type *ArgTy = CGT.ConvertType(Ty); in EmitVAArg()
10543 ABIArgInfo classifyKernelArgumentType(QualType Ty) const;
10574 ABIArgInfo SPIRVABIInfo::classifyKernelArgumentType(QualType Ty) const { in classifyKernelArgumentType()
10579 llvm::Type *LTy = CGT.ConvertType(Ty); in classifyKernelArgumentType()
10594 if (isAggregateTypeForABI(Ty)) in classifyKernelArgumentType()
10595 return getNaturalAlignIndirect(Ty, /* byval */ true); in classifyKernelArgumentType()
10597 return classifyArgumentType(Ty); in classifyKernelArgumentType()
10989 bool detectFPCCEligibleStructHelper(QualType Ty, CharUnits CurOff,
11003 ABIArgInfo classifyArgumentType(QualType Ty, bool IsFixed, int &ArgGPRsLeft,
11008 QualType Ty) const override;
11010 ABIArgInfo extendType(QualType Ty) const;
11012 bool detectFPCCEligibleStruct(QualType Ty, llvm::Type *&Field1Ty,
11062 bool RISCVABIInfo::detectFPCCEligibleStructHelper(QualType Ty, CharUnits CurOff, in detectFPCCEligibleStructHelper() argument
11067 bool IsInt = Ty->isIntegralOrEnumerationType(); in detectFPCCEligibleStructHelper()
11068 bool IsFloat = Ty->isRealFloatingType(); in detectFPCCEligibleStructHelper()
11071 uint64_t Size = getContext().getTypeSize(Ty); in detectFPCCEligibleStructHelper()
11084 Field1Ty = CGT.ConvertType(Ty); in detectFPCCEligibleStructHelper()
11089 Field2Ty = CGT.ConvertType(Ty); in detectFPCCEligibleStructHelper()
11096 if (auto CTy = Ty->getAs<ComplexType>()) { in detectFPCCEligibleStructHelper()
11109 if (const ConstantArrayType *ATy = getContext().getAsConstantArrayType(Ty)) { in detectFPCCEligibleStructHelper()
11123 if (const auto *RTy = Ty->getAs<RecordType>()) { in detectFPCCEligibleStructHelper()
11126 if (getRecordArgABI(Ty, CGT.getCXXABI())) in detectFPCCEligibleStructHelper()
11128 if (isEmptyRecord(getContext(), Ty, true)) in detectFPCCEligibleStructHelper()
11186 bool RISCVABIInfo::detectFPCCEligibleStruct(QualType Ty, llvm::Type *&Field1Ty, in detectFPCCEligibleStruct() argument
11197 Ty, CharUnits::Zero(), Field1Ty, Field1Off, Field2Ty, Field2Off); in detectFPCCEligibleStruct()
11264 ABIArgInfo RISCVABIInfo::classifyArgumentType(QualType Ty, bool IsFixed, in classifyArgumentType() argument
11268 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyArgumentType()
11272 if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) { in classifyArgumentType()
11275 return getNaturalAlignIndirect(Ty, /*ByVal=*/RAA == in classifyArgumentType()
11280 if (isEmptyRecord(getContext(), Ty, true)) in classifyArgumentType()
11283 uint64_t Size = getContext().getTypeSize(Ty); in classifyArgumentType()
11286 if (IsFixed && Ty->isFloatingType() && !Ty->isComplexType() && in classifyArgumentType()
11294 if (IsFixed && Ty->isComplexType() && FLen && ArgFPRsLeft >= 2) { in classifyArgumentType()
11295 QualType EltTy = Ty->castAs<ComplexType>()->getElementType(); in classifyArgumentType()
11302 if (IsFixed && FLen && Ty->isStructureOrClassType()) { in classifyArgumentType()
11310 detectFPCCEligibleStruct(Ty, Field1Ty, Field1Off, Field2Ty, Field2Off, in classifyArgumentType()
11321 uint64_t NeededAlign = getContext().getTypeAlign(Ty); in classifyArgumentType()
11337 if (!isAggregateTypeForABI(Ty) && !Ty->isVectorType()) { in classifyArgumentType()
11339 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in classifyArgumentType()
11340 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
11343 if (Size < XLen && Ty->isIntegralOrEnumerationType()) { in classifyArgumentType()
11344 return extendType(Ty); in classifyArgumentType()
11347 if (const auto *EIT = Ty->getAs<BitIntType>()) { in classifyArgumentType()
11349 return extendType(Ty); in classifyArgumentType()
11353 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in classifyArgumentType()
11362 unsigned Alignment = getContext().getTypeAlign(Ty); in classifyArgumentType()
11377 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in classifyArgumentType()
11394 QualType Ty) const { in EmitVAArg()
11398 if (isEmptyRecord(getContext(), Ty, true)) { in EmitVAArg()
11401 Addr = CGF.Builder.CreateElementBitCast(Addr, CGF.ConvertTypeForMem(Ty)); in EmitVAArg()
11405 auto TInfo = getContext().getTypeInfoInChars(Ty); in EmitVAArg()
11410 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, IsIndirect, TInfo, in EmitVAArg()
11414 ABIArgInfo RISCVABIInfo::extendType(QualType Ty) const { in extendType()
11415 int TySize = getContext().getTypeSize(Ty); in extendType()
11417 if (XLen == 64 && Ty->isUnsignedIntegerOrEnumerationType() && TySize == 32) in extendType()
11418 return ABIArgInfo::getSignExtend(Ty); in extendType()
11419 return ABIArgInfo::getExtend(Ty); in extendType()
11467 ABIArgInfo VEABIInfo::classifyReturnType(QualType Ty) const { in classifyReturnType()
11468 if (Ty->isAnyComplexType()) in classifyReturnType()
11470 uint64_t Size = getContext().getTypeSize(Ty); in classifyReturnType()
11471 if (Size < 64 && Ty->isIntegerType()) in classifyReturnType()
11472 return ABIArgInfo::getExtend(Ty); in classifyReturnType()
11473 return DefaultABIInfo::classifyReturnType(Ty); in classifyReturnType()
11476 ABIArgInfo VEABIInfo::classifyArgumentType(QualType Ty) const { in classifyArgumentType()
11477 if (Ty->isAnyComplexType()) in classifyArgumentType()
11479 uint64_t Size = getContext().getTypeSize(Ty); in classifyArgumentType()
11480 if (Size < 64 && Ty->isIntegerType()) in classifyArgumentType()
11481 return ABIArgInfo::getExtend(Ty); in classifyArgumentType()
11482 return DefaultABIInfo::classifyArgumentType(Ty); in classifyArgumentType()
11521 ABIArgInfo classifyArgumentType(QualType Ty, int &ArgGPRsLeft,
11527 QualType Ty) const override;
11551 QualType Ty) const { in EmitVAArg()
11555 if (isEmptyRecord(getContext(), Ty, true)) { in EmitVAArg()
11558 Addr = CGF.Builder.CreateElementBitCast(Addr, CGF.ConvertTypeForMem(Ty)); in EmitVAArg()
11562 auto TInfo = getContext().getTypeInfoInChars(Ty); in EmitVAArg()
11564 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, false, TInfo, SlotSize, in EmitVAArg()
11568 ABIArgInfo CSKYABIInfo::classifyArgumentType(QualType Ty, int &ArgGPRsLeft, in classifyArgumentType() argument
11572 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyArgumentType()
11576 if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) { in classifyArgumentType()
11579 return getNaturalAlignIndirect(Ty, /*ByVal=*/RAA == in classifyArgumentType()
11584 if (isEmptyRecord(getContext(), Ty, true)) in classifyArgumentType()
11587 if (!Ty->getAsUnionType()) in classifyArgumentType()
11588 if (const Type *SeltTy = isSingleElementStruct(Ty, getContext())) in classifyArgumentType()
11591 uint64_t Size = getContext().getTypeSize(Ty); in classifyArgumentType()
11593 if (Ty->isFloatingType() && !Ty->isComplexType() && FLen >= Size && in classifyArgumentType()
11601 if (Ty->isComplexType() && FLen && !isReturnType) { in classifyArgumentType()
11602 QualType EltTy = Ty->castAs<ComplexType>()->getElementType(); in classifyArgumentType()
11609 if (!isAggregateTypeForABI(Ty)) { in classifyArgumentType()
11611 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in classifyArgumentType()
11612 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
11616 if (Size < XLen && Ty->isIntegralOrEnumerationType()) in classifyArgumentType()
11617 return ABIArgInfo::getExtend(Ty); in classifyArgumentType()
11619 if (const auto *EIT = Ty->getAs<BitIntType>()) { in classifyArgumentType()
11621 return ABIArgInfo::getExtend(Ty); in classifyArgumentType()
11641 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in classifyArgumentType()
11674 ABIArgInfo classifyArgumentType(QualType Ty) const { in classifyArgumentType()
11675 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyArgumentType()
11677 if (isAggregateTypeForABI(Ty)) { in classifyArgumentType()
11678 uint64_t Bits = getContext().getTypeSize(Ty); in classifyArgumentType()
11694 return getNaturalAlignIndirect(Ty); in classifyArgumentType()
11698 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in classifyArgumentType()
11699 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
11702 if (const auto *EIT = Ty->getAs<BitIntType>()) in classifyArgumentType()
11704 return getNaturalAlignIndirect(Ty); in classifyArgumentType()
11706 return (isPromotableIntegerTypeForABI(Ty) ? ABIArgInfo::getExtend(Ty) in classifyArgumentType()
11766 bool detectFARsEligibleStructHelper(QualType Ty, CharUnits CurOff,
11778 ABIArgInfo classifyArgumentType(QualType Ty, bool IsFixed, int &GARsLeft,
11783 QualType Ty) const override;
11785 ABIArgInfo extendType(QualType Ty) const;
11787 bool detectFARsEligibleStruct(QualType Ty, llvm::Type *&Field1Ty,
11839 QualType Ty, CharUnits CurOff, llvm::Type *&Field1Ty, CharUnits &Field1Off, in detectFARsEligibleStructHelper() argument
11841 bool IsInt = Ty->isIntegralOrEnumerationType(); in detectFARsEligibleStructHelper()
11842 bool IsFloat = Ty->isRealFloatingType(); in detectFARsEligibleStructHelper()
11845 uint64_t Size = getContext().getTypeSize(Ty); in detectFARsEligibleStructHelper()
11858 Field1Ty = CGT.ConvertType(Ty); in detectFARsEligibleStructHelper()
11863 Field2Ty = CGT.ConvertType(Ty); in detectFARsEligibleStructHelper()
11870 if (auto CTy = Ty->getAs<ComplexType>()) { in detectFARsEligibleStructHelper()
11883 if (const ConstantArrayType *ATy = getContext().getAsConstantArrayType(Ty)) { in detectFARsEligibleStructHelper()
11896 if (const auto *RTy = Ty->getAs<RecordType>()) { in detectFARsEligibleStructHelper()
11899 if (getRecordArgABI(Ty, CGT.getCXXABI())) in detectFARsEligibleStructHelper()
11901 if (isEmptyRecord(getContext(), Ty, true)) in detectFARsEligibleStructHelper()
11950 QualType Ty, llvm::Type *&Field1Ty, CharUnits &Field1Off, in detectFARsEligibleStruct() argument
11957 if (!detectFARsEligibleStructHelper(Ty, CharUnits::Zero(), Field1Ty, in detectFARsEligibleStruct()
12022 ABIArgInfo LoongArchABIInfo::classifyArgumentType(QualType Ty, bool IsFixed, in classifyArgumentType() argument
12026 Ty = useFirstFieldIfTransparentUnion(Ty); in classifyArgumentType()
12030 if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI())) { in classifyArgumentType()
12033 return getNaturalAlignIndirect(Ty, /*ByVal=*/RAA == in classifyArgumentType()
12038 if (isEmptyRecord(getContext(), Ty, true)) in classifyArgumentType()
12041 uint64_t Size = getContext().getTypeSize(Ty); in classifyArgumentType()
12044 if (IsFixed && Ty->isFloatingType() && !Ty->isComplexType() && in classifyArgumentType()
12052 if (IsFixed && Ty->isComplexType() && FRLen && FARsLeft >= 2) { in classifyArgumentType()
12053 QualType EltTy = Ty->castAs<ComplexType>()->getElementType(); in classifyArgumentType()
12060 if (IsFixed && FRLen && Ty->isStructureOrClassType()) { in classifyArgumentType()
12068 Ty, Field1Ty, Field1Off, Field2Ty, Field2Off, NeededGARs, NeededFARs); in classifyArgumentType()
12077 uint64_t NeededAlign = getContext().getTypeAlign(Ty); in classifyArgumentType()
12092 if (!isAggregateTypeForABI(Ty) && !Ty->isVectorType()) { in classifyArgumentType()
12094 if (const EnumType *EnumTy = Ty->getAs<EnumType>()) in classifyArgumentType()
12095 Ty = EnumTy->getDecl()->getIntegerType(); in classifyArgumentType()
12098 if (Size < GRLen && Ty->isIntegralOrEnumerationType()) in classifyArgumentType()
12099 return extendType(Ty); in classifyArgumentType()
12101 if (const auto *EIT = Ty->getAs<BitIntType>()) { in classifyArgumentType()
12103 return extendType(Ty); in classifyArgumentType()
12107 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in classifyArgumentType()
12123 if (getContext().getTypeAlign(Ty) == 2 * GRLen) { in classifyArgumentType()
12130 return getNaturalAlignIndirect(Ty, /*ByVal=*/false); in classifyArgumentType()
12144 QualType Ty) const { in EmitVAArg()
12148 if (isEmptyRecord(getContext(), Ty, true)) { in EmitVAArg()
12151 Addr = CGF.Builder.CreateElementBitCast(Addr, CGF.ConvertTypeForMem(Ty)); in EmitVAArg()
12155 auto TInfo = getContext().getTypeInfoInChars(Ty); in EmitVAArg()
12158 return emitVoidPtrVAArg(CGF, VAListAddr, Ty, in EmitVAArg()
12164 ABIArgInfo LoongArchABIInfo::extendType(QualType Ty) const { in extendType()
12165 int TySize = getContext().getTypeSize(Ty); in extendType()
12167 if (GRLen == 64 && Ty->isUnsignedIntegerOrEnumerationType() && TySize == 32) in extendType()
12168 return ABIArgInfo::getSignExtend(Ty); in extendType()
12169 return ABIArgInfo::getExtend(Ty); in extendType()