|
LLVM 24.0.0git
|
#include "llvm/ABI/TargetInfo.h"
Public Member Functions | |
| TargetInfo (TypeBuilder &Builder) | |
| virtual | ~TargetInfo ()=default |
| virtual void | computeInfo (FunctionInfo &FI) const =0 |
| Populate FI with the target's ABI-lowering decisions for each argument and return value. | |
| virtual bool | isPassByRef (const Type *Ty) const |
| virtual const ABICompatInfo & | getABICompatInfo () const =0 |
| Return this target's ABI compatibility flags. | |
| virtual unsigned | getAllocaAddrSpace () const |
| Address space in which indirect arguments are allocated (the target's alloca/stack space). | |
| virtual bool | hasInt128Type () const |
| Whether the target has a 128-bit integer type. Default true. | |
| virtual unsigned | getLongLongWidth () const |
| Width of long long in bits. Default 64. | |
| virtual llvm::Align | getMaxIntegerAlign () const |
| Alignment of the widest integer the target's data layout gives an alignment to. | |
Protected Member Functions | |
| LLVM_ABI RecordArgABI | getRecordArgABI (const RecordType *RT) const |
| LLVM_ABI RecordArgABI | getRecordArgABI (const Type *Ty) const |
| LLVM_ABI bool | isPromotableInteger (const IntegerType *IT) const |
| unsigned | getBitIntRegThreshold () const |
| Bit width above which a _BitInt cannot stay in registers. | |
| LLVM_ABI ArgInfo | getNaturalAlignIndirect (const Type *Ty, unsigned AddrSpace, bool ByVal=true) const |
| LLVM_ABI const Type * | getI8Array (uint64_t NumBytes) const |
An array of NumBytes i8 elements, the padding element of a coerce-and-expand type. | |
| LLVM_ABI const Type * | convertTypeForMem (const Type *Ty) const |
In-memory form of Ty. | |
| LLVM_ABI const Type * | getStructOfTypes (ArrayRef< const Type * > Elems, bool Packed) const |
A record with one field per element of Elems, each at offset 0. | |
| 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 const Type * | isSingleElementStruct (const Type *Ty) const |
| Returns the scalar a single-element struct reduces to, else null. | |
| LLVM_ABI bool | maybeCommonClassifyReturnType (FunctionInfo &FI) const |
| Apply rules for classifying return types that are common to all targets. | |
| virtual bool | isHomogeneousAggregateBaseType (const Type *Ty) const |
Return true if Ty is a valid base type for a homogeneous aggregate. | |
| 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 registers for this ABI. | |
| virtual bool | isZeroLengthBitfieldPermittedInHomogeneousAggregate () const |
| Return true if zero-length bitfields should be ignored when deciding whether an aggregate is homogeneous. | |
| virtual bool | isPermittedToBeHomogeneousAggregate (const RecordType *RT) const |
Return true if the C++ ABI permits RT to be a homogeneous aggregate. | |
| LLVM_ABI bool | isHomogeneousAggregate (const Type *Ty, const Type *&Base, uint64_t &Members) const |
Return true if Ty is an ELFv2-style homogeneous aggregate. | |
Protected Attributes | |
| TypeBuilder & | TB |
Definition at line 65 of file TargetInfo.h.
|
inlineexplicit |
Definition at line 70 of file TargetInfo.h.
References TB.
Referenced by llvm::abi::AArch64TargetInfo::AArch64TargetInfo(), llvm::abi::BPFTargetInfo::BPFTargetInfo(), and llvm::abi::X86_64TargetInfo::X86_64TargetInfo().
|
virtualdefault |
|
pure virtual |
Populate FI with the target's ABI-lowering decisions for each argument and return value.
Implemented in llvm::abi::AArch64TargetInfo, llvm::abi::AMDGPUTargetInfo, llvm::abi::BPFTargetInfo, and llvm::abi::DefaultTargetInfo.
In-memory form of Ty.
A record becomes one field list: non-empty bases and fields in offset order. Padding is an array of i8. The result is packed when a member offset or the record size is not a multiple of the converted member alignment, and then every gap is an explicit array. Any other record has an array only where that alignment does not already produce the gap, and for the tail that alignment is capped at getMaxIntegerAlign(). A record with a virtual base has no layout here. An array is rebuilt when its element type changes. Any other type is returned unchanged.
Definition at line 102 of file TargetInfo.cpp.
References A(), llvm::alignTo(), assert(), B(), llvm::sampleprof::Base, convertTypeForMem(), llvm::abi::Default, llvm::dyn_cast(), llvm::SmallVectorImpl< T >::emplace_back(), getConvertedAlign(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::getFixedValue(), getI8Array(), getMaxIntegerAlign(), llvm::abi::Type::getSizeInBits(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::isScalable(), llvm::Offset, llvm::abi::Packed, llvm::SmallVectorTemplateBase< T, bool >::push_back(), Size, llvm::stable_sort(), TB, and llvm::Align::value().
Referenced by convertTypeForMem().
|
pure virtual |
Return this target's ABI compatibility flags.
Targets with extra flags store a derived object and return that as an ABICompatInfo reference.
Implemented in llvm::abi::AArch64TargetInfo, llvm::abi::AMDGPUTargetInfo, llvm::abi::BPFTargetInfo, and llvm::abi::X86_64TargetInfo.
Referenced by isHomogeneousAggregate().
|
inlinevirtual |
Address space in which indirect arguments are allocated (the target's alloca/stack space).
Reimplemented in llvm::abi::AMDGPUTargetInfo.
Definition at line 85 of file TargetInfo.h.
Referenced by llvm::abi::DefaultTargetInfo::classifyArgumentType(), and llvm::abi::DefaultTargetInfo::classifyReturnType().
|
inlineprotected |
Bit width above which a _BitInt cannot stay in registers.
Definition at line 104 of file TargetInfo.h.
References getLongLongWidth(), and hasInt128Type().
Referenced by llvm::abi::DefaultTargetInfo::classifyArgumentType(), and llvm::abi::DefaultTargetInfo::classifyReturnType().
An array of NumBytes i8 elements, the padding element of a coerce-and-expand type.
Definition at line 53 of file TargetInfo.cpp.
Referenced by convertTypeForMem().
|
inlinevirtual |
Width of long long in bits. Default 64.
Definition at line 91 of file TargetInfo.h.
Referenced by getBitIntRegThreshold().
|
inlinevirtual |
Alignment of the widest integer the target's data layout gives an alignment to.
An integer wider than that one is aligned to this. Default 16, the alignment of i128 on AArch64 and x86-64.
Definition at line 96 of file TargetInfo.h.
Referenced by convertTypeForMem().
|
protected |
Definition at line 48 of file TargetInfo.cpp.
References llvm::abi::ArgInfo::getIndirect().
Referenced by llvm::abi::DefaultTargetInfo::classifyArgumentType(), and llvm::abi::DefaultTargetInfo::classifyReturnType().
|
protected |
Definition at line 199 of file TargetInfo.cpp.
References llvm::abi::RecordType::canPassInRegisters(), llvm::abi::RAA_Default, and llvm::abi::RAA_Indirect.
Referenced by llvm::abi::DefaultTargetInfo::classifyArgumentType(), and getRecordArgABI().
|
protected |
Definition at line 205 of file TargetInfo.cpp.
References llvm::dyn_cast(), getRecordArgABI(), and llvm::abi::RAA_Default.
|
protected |
A record with one field per element of Elems, each at offset 0.
Packed selects a packed record, which has no alignment padding between fields.
Definition at line 59 of file TargetInfo.cpp.
References assert(), llvm::abi::Default, llvm::SmallVectorImpl< T >::emplace_back(), llvm::ArrayRef< T >::empty(), llvm::TypeSize::getFixed(), llvm::abi::Packed, llvm::SmallVectorImpl< T >::reserve(), llvm::ArrayRef< T >::size(), and TB.
|
inlinevirtual |
Whether the target has a 128-bit integer type. Default true.
Definition at line 88 of file TargetInfo.h.
Referenced by getBitIntRegThreshold().
Definition at line 20 of file TargetInfo.cpp.
References llvm::dyn_cast(), and isAggregateTypeForABI().
Referenced by llvm::abi::DefaultTargetInfo::classifyArgumentType(), llvm::abi::DefaultTargetInfo::classifyReturnType(), isAggregateTypeForABI(), and isSingleElementStruct().
|
protected |
Return true if Ty is an ELFv2-style homogeneous aggregate.
Base is set to the base element type and Members to the number of base elements.
Definition at line 302 of file TargetInfo.cpp.
References assert(), llvm::sampleprof::Base, llvm::dyn_cast(), getABICompatInfo(), llvm::ElementCount::getFixed(), llvm::abi::Type::isEmptyRecord(), isHomogeneousAggregate(), isHomogeneousAggregateBaseType(), isHomogeneousAggregateSmallEnough(), llvm::abi::ABICompatInfo::IsMatrixHA, isPermittedToBeHomogeneousAggregate(), isZeroLengthBitfieldPermittedInHomogeneousAggregate(), and TB.
Referenced by isHomogeneousAggregate().
|
inlineprotectedvirtual |
Return true if Ty is a valid base type for a homogeneous aggregate.
Definition at line 144 of file TargetInfo.h.
Referenced by isHomogeneousAggregate().
|
inlineprotectedvirtual |
Return true if a homogeneous aggregate with Members copies of Base is small enough to be passed in registers for this ABI.
Definition at line 150 of file TargetInfo.h.
References llvm::sampleprof::Base, and uint64_t.
Referenced by isHomogeneousAggregate().
Definition at line 77 of file TargetInfo.h.
|
inlineprotectedvirtual |
Return true if the C++ ABI permits RT to be a homogeneous aggregate.
Definition at line 162 of file TargetInfo.h.
Referenced by isHomogeneousAggregate().
|
protected |
Definition at line 41 of file TargetInfo.cpp.
References llvm::BitWidth, and IT.
Referenced by llvm::abi::DefaultTargetInfo::classifyArgumentType(), and llvm::abi::DefaultTargetInfo::classifyReturnType().
Returns the scalar a single-element struct reduces to, else null.
Definition at line 225 of file TargetInfo.cpp.
References llvm::sampleprof::Base, llvm::dyn_cast(), llvm::abi::Type::getABISizeInBits(), isAggregateTypeForABI(), and isSingleElementStruct().
Referenced by isSingleElementStruct().
|
inlineprotectedvirtual |
Return true if zero-length bitfields should be ignored when deciding whether an aggregate is homogeneous.
Definition at line 157 of file TargetInfo.h.
Referenced by isHomogeneousAggregate().
|
protected |
Apply rules for classifying return types that are common to all targets.
Definition at line 282 of file TargetInfo.cpp.
References llvm::dyn_cast(), llvm::abi::ArgInfo::getIndirect(), llvm::abi::FunctionInfo::getReturnInfo(), and llvm::abi::FunctionInfo::getReturnType().
Referenced by llvm::abi::AArch64TargetInfo::computeInfo(), llvm::abi::AMDGPUTargetInfo::computeInfo(), and llvm::abi::DefaultTargetInfo::computeInfo().
If Ty is a transparent union, return its first field type; otherwise return Ty unchanged.
Definition at line 214 of file TargetInfo.cpp.
References assert(), and llvm::dyn_cast().
Referenced by llvm::abi::DefaultTargetInfo::classifyArgumentType().
|
protected |
Definition at line 67 of file TargetInfo.h.
Referenced by llvm::abi::AArch64TargetInfo::AArch64TargetInfo(), convertTypeForMem(), getI8Array(), getStructOfTypes(), isHomogeneousAggregate(), and TargetInfo().