LLVM  6.0.0svn
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/STLExtras.h"
23 #include "llvm/ADT/StringRef.h"
24 #include "llvm/IR/Type.h"
25 #include "llvm/Support/Casting.h"
26 #include "llvm/Support/Compiler.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 /// @brief 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<<24)-1 ///< 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. This yields a maximum bit width of 16,777,215
55  ///< bits.
56  };
57 
58  /// This static method is the primary way of constructing an IntegerType.
59  /// If an IntegerType with the same NumBits value was previously instantiated,
60  /// that instance will be returned. Otherwise a new one will be created. Only
61  /// one instance with a given NumBits value is ever created.
62  /// @brief Get or create an IntegerType instance.
63  static IntegerType *get(LLVMContext &C, unsigned NumBits);
64 
65  /// @brief Get the number of bits in this IntegerType
66  unsigned getBitWidth() const { return getSubclassData(); }
67 
68  /// Return a bitmask with ones set for all of the bits that can be set by an
69  /// unsigned version of this type. This is 0xFF for i8, 0xFFFF for i16, etc.
70  uint64_t getBitMask() const {
71  return ~uint64_t(0UL) >> (64-getBitWidth());
72  }
73 
74  /// Return a uint64_t with just the most significant bit set (the sign bit, if
75  /// the value is treated as a signed number).
76  uint64_t getSignBit() const {
77  return 1ULL << (getBitWidth()-1);
78  }
79 
80  /// For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
81  /// @returns a bit mask with ones set for all the bits of this type.
82  /// @brief Get a bit mask for this type.
83  APInt getMask() const;
84 
85  /// This method determines if the width of this IntegerType is a power-of-2
86  /// in terms of 8 bit bytes.
87  /// @returns true if this is a power-of-2 byte width.
88  /// @brief Is this a power-of-2 byte-width IntegerType ?
89  bool isPowerOf2ByteWidth() 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 
153 Type *Type::getFunctionParamType(unsigned i) const {
154  return cast<FunctionType>(this)->getParamType(i);
155 }
156 
157 unsigned Type::getFunctionNumParams() const {
158  return cast<FunctionType>(this)->getNumParams();
159 }
160 
161 /// Common super class of ArrayType, StructType and VectorType.
162 class CompositeType : public Type {
163 protected:
164  explicit CompositeType(LLVMContext &C, TypeID tid) : Type(C, tid) {}
165 
166 public:
167  /// Given an index value into the type, return the type of the element.
168  Type *getTypeAtIndex(const Value *V) const;
169  Type *getTypeAtIndex(unsigned Idx) const;
170  bool indexValid(const Value *V) const;
171  bool indexValid(unsigned Idx) const;
172 
173  /// Methods for support type inquiry through isa, cast, and dyn_cast.
174  static bool classof(const Type *T) {
175  return T->getTypeID() == ArrayTyID ||
176  T->getTypeID() == StructTyID ||
177  T->getTypeID() == VectorTyID;
178  }
179 };
180 
181 /// Class to represent struct types. There are two different kinds of struct
182 /// types: Literal structs and Identified structs.
183 ///
184 /// Literal struct types (e.g. { i32, i32 }) are uniqued structurally, and must
185 /// always have a body when created. You can get one of these by using one of
186 /// the StructType::get() forms.
187 ///
188 /// Identified structs (e.g. %foo or %42) may optionally have a name and are not
189 /// uniqued. The names for identified structs are managed at the LLVMContext
190 /// level, so there can only be a single identified struct with a given name in
191 /// a particular LLVMContext. Identified structs may also optionally be opaque
192 /// (have no body specified). You get one of these by using one of the
193 /// StructType::create() forms.
194 ///
195 /// Independent of what kind of struct you have, the body of a struct type are
196 /// laid out in memory consequtively with the elements directly one after the
197 /// other (if the struct is packed) or (if not packed) with padding between the
198 /// elements as defined by DataLayout (which is required to match what the code
199 /// generator for a target expects).
200 ///
201 class StructType : public CompositeType {
203 
204  enum {
205  /// This is the contents of the SubClassData field.
206  SCDB_HasBody = 1,
207  SCDB_Packed = 2,
208  SCDB_IsLiteral = 4,
209  SCDB_IsSized = 8
210  };
211 
212  /// For a named struct that actually has a name, this is a pointer to the
213  /// symbol table entry (maintained by LLVMContext) for the struct.
214  /// This is null if the type is an literal struct or if it is a identified
215  /// type that has an empty name.
216  void *SymbolTableEntry = nullptr;
217 
218 public:
219  StructType(const StructType &) = delete;
220  StructType &operator=(const StructType &) = delete;
221 
222  /// This creates an identified struct.
223  static StructType *create(LLVMContext &Context, StringRef Name);
224  static StructType *create(LLVMContext &Context);
225 
226  static StructType *create(ArrayRef<Type *> Elements, StringRef Name,
227  bool isPacked = false);
228  static StructType *create(ArrayRef<Type *> Elements);
229  static StructType *create(LLVMContext &Context, ArrayRef<Type *> Elements,
230  StringRef Name, bool isPacked = false);
231  static StructType *create(LLVMContext &Context, ArrayRef<Type *> Elements);
232  template <class... Tys>
233  static typename std::enable_if<are_base_of<Type, Tys...>::value,
234  StructType *>::type
235  create(StringRef Name, Type *elt1, Tys *... elts) {
236  assert(elt1 && "Cannot create a struct type with no elements with this");
237  SmallVector<llvm::Type *, 8> StructFields({elt1, elts...});
238  return create(StructFields, Name);
239  }
240 
241  /// This static method is the primary way to create a literal StructType.
242  static StructType *get(LLVMContext &Context, ArrayRef<Type*> Elements,
243  bool isPacked = false);
244 
245  /// Create an empty structure type.
246  static StructType *get(LLVMContext &Context, bool isPacked = false);
247 
248  /// This static method is a convenience method for creating structure types by
249  /// specifying the elements as arguments. Note that this method always returns
250  /// a non-packed struct, and requires at least one element type.
251  template <class... Tys>
252  static typename std::enable_if<are_base_of<Type, Tys...>::value,
253  StructType *>::type
254  get(Type *elt1, Tys *... elts) {
255  assert(elt1 && "Cannot create a struct type with no elements with this");
256  LLVMContext &Ctx = elt1->getContext();
257  SmallVector<llvm::Type *, 8> StructFields({elt1, elts...});
258  return llvm::StructType::get(Ctx, StructFields);
259  }
260 
261  bool isPacked() const { return (getSubclassData() & SCDB_Packed) != 0; }
262 
263  /// Return true if this type is uniqued by structural equivalence, false if it
264  /// is a struct definition.
265  bool isLiteral() const { return (getSubclassData() & SCDB_IsLiteral) != 0; }
266 
267  /// Return true if this is a type with an identity that has no body specified
268  /// yet. These prints as 'opaque' in .ll files.
269  bool isOpaque() const { return (getSubclassData() & SCDB_HasBody) == 0; }
270 
271  /// isSized - Return true if this is a sized type.
272  bool isSized(SmallPtrSetImpl<Type *> *Visited = nullptr) const;
273 
274  /// Return true if this is a named struct that has a non-empty name.
275  bool hasName() const { return SymbolTableEntry != nullptr; }
276 
277  /// Return the name for this struct type if it has an identity.
278  /// This may return an empty string for an unnamed struct type. Do not call
279  /// this on an literal type.
280  StringRef getName() const;
281 
282  /// Change the name of this type to the specified name, or to a name with a
283  /// suffix if there is a collision. Do not call this on an literal type.
284  void setName(StringRef Name);
285 
286  /// Specify a body for an opaque identified type.
287  void setBody(ArrayRef<Type*> Elements, bool isPacked = false);
288 
289  template <typename... Tys>
290  typename std::enable_if<are_base_of<Type, Tys...>::value, void>::type
291  setBody(Type *elt1, Tys *... elts) {
292  assert(elt1 && "Cannot create a struct type with no elements with this");
293  SmallVector<llvm::Type *, 8> StructFields({elt1, elts...});
294  setBody(StructFields);
295  }
296 
297  /// Return true if the specified type is valid as a element type.
298  static bool isValidElementType(Type *ElemTy);
299 
300  // Iterator access to the elements.
302 
305  ArrayRef<Type *> const elements() const {
306  return makeArrayRef(element_begin(), element_end());
307  }
308 
309  /// Return true if this is layout identical to the specified struct.
310  bool isLayoutIdentical(StructType *Other) const;
311 
312  /// Random access to the elements
313  unsigned getNumElements() const { return NumContainedTys; }
314  Type *getElementType(unsigned N) const {
315  assert(N < NumContainedTys && "Element number out of range!");
316  return ContainedTys[N];
317  }
318 
319  /// Methods for support type inquiry through isa, cast, and dyn_cast.
320  static bool classof(const Type *T) {
321  return T->getTypeID() == StructTyID;
322  }
323 };
324 
326  return cast<StructType>(this)->getName();
327 }
328 
329 unsigned Type::getStructNumElements() const {
330  return cast<StructType>(this)->getNumElements();
331 }
332 
334  return cast<StructType>(this)->getElementType(N);
335 }
336 
337 /// This is the superclass of the array and vector type classes. Both of these
338 /// represent "arrays" in memory. The array type represents a specifically sized
339 /// array, and the vector type represents a specifically sized array that allows
340 /// for use of SIMD instructions. SequentialType holds the common features of
341 /// both, which stem from the fact that both lay their components out in memory
342 /// identically.
344  Type *ContainedType; ///< Storage for the single contained type.
345  uint64_t NumElements;
346 
347 protected:
348  SequentialType(TypeID TID, Type *ElType, uint64_t NumElements)
349  : CompositeType(ElType->getContext(), TID), ContainedType(ElType),
350  NumElements(NumElements) {
351  ContainedTys = &ContainedType;
352  NumContainedTys = 1;
353  }
354 
355 public:
356  SequentialType(const SequentialType &) = delete;
357  SequentialType &operator=(const SequentialType &) = delete;
358 
359  uint64_t getNumElements() const { return NumElements; }
360  Type *getElementType() const { return ContainedType; }
361 
362  /// Methods for support type inquiry through isa, cast, and dyn_cast.
363  static bool classof(const Type *T) {
364  return T->getTypeID() == ArrayTyID || T->getTypeID() == VectorTyID;
365  }
366 };
367 
368 /// Class to represent array types.
369 class ArrayType : public SequentialType {
370  ArrayType(Type *ElType, uint64_t NumEl);
371 
372 public:
373  ArrayType(const ArrayType &) = delete;
374  ArrayType &operator=(const ArrayType &) = delete;
375 
376  /// This static method is the primary way to construct an ArrayType
377  static ArrayType *get(Type *ElementType, uint64_t NumElements);
378 
379  /// Return true if the specified type is valid as a element type.
380  static bool isValidElementType(Type *ElemTy);
381 
382  /// Methods for support type inquiry through isa, cast, and dyn_cast.
383  static bool classof(const Type *T) {
384  return T->getTypeID() == ArrayTyID;
385  }
386 };
387 
388 uint64_t Type::getArrayNumElements() const {
389  return cast<ArrayType>(this)->getNumElements();
390 }
391 
392 /// Class to represent vector types.
393 class VectorType : public SequentialType {
394  VectorType(Type *ElType, unsigned NumEl);
395 
396 public:
397  VectorType(const VectorType &) = delete;
398  VectorType &operator=(const VectorType &) = delete;
399 
400  /// This static method is the primary way to construct an VectorType.
401  static VectorType *get(Type *ElementType, unsigned NumElements);
402 
403  /// This static method gets a VectorType with the same number of elements as
404  /// the input type, and the element type is an integer type of the same width
405  /// as the input element type.
407  unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
408  assert(EltBits && "Element size must be of a non-zero size");
409  Type *EltTy = IntegerType::get(VTy->getContext(), EltBits);
410  return VectorType::get(EltTy, VTy->getNumElements());
411  }
412 
413  /// This static method is like getInteger except that the element types are
414  /// twice as wide as the elements in the input type.
416  unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
417  Type *EltTy = IntegerType::get(VTy->getContext(), EltBits * 2);
418  return VectorType::get(EltTy, VTy->getNumElements());
419  }
420 
421  /// This static method is like getInteger except that the element types are
422  /// half as wide as the elements in the input type.
424  unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
425  assert((EltBits & 1) == 0 &&
426  "Cannot truncate vector element with odd bit-width");
427  Type *EltTy = IntegerType::get(VTy->getContext(), EltBits / 2);
428  return VectorType::get(EltTy, VTy->getNumElements());
429  }
430 
431  /// This static method returns a VectorType with half as many elements as the
432  /// input type and the same element type.
434  unsigned NumElts = VTy->getNumElements();
435  assert ((NumElts & 1) == 0 &&
436  "Cannot halve vector with odd number of elements.");
437  return VectorType::get(VTy->getElementType(), NumElts/2);
438  }
439 
440  /// This static method returns a VectorType with twice as many elements as the
441  /// input type and the same element type.
443  unsigned NumElts = VTy->getNumElements();
444  return VectorType::get(VTy->getElementType(), NumElts*2);
445  }
446 
447  /// Return true if the specified type is valid as a element type.
448  static bool isValidElementType(Type *ElemTy);
449 
450  /// Return the number of bits in the Vector type.
451  /// Returns zero when the vector is a vector of pointers.
452  unsigned getBitWidth() const {
453  return getNumElements() * getElementType()->getPrimitiveSizeInBits();
454  }
455 
456  /// Methods for support type inquiry through isa, cast, and dyn_cast.
457  static bool classof(const Type *T) {
458  return T->getTypeID() == VectorTyID;
459  }
460 };
461 
462 unsigned Type::getVectorNumElements() const {
463  return cast<VectorType>(this)->getNumElements();
464 }
465 
466 /// Class to represent pointers.
467 class PointerType : public Type {
468  explicit PointerType(Type *ElType, unsigned AddrSpace);
469 
470  Type *PointeeTy;
471 
472 public:
473  PointerType(const PointerType &) = delete;
474  PointerType &operator=(const PointerType &) = delete;
475 
476  /// This constructs a pointer to an object of the specified type in a numbered
477  /// address space.
478  static PointerType *get(Type *ElementType, unsigned AddressSpace);
479 
480  /// This constructs a pointer to an object of the specified type in the
481  /// generic address space (address space zero).
482  static PointerType *getUnqual(Type *ElementType) {
483  return PointerType::get(ElementType, 0);
484  }
485 
486  Type *getElementType() const { return PointeeTy; }
487 
488  /// Return true if the specified type is valid as a element type.
489  static bool isValidElementType(Type *ElemTy);
490 
491  /// Return true if we can load or store from a pointer to this type.
492  static bool isLoadableOrStorableType(Type *ElemTy);
493 
494  /// Return the address space of the Pointer type.
495  inline unsigned getAddressSpace() const { return getSubclassData(); }
496 
497  /// Implement support type inquiry through isa, cast, and dyn_cast.
498  static bool classof(const Type *T) {
499  return T->getTypeID() == PointerTyID;
500  }
501 };
502 
504  return cast<PointerType>(getScalarType())->getAddressSpace();
505 }
506 
507 } // end namespace llvm
508 
509 #endif // LLVM_IR_DERIVEDTYPES_H
uint64_t CallInst * C
CompositeType(LLVMContext &C, TypeID tid)
Definition: DerivedTypes.h:164
LLVMContext & Context
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
Type * getParamType(unsigned i) const
Parameter type accessors.
Definition: DerivedTypes.h:135
Type * getElementType(unsigned N) const
Definition: DerivedTypes.h:314
unsigned getFunctionNumParams() const
Definition: DerivedTypes.h:157
bool isSized(SmallPtrSetImpl< Type *> *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
Definition: Type.h:262
ArrayRef< Type * > const elements() const
Definition: DerivedTypes.h:305
unsigned getNumElements() const
Random access to the elements.
Definition: DerivedTypes.h:313
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:383
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:617
13: Structures
Definition: Type.h:73
Type * getStructElementType(unsigned N) const
Definition: DerivedTypes.h:333
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
Definition: DerivedTypes.h:503
param_iterator param_end() const
Definition: DerivedTypes.h:129
bool isOpaque() const
Return true if this is a type with an identity that has no body specified yet.
Definition: DerivedTypes.h:269
SequentialType(TypeID TID, Type *ElType, uint64_t NumElements)
Definition: DerivedTypes.h:348
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:142
15: Pointers
Definition: Type.h:75
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:423
12: Functions
Definition: Type.h:72
Type *const * ContainedTys
A pointer to the array of Types contained by this Type.
Definition: Type.h:111
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition: Type.h:130
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition: SmallPtrSet.h:345
unsigned getBitWidth() const
Return the number of bits in the Vector type.
Definition: DerivedTypes.h:452
APInt getMask() const
For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
Definition: Type.cpp:269
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:451
TypeID getTypeID() const
Return the type id for the type.
Definition: Type.h:138
uint64_t getArrayNumElements() const
Definition: DerivedTypes.h:388
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:457
Class to represent struct types.
Definition: DerivedTypes.h:201
static StringRef getName(Value *V)
TypeID
Definitions of all of the base types for the Type system.
Definition: Type.h:55
Type * getFunctionParamType(unsigned i) const
Definition: DerivedTypes.h:153
uint64_t getNumElements() const
Definition: DerivedTypes.h:359
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:336
ELFYAML::ELF_STO Other
Definition: ELFYAML.cpp:695
Class to represent function types.
Definition: DerivedTypes.h:103
Class to represent array types.
Definition: DerivedTypes.h:369
bool isVarArg() const
Definition: DerivedTypes.h:123
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
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:70
Type(LLVMContext &C, TypeID tid)
Definition: Type.h:91
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
Definition: DerivedTypes.h:66
Type *const * subtype_iterator
Definition: Type.h:310
Type::subtype_iterator element_iterator
Definition: DerivedTypes.h:301
const char * Name
Class to represent pointers.
Definition: DerivedTypes.h:467
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return &#39;this&#39;.
Definition: Type.h:301
11: Arbitrary bit width integers
Definition: Type.h:71
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:433
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
static std::enable_if< are_base_of< Type, Tys... >::value, StructType * >::type create(StringRef Name, Type *elt1, Tys *... elts)
Definition: DerivedTypes.h:235
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
Definition: DerivedTypes.h:139
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:174
element_iterator element_end() const
Definition: DerivedTypes.h:304
ArrayRef< Type * > params() const
Definition: DerivedTypes.h:130
param_iterator param_begin() const
Definition: DerivedTypes.h:128
static VectorType * getInteger(VectorType *VTy)
This static method gets a VectorType with the same number of elements as the input type...
Definition: DerivedTypes.h:406
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:363
unsigned getStructNumElements() const
Definition: DerivedTypes.h:329
unsigned getAddressSpace() const
Return the address space of the Pointer type.
Definition: DerivedTypes.h:495
Class to represent integer types.
Definition: DerivedTypes.h:40
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:442
bool isFunctionVarArg() const
Definition: DerivedTypes.h:149
14: Arrays
Definition: Type.h:74
This is the superclass of the array and vector type classes.
Definition: DerivedTypes.h:343
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:240
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:482
16: SIMD &#39;packed&#39; format, or other vector type
Definition: Type.h:76
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:864
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:320
Type::subtype_iterator param_iterator
Definition: DerivedTypes.h:126
AddressSpace
Definition: NVPTXBaseInfo.h:22
Type * getReturnType() const
Definition: DerivedTypes.h:124
const size_t N
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:415
unsigned getVectorNumElements() const
Definition: DerivedTypes.h:462
Symbol info for RuntimeDyld.
bool isLiteral() const
Return true if this type is uniqued by structural equivalence, false if it is a struct definition...
Definition: DerivedTypes.h:265
Class to represent vector types.
Definition: DerivedTypes.h:393
Class for arbitrary precision integers.
Definition: APInt.h:69
element_iterator element_begin() const
Definition: DerivedTypes.h:303
Common super class of ArrayType, StructType and VectorType.
Definition: DerivedTypes.h:162
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:92
std::enable_if< are_base_of< Type, Tys... >::value, void >::type setBody(Type *elt1, Tys *... elts)
Definition: DerivedTypes.h:291
unsigned getSubclassData() const
Definition: Type.h:95
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:264
bool isPacked() const
Definition: DerivedTypes.h:261
unsigned getIntegerBitWidth() const
Definition: DerivedTypes.h:97
Minimum number of bits that can be specified.
Definition: DerivedTypes.h:51
static bool isValidElementType(Type *Ty)
Predicate for the element types that the SLP vectorizer supports.
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:76
static bool classof(const Type *T)
Implement support type inquiry through isa, cast, and dyn_cast.
Definition: DerivedTypes.h:498
IntegerType(LLVMContext &C, unsigned NumBits)
Definition: DerivedTypes.h:44
void setSubclassData(unsigned val)
Definition: Type.h:97
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
traits class for checking whether type T is a base class for all the given types in the variadic list...
Definition: STLExtras.h:715
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
Definition: Type.cpp:115
LLVM Value Representation.
Definition: Value.h:73
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
Definition: Type.cpp:593
Type * getElementType() const
Definition: DerivedTypes.h:360
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
bool hasName() const
Return true if this is a named struct that has a non-empty name.
Definition: DerivedTypes.h:275
Maximum number of bits that can be specified.
Definition: DerivedTypes.h:52
Type * getElementType() const
Definition: DerivedTypes.h:486
unsigned NumContainedTys
Keeps track of how many Type*&#39;s there are in the ContainedTys list.
Definition: Type.h:104
StringRef getStructName() const
Definition: DerivedTypes.h:325