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:
64
67
68public:
69 TypeKind getKind() const { return Kind; }
70 TypeSize getSizeInBits() const { return SizeInBits; }
71 Align getAlignment() const { return ABIAlignment; }
72
74 return alignTo(getTypeStoreSize(), getAlignment().value());
75 }
76
77 bool isVoid() const { return Kind == TypeKind::Void; }
78 bool isAtomic() const { return Kind == TypeKind::Atomic; }
79 bool isInteger() const { return Kind == TypeKind::Integer; }
80 bool isFloat() const { return Kind == TypeKind::Float; }
81 bool isPointer() const { return Kind == TypeKind::Pointer; }
82 bool isArray() const { return Kind == TypeKind::Array; }
83 bool isVector() const { return Kind == TypeKind::Vector; }
84 bool isTuple() const { return Kind == TypeKind::Tuple; }
85 bool isRecord() const { return Kind == TypeKind::Record; }
86 bool isMemberPointer() const { return Kind == TypeKind::MemberPointer; }
87 bool isComplex() const { return Kind == TypeKind::Complex; }
88 bool isZeroSize() const { return getSizeInBits().isZero(); }
89};
90
91class VoidType : public Type {
92public:
93 VoidType() : Type(TypeKind::Void, TypeSize::getFixed(0), Align(1)) {}
94
95 static bool classof(const Type *T) { return T->getKind() == TypeKind::Void; }
96};
97
98class AtomicType : public Type {
99public:
100 AtomicType(const Type *ValueType, uint64_t SizeInBits, Align Alignment)
101 : Type(TypeKind::Atomic, TypeSize::getFixed(SizeInBits), Alignment),
102 ValueType(ValueType) {}
103
104 const Type *getValueType() const { return ValueType; }
105
106 static bool classof(const Type *T) {
107 return T->getKind() == TypeKind::Atomic;
108 }
109
110private:
111 const Type *ValueType;
112};
113
114class ComplexType : public Type {
115public:
116 ComplexType(const Type *ElementType, uint64_t SizeInBits, Align Alignment)
117 : Type(TypeKind::Complex, TypeSize::getFixed(SizeInBits), Alignment),
118 ElementType(ElementType) {}
119
120 const Type *getElementType() const { return ElementType; }
121
122 static bool classof(const Type *T) {
123 return T->getKind() == TypeKind::Complex;
124 }
125
126private:
127 const Type *ElementType;
128};
129
130class IntegerType : public Type {
131private:
132 bool IsSigned;
133 bool IsBitInt;
134
135public:
136 IntegerType(uint64_t BitWidth, Align ABIAlign, bool IsSigned,
137 bool IsBitInt = false)
138 : Type(TypeKind::Integer, TypeSize::getFixed(BitWidth), ABIAlign),
139 IsSigned(IsSigned), IsBitInt(IsBitInt) {}
140
141 bool isSigned() const { return IsSigned; }
142 bool isBitInt() const { return IsBitInt; }
143 bool isBool() const {
144 return getSizeInBits().getFixedValue() == 1 && !IsBitInt;
145 }
146
147 static bool classof(const Type *T) {
148 return T->getKind() == TypeKind::Integer;
149 }
150};
151
152class FloatType : public Type {
153private:
154 const fltSemantics *Semantics;
155
156public:
157 FloatType(const fltSemantics &FloatSemantics, Align ABIAlign)
159 TypeSize::getFixed(APFloat::getSizeInBits(FloatSemantics)),
160 ABIAlign),
161 Semantics(&FloatSemantics) {}
162
163 const fltSemantics *getSemantics() const { return Semantics; }
164 static bool classof(const Type *T) { return T->getKind() == TypeKind::Float; }
165};
166
167class PointerLikeType : public Type {
168protected:
169 unsigned AddrSpace;
171 : Type(K, SizeInBits, ABIAlign), AddrSpace(AS) {}
172
173public:
174 unsigned getAddrSpace() const { return AddrSpace; }
175 bool isMemberPointer() const { return getKind() == TypeKind::MemberPointer; }
176
177 static bool classof(const Type *T) {
178 return T->getKind() == TypeKind::Pointer ||
179 T->getKind() == TypeKind::MemberPointer;
180 }
181};
182
184public:
185 PointerType(uint64_t Size, Align ABIAlign, unsigned AddressSpace = 0)
186 : PointerLikeType(TypeKind::Pointer, TypeSize::getFixed(Size), ABIAlign,
187 AddressSpace) {}
188
189 static bool classof(const Type *T) {
190 return T->getKind() == TypeKind::Pointer;
191 }
192};
193
195private:
196 bool IsFunctionPointer;
197
198public:
199 MemberPointerType(bool IsFunctionPointer, uint64_t SizeInBits, Align ABIAlign,
200 unsigned AddressSpace = 0)
202 ABIAlign, AddressSpace),
203 IsFunctionPointer(IsFunctionPointer) {}
204 bool isFunctionPointer() const { return IsFunctionPointer; }
205
206 static bool classof(const Type *T) {
207 return T->getKind() == TypeKind::MemberPointer;
208 }
209};
210
211class ArrayType : public Type {
212private:
213 const Type *ElementType;
214 uint64_t NumElements;
215 bool IsMatrix;
216
217public:
218 ArrayType(const Type *ElementType, uint64_t NumElements, uint64_t SizeInBits,
219 bool IsMatrixType = false)
220 : Type(TypeKind::Array, TypeSize::getFixed(SizeInBits),
221 ElementType->getAlignment()),
222 ElementType(ElementType), NumElements(NumElements),
223 IsMatrix(IsMatrixType) {}
224
225 const Type *getElementType() const { return ElementType; }
226 uint64_t getNumElements() const { return NumElements; }
227 bool isMatrixType() const { return IsMatrix; }
228
229 static bool classof(const Type *T) { return T->getKind() == TypeKind::Array; }
230};
231
232/// Distinguishes the vector flavors that ABIs have to treat differently.
233/// Scalability is not part of the kind. It is tracked by the vector's
234/// ElementCount, because some flavors have both a scalable and a
235/// fixed-length spelling.
236enum class VectorKind {
237 /// A plain vector, such as a Neon vector or a GCC vector_size vector.
239
240 /// An AArch64 SVE data vector, such as svint32_t. Data vectors are
241 /// passed in Z registers. Tuples of these vectors use TupleType.
243
244 /// An AArch64 SVE predicate vector, such as svbool_t. These are passed
245 /// in P registers. Sizeless predicates have one-bit elements; the
246 /// fixed-length arm_sve_vector_bits form keeps unsigned char (i8)
247 /// elements, matching the Clang AST. Both use this kind. Tuples of
248 /// these vectors use TupleType.
250
251 /// The AArch64 __SVCount_t type. It is opaque rather than a real vector,
252 /// but it occupies a predicate register, so it is given the same shape as
253 /// svbool_t.
255};
256
257class VectorType : public Type {
258private:
259 const Type *ElementType;
260 ElementCount NumElements;
261 VectorKind VecKind;
262
263 static TypeSize computeSizeInBits(const Type *ElementType,
264 ElementCount NumElements) {
265 return TypeSize(ElementType->getSizeInBits().getFixedValue() *
266 NumElements.getKnownMinValue(),
267 NumElements.isScalable());
268 }
269
270public:
271 VectorType(const Type *ElementType, ElementCount NumElements, Align ABIAlign,
273 : Type(TypeKind::Vector, computeSizeInBits(ElementType, NumElements),
274 ABIAlign),
275 ElementType(ElementType), NumElements(NumElements), VecKind(VecKind) {}
276
277 const Type *getElementType() const { return ElementType; }
278 ElementCount getNumElements() const { return NumElements; }
279
280 VectorKind getVectorKind() const { return VecKind; }
281
282 bool isScalable() const { return NumElements.isScalable(); }
283 bool isFixedLength() const { return !NumElements.isScalable(); }
284
285 bool isSVEData() const { return VecKind == VectorKind::SVEData; }
286 bool isSVEPredicate() const { return VecKind == VectorKind::SVEPredicate; }
287 bool isSVECount() const { return VecKind == VectorKind::SVECount; }
288
289 /// Returns true for any of the AArch64 SVE flavors.
290 bool isSVEType() const { return VecKind != VectorKind::Generic; }
291
292 static bool classof(const Type *T) {
293 return T->getKind() == TypeKind::Vector;
294 }
295};
296
297/// A homogeneous tuple of 2, 3, or 4 identical vectors, such as the
298/// AArch64 SVE types svint32x3_t and svboolx2_t.
299///
300/// The contained vector describes one register-shaped member. Size and
301/// alignment of the tuple cover the whole group: size is NumVectors times
302/// the vector size, and alignment matches the contained vector.
303class TupleType : public Type {
304private:
305 const VectorType *Vec;
306 unsigned NumVectors;
307
308public:
309 TupleType(const VectorType *Vec, unsigned NumVectors)
310 : Type(TypeKind::Tuple, (Vec->getSizeInBits() * NumVectors),
311 Vec->getAlignment()),
312 Vec(Vec), NumVectors(NumVectors) {}
313
314 const VectorType *getVectorType() const { return Vec; }
315 unsigned getNumVectors() const { return NumVectors; }
316
317 static bool classof(const Type *T) { return T->getKind() == TypeKind::Tuple; }
318};
319
338
340
341enum RecordFlags : unsigned {
342 None = 0,
344 IsUnion = 1 << 1,
346 IsCXXRecord = 1 << 3,
350};
351
352class RecordType : public Type {
353private:
354 ArrayRef<FieldInfo> Fields;
355 ArrayRef<FieldInfo> BaseClasses;
356 ArrayRef<FieldInfo> VirtualBaseClasses;
357 StructPacking Packing;
358 RecordFlags Flags;
359
360public:
365 : Type(TypeKind::Record, Size, Align), Fields(StructFields),
366 BaseClasses(Bases), VirtualBaseClasses(VBases), Packing(Pack),
367 Flags(RecFlags) {}
368 uint32_t getNumFields() const { return Fields.size(); }
369 StructPacking getPacking() const { return Packing; }
370
371 bool isUnion() const {
372 return static_cast<unsigned>(Flags & RecordFlags::IsUnion) != 0;
373 }
374 bool isCXXRecord() const {
375 return static_cast<unsigned>(Flags & RecordFlags::IsCXXRecord) != 0;
376 }
377 bool isPolymorphic() const {
378 return static_cast<unsigned>(Flags & RecordFlags::IsPolymorphic) != 0;
379 }
380 bool canPassInRegisters() const {
381 return static_cast<unsigned>(Flags & RecordFlags::CanPassInRegisters) != 0;
382 }
384 return static_cast<unsigned>(Flags & RecordFlags::HasFlexibleArrayMember) !=
385 0;
386 }
387 uint32_t getNumBaseClasses() const { return BaseClasses.size(); }
389 return VirtualBaseClasses.size();
390 }
391 bool isTransparentUnion() const {
392 return static_cast<unsigned>(Flags & RecordFlags::IsTransparent) != 0;
393 }
394 ArrayRef<FieldInfo> getFields() const { return Fields; }
395 ArrayRef<FieldInfo> getBaseClasses() const { return BaseClasses; }
397 return VirtualBaseClasses;
398 }
399
400 LLVM_ABI bool isEmpty() const;
401
402 /// Returns the field, base, or virtual base whose extent contains
403 /// \p OffsetInBits, or nullptr if no such element exists. Empty bases and
404 /// unnamed bitfields are skipped.
405 LLVM_ABI const FieldInfo *
406 getElementContainingOffset(unsigned OffsetInBits) const;
407
408 static bool classof(const Type *T) {
409 return T->getKind() == TypeKind::Record;
410 }
411};
412
413/// TypeBuilder manages the lifecycle of ABI types using bump pointer
414/// allocation. Types created by a TypeBuilder are valid for the lifetime of the
415/// allocator.
416///
417/// Example usage:
418/// \code
419/// BumpPtrAllocator Alloc;
420/// TypeBuilder Builder(Alloc);
421/// const auto *IntTy = Builder.getIntegerType(32, Align(4), true);
422/// \endcode
424private:
425 BumpPtrAllocator &Allocator;
426
427public:
428 explicit TypeBuilder(BumpPtrAllocator &Alloc) : Allocator(Alloc) {}
429
431 return new (Allocator.Allocate<VoidType>()) VoidType();
432 }
433
434 const AtomicType *getAtomicType(const Type *ValueType, uint64_t SizeInBits,
435 Align Align) {
436 return new (Allocator.Allocate<AtomicType>())
437 AtomicType(ValueType, SizeInBits, Align);
438 }
439
441 bool IsBitInt = false) {
442 return new (Allocator.Allocate<IntegerType>())
443 IntegerType(BitWidth, Align, Signed, IsBitInt);
444 }
445
446 const FloatType *getFloatType(const fltSemantics &Semantics, Align Align) {
447 return new (Allocator.Allocate<FloatType>()) FloatType(Semantics, Align);
448 }
449
451 unsigned Addrspace = 0) {
452 return new (Allocator.Allocate<PointerType>())
453 PointerType(Size, Align, Addrspace);
454 }
455
456 const ArrayType *getArrayType(const Type *ElementType, uint64_t NumElements,
457 uint64_t SizeInBits,
458 bool IsMatrixType = false) {
459 return new (Allocator.Allocate<ArrayType>())
460 ArrayType(ElementType, NumElements, SizeInBits, IsMatrixType);
461 }
462
463 const VectorType *getVectorType(const Type *ElementType,
464 ElementCount NumElements, Align Align,
466 return new (Allocator.Allocate<VectorType>())
467 VectorType(ElementType, NumElements, Align, VecKind);
468 }
469
470 /// Creates a homogeneous tuple of \p NumVectors copies of \p Vec.
471 /// \p NumVectors must be 2, 3, or 4.
472 const TupleType *getTupleType(const VectorType *Vec, unsigned NumVectors) {
473 assert(NumVectors >= 2 && NumVectors <= 4 &&
474 "tuple types hold 2, 3, or 4 vectors");
475 return new (Allocator.Allocate<TupleType>()) TupleType(Vec, NumVectors);
476 }
477
478 /// Creates the AArch64 __SVCount_t type. The type is opaque, so it is
479 /// modeled with the shape of svbool_t: a scalable vector of 16 one-bit
480 /// elements.
482 const Type *PredicateBit =
483 getIntegerType(1, Align(1), /*Signed=*/false, /*IsBitInt=*/false);
484 return getVectorType(PredicateBit, ElementCount::getScalable(16), ABIAlign,
486 }
487
489 Align Align,
491 ArrayRef<FieldInfo> BaseClasses = {},
492 ArrayRef<FieldInfo> VirtualBaseClasses = {},
493 RecordFlags RecFlags = RecordFlags::None) {
494 FieldInfo *FieldArray = Allocator.Allocate<FieldInfo>(Fields.size());
495 std::copy(Fields.begin(), Fields.end(), FieldArray);
496
497 FieldInfo *BaseArray = nullptr;
498 if (!BaseClasses.empty()) {
499 BaseArray = Allocator.Allocate<FieldInfo>(BaseClasses.size());
500 std::copy(BaseClasses.begin(), BaseClasses.end(), BaseArray);
501 }
502
503 FieldInfo *VBaseArray = nullptr;
504 if (!VirtualBaseClasses.empty()) {
505 VBaseArray = Allocator.Allocate<FieldInfo>(VirtualBaseClasses.size());
506 std::copy(VirtualBaseClasses.begin(), VirtualBaseClasses.end(),
507 VBaseArray);
508 }
509
510 ArrayRef<FieldInfo> FieldsRef(FieldArray, Fields.size());
511 ArrayRef<FieldInfo> BasesRef(BaseArray, BaseClasses.size());
512 ArrayRef<FieldInfo> VBasesRef(VBaseArray, VirtualBaseClasses.size());
513
514 return new (Allocator.Allocate<RecordType>())
515 RecordType(FieldsRef, BasesRef, VBasesRef, Size, Align, Pack, RecFlags);
516 }
517
519 Align Align,
521 RecordFlags RecFlags = RecordFlags::None) {
522 FieldInfo *FieldArray = Allocator.Allocate<FieldInfo>(Fields.size());
523
524 for (size_t I = 0, E = Fields.size(); I != E; ++I) {
525 FieldInfo Field = Fields[I];
526 Field.OffsetInBits = 0;
527 new (&FieldArray[I]) FieldInfo(Field);
528 }
529
530 ArrayRef<FieldInfo> FieldsRef(FieldArray, Fields.size());
531
532 return new (Allocator.Allocate<RecordType>())
534 Size, Align, Pack, RecFlags | RecordFlags::IsUnion);
535 }
536
537 const ComplexType *getComplexType(const Type *ElementType, Align Align) {
538 // Complex types have two elements (real and imaginary parts)
539 uint64_t ElementSizeInBits = ElementType->getSizeInBits().getFixedValue();
540 uint64_t ComplexSizeInBits = ElementSizeInBits * 2;
541
542 return new (Allocator.Allocate<ComplexType>())
543 ComplexType(ElementType, ComplexSizeInBits, Align);
544 }
545
546 const MemberPointerType *getMemberPointerType(bool IsFunctionPointer,
547 uint64_t SizeInBits,
548 Align Align) {
549 return new (Allocator.Allocate<MemberPointerType>())
550 MemberPointerType(IsFunctionPointer, SizeInBits, Align);
551 }
552};
553
554} // namespace abi
555} // namespace llvm
556
557#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:225
bool isMatrixType() const
Definition Types.h:227
static bool classof(const Type *T)
Definition Types.h:229
ArrayType(const Type *ElementType, uint64_t NumElements, uint64_t SizeInBits, bool IsMatrixType=false)
Definition Types.h:218
uint64_t getNumElements() const
Definition Types.h:226
const Type * getValueType() const
Definition Types.h:104
AtomicType(const Type *ValueType, uint64_t SizeInBits, Align Alignment)
Definition Types.h:100
static bool classof(const Type *T)
Definition Types.h:106
ComplexType(const Type *ElementType, uint64_t SizeInBits, Align Alignment)
Definition Types.h:116
const Type * getElementType() const
Definition Types.h:120
static bool classof(const Type *T)
Definition Types.h:122
FloatType(const fltSemantics &FloatSemantics, Align ABIAlign)
Definition Types.h:157
const fltSemantics * getSemantics() const
Definition Types.h:163
static bool classof(const Type *T)
Definition Types.h:164
static bool classof(const Type *T)
Definition Types.h:147
bool isBitInt() const
Definition Types.h:142
IntegerType(uint64_t BitWidth, Align ABIAlign, bool IsSigned, bool IsBitInt=false)
Definition Types.h:136
bool isBool() const
Definition Types.h:143
bool isSigned() const
Definition Types.h:141
bool isFunctionPointer() const
Definition Types.h:204
static bool classof(const Type *T)
Definition Types.h:206
MemberPointerType(bool IsFunctionPointer, uint64_t SizeInBits, Align ABIAlign, unsigned AddressSpace=0)
Definition Types.h:199
PointerLikeType(TypeKind K, TypeSize SizeInBits, Align ABIAlign, unsigned AS)
Definition Types.h:170
static bool classof(const Type *T)
Definition Types.h:177
bool isMemberPointer() const
Definition Types.h:175
unsigned getAddrSpace() const
Definition Types.h:174
PointerType(uint64_t Size, Align ABIAlign, unsigned AddressSpace=0)
Definition Types.h:185
static bool classof(const Type *T)
Definition Types.h:189
bool isPolymorphic() const
Definition Types.h:377
bool isUnion() const
Definition Types.h:371
bool canPassInRegisters() const
Definition Types.h:380
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:41
ArrayRef< FieldInfo > getBaseClasses() const
Definition Types.h:395
uint32_t getNumBaseClasses() const
Definition Types.h:387
ArrayRef< FieldInfo > getFields() const
Definition Types.h:394
uint32_t getNumVirtualBaseClasses() const
Definition Types.h:388
bool hasFlexibleArrayMember() const
Definition Types.h:383
bool isCXXRecord() const
Definition Types.h:374
bool isTransparentUnion() const
Definition Types.h:391
static bool classof(const Type *T)
Definition Types.h:408
LLVM_ABI bool isEmpty() const
Definition Types.cpp:15
RecordType(ArrayRef< FieldInfo > StructFields, ArrayRef< FieldInfo > Bases, ArrayRef< FieldInfo > VBases, TypeSize Size, Align Align, StructPacking Pack=StructPacking::Default, RecordFlags RecFlags=RecordFlags::None)
Definition Types.h:361
uint32_t getNumFields() const
Definition Types.h:368
ArrayRef< FieldInfo > getVirtualBaseClasses() const
Definition Types.h:396
StructPacking getPacking() const
Definition Types.h:369
A homogeneous tuple of 2, 3, or 4 identical vectors, such as the AArch64 SVE types svint32x3_t and sv...
Definition Types.h:303
const VectorType * getVectorType() const
Definition Types.h:314
unsigned getNumVectors() const
Definition Types.h:315
TupleType(const VectorType *Vec, unsigned NumVectors)
Definition Types.h:309
static bool classof(const Type *T)
Definition Types.h:317
const ComplexType * getComplexType(const Type *ElementType, Align Align)
Definition Types.h:537
const FloatType * getFloatType(const fltSemantics &Semantics, Align Align)
Definition Types.h:446
const IntegerType * getIntegerType(uint64_t BitWidth, Align Align, bool Signed, bool IsBitInt=false)
Definition Types.h:440
const AtomicType * getAtomicType(const Type *ValueType, uint64_t SizeInBits, Align Align)
Definition Types.h:434
const VectorType * getSVECountType(Align ABIAlign)
Creates the AArch64 __SVCount_t type.
Definition Types.h:481
const MemberPointerType * getMemberPointerType(bool IsFunctionPointer, uint64_t SizeInBits, Align Align)
Definition Types.h:546
const RecordType * getRecordType(ArrayRef< FieldInfo > Fields, TypeSize Size, Align Align, StructPacking Pack=StructPacking::Default, ArrayRef< FieldInfo > BaseClasses={}, ArrayRef< FieldInfo > VirtualBaseClasses={}, RecordFlags RecFlags=RecordFlags::None)
Definition Types.h:488
TypeBuilder(BumpPtrAllocator &Alloc)
Definition Types.h:428
const TupleType * getTupleType(const VectorType *Vec, unsigned NumVectors)
Creates a homogeneous tuple of NumVectors copies of Vec.
Definition Types.h:472
const VectorType * getVectorType(const Type *ElementType, ElementCount NumElements, Align Align, VectorKind VecKind=VectorKind::Generic)
Definition Types.h:463
const ArrayType * getArrayType(const Type *ElementType, uint64_t NumElements, uint64_t SizeInBits, bool IsMatrixType=false)
Definition Types.h:456
const PointerType * getPointerType(uint64_t Size, Align Align, unsigned Addrspace=0)
Definition Types.h:450
const VoidType * getVoidType()
Definition Types.h:430
const RecordType * getUnionType(ArrayRef< FieldInfo > Fields, TypeSize Size, Align Align, StructPacking Pack=StructPacking::Default, RecordFlags RecFlags=RecordFlags::None)
Definition Types.h:518
Represents the ABI-specific view of a type in LLVM.
Definition Types.h:46
TypeSize getTypeAllocSize() const
Definition Types.h:73
Align ABIAlignment
Definition Types.h:63
bool isMemberPointer() const
Definition Types.h:86
bool isVoid() const
Definition Types.h:77
bool isAtomic() const
Definition Types.h:78
TypeSize SizeInBits
Definition Types.h:62
TypeSize getSizeInBits() const
Definition Types.h:70
bool isInteger() const
Definition Types.h:79
Type(TypeKind K, TypeSize SizeInBits, Align ABIAlign)
Definition Types.h:65
bool isTuple() const
Definition Types.h:84
TypeKind Kind
Definition Types.h:61
bool isRecord() const
Definition Types.h:85
bool isArray() const
Definition Types.h:82
bool isZeroSize() const
Definition Types.h:88
bool isVector() const
Definition Types.h:83
bool isFloat() const
Definition Types.h:80
Align getAlignment() const
Definition Types.h:71
bool isComplex() const
Definition Types.h:87
TypeKind getKind() const
Definition Types.h:69
bool isPointer() const
Definition Types.h:81
ElementCount getNumElements() const
Definition Types.h:278
const Type * getElementType() const
Definition Types.h:277
VectorKind getVectorKind() const
Definition Types.h:280
static bool classof(const Type *T)
Definition Types.h:292
VectorType(const Type *ElementType, ElementCount NumElements, Align ABIAlign, VectorKind VecKind=VectorKind::Generic)
Definition Types.h:271
bool isSVEType() const
Returns true for any of the AArch64 SVE flavors.
Definition Types.h:290
bool isFixedLength() const
Definition Types.h:283
bool isSVECount() const
Definition Types.h:287
bool isScalable() const
Definition Types.h:282
bool isSVEData() const
Definition Types.h:285
bool isSVEPredicate() const
Definition Types.h:286
static bool classof(const Type *T)
Definition Types.h:95
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:341
@ IsPolymorphic
Definition Types.h:347
@ IsCXXRecord
Definition Types.h:346
@ CanPassInRegisters
Definition Types.h:343
@ IsTransparent
Definition Types.h:345
@ LLVM_MARK_AS_BITMASK_ENUM
Definition Types.h:349
@ IsUnion
Definition Types.h:344
@ HasFlexibleArrayMember
Definition Types.h:348
VectorKind
Distinguishes the vector flavors that ABIs have to treat differently.
Definition Types.h:236
@ SVEPredicate
An AArch64 SVE predicate vector, such as svbool_t.
Definition Types.h:249
@ SVEData
An AArch64 SVE data vector, such as svint32_t.
Definition Types.h:242
@ Generic
A plain vector, such as a Neon vector or a GCC vector_size vector.
Definition Types.h:238
@ SVECount
The AArch64 __SVCount_t type.
Definition Types.h:254
StructPacking
Definition Types.h:339
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:328
bool HasNoUniqueAddress
Definition Types.h:326
const Type * FieldType
Definition Types.h:321
uint64_t BitFieldWidth
Definition Types.h:323
LLVM_ABI bool isEmpty() const
Definition Types.cpp:70
uint64_t OffsetInBits
Definition Types.h:322