14#ifndef LLVM_ABI_TYPES_H
15#define LLVM_ABI_TYPES_H
50 TypeSize StoreSizeInBits = getTypeStoreSizeInBits();
54 TypeSize getTypeStoreSizeInBits()
const {
58 return {AlignedSizeInBits, BaseSize.
isScalable()};
136 ValueType(ValueType) {}
152 ElementType(ElementType) {}
161 const Type *ElementType;
171 bool IsBitInt =
false)
173 IsSigned(IsSigned), IsBitInt(IsBitInt) {}
195 Semantics(&FloatSemantics) {}
218 bool HasAddressSpaceQualifier;
222 bool HasAddressSpaceQualifier =
false)
225 HasAddressSpaceQualifier(HasAddressSpaceQualifier) {
227 "an unqualified pointer is in address space 0");
239 bool IsFunctionPointer;
246 IsFunctionPointer(IsFunctionPointer) {}
256 const Type *ElementType;
262 bool IsMatrixType =
false)
265 ElementType(ElementType), NumElements(NumElements),
266 IsMatrix(IsMatrixType) {}
302 const Type *ElementType;
306 static TypeSize computeSizeInBits(
const Type *ElementType,
308 return TypeSize(ElementType->getSizeInBits().getFixedValue() *
309 NumElements.getKnownMinValue(),
310 NumElements.isScalable());
318 ElementType(ElementType), NumElements(NumElements), VecKind(VecKind) {}
360 Vec(Vec), NumVectors(NumVectors) {}
414 Fields(StructFields), BaseClasses(Bases), VirtualBaseClasses(VBases),
415 Packing(Pack), Flags(RecFlags) {}
437 return VirtualBaseClasses.size();
445 return VirtualBaseClasses;
489 bool IsBitInt =
false) {
499 unsigned Addrspace = 0,
500 bool HasAddressSpaceQualifier =
false) {
507 bool IsMatrixType =
false) {
508 return new (Allocator.Allocate<
ArrayType>())
509 ArrayType(ElementType, NumElements, SizeInBits, IsMatrixType);
522 assert(NumVectors >= 2 && NumVectors <= 4 &&
523 "tuple types hold 2, 3, or 4 vectors");
533 "expected predicate or count vector kind");
534 const Type *PredicateBit =
546 FieldInfo *FieldArray =
Allocator.Allocate<FieldInfo>(Fields.
size());
547 std::copy(Fields.
begin(), Fields.
end(), FieldArray);
549 FieldInfo *BaseArray =
nullptr;
550 if (!BaseClasses.empty()) {
551 BaseArray =
Allocator.Allocate<FieldInfo>(BaseClasses.size());
552 std::copy(BaseClasses.begin(), BaseClasses.end(), BaseArray);
555 FieldInfo *VBaseArray =
nullptr;
556 if (!VirtualBaseClasses.
empty()) {
557 VBaseArray =
Allocator.Allocate<FieldInfo>(VirtualBaseClasses.
size());
558 std::copy(VirtualBaseClasses.
begin(), VirtualBaseClasses.
end(),
568 UnadjustedAlign, Pack, RecFlags);
577 for (
size_t I = 0,
E = Fields.
size();
I !=
E; ++
I) {
579 Field.OffsetInBits = 0;
592 uint64_t ElementSizeInBits = ElementType->getSizeInBits().getFixedValue();
593 uint64_t ComplexSizeInBits = ElementSizeInBits * 2;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This file defines the BumpPtrAllocator interface.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
OptimizedStructLayoutField Field
FunctionLoweringInfo::StatepointRelocationRecord RecordType
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
bool empty() const
Check if the array is empty.
static constexpr ElementCount getScalable(ScalarTy MinVal)
const Type * getElementType() const
bool isMatrixType() const
static bool classof(const Type *T)
ArrayType(const Type *ElementType, uint64_t NumElements, uint64_t SizeInBits, bool IsMatrixType=false)
uint64_t getNumElements() const
const Type * getValueType() const
AtomicType(const Type *ValueType, uint64_t SizeInBits, Align Alignment)
static bool classof(const Type *T)
ComplexType(const Type *ElementType, uint64_t SizeInBits, Align Alignment)
const Type * getElementType() const
static bool classof(const Type *T)
FloatType(const fltSemantics &FloatSemantics, Align ABIAlign)
const fltSemantics * getSemantics() const
static bool classof(const Type *T)
static bool classof(const Type *T)
IntegerType(uint64_t BitWidth, Align ABIAlign, bool IsSigned, bool IsBitInt=false)
bool isFunctionPointer() const
static bool classof(const Type *T)
MemberPointerType(bool IsFunctionPointer, uint64_t SizeInBits, Align ABIAlign, unsigned AddressSpace=0)
PointerLikeType(TypeKind K, TypeSize SizeInBits, Align ABIAlign, unsigned AS)
static bool classof(const Type *T)
bool isMemberPointer() const
unsigned getAddrSpace() const
bool hasAddressSpaceQualifier() const
static bool classof(const Type *T)
PointerType(uint64_t Size, Align ABIAlign, unsigned AddressSpace=0, bool HasAddressSpaceQualifier=false)
bool isPolymorphic() const
bool canPassInRegisters() const
LLVM_ABI const FieldInfo * getElementContainingOffset(unsigned OffsetInBits) const
Returns the field, base, or virtual base whose extent contains OffsetInBits, or nullptr if no such el...
ArrayRef< FieldInfo > getBaseClasses() const
uint32_t getNumBaseClasses() const
ArrayRef< FieldInfo > getFields() const
uint32_t getNumVirtualBaseClasses() const
bool hasFlexibleArrayMember() const
bool isTransparentUnion() const
static bool classof(const Type *T)
LLVM_ABI bool isEmpty() const
uint32_t getNumFields() const
ArrayRef< FieldInfo > getVirtualBaseClasses() const
StructPacking getPacking() const
RecordType(ArrayRef< FieldInfo > StructFields, ArrayRef< FieldInfo > Bases, ArrayRef< FieldInfo > VBases, TypeSize Size, Align ABIAlign, Align UnadjustedAlign, StructPacking Pack=StructPacking::Default, RecordFlags RecFlags=RecordFlags::None)
A homogeneous tuple of 2, 3, or 4 identical vectors, such as the AArch64 SVE types svint32x3_t and sv...
const VectorType * getVectorType() const
unsigned getNumVectors() const
TupleType(const VectorType *Vec, unsigned NumVectors)
static bool classof(const Type *T)
const ComplexType * getComplexType(const Type *ElementType, Align Align)
const FloatType * getFloatType(const fltSemantics &Semantics, Align Align)
const PointerType * getPointerType(uint64_t Size, Align Align, unsigned Addrspace=0, bool HasAddressSpaceQualifier=false)
const IntegerType * getIntegerType(uint64_t BitWidth, Align Align, bool Signed, bool IsBitInt=false)
const VectorType * getScalablePredicateOrCountVectorType(Align ABIAlign, VectorKind Kind)
Creates a scalable predicate or count vector.
const AtomicType * getAtomicType(const Type *ValueType, uint64_t SizeInBits, Align Align)
const RecordType * getUnionType(ArrayRef< FieldInfo > Fields, TypeSize Size, Align ABIAlign, Align UnadjustedAlign, StructPacking Pack=StructPacking::Default, RecordFlags RecFlags=RecordFlags::None)
const MemberPointerType * getMemberPointerType(bool IsFunctionPointer, uint64_t SizeInBits, Align Align)
TypeBuilder(BumpPtrAllocator &Alloc)
const TupleType * getTupleType(const VectorType *Vec, unsigned NumVectors)
Creates a homogeneous tuple of NumVectors copies of Vec.
const VectorType * getVectorType(const Type *ElementType, ElementCount NumElements, Align Align, VectorKind VecKind=VectorKind::Generic)
const ArrayType * getArrayType(const Type *ElementType, uint64_t NumElements, uint64_t SizeInBits, bool IsMatrixType=false)
const RecordType * getRecordType(ArrayRef< FieldInfo > Fields, TypeSize Size, Align ABIAlign, Align UnadjustedAlign, StructPacking Pack=StructPacking::Default, ArrayRef< FieldInfo > BaseClasses={}, ArrayRef< FieldInfo > VirtualBaseClasses={}, RecordFlags RecFlags=RecordFlags::None)
const VoidType * getVoidType()
Represents the ABI-specific view of a type in LLVM.
TypeSize getTypeAllocSize() const
bool isMemberPointer() const
Type(TypeKind K, TypeSize SizeInBits, Align ABIAlign, Align UnadjustedAlign)
LLVM_ABI bool isSVESizelessType() const
LLVM_ABI bool isEmptyRecord() const
True if this type is a record that is empty for ABI purposes.
TypeSize getSizeInBits() const
Type(TypeKind K, TypeSize SizeInBits, Align ABIAlign)
LLVM_ABI uint64_t getABISizeInBits() const
Returns the size in bits that the source language gives this type, including any padding.
Align getAlignment() const
Align UnadjustedAlignment
Align getUnadjustedAlignment() const
Alignment before record-level adjustments such as aligned attributes.
uint64_t getFixedSizeInBitsOrZero() const
Returns the size in bits if it is fixed, otherwise 0.
ElementCount getNumElements() const
bool isFixedLengthSVEData() const
const Type * getElementType() const
VectorKind getVectorKind() const
static bool classof(const Type *T)
VectorType(const Type *ElementType, ElementCount NumElements, Align ABIAlign, VectorKind VecKind=VectorKind::Generic)
bool isSVEType() const
Returns true for any of the AArch64 SVE flavors.
bool isFixedLength() const
bool isSVEPredicate() const
bool isFixedLengthSVEPredicate() const
static bool classof(const Type *T)
constexpr ScalarTy getFixedValue() const
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
constexpr bool isZero() const
@ LLVM_MARK_AS_BITMASK_ENUM
VectorKind
Distinguishes the vector flavors that ABIs have to treat differently.
@ SVEPredicate
An AArch64 SVE predicate vector, such as svbool_t.
@ SVEData
An AArch64 SVE data vector, such as svint32_t.
@ Generic
A plain vector, such as a Neon vector or a GCC vector_size vector.
@ SVECount
The AArch64 __SVCount_t type.
This is an optimization pass for GlobalISel generic memory operations.
constexpr T alignToPowerOf2(U Value, V Align)
Will overflow only if result is not representable in T.
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
ArrayRef(const T &OneElt) -> ArrayRef< T >
constexpr unsigned BitWidth
PointerUnion< const Value *, const PseudoSourceValue * > ValueType
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
This struct is a compact representation of a valid (non-zero power of two) alignment.
FieldInfo(const Type *FieldType, uint64_t OffsetInBits=0, bool IsBitField=false, uint64_t BitFieldWidth=0, bool IsUnnamedBitField=false, bool HasNoUniqueAddress=false)
LLVM_ABI bool isEmpty() const