23 if (Ty->isInteger() || Ty->isFloat() || Ty->isPointer() || Ty->isVector())
30 if (AT->isMatrixType())
40 unsigned BitWidth =
IT->getSizeInBits().getFixedValue();
66 if (RT->isUnion() && RT->isTransparentUnion()) {
67 auto Fields = RT->getFields();
68 assert(!Fields.empty() &&
"transparent union cannot be empty");
69 return Fields.front().FieldType;
80 if (RT->hasFlexibleArrayMember())
83 const Type *Found =
nullptr;
85 for (
const auto &
Base : RT->getBaseClasses()) {
89 if (!BaseRT || BaseRT->isEmpty())
98 for (
const auto &FI : RT->getFields()) {
102 const Type *FTy = FI.FieldType;
106 if (AT->getNumElements() != 1)
108 FTy = AT->getElementType();
138 if (!RT->canPassInRegisters()) {
153 uint64_t &Members)
const {
156 if (!isMatrixHA && AT->isMatrixType())
158 uint64_t NElements = AT->getNumElements();
163 Members *= NElements;
165 if (RT->hasFlexibleArrayMember())
171 if (RT->isCXXRecord()) {
175 for (
const FieldInfo &BaseField : RT->getBaseClasses()) {
176 if (BaseField.FieldType->isEmptyRecord())
179 uint64_t FldMembers = 0;
183 Members += FldMembers;
187 for (
const FieldInfo &FD : RT->getFields()) {
189 const Type *FT = FD.FieldType;
193 if (AT->isMatrixType())
195 if (AT->getNumElements() == 0)
197 FT = AT->getElementType();
203 FD.IsBitField && FD.BitFieldWidth == 0)
206 uint64_t FldMembers = 0;
211 RT->isUnion() ? std::max(Members, FldMembers) : Members + FldMembers;
218 if (
Base->getTypeAllocSize() * Members != Ty->getTypeAllocSize())
225 ElemTy = CT->getElementType();
239 assert(VT->isFixedLength() &&
240 "scalable vectors are never homogeneous aggregates");
242 VT->getElementType()->getSizeInBits().getFixedValue();
243 unsigned NumElements =
244 VT->getTypeAllocSize().getFixedValue() * 8 / EltSize;
245 if (NumElements != VT->getNumElements().getKnownMinValue())
246 Base =
TB.getVectorType(VT->getElementType(),
253 Base->getTypeAllocSize() !=
ElemTy->getTypeAllocSize())
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static cl::opt< ITMode > IT(cl::desc("IT block support"), cl::Hidden, cl::init(DefaultIT), cl::values(clEnumValN(DefaultIT, "arm-default-it", "Generate any type of IT block"), clEnumValN(RestrictedIT, "arm-restrict-it", "Disallow complex IT blocks")))
Target-specific ABI information and factory functions.
static constexpr ElementCount getFixed(ScalarTy MinVal)
Helper class to encapsulate information about how a specific type should be passed to or returned fro...
static ArgInfo getIndirect(Align Align, bool ByVal, unsigned AddrSpace=0, bool Realign=false)
Realign: the caller couldn't guarantee sufficient alignment - the callee must copy the argument to a ...
ArgInfo & getReturnInfo()
const Type * getReturnType() const
bool canPassInRegisters() const
LLVM_ABI const Type * isSingleElementStruct(const Type *Ty) const
Returns the scalar a single-element struct reduces to, else null.
virtual bool isPermittedToBeHomogeneousAggregate(const RecordType *RT) const
Return true if the C++ ABI permits RT to be a homogeneous aggregate.
virtual const ABICompatInfo & getABICompatInfo() const =0
Return this target's ABI compatibility flags.
virtual bool isHomogeneousAggregateSmallEnough(const Type *Base, uint64_t Members) const
Return true if a homogeneous aggregate with Members copies of Base is small enough to be passed in re...
LLVM_ABI bool isHomogeneousAggregate(const Type *Ty, const Type *&Base, uint64_t &Members) const
Return true if Ty is an ELFv2-style homogeneous aggregate.
LLVM_ABI bool isPromotableInteger(const IntegerType *IT) const
virtual bool isZeroLengthBitfieldPermittedInHomogeneousAggregate() const
Return true if zero-length bitfields should be ignored when deciding whether an aggregate is homogene...
virtual bool isHomogeneousAggregateBaseType(const Type *Ty) const
Return true if Ty is a valid base type for a homogeneous aggregate.
LLVM_ABI bool maybeCommonClassifyReturnType(FunctionInfo &FI) const
Apply rules for classifying return types that are common to all targets.
LLVM_ABI bool isAggregateTypeForABI(const Type *Ty) const
LLVM_ABI const Type * useFirstFieldIfTransparentUnion(const Type *Ty) const
If Ty is a transparent union, return its first field type; otherwise return Ty unchanged.
LLVM_ABI ArgInfo getNaturalAlignIndirect(const Type *Ty, unsigned AddrSpace, bool ByVal=true) const
LLVM_ABI RecordArgABI getRecordArgABI(const RecordType *RT) const
Represents the ABI-specific view of a type in LLVM.
LLVM_ABI bool isEmptyRecord() const
True if this type is a record that is empty for ABI purposes.
TypeSize getSizeInBits() const
@ RAA_Indirect
Pass it as a pointer to temporary memory.
@ RAA_Default
Pass it using the normal C aggregate rules for the ABI, potentially introducing extra copies and pass...
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
constexpr unsigned BitWidth
bool IsMatrixHA
Whether a matrix type may be the base type of a homogeneous aggregate.