14#ifndef LLVM_ABI_TYPES_H
15#define LLVM_ABI_TYPES_H
51 TypeSize StoreSizeInBits = getTypeStoreSizeInBits();
55 TypeSize getTypeStoreSizeInBits()
const {
59 return {AlignedSizeInBits, BaseSize.
isScalable()};
138 ValueType(ValueType) {}
154 ElementType(ElementType) {}
163 const Type *ElementType;
173 bool IsBitInt =
false)
175 IsSigned(IsSigned), IsBitInt(IsBitInt) {}
197 Semantics(&FloatSemantics) {}
234 bool HasAddressSpaceQualifier;
238 bool HasAddressSpaceQualifier =
false)
241 HasAddressSpaceQualifier(HasAddressSpaceQualifier) {
243 "an unqualified pointer is in address space 0");
255 bool IsFunctionPointer;
262 IsFunctionPointer(IsFunctionPointer) {}
272 const Type *ElementType;
278 bool IsMatrixType =
false)
281 ElementType(ElementType), NumElements(NumElements),
282 IsMatrix(IsMatrixType) {}
318 const Type *ElementType;
322 static TypeSize computeSizeInBits(
const Type *ElementType,
324 return TypeSize(ElementType->getSizeInBits().getFixedValue() *
325 NumElements.getKnownMinValue(),
326 NumElements.isScalable());
334 ElementType(ElementType), NumElements(NumElements), VecKind(VecKind) {
335 assert(!ElementType->isOpaqueFloat8() &&
336 "opaque 8-bit float is not a valid vector element type");
379 Vec(Vec), NumVectors(NumVectors) {}
433 Fields(StructFields), BaseClasses(Bases), VirtualBaseClasses(VBases),
434 Packing(Pack), Flags(RecFlags) {}
456 return VirtualBaseClasses.size();
464 return VirtualBaseClasses;
508 bool IsBitInt =
false) {
522 unsigned Addrspace = 0,
523 bool HasAddressSpaceQualifier =
false) {
530 bool IsMatrixType =
false) {
531 return new (Allocator.Allocate<
ArrayType>())
532 ArrayType(ElementType, NumElements, SizeInBits, IsMatrixType);
545 assert(NumVectors >= 2 && NumVectors <= 4 &&
546 "tuple types hold 2, 3, or 4 vectors");
556 "expected predicate or count vector kind");
557 const Type *PredicateBit =
569 FieldInfo *FieldArray =
Allocator.Allocate<FieldInfo>(Fields.
size());
570 std::copy(Fields.
begin(), Fields.
end(), FieldArray);
572 FieldInfo *BaseArray =
nullptr;
573 if (!BaseClasses.empty()) {
574 BaseArray =
Allocator.Allocate<FieldInfo>(BaseClasses.size());
575 std::copy(BaseClasses.begin(), BaseClasses.end(), BaseArray);
578 FieldInfo *VBaseArray =
nullptr;
579 if (!VirtualBaseClasses.
empty()) {
580 VBaseArray =
Allocator.Allocate<FieldInfo>(VirtualBaseClasses.
size());
581 std::copy(VirtualBaseClasses.
begin(), VirtualBaseClasses.
end(),
591 UnadjustedAlign, Pack, RecFlags);
600 for (
size_t I = 0,
E = Fields.
size();
I !=
E; ++
I) {
602 Field.OffsetInBits = 0;
615 uint64_t ElementSizeInBits = ElementType->getSizeInBits().getFixedValue();
616 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)
An 8-bit floating-point format with no numeric semantics.
static bool classof(const Type *T)
OpaqueFloat8Type(Align ABIAlign)
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 OpaqueFloat8Type * getOpaqueFloat8Type(Align Align)
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
bool isOpaqueFloat8() 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