LLVM  4.0.0
DerivedTypes.h
Go to the documentation of this file.
1 //===-- llvm/DerivedTypes.h - Classes for handling data types ---*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the declarations of classes that represent "derived
11 // types". These are things like "arrays of x" or "structure of x, y, z" or
12 // "function returning x taking (y,z) as parameters", etc...
13 //
14 // The implementations of these classes live in the Type.cpp file.
15 //
16 //===----------------------------------------------------------------------===//
17 
18 #ifndef LLVM_IR_DERIVEDTYPES_H
19 #define LLVM_IR_DERIVEDTYPES_H
20 
21 #include "llvm/ADT/ArrayRef.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 <cassert>
27 #include <cstdint>
28 
29 namespace llvm {
30 
31 class Value;
32 class APInt;
33 class LLVMContext;
34 
35 /// Class to represent integer types. Note that this class is also used to
36 /// represent the built-in integer types: Int1Ty, Int8Ty, Int16Ty, Int32Ty and
37 /// Int64Ty.
38 /// @brief Integer representation type
39 class IntegerType : public Type {
40  friend class LLVMContextImpl;
41 
42 protected:
43  explicit IntegerType(LLVMContext &C, unsigned NumBits) : Type(C, IntegerTyID){
44  setSubclassData(NumBits);
45  }
46 
47 public:
48  /// This enum is just used to hold constants we need for IntegerType.
49  enum {
50  MIN_INT_BITS = 1, ///< Minimum number of bits that can be specified
51  MAX_INT_BITS = (1<<24)-1 ///< Maximum number of bits that can be specified
52  ///< Note that bit width is stored in the Type classes SubclassData field
53  ///< which has 24 bits. This yields a maximum bit width of 16,777,215
54  ///< bits.
55  };
56 
57  /// This static method is the primary way of constructing an IntegerType.
58  /// If an IntegerType with the same NumBits value was previously instantiated,
59  /// that instance will be returned. Otherwise a new one will be created. Only
60  /// one instance with a given NumBits value is ever created.
61  /// @brief Get or create an IntegerType instance.
62  static IntegerType *get(LLVMContext &C, unsigned NumBits);
63 
64  /// @brief Get the number of bits in this IntegerType
65  unsigned getBitWidth() const { return getSubclassData(); }
66 
67  /// Return a bitmask with ones set for all of the bits that can be set by an
68  /// unsigned version of this type. This is 0xFF for i8, 0xFFFF for i16, etc.
69  uint64_t getBitMask() const {
70  return ~uint64_t(0UL) >> (64-getBitWidth());
71  }
72 
73  /// Return a uint64_t with just the most significant bit set (the sign bit, if
74  /// the value is treated as a signed number).
75  uint64_t getSignBit() const {
76  return 1ULL << (getBitWidth()-1);
77  }
78 
79  /// For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
80  /// @returns a bit mask with ones set for all the bits of this type.
81  /// @brief Get a bit mask for this type.
82  APInt getMask() const;
83 
84  /// This method determines if the width of this IntegerType is a power-of-2
85  /// in terms of 8 bit bytes.
86  /// @returns true if this is a power-of-2 byte width.
87  /// @brief Is this a power-of-2 byte-width IntegerType ?
88  bool isPowerOf2ByteWidth() const;
89 
90  /// Methods for support type inquiry through isa, cast, and dyn_cast.
91  static inline bool classof(const Type *T) {
92  return T->getTypeID() == IntegerTyID;
93  }
94 };
95 
96 unsigned Type::getIntegerBitWidth() const {
97  return cast<IntegerType>(this)->getBitWidth();
98 }
99 
100 /// Class to represent function types
101 ///
102 class FunctionType : public Type {
103  FunctionType(Type *Result, ArrayRef<Type*> Params, bool IsVarArgs);
104 
105 public:
106  FunctionType(const FunctionType &) = delete;
107  FunctionType &operator=(const FunctionType &) = delete;
108 
109  /// This static method is the primary way of constructing a FunctionType.
110  static FunctionType *get(Type *Result,
111  ArrayRef<Type*> Params, bool isVarArg);
112 
113  /// Create a FunctionType taking no parameters.
114  static FunctionType *get(Type *Result, bool isVarArg);
115 
116  /// Return true if the specified type is valid as a return type.
117  static bool isValidReturnType(Type *RetTy);
118 
119  /// Return true if the specified type is valid as an argument type.
120  static bool isValidArgumentType(Type *ArgTy);
121 
122  bool isVarArg() const { return getSubclassData()!=0; }
123  Type *getReturnType() const { return ContainedTys[0]; }
124 
126  param_iterator param_begin() const { return ContainedTys + 1; }
129  return makeArrayRef(param_begin(), param_end());
130  }
131 
132  /// Parameter type accessors.
133  Type *getParamType(unsigned i) const { return ContainedTys[i+1]; }
134 
135  /// Return the number of fixed parameters this function type requires.
136  /// This does not consider varargs.
137  unsigned getNumParams() const { return NumContainedTys - 1; }
138 
139  /// Methods for support type inquiry through isa, cast, and dyn_cast.
140  static inline bool classof(const Type *T) {
141  return T->getTypeID() == FunctionTyID;
142  }
143 };
144 static_assert(alignof(FunctionType) >= alignof(Type *),
145  "Alignment sufficient for objects appended to FunctionType");
146 
148  return cast<FunctionType>(this)->isVarArg();
149 }
150 
152  return cast<FunctionType>(this)->getParamType(i);
153 }
154 
155 unsigned Type::getFunctionNumParams() const {
156  return cast<FunctionType>(this)->getNumParams();
157 }
158 
159 /// Common super class of ArrayType, StructType and VectorType.
160 class CompositeType : public Type {
161 protected:
162  explicit CompositeType(LLVMContext &C, TypeID tid) : Type(C, tid) {}
163 
164 public:
165  /// Given an index value into the type, return the type of the element.
166  Type *getTypeAtIndex(const Value *V) const;
167  Type *getTypeAtIndex(unsigned Idx) const;
168  bool indexValid(const Value *V) const;
169  bool indexValid(unsigned Idx) const;
170 
171  /// Methods for support type inquiry through isa, cast, and dyn_cast.
172  static inline bool classof(const Type *T) {
173  return T->getTypeID() == ArrayTyID ||
174  T->getTypeID() == StructTyID ||
175  T->getTypeID() == VectorTyID;
176  }
177 };
178 
179 /// Class to represent struct types. There are two different kinds of struct
180 /// types: Literal structs and Identified structs.
181 ///
182 /// Literal struct types (e.g. { i32, i32 }) are uniqued structurally, and must
183 /// always have a body when created. You can get one of these by using one of
184 /// the StructType::get() forms.
185 ///
186 /// Identified structs (e.g. %foo or %42) may optionally have a name and are not
187 /// uniqued. The names for identified structs are managed at the LLVMContext
188 /// level, so there can only be a single identified struct with a given name in
189 /// a particular LLVMContext. Identified structs may also optionally be opaque
190 /// (have no body specified). You get one of these by using one of the
191 /// StructType::create() forms.
192 ///
193 /// Independent of what kind of struct you have, the body of a struct type are
194 /// laid out in memory consequtively with the elements directly one after the
195 /// other (if the struct is packed) or (if not packed) with padding between the
196 /// elements as defined by DataLayout (which is required to match what the code
197 /// generator for a target expects).
198 ///
199 class StructType : public CompositeType {
201  : CompositeType(C, StructTyID), SymbolTableEntry(nullptr) {}
202 
203  enum {
204  /// This is the contents of the SubClassData field.
205  SCDB_HasBody = 1,
206  SCDB_Packed = 2,
207  SCDB_IsLiteral = 4,
208  SCDB_IsSized = 8
209  };
210 
211  /// For a named struct that actually has a name, this is a pointer to the
212  /// symbol table entry (maintained by LLVMContext) for the struct.
213  /// This is null if the type is an literal struct or if it is a identified
214  /// type that has an empty name.
215  void *SymbolTableEntry;
216 
217 public:
218  StructType(const StructType &) = delete;
219  StructType &operator=(const StructType &) = delete;
220 
221  /// This creates an identified struct.
222  static StructType *create(LLVMContext &Context, StringRef Name);
223  static StructType *create(LLVMContext &Context);
224 
225  static StructType *create(ArrayRef<Type *> Elements, StringRef Name,
226  bool isPacked = false);
227  static StructType *create(ArrayRef<Type *> Elements);
228  static StructType *create(LLVMContext &Context, ArrayRef<Type *> Elements,
229  StringRef Name, bool isPacked = false);
230  static StructType *create(LLVMContext &Context, ArrayRef<Type *> Elements);
231  static StructType *create(StringRef Name, Type *elt1, ...) LLVM_END_WITH_NULL;
232 
233  /// This static method is the primary way to create a literal StructType.
234  static StructType *get(LLVMContext &Context, ArrayRef<Type*> Elements,
235  bool isPacked = false);
236 
237  /// Create an empty structure type.
238  static StructType *get(LLVMContext &Context, bool isPacked = false);
239 
240  /// This static method is a convenience method for creating structure types by
241  /// specifying the elements as arguments. Note that this method always returns
242  /// a non-packed struct, and requires at least one element type.
243  static StructType *get(Type *elt1, ...) LLVM_END_WITH_NULL;
244 
245  bool isPacked() const { return (getSubclassData() & SCDB_Packed) != 0; }
246 
247  /// Return true if this type is uniqued by structural equivalence, false if it
248  /// is a struct definition.
249  bool isLiteral() const { return (getSubclassData() & SCDB_IsLiteral) != 0; }
250 
251  /// Return true if this is a type with an identity that has no body specified
252  /// yet. These prints as 'opaque' in .ll files.
253  bool isOpaque() const { return (getSubclassData() & SCDB_HasBody) == 0; }
254 
255  /// isSized - Return true if this is a sized type.
256  bool isSized(SmallPtrSetImpl<Type *> *Visited = nullptr) const;
257 
258  /// Return true if this is a named struct that has a non-empty name.
259  bool hasName() const { return SymbolTableEntry != nullptr; }
260 
261  /// Return the name for this struct type if it has an identity.
262  /// This may return an empty string for an unnamed struct type. Do not call
263  /// this on an literal type.
264  StringRef getName() const;
265 
266  /// Change the name of this type to the specified name, or to a name with a
267  /// suffix if there is a collision. Do not call this on an literal type.
268  void setName(StringRef Name);
269 
270  /// Specify a body for an opaque identified type.
271  void setBody(ArrayRef<Type*> Elements, bool isPacked = false);
272  void setBody(Type *elt1, ...) LLVM_END_WITH_NULL;
273 
274  /// Return true if the specified type is valid as a element type.
275  static bool isValidElementType(Type *ElemTy);
276 
277  // Iterator access to the elements.
279  element_iterator element_begin() const { return ContainedTys; }
281  ArrayRef<Type *> const elements() const {
282  return makeArrayRef(element_begin(), element_end());
283  }
284 
285  /// Return true if this is layout identical to the specified struct.
286  bool isLayoutIdentical(StructType *Other) const;
287 
288  /// Random access to the elements
289  unsigned getNumElements() const { return NumContainedTys; }
290  Type *getElementType(unsigned N) const {
291  assert(N < NumContainedTys && "Element number out of range!");
292  return ContainedTys[N];
293  }
294 
295  /// Methods for support type inquiry through isa, cast, and dyn_cast.
296  static inline bool classof(const Type *T) {
297  return T->getTypeID() == StructTyID;
298  }
299 };
300 
302  return cast<StructType>(this)->getName();
303 }
304 
305 unsigned Type::getStructNumElements() const {
306  return cast<StructType>(this)->getNumElements();
307 }
308 
310  return cast<StructType>(this)->getElementType(N);
311 }
312 
313 /// This is the superclass of the array and vector type classes. Both of these
314 /// represent "arrays" in memory. The array type represents a specifically sized
315 /// array, and the vector type represents a specifically sized array that allows
316 /// for use of SIMD instructions. SequentialType holds the common features of
317 /// both, which stem from the fact that both lay their components out in memory
318 /// identically.
320  Type *ContainedType; ///< Storage for the single contained type.
321  uint64_t NumElements;
322 
323 protected:
324  SequentialType(TypeID TID, Type *ElType, uint64_t NumElements)
325  : CompositeType(ElType->getContext(), TID), ContainedType(ElType),
326  NumElements(NumElements) {
327  ContainedTys = &ContainedType;
328  NumContainedTys = 1;
329  }
330 
331 public:
332  SequentialType(const SequentialType &) = delete;
333  SequentialType &operator=(const SequentialType &) = delete;
334 
335  uint64_t getNumElements() const { return NumElements; }
336  Type *getElementType() const { return ContainedType; }
337 
338  /// Methods for support type inquiry through isa, cast, and dyn_cast.
339  static inline bool classof(const Type *T) {
340  return T->getTypeID() == ArrayTyID || T->getTypeID() == VectorTyID;
341  }
342 };
343 
344 /// Class to represent array types.
345 class ArrayType : public SequentialType {
346  ArrayType(Type *ElType, uint64_t NumEl);
347 
348 public:
349  ArrayType(const ArrayType &) = delete;
350  ArrayType &operator=(const ArrayType &) = delete;
351 
352  /// This static method is the primary way to construct an ArrayType
353  static ArrayType *get(Type *ElementType, uint64_t NumElements);
354 
355  /// Return true if the specified type is valid as a element type.
356  static bool isValidElementType(Type *ElemTy);
357 
358  /// Methods for support type inquiry through isa, cast, and dyn_cast.
359  static inline bool classof(const Type *T) {
360  return T->getTypeID() == ArrayTyID;
361  }
362 };
363 
364 uint64_t Type::getArrayNumElements() const {
365  return cast<ArrayType>(this)->getNumElements();
366 }
367 
368 /// Class to represent vector types.
369 class VectorType : public SequentialType {
370  VectorType(Type *ElType, unsigned NumEl);
371 
372 public:
373  VectorType(const VectorType &) = delete;
374  VectorType &operator=(const VectorType &) = delete;
375 
376  /// This static method is the primary way to construct an VectorType.
377  static VectorType *get(Type *ElementType, unsigned NumElements);
378 
379  /// This static method gets a VectorType with the same number of elements as
380  /// the input type, and the element type is an integer type of the same width
381  /// as the input element type.
383  unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
384  assert(EltBits && "Element size must be of a non-zero size");
385  Type *EltTy = IntegerType::get(VTy->getContext(), EltBits);
386  return VectorType::get(EltTy, VTy->getNumElements());
387  }
388 
389  /// This static method is like getInteger except that the element types are
390  /// twice as wide as the elements in the input type.
392  unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
393  Type *EltTy = IntegerType::get(VTy->getContext(), EltBits * 2);
394  return VectorType::get(EltTy, VTy->getNumElements());
395  }
396 
397  /// This static method is like getInteger except that the element types are
398  /// half as wide as the elements in the input type.
400  unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
401  assert((EltBits & 1) == 0 &&
402  "Cannot truncate vector element with odd bit-width");
403  Type *EltTy = IntegerType::get(VTy->getContext(), EltBits / 2);
404  return VectorType::get(EltTy, VTy->getNumElements());
405  }
406 
407  /// This static method returns a VectorType with half as many elements as the
408  /// input type and the same element type.
410  unsigned NumElts = VTy->getNumElements();
411  assert ((NumElts & 1) == 0 &&
412  "Cannot halve vector with odd number of elements.");
413  return VectorType::get(VTy->getElementType(), NumElts/2);
414  }
415 
416  /// This static method returns a VectorType with twice as many elements as the
417  /// input type and the same element type.
419  unsigned NumElts = VTy->getNumElements();
420  return VectorType::get(VTy->getElementType(), NumElts*2);
421  }
422 
423  /// Return true if the specified type is valid as a element type.
424  static bool isValidElementType(Type *ElemTy);
425 
426  /// Return the number of bits in the Vector type.
427  /// Returns zero when the vector is a vector of pointers.
428  unsigned getBitWidth() const {
429  return getNumElements() * getElementType()->getPrimitiveSizeInBits();
430  }
431 
432  /// Methods for support type inquiry through isa, cast, and dyn_cast.
433  static inline bool classof(const Type *T) {
434  return T->getTypeID() == VectorTyID;
435  }
436 };
437 
438 unsigned Type::getVectorNumElements() const {
439  return cast<VectorType>(this)->getNumElements();
440 }
441 
442 /// Class to represent pointers.
443 class PointerType : public Type {
444  explicit PointerType(Type *ElType, unsigned AddrSpace);
445 
446  Type *PointeeTy;
447 
448 public:
449  PointerType(const PointerType &) = delete;
450  PointerType &operator=(const PointerType &) = delete;
451 
452  /// This constructs a pointer to an object of the specified type in a numbered
453  /// address space.
454  static PointerType *get(Type *ElementType, unsigned AddressSpace);
455 
456  /// This constructs a pointer to an object of the specified type in the
457  /// generic address space (address space zero).
458  static PointerType *getUnqual(Type *ElementType) {
459  return PointerType::get(ElementType, 0);
460  }
461 
462  Type *getElementType() const { return PointeeTy; }
463 
464  /// Return true if the specified type is valid as a element type.
465  static bool isValidElementType(Type *ElemTy);
466 
467  /// Return true if we can load or store from a pointer to this type.
468  static bool isLoadableOrStorableType(Type *ElemTy);
469 
470  /// Return the address space of the Pointer type.
471  inline unsigned getAddressSpace() const { return getSubclassData(); }
472 
473  /// Implement support type inquiry through isa, cast, and dyn_cast.
474  static inline bool classof(const Type *T) {
475  return T->getTypeID() == PointerTyID;
476  }
477 };
478 
480  return cast<PointerType>(getScalarType())->getAddressSpace();
481 }
482 
483 } // end namespace llvm
484 
485 #endif // LLVM_IR_DERIVEDTYPES_H
Maximum number of bits that can be specified.
Definition: DerivedTypes.h:51
CompositeType(LLVMContext &C, TypeID tid)
Definition: DerivedTypes.h:162
LLVMContext & Context
size_t i
Minimum number of bits that can be specified.
Definition: DerivedTypes.h:50
bool isOpaque() const
Return true if this is a type with an identity that has no body specified yet.
Definition: DerivedTypes.h:253
APInt getMask() const
For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
Definition: Type.cpp:263
unsigned getStructNumElements() const
Definition: DerivedTypes.h:305
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
Definition: DerivedTypes.h:137
Type::subtype_iterator param_iterator
Definition: DerivedTypes.h:125
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:359
ArrayRef< Type * > params() const
Definition: DerivedTypes.h:128
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:655
13: Structures
Definition: Type.h:72
unsigned getAddressSpace() const
Return the address space of the Pointer type.
Definition: DerivedTypes.h:471
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
Definition: DerivedTypes.h:65
SequentialType(TypeID TID, Type *ElType, uint64_t NumElements)
Definition: DerivedTypes.h:324
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:140
15: Pointers
Definition: Type.h:74
Type * getElementType() const
Definition: DerivedTypes.h:462
static VectorType * getTruncatedElementVectorType(VectorType *VTy)
This static method is like getInteger except that the element types are half as wide as the elements ...
Definition: DerivedTypes.h:399
12: Functions
Definition: Type.h:71
Type * getFunctionParamType(unsigned i) const
Definition: DerivedTypes.h:151
Type *const * ContainedTys
A pointer to the array of Types contained by this Type.
Definition: Type.h:110
uint64_t getArrayNumElements() const
Definition: DerivedTypes.h:364
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition: SmallPtrSet.h:345
element_iterator element_end() const
Definition: DerivedTypes.h:280
bool isPacked() const
Definition: DerivedTypes.h:245
Type::subtype_iterator element_iterator
Definition: DerivedTypes.h:278
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:440
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:433
Class to represent struct types.
Definition: DerivedTypes.h:199
param_iterator param_end() const
Definition: DerivedTypes.h:127
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:75
unsigned getBitWidth() const
Return the number of bits in the Vector type.
Definition: DerivedTypes.h:428
bool isLiteral() const
Return true if this type is uniqued by structural equivalence, false if it is a struct definition...
Definition: DerivedTypes.h:249
static StringRef getName(Value *V)
TypeID
Definitions of all of the base types for the Type system.
Definition: Type.h:54
Class to represent function types.
Definition: DerivedTypes.h:102
Type * getStructElementType(unsigned N) const
Definition: DerivedTypes.h:309
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition: Type.h:128
ArrayRef< Type * > const elements() const
Definition: DerivedTypes.h:281
Class to represent array types.
Definition: DerivedTypes.h:345
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
TypeID getTypeID() const
Return the type id for the type.
Definition: Type.h:136
unsigned getSubclassData() const
Definition: Type.h:94
Type(LLVMContext &C, TypeID tid)
Definition: Type.h:89
Type * getScalarType() const LLVM_READONLY
If this is a vector type, return the element type, otherwise return 'this'.
Definition: Type.cpp:44
Type * getElementType() const
Definition: DerivedTypes.h:336
Class to represent pointers.
Definition: DerivedTypes.h:443
11: Arbitrary bit width integers
Definition: Type.h:70
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
Definition: Type.h:254
Type * getParamType(unsigned i) const
Parameter type accessors.
Definition: DerivedTypes.h:133
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:409
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:48
Type * getElementType(unsigned N) const
Definition: DerivedTypes.h:290
param_iterator param_begin() const
Definition: DerivedTypes.h:126
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:172
static VectorType * getInteger(VectorType *VTy)
This static method gets a VectorType with the same number of elements as the input type...
Definition: DerivedTypes.h:382
uint64_t getNumElements() const
Definition: DerivedTypes.h:335
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:339
bool isFunctionVarArg() const
Definition: DerivedTypes.h:147
unsigned getIntegerBitWidth() const
Definition: DerivedTypes.h:96
Class to represent integer types.
Definition: DerivedTypes.h:39
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:418
#define LLVM_END_WITH_NULL
Definition: Compiler.h:117
14: Arrays
Definition: Type.h:73
This is the superclass of the array and vector type classes.
Definition: DerivedTypes.h:319
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:234
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the generic address space (address sp...
Definition: DerivedTypes.h:458
16: SIMD 'packed' format, or other vector type
Definition: Type.h:75
Type *const * subtype_iterator
Definition: Type.h:298
bool hasName() const
Return true if this is a named struct that has a non-empty name.
Definition: DerivedTypes.h:259
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:296
AddressSpace
Definition: NVPTXBaseInfo.h:22
StringRef getStructName() const
Definition: DerivedTypes.h:301
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:391
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
Symbol info for RuntimeDyld.
Class to represent vector types.
Definition: DerivedTypes.h:369
Class for arbitrary precision integers.
Definition: APInt.h:77
unsigned getVectorNumElements() const
Definition: DerivedTypes.h:438
Common super class of ArrayType, StructType and VectorType.
Definition: DerivedTypes.h:160
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:69
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:91
unsigned getFunctionNumParams() const
Definition: DerivedTypes.h:155
#define N
static bool isValidElementType(Type *Ty)
Predicate for the element types that the SLP vectorizer supports.
bool isPowerOf2ByteWidth() const
This method determines if the width of this IntegerType is a power-of-2 in terms of 8 bit bytes...
Definition: Type.cpp:258
static bool classof(const Type *T)
Implement support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:474
IntegerType(LLVMContext &C, unsigned NumBits)
Definition: DerivedTypes.h:43
bool isVarArg() const
Definition: DerivedTypes.h:122
void setSubclassData(unsigned val)
Definition: Type.h:96
Type * getReturnType() const
Definition: DerivedTypes.h:123
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
Definition: Type.cpp:108
LLVM Value Representation.
Definition: Value.h:71
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
Definition: Type.cpp:631
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
unsigned getNumElements() const
Random access to the elements.
Definition: DerivedTypes.h:289
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
Definition: DerivedTypes.h:479
unsigned NumContainedTys
Keeps track of how many Type*'s there are in the ContainedTys list.
Definition: Type.h:103