LLVM 24.0.0git
Types.h
Go to the documentation of this file.
1//===- ABI/Types.h ----------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// This file defines the type system for the LLVMABI library, which mirrors
11/// ABI-relevant aspects of frontend types.
12///
13//===----------------------------------------------------------------------===//
14#ifndef LLVM_ABI_TYPES_H
15#define LLVM_ABI_TYPES_H
16
17#include "llvm/ADT/APFloat.h"
18#include "llvm/ADT/ArrayRef.h"
24
25namespace llvm {
26namespace abi {
27
41
42/// Represents the ABI-specific view of a type in LLVM.
43///
44/// This abstracts platform and language-specific ABI details from the
45/// frontend, providing a consistent interface for the ABI Library.
46class Type {
47private:
48 TypeSize getTypeStoreSize() const {
49 TypeSize StoreSizeInBits = getTypeStoreSizeInBits();
50 return {StoreSizeInBits.getKnownMinValue() / 8,
51 StoreSizeInBits.isScalable()};
52 }
53 TypeSize getTypeStoreSizeInBits() const {
54 TypeSize BaseSize = getSizeInBits();
55 uint64_t AlignedSizeInBits =
56 alignToPowerOf2(BaseSize.getKnownMinValue(), 8);
57 return {AlignedSizeInBits, BaseSize.isScalable()};
58 }
59
60protected:
65
67 : Type(K, SizeInBits, ABIAlign, ABIAlign) {}
68 Type(TypeKind K, TypeSize SizeInBits, Align ABIAlign, Align UnadjustedAlign)
69 : Kind(K), SizeInBits(SizeInBits), ABIAlignment(ABIAlign),
70 UnadjustedAlignment(UnadjustedAlign) {}
71
72public:
73 TypeKind getKind() const { return Kind; }
74 TypeSize getSizeInBits() const { return SizeInBits; }
75 Align getAlignment() const { return ABIAlignment; }
76
77 /// Alignment before record-level adjustments such as aligned attributes.
78 /// Equal to getAlignment() unless a distinct unadjusted alignment was
79 /// provided when the type was created.
81
83 return alignTo(getTypeStoreSize(), getAlignment().value());
84 }
85
86 bool isVoid() const { return Kind == TypeKind::Void; }
87 bool isAtomic() const { return Kind == TypeKind::Atomic; }
88 bool isInteger() const { return Kind == TypeKind::Integer; }
89 bool isFloat() const { return Kind == TypeKind::Float; }
90 bool isPointer() const { return Kind == TypeKind::Pointer; }
91 bool isArray() const { return Kind == TypeKind::Array; }
92 bool isVector() const { return Kind == TypeKind::Vector; }
93 bool isTuple() const { return Kind == TypeKind::Tuple; }
94 bool isRecord() const { return Kind == TypeKind::Record; }
95 bool isMemberPointer() const { return Kind == TypeKind::MemberPointer; }
96 bool isComplex() const { return Kind == TypeKind::Complex; }
97 bool isZeroSize() const { return getSizeInBits().isZero(); }
98
99 LLVM_ABI bool isSVESizelessType() const;
100};
101
102class VoidType : public Type {
103public:
104 VoidType() : Type(TypeKind::Void, TypeSize::getFixed(0), Align(1)) {}
105
106 static bool classof(const Type *T) { return T->getKind() == TypeKind::Void; }
107};
108
109class AtomicType : public Type {
110public:
111 AtomicType(const Type *ValueType, uint64_t SizeInBits, Align Alignment)
112 : Type(TypeKind::Atomic, TypeSize::getFixed(SizeInBits), Alignment),
113 ValueType(ValueType) {}
114
115 const Type *getValueType() const { return ValueType; }
116
117 static bool classof(const Type *T) {
118 return T->getKind() == TypeKind::Atomic;
119 }
120
121private:
122 const Type *ValueType;
123};
124
125class ComplexType : public Type {
126public:
127 ComplexType(const Type *ElementType, uint64_t SizeInBits, Align Alignment)
128 : Type(TypeKind::Complex, TypeSize::getFixed(SizeInBits), Alignment),
129 ElementType(ElementType) {}
130
131 const Type *getElementType() const { return ElementType; }
132
133 static bool classof(const Type *T) {
134 return T->getKind() == TypeKind::Complex;
135 }
136
137private:
138 const Type *ElementType;
139};
140
141class IntegerType : public Type {
142private:
143 bool IsSigned;
144 bool IsBitInt;
145
146public:
147 IntegerType(uint64_t BitWidth, Align ABIAlign, bool IsSigned,
148 bool IsBitInt = false)
149 : Type(TypeKind::Integer, TypeSize::getFixed(BitWidth), ABIAlign),
150 IsSigned(IsSigned), IsBitInt(IsBitInt) {}
151
152 bool isSigned() const { return IsSigned; }
153 bool isBitInt() const { return IsBitInt; }
154 bool isBool() const {
155 return getSizeInBits().getFixedValue() == 1 && !IsBitInt;
156 }
157
158 static bool classof(const Type *T) {
159 return T->getKind() == TypeKind::Integer;
160 }
161};
162
163class FloatType : public Type {
164private:
165 const fltSemantics *Semantics;
166
167public:
168 FloatType(const fltSemantics &FloatSemantics, Align ABIAlign)
170 TypeSize::getFixed(APFloat::getSizeInBits(FloatSemantics)),
171 ABIAlign),
172 Semantics(&FloatSemantics) {}
173
174 const fltSemantics *getSemantics() const { return Semantics; }
175 static bool classof(const Type *T) { return T->getKind() == TypeKind::Float; }
176};
177
178class PointerLikeType : public Type {
179protected:
180 unsigned AddrSpace;
182 : Type(K, SizeInBits, ABIAlign), AddrSpace(AS) {}
183
184public:
185 unsigned getAddrSpace() const { return AddrSpace; }
186 bool isMemberPointer() const { return getKind() == TypeKind::MemberPointer; }
187
188 static bool classof(const Type *T) {
189 return T->getKind() == TypeKind::Pointer ||
190 T->getKind() == TypeKind::MemberPointer;
191 }
192};
193
195public:
196 PointerType(uint64_t Size, Align ABIAlign, unsigned AddressSpace = 0)
197 : PointerLikeType(TypeKind::Pointer, TypeSize::getFixed(Size), ABIAlign,
198 AddressSpace) {}
199
200 static bool classof(const Type *T) {
201 return T->getKind() == TypeKind::Pointer;
202 }
203};
204
206private:
207 bool IsFunctionPointer;
208
209public:
210 MemberPointerType(bool IsFunctionPointer, uint64_t SizeInBits, Align ABIAlign,
211 unsigned AddressSpace = 0)
213 ABIAlign, AddressSpace),
214 IsFunctionPointer(IsFunctionPointer) {}
215 bool isFunctionPointer() const { return IsFunctionPointer; }
216
217 static bool classof(const Type *T) {
218 return T->getKind() == TypeKind::MemberPointer;
219 }
220};
221
222class ArrayType : public Type {
223private:
224 const Type *ElementType;
225 uint64_t NumElements;
226 bool IsMatrix;
227
228public:
229 ArrayType(const Type *ElementType, uint64_t NumElements, uint64_t SizeInBits,
230 bool IsMatrixType = false)
231 : Type(TypeKind::Array, TypeSize::getFixed(SizeInBits),
232 ElementType->getAlignment()),
233 ElementType(ElementType), NumElements(NumElements),
234 IsMatrix(IsMatrixType) {}
235
236 const Type *getElementType() const { return ElementType; }
237 uint64_t getNumElements() const { return NumElements; }
238 bool isMatrixType() const { return IsMatrix; }
239
240 static bool classof(const Type *T) { return T->getKind() == TypeKind::Array; }
241};
242
243/// Distinguishes the vector flavors that ABIs have to treat differently.
244/// Scalability is not part of the kind. It is tracked by the vector's
245/// ElementCount, because some flavors have both a scalable and a
246/// fixed-length spelling.
247enum class VectorKind {
248 /// A plain vector, such as a Neon vector or a GCC vector_size vector.
250
251 /// An AArch64 SVE data vector, such as svint32_t. Data vectors are
252 /// passed in Z registers. Tuples of these vectors use TupleType.
254
255 /// An AArch64 SVE predicate vector, such as svbool_t. These are passed
256 /// in P registers. Sizeless predicates have one-bit elements; the
257 /// fixed-length arm_sve_vector_bits form keeps unsigned char (i8)
258 /// elements, matching the Clang AST. Both use this kind. Tuples of
259 /// these vectors use TupleType.
261
262 /// The AArch64 __SVCount_t type. It is opaque rather than a real vector,
263 /// but it occupies a predicate register, so it is given the same shape as
264 /// svbool_t.
266};
267
268class VectorType : public Type {
269private:
270 const Type *ElementType;
271 ElementCount NumElements;
272 VectorKind VecKind;
273
274 static TypeSize computeSizeInBits(const Type *ElementType,
275 ElementCount NumElements) {
276 return TypeSize(ElementType->getSizeInBits().getFixedValue() *
277 NumElements.getKnownMinValue(),
278 NumElements.isScalable());
279 }
280
281public:
282 VectorType(const Type *ElementType, ElementCount NumElements, Align ABIAlign,
284 : Type(TypeKind::Vector, computeSizeInBits(ElementType, NumElements),
285 ABIAlign),
286 ElementType(ElementType), NumElements(NumElements), VecKind(VecKind) {}
287
288 const Type *getElementType() const { return ElementType; }
289 ElementCount getNumElements() const { return NumElements; }
290
291 VectorKind getVectorKind() const { return VecKind; }
292
293 bool isScalable() const { return NumElements.isScalable(); }
294 bool isFixedLength() const { return !NumElements.isScalable(); }
295
296 bool isSVEData() const { return VecKind == VectorKind::SVEData; }
297 bool isSVEPredicate() const { return VecKind == VectorKind::SVEPredicate; }
298 bool isSVECount() const { return VecKind == VectorKind::SVECount; }
299
300 /// Returns true for any of the AArch64 SVE flavors.
301 bool isSVEType() const { return VecKind != VectorKind::Generic; }
302
303 static bool classof(const Type *T) {
304 return T->getKind() == TypeKind::Vector;
305 }
306};
307
308/// A homogeneous tuple of 2, 3, or 4 identical vectors, such as the
309/// AArch64 SVE types svint32x3_t and svboolx2_t.
310///
311/// The contained vector describes one register-shaped member. Size and
312/// alignment of the tuple cover the whole group: size is NumVectors times
313/// the vector size, and alignment matches the contained vector.
314class TupleType : public Type {
315private:
316 const VectorType *Vec;
317 unsigned NumVectors;
318
319public:
320 TupleType(const VectorType *Vec, unsigned NumVectors)
321 : Type(TypeKind::Tuple, (Vec->getSizeInBits() * NumVectors),
322 Vec->getAlignment()),
323 Vec(Vec), NumVectors(NumVectors) {}
324
325 const VectorType *getVectorType() const { return Vec; }
326 unsigned getNumVectors() const { return NumVectors; }
327
328 static bool classof(const Type *T) { return T->getKind() == TypeKind::Tuple; }
329};
330
349
351
352enum RecordFlags : unsigned {
353 None = 0,
355 IsUnion = 1 << 1,
357 IsCXXRecord = 1 << 3,
361};
362
363class RecordType : public Type {
364private:
365 ArrayRef<FieldInfo> Fields;
366 ArrayRef<FieldInfo> BaseClasses;
367 ArrayRef<FieldInfo> VirtualBaseClasses;
368 StructPacking Packing;
369 RecordFlags Flags;
370
371public:
373 ArrayRef<FieldInfo> VBases, TypeSize Size, Align ABIAlign,
374 Align UnadjustedAlign, StructPacking Pack = StructPacking::Default,
376 : Type(TypeKind::Record, Size, ABIAlign, UnadjustedAlign),
377 Fields(StructFields), BaseClasses(Bases), VirtualBaseClasses(VBases),
378 Packing(Pack), Flags(RecFlags) {}
379 uint32_t getNumFields() const { return Fields.size(); }
380 StructPacking getPacking() const { return Packing; }
381
382 bool isUnion() const {
383 return static_cast<unsigned>(Flags & RecordFlags::IsUnion) != 0;
384 }
385 bool isCXXRecord() const {
386 return static_cast<unsigned>(Flags & RecordFlags::IsCXXRecord) != 0;
387 }
388 bool isPolymorphic() const {
389 return static_cast<unsigned>(Flags & RecordFlags::IsPolymorphic) != 0;
390 }
391 bool canPassInRegisters() const {
392 return static_cast<unsigned>(Flags & RecordFlags::CanPassInRegisters) != 0;
393 }
395 return static_cast<unsigned>(Flags & RecordFlags::HasFlexibleArrayMember) !=
396 0;
397 }
398 uint32_t getNumBaseClasses() const { return BaseClasses.size(); }
400 return VirtualBaseClasses.size();
401 }
402 bool isTransparentUnion() const {
403 return static_cast<unsigned>(Flags & RecordFlags::IsTransparent) != 0;
404 }
405 ArrayRef<FieldInfo> getFields() const { return Fields; }
406 ArrayRef<FieldInfo> getBaseClasses() const { return BaseClasses; }
408 return VirtualBaseClasses;
409 }
410
411 LLVM_ABI bool isEmpty() const;
412
413 /// Returns the field, base, or virtual base whose extent contains
414 /// \p OffsetInBits, or nullptr if no such element exists. Empty bases and
415 /// unnamed bitfields are skipped.
416 LLVM_ABI const FieldInfo *
417 getElementContainingOffset(unsigned OffsetInBits) const;
418
419 static bool classof(const Type *T) {
420 return T->getKind() == TypeKind::Record;
421 }
422};
423
424/// TypeBuilder manages the lifecycle of ABI types using bump pointer
425/// allocation. Types created by a TypeBuilder are valid for the lifetime of the
426/// allocator.
427///
428/// Example usage:
429/// \code
430/// BumpPtrAllocator Alloc;
431/// TypeBuilder Builder(Alloc);
432/// const auto *IntTy = Builder.getIntegerType(32, Align(4), true);
433/// \endcode
435private:
436 BumpPtrAllocator &Allocator;
437
438public:
439 explicit TypeBuilder(BumpPtrAllocator &Alloc) : Allocator(Alloc) {}
440
442 return new (Allocator.Allocate<VoidType>()) VoidType();
443 }
444
445 const AtomicType *getAtomicType(const Type *ValueType, uint64_t SizeInBits,
446 Align Align) {
447 return new (Allocator.Allocate<AtomicType>())
448 AtomicType(ValueType, SizeInBits, Align);
449 }
450
452 bool IsBitInt = false) {
453 return new (Allocator.Allocate<IntegerType>())
454 IntegerType(BitWidth, Align, Signed, IsBitInt);
455 }
456
457 const FloatType *getFloatType(const fltSemantics &Semantics, Align Align) {
458 return new (Allocator.Allocate<FloatType>()) FloatType(Semantics, Align);
459 }
460
462 unsigned Addrspace = 0) {
463 return new (Allocator.Allocate<PointerType>())
464 PointerType(Size, Align, Addrspace);
465 }
466
467 const ArrayType *getArrayType(const Type *ElementType, uint64_t NumElements,
468 uint64_t SizeInBits,
469 bool IsMatrixType = false) {
470 return new (Allocator.Allocate<ArrayType>())
471 ArrayType(ElementType, NumElements, SizeInBits, IsMatrixType);
472 }
473
474 const VectorType *getVectorType(const Type *ElementType,
475 ElementCount NumElements, Align Align,
477 return new (Allocator.Allocate<VectorType>())
478 VectorType(ElementType, NumElements, Align, VecKind);
479 }
480
481 /// Creates a homogeneous tuple of \p NumVectors copies of \p Vec.
482 /// \p NumVectors must be 2, 3, or 4.
483 const TupleType *getTupleType(const VectorType *Vec, unsigned NumVectors) {
484 assert(NumVectors >= 2 && NumVectors <= 4 &&
485 "tuple types hold 2, 3, or 4 vectors");
486 return new (Allocator.Allocate<TupleType>()) TupleType(Vec, NumVectors);
487 }
488
489 /// Creates the AArch64 __SVCount_t type. The type is opaque, so it is
490 /// modeled with the shape of svbool_t: a scalable vector of 16 one-bit
491 /// elements.
493 const Type *PredicateBit =
494 getIntegerType(1, Align(1), /*Signed=*/false, /*IsBitInt=*/false);
495 return getVectorType(PredicateBit, ElementCount::getScalable(16), ABIAlign,
497 }
498
500 Align ABIAlign, Align UnadjustedAlign,
502 ArrayRef<FieldInfo> BaseClasses = {},
503 ArrayRef<FieldInfo> VirtualBaseClasses = {},
504 RecordFlags RecFlags = RecordFlags::None) {
505 FieldInfo *FieldArray = Allocator.Allocate<FieldInfo>(Fields.size());
506 std::copy(Fields.begin(), Fields.end(), FieldArray);
507
508 FieldInfo *BaseArray = nullptr;
509 if (!BaseClasses.empty()) {
510 BaseArray = Allocator.Allocate<FieldInfo>(BaseClasses.size());
511 std::copy(BaseClasses.begin(), BaseClasses.end(), BaseArray);
512 }
513
514 FieldInfo *VBaseArray = nullptr;
515 if (!VirtualBaseClasses.empty()) {
516 VBaseArray = Allocator.Allocate<FieldInfo>(VirtualBaseClasses.size());
517 std::copy(VirtualBaseClasses.begin(), VirtualBaseClasses.end(),
518 VBaseArray);
519 }
520
521 ArrayRef<FieldInfo> FieldsRef(FieldArray, Fields.size());
522 ArrayRef<FieldInfo> BasesRef(BaseArray, BaseClasses.size());
523 ArrayRef<FieldInfo> VBasesRef(VBaseArray, VirtualBaseClasses.size());
524
525 return new (Allocator.Allocate<RecordType>())
526 RecordType(FieldsRef, BasesRef, VBasesRef, Size, ABIAlign,
527 UnadjustedAlign, Pack, RecFlags);
528 }
529
531 Align ABIAlign, Align UnadjustedAlign,
533 RecordFlags RecFlags = RecordFlags::None) {
534 FieldInfo *FieldArray = Allocator.Allocate<FieldInfo>(Fields.size());
535
536 for (size_t I = 0, E = Fields.size(); I != E; ++I) {
537 FieldInfo Field = Fields[I];
538 Field.OffsetInBits = 0;
539 new (&FieldArray[I]) FieldInfo(Field);
540 }
541
542 ArrayRef<FieldInfo> FieldsRef(FieldArray, Fields.size());
543
544 return new (Allocator.Allocate<RecordType>()) RecordType(
545 FieldsRef, ArrayRef<FieldInfo>(), ArrayRef<FieldInfo>(), Size, ABIAlign,
546 UnadjustedAlign, Pack, RecFlags | RecordFlags::IsUnion);
547 }
548
549 const ComplexType *getComplexType(const Type *ElementType, Align Align) {
550 // Complex types have two elements (real and imaginary parts)
551 uint64_t ElementSizeInBits = ElementType->getSizeInBits().getFixedValue();
552 uint64_t ComplexSizeInBits = ElementSizeInBits * 2;
553
554 return new (Allocator.Allocate<ComplexType>())
555 ComplexType(ElementType, ComplexSizeInBits, Align);
556 }
557
558 const MemberPointerType *getMemberPointerType(bool IsFunctionPointer,
559 uint64_t SizeInBits,
560 Align Align) {
561 return new (Allocator.Allocate<MemberPointerType>())
562 MemberPointerType(IsFunctionPointer, SizeInBits, Align);
563 }
564};
565
566} // namespace abi
567} // namespace llvm
568
569#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
unsigned uint64_t
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")
#define LLVM_ABI
Definition Compiler.h:215
#define I(x, y, z)
Definition MD5.cpp:57
#define T
OptimizedStructLayoutField Field
Basic Register Allocator
FunctionLoweringInfo::StatepointRelocationRecord RecordType
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
iterator end() const
Definition ArrayRef.h:130
size_t size() const
Get the array size.
Definition ArrayRef.h:141
iterator begin() const
Definition ArrayRef.h:129
bool empty() const
Check if the array is empty.
Definition ArrayRef.h:136
static constexpr ElementCount getScalable(ScalarTy MinVal)
Definition TypeSize.h:308
const Type * getElementType() const
Definition Types.h:236
bool isMatrixType() const
Definition Types.h:238
static bool classof(const Type *T)
Definition Types.h:240
ArrayType(const Type *ElementType, uint64_t NumElements, uint64_t SizeInBits, bool IsMatrixType=false)
Definition Types.h:229
uint64_t getNumElements() const
Definition Types.h:237
const Type * getValueType() const
Definition Types.h:115
AtomicType(const Type *ValueType, uint64_t SizeInBits, Align Alignment)
Definition Types.h:111
static bool classof(const Type *T)
Definition Types.h:117
ComplexType(const Type *ElementType, uint64_t SizeInBits, Align Alignment)
Definition Types.h:127
const Type * getElementType() const
Definition Types.h:131
static bool classof(const Type *T)
Definition Types.h:133
FloatType(const fltSemantics &FloatSemantics, Align ABIAlign)
Definition Types.h:168
const fltSemantics * getSemantics() const
Definition Types.h:174
static bool classof(const Type *T)
Definition Types.h:175
static bool classof(const Type *T)
Definition Types.h:158
bool isBitInt() const
Definition Types.h:153
IntegerType(uint64_t BitWidth, Align ABIAlign, bool IsSigned, bool IsBitInt=false)
Definition Types.h:147
bool isBool() const
Definition Types.h:154
bool isSigned() const
Definition Types.h:152
bool isFunctionPointer() const
Definition Types.h:215
static bool classof(const Type *T)
Definition Types.h:217
MemberPointerType(bool IsFunctionPointer, uint64_t SizeInBits, Align ABIAlign, unsigned AddressSpace=0)
Definition Types.h:210
PointerLikeType(TypeKind K, TypeSize SizeInBits, Align ABIAlign, unsigned AS)
Definition Types.h:181
static bool classof(const Type *T)
Definition Types.h:188
bool isMemberPointer() const
Definition Types.h:186
unsigned getAddrSpace() const
Definition Types.h:185
PointerType(uint64_t Size, Align ABIAlign, unsigned AddressSpace=0)
Definition Types.h:196
static bool classof(const Type *T)
Definition Types.h:200
bool isPolymorphic() const
Definition Types.h:388
bool isUnion() const
Definition Types.h:382
bool canPassInRegisters() const
Definition Types.h:391
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...
Definition Types.cpp:54
ArrayRef< FieldInfo > getBaseClasses() const
Definition Types.h:406
uint32_t getNumBaseClasses() const
Definition Types.h:398
ArrayRef< FieldInfo > getFields() const
Definition Types.h:405
uint32_t getNumVirtualBaseClasses() const
Definition Types.h:399
bool hasFlexibleArrayMember() const
Definition Types.h:394
bool isCXXRecord() const
Definition Types.h:385
bool isTransparentUnion() const
Definition Types.h:402
static bool classof(const Type *T)
Definition Types.h:419
LLVM_ABI bool isEmpty() const
Definition Types.cpp:28
uint32_t getNumFields() const
Definition Types.h:379
ArrayRef< FieldInfo > getVirtualBaseClasses() const
Definition Types.h:407
StructPacking getPacking() const
Definition Types.h:380
RecordType(ArrayRef< FieldInfo > StructFields, ArrayRef< FieldInfo > Bases, ArrayRef< FieldInfo > VBases, TypeSize Size, Align ABIAlign, Align UnadjustedAlign, StructPacking Pack=StructPacking::Default, RecordFlags RecFlags=RecordFlags::None)
Definition Types.h:372
A homogeneous tuple of 2, 3, or 4 identical vectors, such as the AArch64 SVE types svint32x3_t and sv...
Definition Types.h:314
const VectorType * getVectorType() const
Definition Types.h:325
unsigned getNumVectors() const
Definition Types.h:326
TupleType(const VectorType *Vec, unsigned NumVectors)
Definition Types.h:320
static bool classof(const Type *T)
Definition Types.h:328
const ComplexType * getComplexType(const Type *ElementType, Align Align)
Definition Types.h:549
const FloatType * getFloatType(const fltSemantics &Semantics, Align Align)
Definition Types.h:457
const IntegerType * getIntegerType(uint64_t BitWidth, Align Align, bool Signed, bool IsBitInt=false)
Definition Types.h:451
const AtomicType * getAtomicType(const Type *ValueType, uint64_t SizeInBits, Align Align)
Definition Types.h:445
const VectorType * getSVECountType(Align ABIAlign)
Creates the AArch64 __SVCount_t type.
Definition Types.h:492
const RecordType * getUnionType(ArrayRef< FieldInfo > Fields, TypeSize Size, Align ABIAlign, Align UnadjustedAlign, StructPacking Pack=StructPacking::Default, RecordFlags RecFlags=RecordFlags::None)
Definition Types.h:530
const MemberPointerType * getMemberPointerType(bool IsFunctionPointer, uint64_t SizeInBits, Align Align)
Definition Types.h:558
TypeBuilder(BumpPtrAllocator &Alloc)
Definition Types.h:439
const TupleType * getTupleType(const VectorType *Vec, unsigned NumVectors)
Creates a homogeneous tuple of NumVectors copies of Vec.
Definition Types.h:483
const VectorType * getVectorType(const Type *ElementType, ElementCount NumElements, Align Align, VectorKind VecKind=VectorKind::Generic)
Definition Types.h:474
const ArrayType * getArrayType(const Type *ElementType, uint64_t NumElements, uint64_t SizeInBits, bool IsMatrixType=false)
Definition Types.h:467
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)
Definition Types.h:499
const PointerType * getPointerType(uint64_t Size, Align Align, unsigned Addrspace=0)
Definition Types.h:461
const VoidType * getVoidType()
Definition Types.h:441
Represents the ABI-specific view of a type in LLVM.
Definition Types.h:46
TypeSize getTypeAllocSize() const
Definition Types.h:82
Align ABIAlignment
Definition Types.h:63
bool isMemberPointer() const
Definition Types.h:95
bool isVoid() const
Definition Types.h:86
Type(TypeKind K, TypeSize SizeInBits, Align ABIAlign, Align UnadjustedAlign)
Definition Types.h:68
LLVM_ABI bool isSVESizelessType() const
Definition Types.cpp:15
bool isAtomic() const
Definition Types.h:87
TypeSize SizeInBits
Definition Types.h:62
TypeSize getSizeInBits() const
Definition Types.h:74
bool isInteger() const
Definition Types.h:88
Type(TypeKind K, TypeSize SizeInBits, Align ABIAlign)
Definition Types.h:66
bool isTuple() const
Definition Types.h:93
TypeKind Kind
Definition Types.h:61
bool isRecord() const
Definition Types.h:94
bool isArray() const
Definition Types.h:91
bool isZeroSize() const
Definition Types.h:97
bool isVector() const
Definition Types.h:92
bool isFloat() const
Definition Types.h:89
Align getAlignment() const
Definition Types.h:75
Align UnadjustedAlignment
Definition Types.h:64
Align getUnadjustedAlignment() const
Alignment before record-level adjustments such as aligned attributes.
Definition Types.h:80
bool isComplex() const
Definition Types.h:96
TypeKind getKind() const
Definition Types.h:73
bool isPointer() const
Definition Types.h:90
ElementCount getNumElements() const
Definition Types.h:289
const Type * getElementType() const
Definition Types.h:288
VectorKind getVectorKind() const
Definition Types.h:291
static bool classof(const Type *T)
Definition Types.h:303
VectorType(const Type *ElementType, ElementCount NumElements, Align ABIAlign, VectorKind VecKind=VectorKind::Generic)
Definition Types.h:282
bool isSVEType() const
Returns true for any of the AArch64 SVE flavors.
Definition Types.h:301
bool isFixedLength() const
Definition Types.h:294
bool isSVECount() const
Definition Types.h:298
bool isScalable() const
Definition Types.h:293
bool isSVEData() const
Definition Types.h:296
bool isSVEPredicate() const
Definition Types.h:297
static bool classof(const Type *T)
Definition Types.h:106
constexpr ScalarTy getFixedValue() const
Definition TypeSize.h:200
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
Definition TypeSize.h:168
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
Definition TypeSize.h:165
constexpr bool isZero() const
Definition TypeSize.h:153
RecordFlags
Definition Types.h:352
@ IsPolymorphic
Definition Types.h:358
@ IsCXXRecord
Definition Types.h:357
@ CanPassInRegisters
Definition Types.h:354
@ IsTransparent
Definition Types.h:356
@ LLVM_MARK_AS_BITMASK_ENUM
Definition Types.h:360
@ IsUnion
Definition Types.h:355
@ HasFlexibleArrayMember
Definition Types.h:359
VectorKind
Distinguishes the vector flavors that ABIs have to treat differently.
Definition Types.h:247
@ SVEPredicate
An AArch64 SVE predicate vector, such as svbool_t.
Definition Types.h:260
@ SVEData
An AArch64 SVE data vector, such as svint32_t.
Definition Types.h:253
@ Generic
A plain vector, such as a Neon vector or a GCC vector_size vector.
Definition Types.h:249
@ SVECount
The AArch64 __SVCount_t type.
Definition Types.h:265
StructPacking
Definition Types.h:350
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.
Definition MathExtras.h:488
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition Alignment.h:144
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.
Definition Allocator.h:390
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
FieldInfo(const Type *FieldType, uint64_t OffsetInBits=0, bool IsBitField=false, uint64_t BitFieldWidth=0, bool IsUnnamedBitField=false, bool HasNoUniqueAddress=false)
Definition Types.h:339
bool HasNoUniqueAddress
Definition Types.h:337
const Type * FieldType
Definition Types.h:332
uint64_t BitFieldWidth
Definition Types.h:334
LLVM_ABI bool isEmpty() const
Definition Types.cpp:83
uint64_t OffsetInBits
Definition Types.h:333