28 return Opts.CompatInfo;
37 unsigned NSRN = 0, NPRN = 0;
39 const bool IsNamedArg =
42 I.Info = classifyArgumentType(
I.ABIType, FI.
isVariadic(), IsNamedArg,
50 ArgInfo classifyReturnType(
const Type *RetTy,
bool IsVariadicFn)
const;
51 ArgInfo classifyArgumentType(
const Type *Ty,
bool IsVariadicFn,
52 bool IsNamedArg,
unsigned CallingConvention,
53 unsigned &NSRN,
unsigned &NPRN)
const;
57 bool passAsAggregateType(
const Type *Ty)
const;
59 bool isHomogeneousAggregateBaseType(
const Type *Ty)
const override;
60 bool isHomogeneousAggregateSmallEnough(
const Type *
Base,
63 bool isPermittedToBeHomogeneousAggregate(
const RecordType *RT)
const override;
66std::unique_ptr<TargetInfo>
68 return std::make_unique<AArch64TargetInfo>(TB, Opts);
74 <<
" is not yet implemented for AArch64 in the LLVM ABI library.\n";
77ArgInfo AArch64TargetInfo::classifyReturnType(
const Type *RetTy,
78 bool IsVariadicFn)
const {
82 if (RetTy->isVector()) {
87 if (!passAsAggregateType(RetTy)) {
89 if (IntTy->isBitInt())
90 if (RetTy->getSizeInBits().getFixedValue() > 128)
106 !(Opts.IsILP32 && IsVariadicFn)) {
111 reportNYI(
"Aggregate return type handling");
115ArgInfo AArch64TargetInfo::classifyArgumentType(
116 const Type *Ty,
bool IsVariadicFn,
bool IsNamedArg,
117 unsigned CallingConvention,
unsigned &NSRN,
unsigned &NPRN)
const {
120 if (Ty->isVector()) {
121 reportNYI(
"Vector argument type handling");
125 if (!passAsAggregateType(Ty)) {
127 if (IntTy->isBitInt())
128 if (Ty->getSizeInBits().getFixedValue() > 128)
138 NSRN = std::min(NSRN + 1, 8u);
151 TypeSize TySize = Ty->getSizeInBits();
152 uint64_t Size = TySize.isFixed() ? TySize.getFixedValue() : 0;
154 if (!Ty->isSVESizelessType() && ((RT && RT->isEmpty()) ||
Size == 0)) {
155 reportNYI(
"Empty record argument handling");
164 bool IsWinVariadic = IsWin64 && IsVariadicFn;
168 NSRN = std::min(NSRN + Members,
uint64_t(8));
169 uint64_t BaseAllocSizeInBits =
Base->getTypeAllocSize().getFixedValue() * 8;
170 const Type *CoerceTy =
171 TB.getArrayType(
Base, Members, Members * BaseAllocSizeInBits);
177 unsigned TyAlign = Ty->getUnadjustedAlignment().value();
178 TyAlign = (TyAlign >= 16) ? 16 : 8;
182 reportNYI(
"Aggregate argument type handling");
186bool AArch64TargetInfo::passAsAggregateType(
const Type *Ty)
const {
191bool AArch64TargetInfo::isHomogeneousAggregateBaseType(
const Type *Ty)
const {
202 if (VT->isScalable() || VT->isSVEData() || VT->isSVEPredicate())
209 bit_ceil(std::max<uint64_t>(8, VT->getSizeInBits().getFixedValue()));
210 if (VecSize == 64 || VecSize == 128)
216bool AArch64TargetInfo::isHomogeneousAggregateSmallEnough(
228bool AArch64TargetInfo::isPermittedToBeHomogeneousAggregate(
230 if (Opts.IsMicrosoftCXXABI && RT->isCXXRecord()) {
233 reportNYI(
"MicrosoftCXXABI homogeneous record classification");
FunctionLoweringInfo::StatepointRelocationRecord RecordType
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Target-specific ABI information and factory functions.
Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI raw_ostream & warning()
Convenience method for printing "warning: " to stderr.
AArch64TargetInfo(TypeBuilder &TB, const AArch64ABIOptions &Opts)
void computeInfo(FunctionInfo &FI) const override
Populate FI with the target's ABI-lowering decisions for each argument and return value.
const ABICompatInfo & getABICompatInfo() const override
Return this target's ABI compatibility flags.
Helper class to encapsulate information about how a specific type should be passed to or returned fro...
static ArgInfo getIgnore()
static ArgInfo getExtend(const Type *T)
static ArgInfo getDirect(const Type *T=nullptr, unsigned Offset=0, MaybeAlign Align=std::nullopt, bool CanBeFlattened=true)
ArrayRef< ArgEntry > arguments() const
unsigned getNumRequiredArgs() const
CallingConv::ID getCallingConvention() const
ArgInfo & getReturnInfo()
const Type * getReturnType() const
LLVM_ABI ArgInfo getNaturalAlignIndirect(const Type *Ty, bool ByVal=true) const
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...
TargetInfo(TypeBuilder &Builder)
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 RecordArgABI getRecordArgABI(const RecordType *RT) const
TypeBuilder manages the lifecycle of ABI types using bump pointer allocation.
Represents the ABI-specific view of a type in LLVM.
This file defines the type system for the LLVMABI library, which mirrors ABI-relevant aspects of fron...
@ Win64
The C convention as implemented on Windows/x86-64 and AArch64.
static void reportNYI(StringRef Feature)
@ RAA_DirectInMemory
Pass it on the stack using its defined layout.
LLVM_ABI std::unique_ptr< TargetInfo > createAArch64TargetInfo(TypeBuilder &TB, const AArch64ABIOptions &Opts)
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
T bit_ceil(T Value)
Returns the smallest integral power of two no smaller than Value if Value is nonzero.
Helper struct shared between Function Specialization and SCCP Solver.
Target / language flags that affect AArch64 ABI classification.
Flags controlling ABI compatibility behaviour that applies to every target.