LLVM 23.0.0git
DerivedTypes.h
Go to the documentation of this file.
1//===- llvm/DerivedTypes.h - Classes for handling data types ----*- 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// This file contains the declarations of classes that represent "derived
10// types". These are things like "arrays of x" or "structure of x, y, z" or
11// "function returning x taking (y,z) as parameters", etc...
12//
13// The implementations of these classes live in the Type.cpp file.
14//
15//===----------------------------------------------------------------------===//
16
17#ifndef LLVM_IR_DERIVEDTYPES_H
18#define LLVM_IR_DERIVEDTYPES_H
19
20#include "llvm/ADT/ArrayRef.h"
21#include "llvm/ADT/STLExtras.h"
22#include "llvm/ADT/StringRef.h"
23#include "llvm/IR/Type.h"
27#include <cassert>
28#include <cstdint>
29
30namespace llvm {
31
32class Value;
33class APInt;
34class LLVMContext;
35template <typename T> class Expected;
36class Error;
37
38/// Class to represent integer types. Note that this class is also used to
39/// represent the built-in integer types: Int1Ty, Int8Ty, Int16Ty, Int32Ty and
40/// Int64Ty.
41/// Integer representation type
42class IntegerType : public Type {
43 friend class LLVMContextImpl;
44
45protected:
46 explicit IntegerType(LLVMContext &C, unsigned NumBits) : Type(C, IntegerTyID){
47 setSubclassData(NumBits);
48 }
49
50public:
51 /// This enum is just used to hold constants we need for IntegerType.
52 enum {
53 MIN_INT_BITS = 1, ///< Minimum number of bits that can be specified
54 MAX_INT_BITS = (1<<23) ///< Maximum number of bits that can be specified
55 ///< Note that bit width is stored in the Type classes SubclassData field
56 ///< which has 24 bits. SelectionDAG type legalization can require a
57 ///< power of 2 IntegerType, so limit to the largest representable power
58 ///< of 2, 8388608.
59 };
60
61 /// This static method is the primary way of constructing an IntegerType.
62 /// If an IntegerType with the same NumBits value was previously instantiated,
63 /// that instance will be returned. Otherwise a new one will be created. Only
64 /// one instance with a given NumBits value is ever created.
65 /// Get or create an IntegerType instance.
66 LLVM_ABI static IntegerType *get(LLVMContext &C, unsigned NumBits);
67
68 /// Returns type twice as wide the input type.
72
73 /// Get the number of bits in this IntegerType
74 unsigned getBitWidth() const { return getSubclassData(); }
75
76 /// Return a bitmask with ones set for all of the bits that can be set by an
77 /// unsigned version of this type. This is 0xFF for i8, 0xFFFF for i16, etc.
79 return ~uint64_t(0UL) >> (64-getBitWidth());
80 }
81
82 /// Return a uint64_t with just the most significant bit set (the sign bit, if
83 /// the value is treated as a signed number).
85 return 1ULL << (getBitWidth()-1);
86 }
87
88 /// For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
89 /// @returns a bit mask with ones set for all the bits of this type.
90 /// Get a bit mask for this type.
91 LLVM_ABI APInt getMask() const;
92
93 /// Methods for support type inquiry through isa, cast, and dyn_cast.
94 static bool classof(const Type *T) {
95 return T->getTypeID() == IntegerTyID;
96 }
97};
98
99unsigned Type::getIntegerBitWidth() const {
100 return cast<IntegerType>(this)->getBitWidth();
101}
102
103/// Class to represent byte types.
104class ByteType : public Type {
105 friend class LLVMContextImpl;
106
107protected:
108 explicit ByteType(LLVMContext &C, unsigned NumBits) : Type(C, ByteTyID) {
109 setSubclassData(NumBits);
110 }
111
112public:
113 /// This enum is just used to hold constants we need for ByteType.
114 enum {
115 MIN_BYTE_BITS = 1, ///< Minimum number of bits that can be specified
117 (1 << 23) ///< Maximum number of bits that can be specified
118 ///< Note that bit width is stored in the Type classes
119 ///< SubclassData field which has 24 bits. SelectionDAG type
120 ///< legalization can require a power of 2 ByteType, so limit
121 ///< to the largest representable power of 2, 8388608.
122 };
123
124 /// This static method is the primary way of constructing a ByteType.
125 /// If a ByteType with the same NumBits value was previously instantiated,
126 /// that instance will be returned. Otherwise a new one will be created. Only
127 /// one instance with a given NumBits value is ever created.
128 /// Get or create a ByteType instance.
129 LLVM_ABI static ByteType *get(LLVMContext &C, unsigned NumBits);
130
131 /// Get the number of bits in this ByteType
132 unsigned getBitWidth() const { return getSubclassData(); }
133
134 /// For example, this is 0xFF for an 8 bit byte, 0xFFFF for b16, etc.
135 /// @returns a bit mask with ones set for all the bits of this type.
136 /// Get a bit mask for this type.
137 LLVM_ABI APInt getMask() const;
138
139 /// Methods for support type inquiry through isa, cast, and dyn_cast.
140 static bool classof(const Type *T) { return T->getTypeID() == ByteTyID; }
141};
142
143unsigned Type::getByteBitWidth() const {
144 return cast<ByteType>(this)->getBitWidth();
145}
146
147/// Class to represent function types
148///
149class FunctionType : public Type {
150 FunctionType(Type *Result, ArrayRef<Type*> Params, bool IsVarArgs);
151
152public:
153 FunctionType(const FunctionType &) = delete;
154 FunctionType &operator=(const FunctionType &) = delete;
155
156 /// This static method is the primary way of constructing a FunctionType.
157 LLVM_ABI static FunctionType *get(Type *Result, ArrayRef<Type *> Params,
158 bool isVarArg);
159
160 /// Create a FunctionType taking no parameters.
161 LLVM_ABI static FunctionType *get(Type *Result, bool isVarArg);
162
163 /// Return true if the specified type is valid as a return type.
164 LLVM_ABI static bool isValidReturnType(Type *RetTy);
165
166 /// Return true if the specified type is valid as an argument type.
167 LLVM_ABI static bool isValidArgumentType(Type *ArgTy);
168
169 bool isVarArg() const { return getSubclassData()!=0; }
170 Type *getReturnType() const { return ContainedTys[0]; }
171
173
177 return ArrayRef(param_begin(), param_end());
178 }
179
180 /// Parameter type accessors.
181 Type *getParamType(unsigned i) const {
182 assert(i < getNumParams() && "getParamType() out of range!");
183 return ContainedTys[i + 1];
184 }
185
186 /// Return the number of fixed parameters this function type requires.
187 /// This does not consider varargs.
188 unsigned getNumParams() const { return NumContainedTys - 1; }
189
190 /// Methods for support type inquiry through isa, cast, and dyn_cast.
191 static bool classof(const Type *T) {
192 return T->getTypeID() == FunctionTyID;
193 }
194};
195static_assert(alignof(FunctionType) >= alignof(Type *),
196 "Alignment sufficient for objects appended to FunctionType");
197
199 return cast<FunctionType>(this)->isVarArg();
200}
201
203 return cast<FunctionType>(this)->getParamType(i);
204}
205
207 return cast<FunctionType>(this)->getNumParams();
208}
209
210/// A handy container for a FunctionType+Callee-pointer pair, which can be
211/// passed around as a single entity. This assists in replacing the use of
212/// PointerType::getElementType() to access the function's type, since that's
213/// slated for removal as part of the [opaque pointer types] project.
215public:
216 // Allow implicit conversion from types which have a getFunctionType member
217 // (e.g. Function and InlineAsm).
218 template <typename T, typename U = decltype(&T::getFunctionType)>
220 : FnTy(Fn ? Fn->getFunctionType() : nullptr), Callee(Fn) {}
221
223 : FnTy(FnTy), Callee(Callee) {
224 assert((FnTy == nullptr) == (Callee == nullptr));
225 }
226
227 FunctionCallee(std::nullptr_t) {}
228
229 FunctionCallee() = default;
230
231 FunctionType *getFunctionType() { return FnTy; }
232
233 Value *getCallee() { return Callee; }
234
235 explicit operator bool() { return Callee; }
236
237private:
238 FunctionType *FnTy = nullptr;
239 Value *Callee = nullptr;
240};
241
242/// Class to represent struct types. There are two different kinds of struct
243/// types: Literal structs and Identified structs.
244///
245/// Literal struct types (e.g. { i32, i32 }) are uniqued structurally, and must
246/// always have a body when created. You can get one of these by using one of
247/// the StructType::get() forms.
248///
249/// Identified structs (e.g. %foo or %42) may optionally have a name and are not
250/// uniqued. The names for identified structs are managed at the LLVMContext
251/// level, so there can only be a single identified struct with a given name in
252/// a particular LLVMContext. Identified structs may also optionally be opaque
253/// (have no body specified). You get one of these by using one of the
254/// StructType::create() forms.
255///
256/// Independent of what kind of struct you have, the body of a struct type are
257/// laid out in memory consecutively with the elements directly one after the
258/// other (if the struct is packed) or (if not packed) with padding between the
259/// elements as defined by DataLayout (which is required to match what the code
260/// generator for a target expects).
261///
262class StructType : public Type {
263 StructType(LLVMContext &C) : Type(C, StructTyID) {}
264
265 enum {
266 /// This is the contents of the SubClassData field.
267 SCDB_HasBody = 1,
268 SCDB_Packed = 2,
269 SCDB_IsLiteral = 4,
270 SCDB_IsSized = 8,
271 SCDB_ContainsScalableVector = 16,
272 SCDB_NotContainsScalableVector = 32,
273 SCDB_ContainsNonGlobalTargetExtType = 64,
274 SCDB_NotContainsNonGlobalTargetExtType = 128,
275 SCDB_ContainsNonLocalTargetExtType = 64,
276 SCDB_NotContainsNonLocalTargetExtType = 128,
277 };
278
279 /// For a named struct that actually has a name, this is a pointer to the
280 /// symbol table entry (maintained by LLVMContext) for the struct.
281 /// This is null if the type is an literal struct or if it is a identified
282 /// type that has an empty name.
283 void *SymbolTableEntry = nullptr;
284
285public:
286 StructType(const StructType &) = delete;
287 StructType &operator=(const StructType &) = delete;
288
289 /// This creates an identified struct.
290 LLVM_ABI static StructType *create(LLVMContext &Context, StringRef Name);
291 LLVM_ABI static StructType *create(LLVMContext &Context);
292
293 LLVM_ABI static StructType *create(ArrayRef<Type *> Elements, StringRef Name,
294 bool isPacked = false);
295 LLVM_ABI static StructType *create(ArrayRef<Type *> Elements);
296 LLVM_ABI static StructType *create(LLVMContext &Context,
297 ArrayRef<Type *> Elements, StringRef Name,
298 bool isPacked = false);
299 LLVM_ABI static StructType *create(LLVMContext &Context,
300 ArrayRef<Type *> Elements);
301 template <class... Tys>
302 static std::enable_if_t<are_base_of<Type, Tys...>::value, StructType *>
303 create(StringRef Name, Type *elt1, Tys *... elts) {
304 assert(elt1 && "Cannot create a struct type with no elements with this");
305 return create(ArrayRef<Type *>({elt1, elts...}), Name);
306 }
307
308 /// This static method is the primary way to create a literal StructType.
309 LLVM_ABI static StructType *
310 get(LLVMContext &Context, ArrayRef<Type *> Elements, bool isPacked = false);
311
312 /// Create an empty structure type.
313 LLVM_ABI static StructType *get(LLVMContext &Context, bool isPacked = false);
314
315 /// This static method is a convenience method for creating structure types by
316 /// specifying the elements as arguments. Note that this method always returns
317 /// a non-packed struct, and requires at least one element type.
318 template <class... Tys>
319 static std::enable_if_t<are_base_of<Type, Tys...>::value, StructType *>
320 get(Type *elt1, Tys *... elts) {
321 assert(elt1 && "Cannot create a struct type with no elements with this");
322 LLVMContext &Ctx = elt1->getContext();
323 return StructType::get(Ctx, ArrayRef<Type *>({elt1, elts...}));
324 }
325
326 /// Return the type with the specified name, or null if there is none by that
327 /// name.
329
330 bool isPacked() const { return (getSubclassData() & SCDB_Packed) != 0; }
331
332 /// Return true if this type is uniqued by structural equivalence, false if it
333 /// is a struct definition.
334 bool isLiteral() const { return (getSubclassData() & SCDB_IsLiteral) != 0; }
335
336 /// Return true if this is a type with an identity that has no body specified
337 /// yet. These prints as 'opaque' in .ll files.
338 bool isOpaque() const { return (getSubclassData() & SCDB_HasBody) == 0; }
339
340 /// isSized - Return true if this is a sized type.
341 LLVM_ABI bool isSized(SmallPtrSetImpl<Type *> *Visited = nullptr) const;
342
343 /// Returns true if this struct contains a scalable vector.
345 using Type::isScalableTy;
346
347 /// Return true if this type is or contains a target extension type that
348 /// disallows being used as a global.
349 LLVM_ABI bool
352
353 /// Return true if this type is or contains a target extension type that
354 /// disallows being used as a local.
355 LLVM_ABI bool
358
359 /// Returns true if this struct contains homogeneous scalable vector types.
360 /// Note that the definition of homogeneous scalable vector type is not
361 /// recursive here. That means the following structure will return false
362 /// when calling this function.
363 /// {{<vscale x 2 x i32>, <vscale x 4 x i64>},
364 /// {<vscale x 2 x i32>, <vscale x 4 x i64>}}
366
367 /// Return true if this struct is non-empty and all element types are the
368 /// same.
370
371 /// Return true if this is a named struct that has a non-empty name.
372 bool hasName() const { return SymbolTableEntry != nullptr; }
373
374 /// Return the name for this struct type if it has an identity.
375 /// This may return an empty string for an unnamed struct type. Do not call
376 /// this on an literal type.
377 LLVM_ABI StringRef getName() const;
378
379 /// Change the name of this type to the specified name, or to a name with a
380 /// suffix if there is a collision. Do not call this on an literal type.
381 LLVM_ABI void setName(StringRef Name);
382
383 /// Specify a body for an opaque identified type, which must not make the type
384 /// recursive.
385 LLVM_ABI void setBody(ArrayRef<Type *> Elements, bool isPacked = false);
386
387 /// Specify a body for an opaque identified type or return an error if it
388 /// would make the type recursive.
390 bool isPacked = false);
391
392 /// Return an error if the body for an opaque identified type would make it
393 /// recursive.
395
396 /// Return true if the specified type is valid as a element type.
397 LLVM_ABI static bool isValidElementType(Type *ElemTy);
398
399 // Iterator access to the elements.
401
406 }
407
408 /// Return true if this is layout identical to the specified struct.
410
411 /// Random access to the elements
412 unsigned getNumElements() const { return NumContainedTys; }
413 Type *getElementType(unsigned N) const {
414 assert(N < NumContainedTys && "Element number out of range!");
415 return ContainedTys[N];
416 }
417 /// Given an index value into the type, return the type of the element.
418 LLVM_ABI Type *getTypeAtIndex(const Value *V) const;
419 Type *getTypeAtIndex(unsigned N) const { return getElementType(N); }
420 LLVM_ABI bool indexValid(const Value *V) const;
421 bool indexValid(unsigned Idx) const { return Idx < getNumElements(); }
422
423 /// Methods for support type inquiry through isa, cast, and dyn_cast.
424 static bool classof(const Type *T) {
425 return T->getTypeID() == StructTyID;
426 }
427};
428
430 return cast<StructType>(this)->getName();
431}
432
434 return cast<StructType>(this)->getNumElements();
435}
436
438 return cast<StructType>(this)->getElementType(N);
439}
440
441/// Class to represent array types.
442class ArrayType : public Type {
443 /// The element type of the array.
444 Type *ContainedType;
445 /// Number of elements in the array.
446 uint64_t NumElements;
447
448 ArrayType(Type *ElType, uint64_t NumEl);
449
450public:
451 ArrayType(const ArrayType &) = delete;
452 ArrayType &operator=(const ArrayType &) = delete;
453
454 uint64_t getNumElements() const { return NumElements; }
455 Type *getElementType() const { return ContainedType; }
456
457 /// This static method is the primary way to construct an ArrayType
458 LLVM_ABI static ArrayType *get(Type *ElementType, uint64_t NumElements);
459
460 /// Return true if the specified type is valid as a element type.
461 LLVM_ABI static bool isValidElementType(Type *ElemTy);
462
463 /// Methods for support type inquiry through isa, cast, and dyn_cast.
464 static bool classof(const Type *T) {
465 return T->getTypeID() == ArrayTyID;
466 }
467};
468
470 return cast<ArrayType>(this)->getNumElements();
471}
472
473/// Base class of all SIMD vector types
474class VectorType : public Type {
475 /// A fully specified VectorType is of the form <vscale x n x Ty>. 'n' is the
476 /// minimum number of elements of type Ty contained within the vector, and
477 /// 'vscale x' indicates that the total element count is an integer multiple
478 /// of 'n', where the multiple is either guaranteed to be one, or is
479 /// statically unknown at compile time.
480 ///
481 /// If the multiple is known to be 1, then the extra term is discarded in
482 /// textual IR:
483 ///
484 /// <4 x i32> - a vector containing 4 i32s
485 /// <vscale x 4 x i32> - a vector containing an unknown integer multiple
486 /// of 4 i32s
487
488 /// The element type of the vector.
489 Type *ContainedType;
490
491protected:
492 /// The element quantity of this vector. The meaning of this value depends
493 /// on the type of vector:
494 /// - For FixedVectorType = <ElementQuantity x ty>, there are
495 /// exactly ElementQuantity elements in this vector.
496 /// - For ScalableVectorType = <vscale x ElementQuantity x ty>,
497 /// there are vscale * ElementQuantity elements in this vector, where
498 /// vscale is a runtime-constant integer greater than 0.
499 const unsigned ElementQuantity;
500
501 LLVM_ABI VectorType(Type *ElType, unsigned EQ, Type::TypeID TID);
502
503public:
504 VectorType(const VectorType &) = delete;
505 VectorType &operator=(const VectorType &) = delete;
506
507 Type *getElementType() const { return ContainedType; }
508
509 /// This static method is the primary way to construct an VectorType.
510 LLVM_ABI static VectorType *get(Type *ElementType, ElementCount EC);
511
512 static VectorType *get(Type *ElementType, unsigned NumElements,
513 bool Scalable) {
514 return VectorType::get(ElementType,
515 ElementCount::get(NumElements, Scalable));
516 }
517
518 static VectorType *get(Type *ElementType, const VectorType *Other) {
519 return VectorType::get(ElementType, Other->getElementCount());
520 }
521
522 /// This static method gets a VectorType with the same number of elements as
523 /// the input type, and the element type is an integer type of the same width
524 /// as the input element type.
526 unsigned EltBits =
528 assert(EltBits && "Element size must be of a non-zero size");
529 Type *EltTy = IntegerType::get(VTy->getContext(), EltBits);
530 return VectorType::get(EltTy, VTy->getElementCount());
531 }
532
533 /// This static method is like getInteger except that the element types are
534 /// twice as wide as the elements in the input type.
536 assert(VTy->isIntOrIntVectorTy() && "VTy expected to be a vector of ints.");
537 auto *EltTy = cast<IntegerType>(VTy->getElementType());
538 return VectorType::get(EltTy->getExtendedType(), VTy->getElementCount());
539 }
540
541 // This static method gets a VectorType with the same number of elements as
542 // the input type, and the element type is an integer or float type which
543 // is half as wide as the elements in the input type.
545 Type *EltTy;
546 if (VTy->getElementType()->isFloatingPointTy()) {
547 switch(VTy->getElementType()->getTypeID()) {
548 case DoubleTyID:
549 EltTy = Type::getFloatTy(VTy->getContext());
550 break;
551 case FloatTyID:
552 EltTy = Type::getHalfTy(VTy->getContext());
553 break;
554 default:
555 llvm_unreachable("Cannot create narrower fp vector element type");
556 }
557 } else {
558 unsigned EltBits =
560 assert((EltBits & 1) == 0 &&
561 "Cannot truncate vector element with odd bit-width");
562 EltTy = IntegerType::get(VTy->getContext(), EltBits / 2);
563 }
564 return VectorType::get(EltTy, VTy->getElementCount());
565 }
566
567 // This static method returns a VectorType with a larger number of elements
568 // of a smaller type than the input element type. For example, a <4 x i64>
569 // subdivided twice would return <16 x i16>
570 static VectorType *getSubdividedVectorType(VectorType *VTy, int NumSubdivs) {
571 for (int i = 0; i < NumSubdivs; ++i) {
574 }
575 return VTy;
576 }
577
578 /// This static method returns a VectorType with half as many elements as the
579 /// input type and the same element type.
581 auto EltCnt = VTy->getElementCount();
582 assert(EltCnt.isKnownEven() &&
583 "Cannot halve vector with odd number of elements.");
584 return VectorType::get(VTy->getElementType(),
585 EltCnt.divideCoefficientBy(2));
586 }
587
589 unsigned Denominator) {
590 auto EltCnt = VTy->getElementCount();
591 assert(EltCnt.isKnownMultipleOf(Denominator) &&
592 "Cannot take one-nth of a vector");
593 return VectorType::get(VTy->getScalarType(),
594 EltCnt.divideCoefficientBy(Denominator));
595 }
596
597 /// This static method returns a VectorType with twice as many elements as the
598 /// input type and the same element type.
600 auto EltCnt = VTy->getElementCount();
601 assert((EltCnt.getKnownMinValue() * 2ull) <= UINT_MAX &&
602 "Too many elements in vector");
603 return VectorType::get(VTy->getElementType(), EltCnt * 2);
604 }
605
606 /// This static method attempts to construct a VectorType with the same
607 /// size-in-bits as SizeTy but with an element type that matches the scalar
608 /// type of EltTy. The VectorType is returned on success, nullptr otherwise.
610 if (SizeTy->getScalarType() == EltTy->getScalarType())
611 return SizeTy;
612
613 unsigned EltSize = EltTy->getScalarSizeInBits();
614 if (!SizeTy->getPrimitiveSizeInBits().isKnownMultipleOf(EltSize))
615 return nullptr;
616
617 ElementCount EC = SizeTy->getElementCount()
619 .divideCoefficientBy(EltSize);
620 return VectorType::get(EltTy->getScalarType(), EC);
621 }
622
623 /// Return true if the specified type is valid as a element type.
624 LLVM_ABI static bool isValidElementType(Type *ElemTy);
625
626 /// Return an ElementCount instance to represent the (possibly scalable)
627 /// number of elements in the vector.
628 inline ElementCount getElementCount() const;
629
630 /// Methods for support type inquiry through isa, cast, and dyn_cast.
631 static bool classof(const Type *T) {
632 return T->getTypeID() == FixedVectorTyID ||
633 T->getTypeID() == ScalableVectorTyID;
634 }
635};
636
637/// Class to represent fixed width SIMD vectors
639protected:
640 FixedVectorType(Type *ElTy, unsigned NumElts)
641 : VectorType(ElTy, NumElts, FixedVectorTyID) {}
642
643public:
644 LLVM_ABI static FixedVectorType *get(Type *ElementType, unsigned NumElts);
645
646 static FixedVectorType *get(Type *ElementType, const FixedVectorType *FVTy) {
647 return get(ElementType, FVTy->getNumElements());
648 }
649
653
657
662
664 int NumSubdivs) {
666 VectorType::getSubdividedVectorType(VTy, NumSubdivs));
667 }
668
672
676
677 static bool classof(const Type *T) {
678 return T->getTypeID() == FixedVectorTyID;
679 }
680
681 unsigned getNumElements() const { return ElementQuantity; }
682};
683
684/// Class to represent scalable SIMD vectors
686protected:
687 ScalableVectorType(Type *ElTy, unsigned MinNumElts)
688 : VectorType(ElTy, MinNumElts, ScalableVectorTyID) {}
689
690public:
691 LLVM_ABI static ScalableVectorType *get(Type *ElementType,
692 unsigned MinNumElts);
693
694 static ScalableVectorType *get(Type *ElementType,
695 const ScalableVectorType *SVTy) {
696 return get(ElementType, SVTy->getMinNumElements());
697 }
698
702
703 static ScalableVectorType *
708
709 static ScalableVectorType *
714
716 int NumSubdivs) {
718 VectorType::getSubdividedVectorType(VTy, NumSubdivs));
719 }
720
721 static ScalableVectorType *
725
726 static ScalableVectorType *
731
732 /// Get the minimum number of elements in this vector. The actual number of
733 /// elements in the vector is an integer multiple of this value.
734 unsigned getMinNumElements() const { return ElementQuantity; }
735
736 static bool classof(const Type *T) {
737 return T->getTypeID() == ScalableVectorTyID;
738 }
739};
740
744
745/// Class to represent pointers.
746class PointerType : public Type {
747 explicit PointerType(LLVMContext &C, unsigned AddrSpace);
748
749public:
750 PointerType(const PointerType &) = delete;
751 PointerType &operator=(const PointerType &) = delete;
752
753 /// This constructs a pointer to an object of the specified type in a numbered
754 /// address space.
755 [[deprecated("PointerType::get with pointee type is pending removal. Use "
756 "Context overload.")]]
757 LLVM_ABI static PointerType *get(Type *ElementType, unsigned AddressSpace);
758 /// This constructs an opaque pointer to an object in a numbered address
759 /// space.
760 LLVM_ABI static PointerType *get(LLVMContext &C, unsigned AddressSpace);
761
762 /// This constructs a pointer to an object of the specified type in the
763 /// default address space (address space zero).
764 [[deprecated("PointerType::getUnqual with pointee type is pending removal. "
765 "Use Context overload.")]]
766 static PointerType *getUnqual(Type *ElementType) {
767 assert(ElementType && "Can't get a pointer to <null> type!");
768 assert(isValidElementType(ElementType) &&
769 "Invalid type for pointer element!");
770 return PointerType::getUnqual(ElementType->getContext());
771 }
772
773 /// This constructs an opaque pointer to an object in the
774 /// default address space (address space zero).
775 static PointerType *getUnqual(LLVMContext &C) {
776 return PointerType::get(C, 0);
777 }
778
779 /// Return true if the specified type is valid as a element type.
780 LLVM_ABI static bool isValidElementType(Type *ElemTy);
781
782 /// Return true if we can load or store from a pointer to this type.
783 LLVM_ABI static bool isLoadableOrStorableType(Type *ElemTy);
784
785 /// Return the address space of the Pointer type.
786 inline unsigned getAddressSpace() const { return getSubclassData(); }
787
788 /// Implement support type inquiry through isa, cast, and dyn_cast.
789 static bool classof(const Type *T) {
790 return T->getTypeID() == PointerTyID;
791 }
792};
793
795 assert(
797 "Original type expected to be a vector of integers or a scalar integer.");
798 if (auto *VTy = dyn_cast<VectorType>(this))
800 const_cast<VectorType *>(VTy));
801 return cast<IntegerType>(this)->getExtendedType();
802}
803
805 if (auto *VTy = dyn_cast<VectorType>(this))
806 return VectorType::get(EltTy, VTy->getElementCount());
807 return EltTy;
808}
809
810Type *Type::getWithNewBitWidth(unsigned NewBitWidth) const {
811 assert(
813 "Original type expected to be a vector of integers or a scalar integer.");
814 return getWithNewType(getIntNTy(getContext(), NewBitWidth));
815}
816
818 return cast<PointerType>(getScalarType())->getAddressSpace();
819}
820
821/// Class to represent target extensions types, which are generally
822/// unintrospectable from target-independent optimizations.
823///
824/// Target extension types have a string name, and optionally have type and/or
825/// integer parameters. The exact meaning of any parameters is dependent on the
826/// target.
827class TargetExtType : public Type {
828 TargetExtType(LLVMContext &C, StringRef Name, ArrayRef<Type *> Types,
829 ArrayRef<unsigned> Ints);
830
831 // These strings are ultimately owned by the context.
832 StringRef Name;
833 unsigned *IntParams;
834
835public:
836 TargetExtType(const TargetExtType &) = delete;
837 TargetExtType &operator=(const TargetExtType &) = delete;
838
839 /// Return a target extension type having the specified name and optional
840 /// type and integer parameters.
841 LLVM_ABI static TargetExtType *get(LLVMContext &Context, StringRef Name,
842 ArrayRef<Type *> Types = {},
843 ArrayRef<unsigned> Ints = {});
844
845 /// Return a target extension type having the specified name and optional
846 /// type and integer parameters, or an appropriate Error if it fails the
847 /// parameters check.
848 LLVM_ABI static Expected<TargetExtType *>
849 getOrError(LLVMContext &Context, StringRef Name, ArrayRef<Type *> Types = {},
850 ArrayRef<unsigned> Ints = {});
851
852 /// Check that a newly created target extension type has the expected number
853 /// of type parameters and integer parameters, returning the type itself if OK
854 /// or an appropriate Error if not.
855 LLVM_ABI static Expected<TargetExtType *> checkParams(TargetExtType *TTy);
856
857 /// Return the name for this target extension type. Two distinct target
858 /// extension types may have the same name if their type or integer parameters
859 /// differ.
860 StringRef getName() const { return Name; }
861
862 /// Return the type parameters for this particular target extension type. If
863 /// there are no parameters, an empty array is returned.
867
873
874 Type *getTypeParameter(unsigned i) const { return getContainedType(i); }
875 unsigned getNumTypeParameters() const { return getNumContainedTypes(); }
876
877 /// Return the integer parameters for this particular target extension type.
878 /// If there are no parameters, an empty array is returned.
880 return ArrayRef(IntParams, getNumIntParameters());
881 }
882
883 unsigned getIntParameter(unsigned i) const { return IntParams[i]; }
884 unsigned getNumIntParameters() const { return getSubclassData(); }
885
886 enum Property {
887 /// zeroinitializer is valid for this target extension type.
888 HasZeroInit = 1U << 0,
889 /// This type may be used as the value type of a global variable.
890 CanBeGlobal = 1U << 1,
891 /// This type may be allocated on the stack, either as the allocated type
892 /// of an alloca instruction or as a byval function parameter.
893 CanBeLocal = 1U << 2,
894 /// This type may be used as an element in a vector.
896 // This type can only be used in intrinsic arguments and return values.
897 /// In particular, it cannot be used in select and phi instructions.
898 IsTokenLike = 1U << 4,
899 };
900
901 /// Returns true if the target extension type contains the given property.
902 LLVM_ABI bool hasProperty(Property Prop) const;
903
904 /// Returns an underlying layout type for the target extension type. This
905 /// type can be used to query size and alignment information, if it is
906 /// appropriate (although note that the layout type may also be void). It is
907 /// not legal to bitcast between this type and the layout type, however.
908 LLVM_ABI Type *getLayoutType() const;
909
910 /// Methods for support type inquiry through isa, cast, and dyn_cast.
911 static bool classof(const Type *T) { return T->getTypeID() == TargetExtTyID; }
912};
913
915 return cast<TargetExtType>(this)->getName();
916}
917
918} // end namespace llvm
919
920#endif // LLVM_IR_DERIVEDTYPES_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_ABI
Definition Compiler.h:213
#define T
This file contains some templates that are useful if you are working with the STL at all.
Class for arbitrary precision integers.
Definition APInt.h:78
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
static LLVM_ABI ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
uint64_t getNumElements() const
static LLVM_ABI bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition Type.cpp:835
ArrayType & operator=(const ArrayType &)=delete
ArrayType(const ArrayType &)=delete
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Type * getElementType() const
Class to represent byte types.
@ MIN_BYTE_BITS
Minimum number of bits that can be specified.
@ MAX_BYTE_BITS
Maximum number of bits that can be specified Note that bit width is stored in the Type classes Subcla...
unsigned getBitWidth() const
Get the number of bits in this ByteType.
static LLVM_ABI ByteType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing a ByteType.
Definition Type.cpp:384
ByteType(LLVMContext &C, unsigned NumBits)
friend class LLVMContextImpl
LLVM_ABI APInt getMask() const
For example, this is 0xFF for an 8 bit byte, 0xFFFF for b16, etc.
Definition Type.cpp:412
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
static constexpr ElementCount get(ScalarTy MinVal, bool Scalable)
Definition TypeSize.h:315
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Tagged union holding either a T or a Error.
Definition Error.h:485
Class to represent fixed width SIMD vectors.
unsigned getNumElements() const
static FixedVectorType * getDoubleElementsVectorType(FixedVectorType *VTy)
static FixedVectorType * getInteger(FixedVectorType *VTy)
static FixedVectorType * getSubdividedVectorType(FixedVectorType *VTy, int NumSubdivs)
static FixedVectorType * getExtendedElementVectorType(FixedVectorType *VTy)
FixedVectorType(Type *ElTy, unsigned NumElts)
static FixedVectorType * get(Type *ElementType, const FixedVectorType *FVTy)
static FixedVectorType * getTruncatedElementVectorType(FixedVectorType *VTy)
static bool classof(const Type *T)
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
Definition Type.cpp:873
static FixedVectorType * getHalfElementsVectorType(FixedVectorType *VTy)
FunctionCallee(std::nullptr_t)
FunctionType * getFunctionType()
FunctionCallee()=default
FunctionCallee(FunctionType *FnTy, Value *Callee)
Class to represent function types.
param_iterator param_begin() const
static LLVM_ABI bool isValidArgumentType(Type *ArgTy)
Return true if the specified type is valid as an argument type.
Definition Type.cpp:473
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
Type::subtype_iterator param_iterator
Type * getParamType(unsigned i) const
Parameter type accessors.
static LLVM_ABI bool isValidReturnType(Type *RetTy)
Return true if the specified type is valid as a return type.
Definition Type.cpp:468
FunctionType(const FunctionType &)=delete
ArrayRef< Type * > params() const
FunctionType & operator=(const FunctionType &)=delete
bool isVarArg() const
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Type * getReturnType() const
static LLVM_ABI FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
param_iterator param_end() const
Class to represent integer types.
static LLVM_ABI IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition Type.cpp:354
uint64_t getSignBit() const
Return a uint64_t with just the most significant bit set (the sign bit, if the value is treated as a ...
LLVM_ABI APInt getMask() const
For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
Definition Type.cpp:378
IntegerType * getExtendedType() const
Returns type twice as wide the input type.
@ MIN_INT_BITS
Minimum number of bits that can be specified.
@ MAX_INT_BITS
Maximum number of bits that can be specified.
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
uint64_t getBitMask() const
Return a bitmask with ones set for all of the bits that can be set by an unsigned version of this typ...
friend class LLVMContextImpl
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
IntegerType(LLVMContext &C, unsigned NumBits)
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
static LLVM_ABI bool isLoadableOrStorableType(Type *ElemTy)
Return true if we can load or store from a pointer to this type.
Definition Type.cpp:952
PointerType(const PointerType &)=delete
static PointerType * getUnqual(LLVMContext &C)
This constructs an opaque pointer to an object in the default address space (address space zero).
static bool classof(const Type *T)
Implement support type inquiry through isa, cast, and dyn_cast.
static LLVM_ABI bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition Type.cpp:946
PointerType & operator=(const PointerType &)=delete
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
unsigned getAddressSpace() const
Return the address space of the Pointer type.
static LLVM_ABI PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
Class to represent scalable SIMD vectors.
static ScalableVectorType * get(Type *ElementType, const ScalableVectorType *SVTy)
static ScalableVectorType * getInteger(ScalableVectorType *VTy)
static LLVM_ABI ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
Definition Type.cpp:895
static bool classof(const Type *T)
static ScalableVectorType * getExtendedElementVectorType(ScalableVectorType *VTy)
static ScalableVectorType * getHalfElementsVectorType(ScalableVectorType *VTy)
static ScalableVectorType * getSubdividedVectorType(ScalableVectorType *VTy, int NumSubdivs)
static ScalableVectorType * getDoubleElementsVectorType(ScalableVectorType *VTy)
unsigned getMinNumElements() const
Get the minimum number of elements in this vector.
ScalableVectorType(Type *ElTy, unsigned MinNumElts)
static ScalableVectorType * getTruncatedElementVectorType(ScalableVectorType *VTy)
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Class to represent struct types.
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
static std::enable_if_t< are_base_of< Type, Tys... >::value, StructType * > create(StringRef Name, Type *elt1, Tys *... elts)
LLVM_ABI bool indexValid(const Value *V) const
Definition Type.cpp:794
static LLVM_ABI StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
Definition Type.cpp:483
element_iterator element_end() const
StructType(const StructType &)=delete
ArrayRef< Type * > elements() const
LLVM_ABI void setBody(ArrayRef< Type * > Elements, bool isPacked=false)
Specify a body for an opaque identified type, which must not make the type recursive.
Definition Type.cpp:604
LLVM_ABI bool containsHomogeneousScalableVectorTypes() const
Returns true if this struct contains homogeneous scalable vector types.
Definition Type.cpp:593
LLVM_ABI Error checkBody(ArrayRef< Type * > Elements)
Return an error if the body for an opaque identified type would make it recursive.
Definition Type.cpp:626
LLVM_ABI bool containsHomogeneousTypes() const
Return true if this struct is non-empty and all element types are the same.
Definition Type.cpp:599
element_iterator element_begin() const
static LLVM_ABI StructType * getTypeByName(LLVMContext &C, StringRef Name)
Return the type with the specified name, or null if there is none by that name.
Definition Type.cpp:808
static LLVM_ABI StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
Definition Type.cpp:689
bool isPacked() const
static LLVM_ABI bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition Type.cpp:773
unsigned getNumElements() const
Random access to the elements.
LLVM_ABI bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
isSized - Return true if this is a sized type.
Definition Type.cpp:728
Type * getTypeAtIndex(unsigned N) const
StructType & operator=(const StructType &)=delete
LLVM_ABI void setName(StringRef Name)
Change the name of this type to the specified name, or to a name with a suffix if there is a collisio...
Definition Type.cpp:638
LLVM_ABI bool isLayoutIdentical(StructType *Other) const
Return true if this is layout identical to the specified struct.
Definition Type.cpp:779
LLVM_ABI bool isScalableTy() const
Definition Type.cpp:73
LLVM_ABI Error setBodyOrError(ArrayRef< Type * > Elements, bool isPacked=false)
Specify a body for an opaque identified type or return an error if it would make the type recursive.
Definition Type.cpp:608
LLVM_ABI Type * getTypeAtIndex(const Value *V) const
Given an index value into the type, return the type of the element.
Definition Type.cpp:788
bool hasName() const
Return true if this is a named struct that has a non-empty name.
bool isLiteral() const
Return true if this type is uniqued by structural equivalence, false if it is a struct definition.
bool indexValid(unsigned Idx) const
LLVM_ABI bool containsNonLocalTargetExtType() const
Definition Type.cpp:105
LLVM_ABI bool containsNonGlobalTargetExtType() const
Definition Type.cpp:89
bool isOpaque() const
Return true if this is a type with an identity that has no body specified yet.
Type * getElementType(unsigned N) const
Type::subtype_iterator element_iterator
static std::enable_if_t< are_base_of< Type, Tys... >::value, StructType * > get(Type *elt1, Tys *... elts)
This static method is a convenience method for creating structure types by specifying the elements as...
LLVM_ABI StringRef getName() const
Return the name for this struct type if it has an identity.
Definition Type.cpp:766
ArrayRef< Type * > type_params() const
Return the type parameters for this particular target extension type.
unsigned getNumIntParameters() const
type_param_iterator type_param_end() const
Type::subtype_iterator type_param_iterator
static LLVM_ABI TargetExtType * get(LLVMContext &Context, StringRef Name, ArrayRef< Type * > Types={}, ArrayRef< unsigned > Ints={})
Return a target extension type having the specified name and optional type and integer parameters.
Definition Type.cpp:978
Type * getTypeParameter(unsigned i) const
unsigned getNumTypeParameters() const
ArrayRef< unsigned > int_params() const
Return the integer parameters for this particular target extension type.
type_param_iterator type_param_begin() const
static LLVM_ABI Expected< TargetExtType * > checkParams(TargetExtType *TTy)
Check that a newly created target extension type has the expected number of type parameters and integ...
Definition Type.cpp:1012
unsigned getIntParameter(unsigned i) const
TargetExtType(const TargetExtType &)=delete
LLVM_ABI bool hasProperty(Property Prop) const
Returns true if the target extension type contains the given property.
Definition Type.cpp:1148
TargetExtType & operator=(const TargetExtType &)=delete
@ IsTokenLike
In particular, it cannot be used in select and phi instructions.
@ HasZeroInit
zeroinitializer is valid for this target extension type.
@ CanBeVectorElement
This type may be used as an element in a vector.
@ CanBeGlobal
This type may be used as the value type of a global variable.
@ CanBeLocal
This type may be allocated on the stack, either as the allocated type of an alloca instruction or as ...
StringRef getName() const
Return the name for this target extension type.
static LLVM_ABI Expected< TargetExtType * > getOrError(LLVMContext &Context, StringRef Name, ArrayRef< Type * > Types={}, ArrayRef< unsigned > Ints={})
Return a target extension type having the specified name and optional type and integer parameters,...
Definition Type.cpp:984
LLVM_ABI Type * getLayoutType() const
Returns an underlying layout type for the target extension type.
Definition Type.cpp:1144
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
LLVM_ABI unsigned getIntegerBitWidth() const
LLVM_ABI Type * getStructElementType(unsigned N) const
LLVM_ABI bool containsNonGlobalTargetExtType(SmallPtrSetImpl< const Type * > &Visited) const
Return true if this type is or contains a target extension type that disallows being used as a global...
Definition Type.cpp:78
LLVM_ABI bool containsNonLocalTargetExtType(SmallPtrSetImpl< const Type * > &Visited) const
Return true if this type is or contains a target extension type that disallows being used as a local.
Definition Type.cpp:94
LLVM_ABI bool isScalableTy(SmallPtrSetImpl< const Type * > &Visited) const
Return true if this is a type whose size is a known multiple of vscale.
Definition Type.cpp:65
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Definition Type.h:263
LLVM_ABI StringRef getStructName() const
Type *const * subtype_iterator
Definition Type.h:379
LLVM_ABI unsigned getStructNumElements() const
LLVM_ABI unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
LLVM_ABI uint64_t getArrayNumElements() const
TypeID
Definitions of all of the base types for the Type system.
Definition Type.h:55
@ FunctionTyID
Functions.
Definition Type.h:73
@ ArrayTyID
Arrays.
Definition Type.h:76
@ TargetExtTyID
Target extension type.
Definition Type.h:80
@ ScalableVectorTyID
Scalable SIMD vector type.
Definition Type.h:78
@ FloatTyID
32-bit floating point type
Definition Type.h:59
@ StructTyID
Structures.
Definition Type.h:75
@ IntegerTyID
Arbitrary bit width integers.
Definition Type.h:71
@ FixedVectorTyID
Fixed width SIMD vector type.
Definition Type.h:77
@ DoubleTyID
64-bit floating point type
Definition Type.h:60
@ ByteTyID
Arbitrary bit width bytes.
Definition Type.h:72
@ PointerTyID
Pointers.
Definition Type.h:74
unsigned getNumContainedTypes() const
Return the number of types in the derived type.
Definition Type.h:405
unsigned NumContainedTys
Keeps track of how many Type*'s there are in the ContainedTys list.
Definition Type.h:108
LLVM_ABI StringRef getTargetExtName() const
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
Definition Type.h:370
Type(LLVMContext &C, TypeID tid)
Definition Type.h:95
LLVM_ABI TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
Definition Type.cpp:201
LLVM_ABI Type * getWithNewBitWidth(unsigned NewBitWidth) const
Given an integer or vector type, change the lane bitwidth to NewBitwidth, whilst keeping the old numb...
LLVM_ABI Type * getWithNewType(Type *EltTy) const
Given vector type, change the element type, whilst keeping the old number of elements.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition Type.h:130
Type *const * ContainedTys
A pointer to the array of Types contained by this Type.
Definition Type.h:115
unsigned getSubclassData() const
Definition Type.h:99
LLVM_ABI bool isFunctionVarArg() const
LLVM_ABI unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
Definition Type.cpp:236
void setSubclassData(unsigned val)
Definition Type.h:101
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
Definition Type.h:186
LLVM_ABI unsigned getByteBitWidth() const
LLVM_ABI Type * getExtendedType() const
Given scalar/vector integer type, returns a type with elements twice as wide as in the original type.
TypeID getTypeID() const
Return the type id for the type.
Definition Type.h:138
LLVM_ABI Type * getFunctionParamType(unsigned i) const
static LLVM_ABI IntegerType * getIntNTy(LLVMContext &C, unsigned N)
Definition Type.cpp:317
Type * getContainedType(unsigned i) const
This method is used to implement the type iterator (defined at the end of the file).
Definition Type.h:399
static LLVM_ABI Type * getFloatTy(LLVMContext &C)
Definition Type.cpp:290
static LLVM_ABI Type * getHalfTy(LLVMContext &C)
Definition Type.cpp:288
LLVM_ABI unsigned getFunctionNumParams() const
LLVM Value Representation.
Definition Value.h:75
Base class of all SIMD vector types.
static VectorType * getHalfElementsVectorType(VectorType *VTy)
This static method returns a VectorType with half as many elements as the input type and the same ele...
LLVM_ABI VectorType(Type *ElType, unsigned EQ, Type::TypeID TID)
Definition Type.cpp:845
static VectorType * getExtendedElementVectorType(VectorType *VTy)
This static method is like getInteger except that the element types are twice as wide as the elements...
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
static VectorType * getOneNthElementsVectorType(VectorType *VTy, unsigned Denominator)
ElementCount getElementCount() const
Return an ElementCount instance to represent the (possibly scalable) number of elements in the vector...
static VectorType * getSubdividedVectorType(VectorType *VTy, int NumSubdivs)
static VectorType * getInteger(VectorType *VTy)
This static method gets a VectorType with the same number of elements as the input type,...
const unsigned ElementQuantity
The element quantity of this vector.
static VectorType * get(Type *ElementType, const VectorType *Other)
static VectorType * getTruncatedElementVectorType(VectorType *VTy)
VectorType & operator=(const VectorType &)=delete
static LLVM_ABI VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
static VectorType * getDoubleElementsVectorType(VectorType *VTy)
This static method returns a VectorType with twice as many elements as the input type and the same el...
static VectorType * getWithSizeAndScalar(VectorType *SizeTy, Type *EltTy)
This static method attempts to construct a VectorType with the same size-in-bits as SizeTy but with a...
static LLVM_ABI bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
static VectorType * get(Type *ElementType, unsigned NumElements, bool Scalable)
VectorType(const VectorType &)=delete
Type * getElementType() const
constexpr bool isKnownMultipleOf(ScalarTy RHS) const
This function tells the caller whether the element count is known at compile time to be a multiple of...
Definition TypeSize.h:180
constexpr ScalarTy getFixedValue() const
Definition TypeSize.h:200
constexpr LeafTy multiplyCoefficientBy(ScalarTy RHS) const
Definition TypeSize.h:256
constexpr LeafTy divideCoefficientBy(ScalarTy RHS) const
We do not provide the '/' operator here because division for polynomial types does not work in the sa...
Definition TypeSize.h:252
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
@ Other
Any other memory.
Definition ModRef.h:68
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
std::conjunction< std::is_base_of< T, Ts >... > are_base_of
traits class for checking whether type T is a base class for all the given types in the variadic list...
Definition STLExtras.h:115
#define N
#define EQ(a, b)
Definition regexec.c:65