LLVM  14.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"
24 #include "llvm/Support/Casting.h"
25 #include "llvm/Support/Compiler.h"
26 #include "llvm/Support/TypeSize.h"
27 #include <cassert>
28 #include <cstdint>
29 
30 namespace llvm {
31 
32 class Value;
33 class APInt;
34 class LLVMContext;
35 
36 /// Class to represent integer types. Note that this class is also used to
37 /// represent the built-in integer types: Int1Ty, Int8Ty, Int16Ty, Int32Ty and
38 /// Int64Ty.
39 /// Integer representation type
40 class IntegerType : public Type {
41  friend class LLVMContextImpl;
42 
43 protected:
44  explicit IntegerType(LLVMContext &C, unsigned NumBits) : Type(C, IntegerTyID){
45  setSubclassData(NumBits);
46  }
47 
48 public:
49  /// This enum is just used to hold constants we need for IntegerType.
50  enum {
51  MIN_INT_BITS = 1, ///< Minimum number of bits that can be specified
52  MAX_INT_BITS = (1<<23) ///< Maximum number of bits that can be specified
53  ///< Note that bit width is stored in the Type classes SubclassData field
54  ///< which has 24 bits. SelectionDAG type legalization can require a
55  ///< power of 2 IntegerType, so limit to the largest representable power
56  ///< of 2, 8388608.
57  };
58 
59  /// This static method is the primary way of constructing an IntegerType.
60  /// If an IntegerType with the same NumBits value was previously instantiated,
61  /// that instance will be returned. Otherwise a new one will be created. Only
62  /// one instance with a given NumBits value is ever created.
63  /// Get or create an IntegerType instance.
64  static IntegerType *get(LLVMContext &C, unsigned NumBits);
65 
66  /// Returns type twice as wide the input type.
69  }
70 
71  /// Get the number of bits in this IntegerType
72  unsigned getBitWidth() const { return getSubclassData(); }
73 
74  /// Return a bitmask with ones set for all of the bits that can be set by an
75  /// unsigned version of this type. This is 0xFF for i8, 0xFFFF for i16, etc.
76  uint64_t getBitMask() const {
77  return ~uint64_t(0UL) >> (64-getBitWidth());
78  }
79 
80  /// Return a uint64_t with just the most significant bit set (the sign bit, if
81  /// the value is treated as a signed number).
82  uint64_t getSignBit() const {
83  return 1ULL << (getBitWidth()-1);
84  }
85 
86  /// For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
87  /// @returns a bit mask with ones set for all the bits of this type.
88  /// Get a bit mask for this type.
89  APInt getMask() const;
90 
91  /// Methods for support type inquiry through isa, cast, and dyn_cast.
92  static bool classof(const Type *T) {
93  return T->getTypeID() == IntegerTyID;
94  }
95 };
96 
97 unsigned Type::getIntegerBitWidth() const {
98  return cast<IntegerType>(this)->getBitWidth();
99 }
100 
101 /// Class to represent function types
102 ///
103 class FunctionType : public Type {
104  FunctionType(Type *Result, ArrayRef<Type*> Params, bool IsVarArgs);
105 
106 public:
107  FunctionType(const FunctionType &) = delete;
108  FunctionType &operator=(const FunctionType &) = delete;
109 
110  /// This static method is the primary way of constructing a FunctionType.
111  static FunctionType *get(Type *Result,
112  ArrayRef<Type*> Params, bool isVarArg);
113 
114  /// Create a FunctionType taking no parameters.
115  static FunctionType *get(Type *Result, bool isVarArg);
116 
117  /// Return true if the specified type is valid as a return type.
118  static bool isValidReturnType(Type *RetTy);
119 
120  /// Return true if the specified type is valid as an argument type.
121  static bool isValidArgumentType(Type *ArgTy);
122 
123  bool isVarArg() const { return getSubclassData()!=0; }
124  Type *getReturnType() const { return ContainedTys[0]; }
125 
127 
128  param_iterator param_begin() const { return ContainedTys + 1; }
131  return makeArrayRef(param_begin(), param_end());
132  }
133 
134  /// Parameter type accessors.
135  Type *getParamType(unsigned i) const { return ContainedTys[i+1]; }
136 
137  /// Return the number of fixed parameters this function type requires.
138  /// This does not consider varargs.
139  unsigned getNumParams() const { return NumContainedTys - 1; }
140 
141  /// Methods for support type inquiry through isa, cast, and dyn_cast.
142  static bool classof(const Type *T) {
143  return T->getTypeID() == FunctionTyID;
144  }
145 };
146 static_assert(alignof(FunctionType) >= alignof(Type *),
147  "Alignment sufficient for objects appended to FunctionType");
148 
150  return cast<FunctionType>(this)->isVarArg();
151 }
152 
154  return cast<FunctionType>(this)->getParamType(i);
155 }
156 
157 unsigned Type::getFunctionNumParams() const {
158  return cast<FunctionType>(this)->getNumParams();
159 }
160 
161 /// A handy container for a FunctionType+Callee-pointer pair, which can be
162 /// passed around as a single entity. This assists in replacing the use of
163 /// PointerType::getElementType() to access the function's type, since that's
164 /// slated for removal as part of the [opaque pointer types] project.
166 public:
167  // Allow implicit conversion from types which have a getFunctionType member
168  // (e.g. Function and InlineAsm).
169  template <typename T, typename U = decltype(&T::getFunctionType)>
171  : FnTy(Fn ? Fn->getFunctionType() : nullptr), Callee(Fn) {}
172 
174  : FnTy(FnTy), Callee(Callee) {
175  assert((FnTy == nullptr) == (Callee == nullptr));
176  }
177 
178  FunctionCallee(std::nullptr_t) {}
179 
180  FunctionCallee() = default;
181 
182  FunctionType *getFunctionType() { return FnTy; }
183 
184  Value *getCallee() { return Callee; }
185 
186  explicit operator bool() { return Callee; }
187 
188 private:
189  FunctionType *FnTy = nullptr;
190  Value *Callee = nullptr;
191 };
192 
193 /// Class to represent struct types. There are two different kinds of struct
194 /// types: Literal structs and Identified structs.
195 ///
196 /// Literal struct types (e.g. { i32, i32 }) are uniqued structurally, and must
197 /// always have a body when created. You can get one of these by using one of
198 /// the StructType::get() forms.
199 ///
200 /// Identified structs (e.g. %foo or %42) may optionally have a name and are not
201 /// uniqued. The names for identified structs are managed at the LLVMContext
202 /// level, so there can only be a single identified struct with a given name in
203 /// a particular LLVMContext. Identified structs may also optionally be opaque
204 /// (have no body specified). You get one of these by using one of the
205 /// StructType::create() forms.
206 ///
207 /// Independent of what kind of struct you have, the body of a struct type are
208 /// laid out in memory consecutively with the elements directly one after the
209 /// other (if the struct is packed) or (if not packed) with padding between the
210 /// elements as defined by DataLayout (which is required to match what the code
211 /// generator for a target expects).
212 ///
213 class StructType : public Type {
215 
216  enum {
217  /// This is the contents of the SubClassData field.
218  SCDB_HasBody = 1,
219  SCDB_Packed = 2,
220  SCDB_IsLiteral = 4,
221  SCDB_IsSized = 8
222  };
223 
224  /// For a named struct that actually has a name, this is a pointer to the
225  /// symbol table entry (maintained by LLVMContext) for the struct.
226  /// This is null if the type is an literal struct or if it is a identified
227  /// type that has an empty name.
228  void *SymbolTableEntry = nullptr;
229 
230 public:
231  StructType(const StructType &) = delete;
232  StructType &operator=(const StructType &) = delete;
233 
234  /// This creates an identified struct.
237 
238  static StructType *create(ArrayRef<Type *> Elements, StringRef Name,
239  bool isPacked = false);
240  static StructType *create(ArrayRef<Type *> Elements);
242  StringRef Name, bool isPacked = false);
244  template <class... Tys>
245  static std::enable_if_t<are_base_of<Type, Tys...>::value, StructType *>
246  create(StringRef Name, Type *elt1, Tys *... elts) {
247  assert(elt1 && "Cannot create a struct type with no elements with this");
248  return create(ArrayRef<Type *>({elt1, elts...}), Name);
249  }
250 
251  /// This static method is the primary way to create a literal StructType.
252  static StructType *get(LLVMContext &Context, ArrayRef<Type*> Elements,
253  bool isPacked = false);
254 
255  /// Create an empty structure type.
256  static StructType *get(LLVMContext &Context, bool isPacked = false);
257 
258  /// This static method is a convenience method for creating structure types by
259  /// specifying the elements as arguments. Note that this method always returns
260  /// a non-packed struct, and requires at least one element type.
261  template <class... Tys>
262  static std::enable_if_t<are_base_of<Type, Tys...>::value, StructType *>
263  get(Type *elt1, Tys *... elts) {
264  assert(elt1 && "Cannot create a struct type with no elements with this");
265  LLVMContext &Ctx = elt1->getContext();
266  return StructType::get(Ctx, ArrayRef<Type *>({elt1, elts...}));
267  }
268 
269  /// Return the type with the specified name, or null if there is none by that
270  /// name.
272 
273  bool isPacked() const { return (getSubclassData() & SCDB_Packed) != 0; }
274 
275  /// Return true if this type is uniqued by structural equivalence, false if it
276  /// is a struct definition.
277  bool isLiteral() const { return (getSubclassData() & SCDB_IsLiteral) != 0; }
278 
279  /// Return true if this is a type with an identity that has no body specified
280  /// yet. These prints as 'opaque' in .ll files.
281  bool isOpaque() const { return (getSubclassData() & SCDB_HasBody) == 0; }
282 
283  /// isSized - Return true if this is a sized type.
284  bool isSized(SmallPtrSetImpl<Type *> *Visited = nullptr) const;
285 
286  /// Returns true if this struct contains a scalable vector.
287  bool containsScalableVectorType() const;
288 
289  /// Return true if this is a named struct that has a non-empty name.
290  bool hasName() const { return SymbolTableEntry != nullptr; }
291 
292  /// Return the name for this struct type if it has an identity.
293  /// This may return an empty string for an unnamed struct type. Do not call
294  /// this on an literal type.
295  StringRef getName() const;
296 
297  /// Change the name of this type to the specified name, or to a name with a
298  /// suffix if there is a collision. Do not call this on an literal type.
299  void setName(StringRef Name);
300 
301  /// Specify a body for an opaque identified type.
302  void setBody(ArrayRef<Type*> Elements, bool isPacked = false);
303 
304  template <typename... Tys>
305  std::enable_if_t<are_base_of<Type, Tys...>::value, void>
306  setBody(Type *elt1, Tys *... elts) {
307  assert(elt1 && "Cannot create a struct type with no elements with this");
308  setBody(ArrayRef<Type *>({elt1, elts...}));
309  }
310 
311  /// Return true if the specified type is valid as a element type.
312  static bool isValidElementType(Type *ElemTy);
313 
314  // Iterator access to the elements.
316 
321  }
322 
323  /// Return true if this is layout identical to the specified struct.
324  bool isLayoutIdentical(StructType *Other) const;
325 
326  /// Random access to the elements
327  unsigned getNumElements() const { return NumContainedTys; }
328  Type *getElementType(unsigned N) const {
329  assert(N < NumContainedTys && "Element number out of range!");
330  return ContainedTys[N];
331  }
332  /// Given an index value into the type, return the type of the element.
333  Type *getTypeAtIndex(const Value *V) const;
334  Type *getTypeAtIndex(unsigned N) const { return getElementType(N); }
335  bool indexValid(const Value *V) const;
336  bool indexValid(unsigned Idx) const { return Idx < getNumElements(); }
337 
338  /// Methods for support type inquiry through isa, cast, and dyn_cast.
339  static bool classof(const Type *T) {
340  return T->getTypeID() == StructTyID;
341  }
342 };
343 
345  return cast<StructType>(this)->getName();
346 }
347 
348 unsigned Type::getStructNumElements() const {
349  return cast<StructType>(this)->getNumElements();
350 }
351 
353  return cast<StructType>(this)->getElementType(N);
354 }
355 
356 /// Class to represent array types.
357 class ArrayType : public Type {
358  /// The element type of the array.
359  Type *ContainedType;
360  /// Number of elements in the array.
361  uint64_t NumElements;
362 
363  ArrayType(Type *ElType, uint64_t NumEl);
364 
365 public:
366  ArrayType(const ArrayType &) = delete;
367  ArrayType &operator=(const ArrayType &) = delete;
368 
369  uint64_t getNumElements() const { return NumElements; }
370  Type *getElementType() const { return ContainedType; }
371 
372  /// This static method is the primary way to construct an ArrayType
373  static ArrayType *get(Type *ElementType, uint64_t NumElements);
374 
375  /// Return true if the specified type is valid as a element type.
376  static bool isValidElementType(Type *ElemTy);
377 
378  /// Methods for support type inquiry through isa, cast, and dyn_cast.
379  static bool classof(const Type *T) {
380  return T->getTypeID() == ArrayTyID;
381  }
382 };
383 
385  return cast<ArrayType>(this)->getNumElements();
386 }
387 
388 /// Base class of all SIMD vector types
389 class VectorType : public Type {
390  /// A fully specified VectorType is of the form <vscale x n x Ty>. 'n' is the
391  /// minimum number of elements of type Ty contained within the vector, and
392  /// 'vscale x' indicates that the total element count is an integer multiple
393  /// of 'n', where the multiple is either guaranteed to be one, or is
394  /// statically unknown at compile time.
395  ///
396  /// If the multiple is known to be 1, then the extra term is discarded in
397  /// textual IR:
398  ///
399  /// <4 x i32> - a vector containing 4 i32s
400  /// <vscale x 4 x i32> - a vector containing an unknown integer multiple
401  /// of 4 i32s
402 
403  /// The element type of the vector.
404  Type *ContainedType;
405 
406 protected:
407  /// The element quantity of this vector. The meaning of this value depends
408  /// on the type of vector:
409  /// - For FixedVectorType = <ElementQuantity x ty>, there are
410  /// exactly ElementQuantity elements in this vector.
411  /// - For ScalableVectorType = <vscale x ElementQuantity x ty>,
412  /// there are vscale * ElementQuantity elements in this vector, where
413  /// vscale is a runtime-constant integer greater than 0.
414  const unsigned ElementQuantity;
415 
416  VectorType(Type *ElType, unsigned EQ, Type::TypeID TID);
417 
418 public:
419  VectorType(const VectorType &) = delete;
420  VectorType &operator=(const VectorType &) = delete;
421 
422  Type *getElementType() const { return ContainedType; }
423 
424  /// This static method is the primary way to construct an VectorType.
425  static VectorType *get(Type *ElementType, ElementCount EC);
426 
427  static VectorType *get(Type *ElementType, unsigned NumElements,
428  bool Scalable) {
429  return VectorType::get(ElementType,
430  ElementCount::get(NumElements, Scalable));
431  }
432 
433  static VectorType *get(Type *ElementType, const VectorType *Other) {
434  return VectorType::get(ElementType, Other->getElementCount());
435  }
436 
437  /// This static method gets a VectorType with the same number of elements as
438  /// the input type, and the element type is an integer type of the same width
439  /// as the input element type.
441  unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
442  assert(EltBits && "Element size must be of a non-zero size");
443  Type *EltTy = IntegerType::get(VTy->getContext(), EltBits);
444  return VectorType::get(EltTy, VTy->getElementCount());
445  }
446 
447  /// This static method is like getInteger except that the element types are
448  /// twice as wide as the elements in the input type.
450  assert(VTy->isIntOrIntVectorTy() && "VTy expected to be a vector of ints.");
451  auto *EltTy = cast<IntegerType>(VTy->getElementType());
452  return VectorType::get(EltTy->getExtendedType(), VTy->getElementCount());
453  }
454 
455  // This static method gets a VectorType with the same number of elements as
456  // the input type, and the element type is an integer or float type which
457  // is half as wide as the elements in the input type.
459  Type *EltTy;
460  if (VTy->getElementType()->isFloatingPointTy()) {
461  switch(VTy->getElementType()->getTypeID()) {
462  case DoubleTyID:
463  EltTy = Type::getFloatTy(VTy->getContext());
464  break;
465  case FloatTyID:
466  EltTy = Type::getHalfTy(VTy->getContext());
467  break;
468  default:
469  llvm_unreachable("Cannot create narrower fp vector element type");
470  }
471  } else {
472  unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
473  assert((EltBits & 1) == 0 &&
474  "Cannot truncate vector element with odd bit-width");
475  EltTy = IntegerType::get(VTy->getContext(), EltBits / 2);
476  }
477  return VectorType::get(EltTy, VTy->getElementCount());
478  }
479 
480  // This static method returns a VectorType with a smaller number of elements
481  // of a larger type than the input element type. For example, a <16 x i8>
482  // subdivided twice would return <4 x i32>
483  static VectorType *getSubdividedVectorType(VectorType *VTy, int NumSubdivs) {
484  for (int i = 0; i < NumSubdivs; ++i) {
487  }
488  return VTy;
489  }
490 
491  /// This static method returns a VectorType with half as many elements as the
492  /// input type and the same element type.
494  auto EltCnt = VTy->getElementCount();
495  assert(EltCnt.isKnownEven() &&
496  "Cannot halve vector with odd number of elements.");
497  return VectorType::get(VTy->getElementType(),
498  EltCnt.divideCoefficientBy(2));
499  }
500 
501  /// This static method returns a VectorType with twice as many elements as the
502  /// input type and the same element type.
504  auto EltCnt = VTy->getElementCount();
505  assert((EltCnt.getKnownMinValue() * 2ull) <= UINT_MAX &&
506  "Too many elements in vector");
507  return VectorType::get(VTy->getElementType(), EltCnt * 2);
508  }
509 
510  /// Return true if the specified type is valid as a element type.
511  static bool isValidElementType(Type *ElemTy);
512 
513  /// Return an ElementCount instance to represent the (possibly scalable)
514  /// number of elements in the vector.
515  inline ElementCount getElementCount() const;
516 
517  /// Methods for support type inquiry through isa, cast, and dyn_cast.
518  static bool classof(const Type *T) {
519  return T->getTypeID() == FixedVectorTyID ||
520  T->getTypeID() == ScalableVectorTyID;
521  }
522 };
523 
524 /// Class to represent fixed width SIMD vectors
525 class FixedVectorType : public VectorType {
526 protected:
527  FixedVectorType(Type *ElTy, unsigned NumElts)
528  : VectorType(ElTy, NumElts, FixedVectorTyID) {}
529 
530 public:
531  static FixedVectorType *get(Type *ElementType, unsigned NumElts);
532 
533  static FixedVectorType *get(Type *ElementType, const FixedVectorType *FVTy) {
534  return get(ElementType, FVTy->getNumElements());
535  }
536 
538  return cast<FixedVectorType>(VectorType::getInteger(VTy));
539  }
540 
542  return cast<FixedVectorType>(VectorType::getExtendedElementVectorType(VTy));
543  }
544 
546  return cast<FixedVectorType>(
548  }
549 
551  int NumSubdivs) {
552  return cast<FixedVectorType>(
553  VectorType::getSubdividedVectorType(VTy, NumSubdivs));
554  }
555 
557  return cast<FixedVectorType>(VectorType::getHalfElementsVectorType(VTy));
558  }
559 
561  return cast<FixedVectorType>(VectorType::getDoubleElementsVectorType(VTy));
562  }
563 
564  static bool classof(const Type *T) {
565  return T->getTypeID() == FixedVectorTyID;
566  }
567 
568  unsigned getNumElements() const { return ElementQuantity; }
569 };
570 
571 /// Class to represent scalable SIMD vectors
573 protected:
574  ScalableVectorType(Type *ElTy, unsigned MinNumElts)
575  : VectorType(ElTy, MinNumElts, ScalableVectorTyID) {}
576 
577 public:
578  static ScalableVectorType *get(Type *ElementType, unsigned MinNumElts);
579 
580  static ScalableVectorType *get(Type *ElementType,
581  const ScalableVectorType *SVTy) {
582  return get(ElementType, SVTy->getMinNumElements());
583  }
584 
586  return cast<ScalableVectorType>(VectorType::getInteger(VTy));
587  }
588 
589  static ScalableVectorType *
591  return cast<ScalableVectorType>(
593  }
594 
595  static ScalableVectorType *
597  return cast<ScalableVectorType>(
599  }
600 
602  int NumSubdivs) {
603  return cast<ScalableVectorType>(
604  VectorType::getSubdividedVectorType(VTy, NumSubdivs));
605  }
606 
607  static ScalableVectorType *
609  return cast<ScalableVectorType>(VectorType::getHalfElementsVectorType(VTy));
610  }
611 
612  static ScalableVectorType *
614  return cast<ScalableVectorType>(
616  }
617 
618  /// Get the minimum number of elements in this vector. The actual number of
619  /// elements in the vector is an integer multiple of this value.
621 
622  static bool classof(const Type *T) {
623  return T->getTypeID() == ScalableVectorTyID;
624  }
625 };
626 
628  return ElementCount::get(ElementQuantity, isa<ScalableVectorType>(this));
629 }
630 
631 /// Class to represent pointers.
632 class PointerType : public Type {
633  explicit PointerType(Type *ElType, unsigned AddrSpace);
634  explicit PointerType(LLVMContext &C, unsigned AddrSpace);
635 
636  Type *PointeeTy;
637 
638 public:
639  PointerType(const PointerType &) = delete;
640  PointerType &operator=(const PointerType &) = delete;
641 
642  /// This constructs a pointer to an object of the specified type in a numbered
643  /// address space.
644  static PointerType *get(Type *ElementType, unsigned AddressSpace);
645  /// This constructs an opaque pointer to an object in a numbered address
646  /// space.
647  static PointerType *get(LLVMContext &C, unsigned AddressSpace);
648 
649  /// This constructs a pointer to an object of the specified type in the
650  /// default address space (address space zero).
651  static PointerType *getUnqual(Type *ElementType) {
652  return PointerType::get(ElementType, 0);
653  }
654 
655  /// This constructs an opaque pointer to an object in the
656  /// default address space (address space zero).
658  return PointerType::get(C, 0);
659  }
660 
661  /// This constructs a pointer type with the same pointee type as input
662  /// PointerType (or opaque pointer is the input PointerType is opaque) and the
663  /// given address space. This is only useful during the opaque pointer
664  /// transition.
665  /// TODO: remove after opaque pointer transition is complete.
667  unsigned AddressSpace) {
668  if (PT->isOpaque())
669  return get(PT->getContext(), AddressSpace);
670  return get(PT->getElementType(), AddressSpace);
671  }
672 
673  Type *getElementType() const {
674  assert(!isOpaque() && "Attempting to get element type of opaque pointer");
675  return PointeeTy;
676  }
677 
678  bool isOpaque() const { return !PointeeTy; }
679 
680  /// Return true if the specified type is valid as a element type.
681  static bool isValidElementType(Type *ElemTy);
682 
683  /// Return true if we can load or store from a pointer to this type.
684  static bool isLoadableOrStorableType(Type *ElemTy);
685 
686  /// Return the address space of the Pointer type.
687  inline unsigned getAddressSpace() const { return getSubclassData(); }
688 
689  /// Return true if either this is an opaque pointer type or if this pointee
690  /// type matches Ty. Primarily used for checking if an instruction's pointer
691  /// operands are valid types. Will be useless after non-opaque pointers are
692  /// removed.
694  return isOpaque() || PointeeTy == Ty;
695  }
696 
697  /// Return true if both pointer types have the same element type. Two opaque
698  /// pointers are considered to have the same element type, while an opaque
699  /// and a non-opaque pointer have different element types.
700  /// TODO: Remove after opaque pointer transition is complete.
702  return PointeeTy == Other->PointeeTy;
703  }
704 
705  /// Implement support type inquiry through isa, cast, and dyn_cast.
706  static bool classof(const Type *T) {
707  return T->getTypeID() == PointerTyID;
708  }
709 };
710 
712  assert(
713  isIntOrIntVectorTy() &&
714  "Original type expected to be a vector of integers or a scalar integer.");
715  if (auto *VTy = dyn_cast<VectorType>(this))
717  const_cast<VectorType *>(VTy));
718  return cast<IntegerType>(this)->getExtendedType();
719 }
720 
722  if (auto *VTy = dyn_cast<VectorType>(this))
723  return VectorType::get(EltTy, VTy->getElementCount());
724  return EltTy;
725 }
726 
727 Type *Type::getWithNewBitWidth(unsigned NewBitWidth) const {
728  assert(
729  isIntOrIntVectorTy() &&
730  "Original type expected to be a vector of integers or a scalar integer.");
731  return getWithNewType(getIntNTy(getContext(), NewBitWidth));
732 }
733 
735  return cast<PointerType>(getScalarType())->getAddressSpace();
736 }
737 
738 } // end namespace llvm
739 
740 #endif // LLVM_IR_DERIVEDTYPES_H
i
i
Definition: README.txt:29
llvm::Type::isFunctionVarArg
bool isFunctionVarArg() const
Definition: DerivedTypes.h:149
llvm::Type::ArrayTyID
@ ArrayTyID
Arrays.
Definition: Type.h:75
llvm::ScalableVectorType::getInteger
static ScalableVectorType * getInteger(ScalableVectorType *VTy)
Definition: DerivedTypes.h:585
llvm::Type::FloatTyID
@ FloatTyID
32-bit floating point type
Definition: Type.h:58
llvm::ScalableVectorType
Class to represent scalable SIMD vectors.
Definition: DerivedTypes.h:572
llvm::VectorType::getSubdividedVectorType
static VectorType * getSubdividedVectorType(VectorType *VTy, int NumSubdivs)
Definition: DerivedTypes.h:483
llvm::Type::DoubleTyID
@ DoubleTyID
64-bit floating point type
Definition: Type.h:59
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::PointerType::isValidElementType
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition: Type.cpp:780
llvm::StructType::getName
StringRef getName() const
Return the name for this struct type if it has an identity.
Definition: Type.cpp:583
llvm::StructType::get
static 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:408
llvm::Type::getFunctionNumParams
unsigned getFunctionNumParams() const
Definition: DerivedTypes.h:157
FunctionType
Definition: ItaniumDemangle.h:783
llvm::ElementCount
Definition: TypeSize.h:386
llvm::VectorType::classof
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:518
llvm::PointerType::getElementType
Type * getElementType() const
Definition: DerivedTypes.h:673
StringRef.h
llvm::VectorType::getDoubleElementsVectorType
static VectorType * getDoubleElementsVectorType(VectorType *VTy)
This static method returns a VectorType with twice as many elements as the input type and the same el...
Definition: DerivedTypes.h:503
llvm::PointerType::get
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
Definition: Type.cpp:729
llvm::StructType::element_iterator
Type::subtype_iterator element_iterator
Definition: DerivedTypes.h:315
llvm::StructType::setBody
void setBody(ArrayRef< Type * > Elements, bool isPacked=false)
Specify a body for an opaque identified type.
Definition: Type.cpp:447
llvm::Type::getScalarType
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
Definition: Type.h:308
TypeSize.h
llvm::VectorType::ElementQuantity
const unsigned ElementQuantity
The element quantity of this vector.
Definition: DerivedTypes.h:414
llvm::StructType::get
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...
Definition: DerivedTypes.h:263
llvm::Type::getPointerAddressSpace
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
Definition: DerivedTypes.h:734
llvm::PointerType::getAddressSpace
unsigned getAddressSpace() const
Return the address space of the Pointer type.
Definition: DerivedTypes.h:687
llvm::FunctionType::get
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
Definition: Type.cpp:363
llvm::Type::getSubclassData
unsigned getSubclassData() const
Definition: Type.h:96
llvm::Type::getTypeID
TypeID getTypeID() const
Return the type id for the type.
Definition: Type.h:135
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::FunctionCallee::FunctionCallee
FunctionCallee(FunctionType *FnTy, Value *Callee)
Definition: DerivedTypes.h:173
llvm::StructType::getTypeByName
static 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:625
llvm::IntegerType::getBitMask
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...
Definition: DerivedTypes.h:76
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::StructType::indexValid
bool indexValid(unsigned Idx) const
Definition: DerivedTypes.h:336
llvm::VectorType::getElementType
Type * getElementType() const
Definition: DerivedTypes.h:422
llvm::FunctionType::getNumParams
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
Definition: DerivedTypes.h:139
STLExtras.h
llvm::Type::subtype_iterator
Type *const * subtype_iterator
Definition: Type.h:317
llvm::ArrayType
Class to represent array types.
Definition: DerivedTypes.h:357
llvm::StructType::create
static StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
Definition: Type.cpp:515
llvm::ScalableVectorType::ScalableVectorType
ScalableVectorType(Type *ElTy, unsigned MinNumElts)
Definition: DerivedTypes.h:574
llvm::Type::isFloatingPointTy
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
Definition: Type.h:162
llvm::PointerType::getUnqual
static PointerType * getUnqual(LLVMContext &C)
This constructs an opaque pointer to an object in the default address space (address space zero).
Definition: DerivedTypes.h:657
llvm::FixedVectorType
Class to represent fixed width SIMD vectors.
Definition: DerivedTypes.h:525
llvm::StructType::setName
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:464
llvm::Type::getWithNewType
Type * getWithNewType(Type *EltTy) const
Given vector type, change the element type, whilst keeping the old number of elements.
Definition: DerivedTypes.h:721
llvm::IntegerType::getExtendedType
IntegerType * getExtendedType() const
Returns type twice as wide the input type.
Definition: DerivedTypes.h:67
llvm::FunctionType::isVarArg
bool isVarArg() const
Definition: DerivedTypes.h:123
llvm::IntegerType::getMask
APInt getMask() const
For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
Definition: Type.cpp:337
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::conjunction
Definition: STLForwardCompat.h:32
llvm::FixedVectorType::getTruncatedElementVectorType
static FixedVectorType * getTruncatedElementVectorType(FixedVectorType *VTy)
Definition: DerivedTypes.h:545
llvm::FunctionType::operator=
FunctionType & operator=(const FunctionType &)=delete
llvm::PointerType::operator=
PointerType & operator=(const PointerType &)=delete
llvm::FixedVectorType::getNumElements
unsigned getNumElements() const
Definition: DerivedTypes.h:568
llvm::PointerType::isOpaqueOrPointeeTypeMatches
bool isOpaqueOrPointeeTypeMatches(Type *Ty)
Return true if either this is an opaque pointer type or if this pointee type matches Ty.
Definition: DerivedTypes.h:693
llvm::VectorType::getTruncatedElementVectorType
static VectorType * getTruncatedElementVectorType(VectorType *VTy)
Definition: DerivedTypes.h:458
llvm::LinearPolySize< ElementCount >::get
static ElementCount get(ScalarTy MinVal, bool Scalable)
Definition: TypeSize.h:290
llvm::Type::FunctionTyID
@ FunctionTyID
Functions.
Definition: Type.h:72
llvm::ArrayType::getNumElements
uint64_t getNumElements() const
Definition: DerivedTypes.h:369
llvm::ScalableVectorType::getDoubleElementsVectorType
static ScalableVectorType * getDoubleElementsVectorType(ScalableVectorType *VTy)
Definition: DerivedTypes.h:613
llvm::ScalableVectorType::getTruncatedElementVectorType
static ScalableVectorType * getTruncatedElementVectorType(ScalableVectorType *VTy)
Definition: DerivedTypes.h:596
llvm::FixedVectorType::FixedVectorType
FixedVectorType(Type *ElTy, unsigned NumElts)
Definition: DerivedTypes.h:527
llvm::StructType::isPacked
bool isPacked() const
Definition: DerivedTypes.h:273
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::LLVMContextImpl
Definition: LLVMContextImpl.h:1341
llvm::FunctionType::param_end
param_iterator param_end() const
Definition: DerivedTypes.h:129
llvm::StructType::isSized
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
isSized - Return true if this is a sized type.
Definition: Type.cpp:554
EQ
#define EQ(a, b)
Definition: regexec.c:112
llvm::VectorType::getInteger
static VectorType * getInteger(VectorType *VTy)
This static method gets a VectorType with the same number of elements as the input type,...
Definition: DerivedTypes.h:440
llvm::Type::getStructName
StringRef getStructName() const
Definition: DerivedTypes.h:344
llvm::FixedVectorType::get
static FixedVectorType * get(Type *ElementType, const FixedVectorType *FVTy)
Definition: DerivedTypes.h:533
llvm::FunctionType::isValidReturnType
static bool isValidReturnType(Type *RetTy)
Return true if the specified type is valid as a return type.
Definition: Type.cpp:393
llvm::IntegerType::IntegerType
IntegerType(LLVMContext &C, unsigned NumBits)
Definition: DerivedTypes.h:44
llvm::VectorType::getElementCount
ElementCount getElementCount() const
Return an ElementCount instance to represent the (possibly scalable) number of elements in the vector...
Definition: DerivedTypes.h:627
llvm::IntegerType
Class to represent integer types.
Definition: DerivedTypes.h:40
llvm::ArrayType::operator=
ArrayType & operator=(const ArrayType &)=delete
llvm::FunctionType::param_begin
param_iterator param_begin() const
Definition: DerivedTypes.h:128
llvm::Type::getScalarSizeInBits
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
Definition: Type.cpp:191
llvm::FunctionType::params
ArrayRef< Type * > params() const
Definition: DerivedTypes.h:130
llvm::FunctionCallee::getFunctionType
FunctionType * getFunctionType()
Definition: DerivedTypes.h:182
llvm::StructType::setBody
std::enable_if_t< are_base_of< Type, Tys... >::value, void > setBody(Type *elt1, Tys *... elts)
Definition: DerivedTypes.h:306
llvm::Type::PointerTyID
@ PointerTyID
Pointers.
Definition: Type.h:73
llvm::IntegerType::getSignBit
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 ...
Definition: DerivedTypes.h:82
llvm::FixedVectorType::get
static FixedVectorType * get(Type *ElementType, unsigned NumElts)
Definition: Type.cpp:686
llvm::PointerType::isOpaque
bool isOpaque() const
Definition: DerivedTypes.h:678
llvm::AddressSpace
AddressSpace
Definition: NVPTXBaseInfo.h:21
llvm::ScalableVectorType::getHalfElementsVectorType
static ScalableVectorType * getHalfElementsVectorType(ScalableVectorType *VTy)
Definition: DerivedTypes.h:608
llvm::VectorType::operator=
VectorType & operator=(const VectorType &)=delete
llvm::Type::getIntegerBitWidth
unsigned getIntegerBitWidth() const
Definition: DerivedTypes.h:97
Type.h
llvm::Type::getStructNumElements
unsigned getStructNumElements() const
Definition: DerivedTypes.h:348
llvm::Type::getExtendedType
Type * getExtendedType() const
Given scalar/vector integer type, returns a type with elements twice as wide as in the original type.
Definition: DerivedTypes.h:711
llvm::VectorType::isValidElementType
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition: Type.cpp:677
llvm::VectorType
Base class of all SIMD vector types.
Definition: DerivedTypes.h:389
llvm::ScalableVectorType::getExtendedElementVectorType
static ScalableVectorType * getExtendedElementVectorType(ScalableVectorType *VTy)
Definition: DerivedTypes.h:590
llvm::FixedVectorType::getExtendedElementVectorType
static FixedVectorType * getExtendedElementVectorType(FixedVectorType *VTy)
Definition: DerivedTypes.h:541
llvm::FunctionCallee::FunctionCallee
FunctionCallee(T *Fn)
Definition: DerivedTypes.h:170
llvm::FunctionType::param_iterator
Type::subtype_iterator param_iterator
Definition: DerivedTypes.h:126
llvm::PointerType::classof
static bool classof(const Type *T)
Implement support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:706
llvm::PointerType::getUnqual
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
Definition: DerivedTypes.h:651
uint64_t
llvm::Type::getWithNewBitWidth
Type * getWithNewBitWidth(unsigned NewBitWidth) const
Given an integer or vector type, change the lane bitwidth to NewBitwidth, whilst keeping the old numb...
Definition: DerivedTypes.h:727
llvm::VectorType::get
static VectorType * get(Type *ElementType, unsigned NumElements, bool Scalable)
Definition: DerivedTypes.h:427
llvm::StructType::isOpaque
bool isOpaque() const
Return true if this is a type with an identity that has no body specified yet.
Definition: DerivedTypes.h:281
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
llvm::FunctionCallee::FunctionCallee
FunctionCallee()=default
llvm::FunctionType::getParamType
Type * getParamType(unsigned i) const
Parameter type accessors.
Definition: DerivedTypes.h:135
llvm::FunctionType::isValidArgumentType
static bool isValidArgumentType(Type *ArgTy)
Return true if the specified type is valid as an argument type.
Definition: Type.cpp:398
llvm::PointerType
Class to represent pointers.
Definition: DerivedTypes.h:632
llvm::ScalableVectorType::getSubdividedVectorType
static ScalableVectorType * getSubdividedVectorType(ScalableVectorType *VTy, int NumSubdivs)
Definition: DerivedTypes.h:601
ArrayRef.h
llvm::IntegerType::classof
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:92
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::ArrayType::classof
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:379
llvm::FixedVectorType::classof
static bool classof(const Type *T)
Definition: DerivedTypes.h:564
llvm::Type::getArrayNumElements
uint64_t getArrayNumElements() const
Definition: DerivedTypes.h:384
llvm::FunctionType::classof
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:142
llvm::ArrayType::get
static ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
Definition: Type.cpp:640
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
llvm::FixedVectorType::getInteger
static FixedVectorType * getInteger(FixedVectorType *VTy)
Definition: DerivedTypes.h:537
llvm::Type::setSubclassData
void setSubclassData(unsigned val)
Definition: Type.h:98
llvm::Type::Type
Type(LLVMContext &C, TypeID tid)
Definition: Type.h:92
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::ScalableVectorType::classof
static bool classof(const Type *T)
Definition: DerivedTypes.h:622
llvm::StructType
Class to represent struct types.
Definition: DerivedTypes.h:213
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::FixedVectorType::getSubdividedVectorType
static FixedVectorType * getSubdividedVectorType(FixedVectorType *VTy, int NumSubdivs)
Definition: DerivedTypes.h:550
llvm::Type::getStructElementType
Type * getStructElementType(unsigned N) const
Definition: DerivedTypes.h:352
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
llvm::StructType::element_begin
element_iterator element_begin() const
Definition: DerivedTypes.h:317
llvm::StructType::indexValid
bool indexValid(const Value *V) const
Definition: Type.cpp:611
Compiler.h
llvm::FunctionCallee::FunctionCallee
FunctionCallee(std::nullptr_t)
Definition: DerivedTypes.h:178
llvm::VectorType::VectorType
VectorType(Type *ElType, unsigned EQ, Type::TypeID TID)
Definition: Type.cpp:663
llvm::StructType::getTypeAtIndex
Type * getTypeAtIndex(const Value *V) const
Given an index value into the type, return the type of the element.
Definition: Type.cpp:605
llvm::VectorType::getHalfElementsVectorType
static VectorType * getHalfElementsVectorType(VectorType *VTy)
This static method returns a VectorType with half as many elements as the input type and the same ele...
Definition: DerivedTypes.h:493
llvm::Type::getContext
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition: Type.h:127
llvm::IntegerType::MAX_INT_BITS
@ MAX_INT_BITS
Maximum number of bits that can be specified.
Definition: DerivedTypes.h:52
llvm::StructType::getNumElements
unsigned getNumElements() const
Random access to the elements.
Definition: DerivedTypes.h:327
llvm::FunctionCallee::getCallee
Value * getCallee()
Definition: DerivedTypes.h:184
llvm::Type::IntegerTyID
@ IntegerTyID
Arbitrary bit width integers.
Definition: Type.h:71
Callee
amdgpu Simplify well known AMD library false FunctionCallee Callee
Definition: AMDGPULibCalls.cpp:206
llvm::VectorType::getExtendedElementVectorType
static VectorType * getExtendedElementVectorType(VectorType *VTy)
This static method is like getInteger except that the element types are twice as wide as the elements...
Definition: DerivedTypes.h:449
llvm::SymbolTableEntry
Symbol info for RuntimeDyld.
Definition: RuntimeDyldImpl.h:217
llvm::StructType::hasName
bool hasName() const
Return true if this is a named struct that has a non-empty name.
Definition: DerivedTypes.h:290
llvm::Type::NumContainedTys
unsigned NumContainedTys
Keeps track of how many Type*'s there are in the ContainedTys list.
Definition: Type.h:105
llvm::StructType::operator=
StructType & operator=(const StructType &)=delete
llvm::ScalableVectorType::getMinNumElements
uint64_t getMinNumElements() const
Get the minimum number of elements in this vector.
Definition: DerivedTypes.h:620
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::PointerType::hasSameElementTypeAs
bool hasSameElementTypeAs(PointerType *Other)
Return true if both pointer types have the same element type.
Definition: DerivedTypes.h:701
llvm::Type::getIntNTy
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
Definition: Type.cpp:245
llvm::Type::getHalfTy
static Type * getHalfTy(LLVMContext &C)
Definition: Type.cpp:226
llvm::StructType::elements
ArrayRef< Type * > elements() const
Definition: DerivedTypes.h:319
llvm::Type::FixedVectorTyID
@ FixedVectorTyID
Fixed width SIMD vector type.
Definition: Type.h:76
llvm::Type::isIntOrIntVectorTy
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Definition: Type.h:196
Casting.h
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::ScalableVectorType::get
static ScalableVectorType * get(Type *ElementType, const ScalableVectorType *SVTy)
Definition: DerivedTypes.h:580
llvm::StructType::element_end
element_iterator element_end() const
Definition: DerivedTypes.h:318
llvm::IntegerType::MIN_INT_BITS
@ MIN_INT_BITS
Minimum number of bits that can be specified.
Definition: DerivedTypes.h:51
llvm::Type::ContainedTys
Type *const * ContainedTys
A pointer to the array of Types contained by this Type.
Definition: Type.h:112
llvm::makeArrayRef
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:476
llvm::StructType::create
static std::enable_if_t< are_base_of< Type, Tys... >::value, StructType * > create(StringRef Name, Type *elt1, Tys *... elts)
Definition: DerivedTypes.h:246
llvm::Type::StructTyID
@ StructTyID
Structures.
Definition: Type.h:74
llvm::StructType::isValidElementType
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition: Type.cpp:590
llvm::PointerType::isLoadableOrStorableType
static bool isLoadableOrStorableType(Type *ElemTy)
Return true if we can load or store from a pointer to this type.
Definition: Type.cpp:786
llvm::StructType::containsScalableVectorType
bool containsScalableVectorType() const
Returns true if this struct contains a scalable vector.
Definition: Type.cpp:435
llvm::PointerType::getWithSamePointeeType
static PointerType * getWithSamePointeeType(PointerType *PT, unsigned AddressSpace)
This constructs a pointer type with the same pointee type as input PointerType (or opaque pointer is ...
Definition: DerivedTypes.h:666
N
#define N
llvm::VectorType::get
static VectorType * get(Type *ElementType, const VectorType *Other)
Definition: DerivedTypes.h:433
llvm::IntegerType::getBitWidth
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
Definition: DerivedTypes.h:72
llvm::StructType::classof
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:339
llvm::FunctionCallee
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
Definition: DerivedTypes.h:165
llvm::StructType::getElementType
Type * getElementType(unsigned N) const
Definition: DerivedTypes.h:328
llvm::Type::ScalableVectorTyID
@ ScalableVectorTyID
Scalable SIMD vector type.
Definition: Type.h:77
llvm::SmallPtrSetImpl
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition: SmallPtrSet.h:343
llvm::ArrayType::isValidElementType
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition: Type.cpp:652
llvm::IntegerType::get
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:313
llvm::ScalableVectorType::get
static ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
Definition: Type.cpp:707
llvm::Type::TypeID
TypeID
Definitions of all of the base types for the Type system.
Definition: Type.h:54
llvm::FixedVectorType::getHalfElementsVectorType
static FixedVectorType * getHalfElementsVectorType(FixedVectorType *VTy)
Definition: DerivedTypes.h:556
llvm::Type::getFunctionParamType
Type * getFunctionParamType(unsigned i) const
Definition: DerivedTypes.h:153
llvm::StructType::isLiteral
bool isLiteral() const
Return true if this type is uniqued by structural equivalence, false if it is a struct definition.
Definition: DerivedTypes.h:277
llvm::StructType::isLayoutIdentical
bool isLayoutIdentical(StructType *Other) const
Return true if this is layout identical to the specified struct.
Definition: Type.cpp:596
llvm::FunctionType::getReturnType
Type * getReturnType() const
Definition: DerivedTypes.h:124
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::StructType::getTypeAtIndex
Type * getTypeAtIndex(unsigned N) const
Definition: DerivedTypes.h:334
llvm::VectorType::get
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
Definition: Type.cpp:670
llvm::FixedVectorType::getDoubleElementsVectorType
static FixedVectorType * getDoubleElementsVectorType(FixedVectorType *VTy)
Definition: DerivedTypes.h:560
llvm::Type::getFloatTy
static Type * getFloatTy(LLVMContext &C)
Definition: Type.cpp:228
llvm::ArrayType::getElementType
Type * getElementType() const
Definition: DerivedTypes.h:370
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1184
llvm::FunctionType
Class to represent function types.
Definition: DerivedTypes.h:103
llvm::Type::getPrimitiveSizeInBits
TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
Definition: Type.cpp:166