LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Type.h
Go to the documentation of this file.
1 //===-- llvm/Type.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 declaration of the Type class. For more "Type"
11 // stuff, look in DerivedTypes.h.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_IR_TYPE_H
16 #define LLVM_IR_TYPE_H
17 
18 #include "llvm/ADT/APFloat.h"
19 #include "llvm/Support/Casting.h"
21 #include "llvm/Support/DataTypes.h"
23 #include "llvm-c/Core.h"
24 
25 namespace llvm {
26 
27 class PointerType;
28 class IntegerType;
29 class raw_ostream;
30 class Module;
31 class LLVMContext;
32 class LLVMContextImpl;
33 class StringRef;
34 template<class GraphType> struct GraphTraits;
35 
36 /// The instances of the Type class are immutable: once they are created,
37 /// they are never changed. Also note that only one instance of a particular
38 /// type is ever created. Thus seeing if two types are equal is a matter of
39 /// doing a trivial pointer comparison. To enforce that no two equal instances
40 /// are created, Type instances can only be created via static factory methods
41 /// in class Type and in derived classes. Once allocated, Types are never
42 /// free'd.
43 ///
44 class Type {
45 public:
46  //===--------------------------------------------------------------------===//
47  /// Definitions of all of the base types for the Type system. Based on this
48  /// value, you can cast to a class defined in DerivedTypes.h.
49  /// Note: If you add an element to this, you need to add an element to the
50  /// Type::getPrimitiveType function, or else things will break!
51  /// Also update LLVMTypeKind and LLVMGetTypeKind () in the C binding.
52  ///
53  enum TypeID {
54  // PrimitiveTypes - make sure LastPrimitiveTyID stays up to date.
55  VoidTyID = 0, ///< 0: type with no size
56  HalfTyID, ///< 1: 16-bit floating point type
57  FloatTyID, ///< 2: 32-bit floating point type
58  DoubleTyID, ///< 3: 64-bit floating point type
59  X86_FP80TyID, ///< 4: 80-bit floating point type (X87)
60  FP128TyID, ///< 5: 128-bit floating point type (112-bit mantissa)
61  PPC_FP128TyID, ///< 6: 128-bit floating point type (two 64-bits, PowerPC)
62  LabelTyID, ///< 7: Labels
63  MetadataTyID, ///< 8: Metadata
64  X86_MMXTyID, ///< 9: MMX vectors (64 bits, X86 specific)
65 
66  // Derived types... see DerivedTypes.h file.
67  // Make sure FirstDerivedTyID stays up to date!
68  IntegerTyID, ///< 10: Arbitrary bit width integers
69  FunctionTyID, ///< 11: Functions
70  StructTyID, ///< 12: Structures
71  ArrayTyID, ///< 13: Arrays
72  PointerTyID, ///< 14: Pointers
73  VectorTyID, ///< 15: SIMD 'packed' format, or other vector type
74 
75  NumTypeIDs, // Must remain as last defined ID
78  };
79 
80 private:
81  /// Context - This refers to the LLVMContext in which this type was uniqued.
82  LLVMContext &Context;
83 
84  // Due to Ubuntu GCC bug 910363:
85  // https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/910363
86  // Bitpack ID and SubclassData manually.
87  // Note: TypeID : low 8 bit; SubclassData : high 24 bit.
88  uint32_t IDAndSubclassData;
89 
90 protected:
91  friend class LLVMContextImpl;
92  explicit Type(LLVMContext &C, TypeID tid)
93  : Context(C), IDAndSubclassData(0),
95  setTypeID(tid);
96  }
97  ~Type() {}
98 
100  IDAndSubclassData = (ID & 0xFF) | (IDAndSubclassData & 0xFFFFFF00);
101  assert(getTypeID() == ID && "TypeID data too large for field");
102  }
103 
104  unsigned getSubclassData() const { return IDAndSubclassData >> 8; }
105 
106  void setSubclassData(unsigned val) {
107  IDAndSubclassData = (IDAndSubclassData & 0xFF) | (val << 8);
108  // Ensure we don't have any accidental truncation.
109  assert(getSubclassData() == val && "Subclass data too large for field");
110  }
111 
112  /// NumContainedTys - Keeps track of how many Type*'s there are in the
113  /// ContainedTys list.
114  unsigned NumContainedTys;
115 
116  /// ContainedTys - A pointer to the array of Types contained by this Type.
117  /// For example, this includes the arguments of a function type, the elements
118  /// of a structure, the pointee of a pointer, the element type of an array,
119  /// etc. This pointer may be 0 for types that don't contain other types
120  /// (Integer, Double, Float).
121  Type * const *ContainedTys;
122 
123 public:
124  void print(raw_ostream &O) const;
125  void dump() const;
126 
127  /// getContext - Return the LLVMContext in which this type was uniqued.
128  LLVMContext &getContext() const { return Context; }
129 
130  //===--------------------------------------------------------------------===//
131  // Accessors for working with types.
132  //
133 
134  /// getTypeID - Return the type id for the type. This will return one
135  /// of the TypeID enum elements defined above.
136  ///
137  TypeID getTypeID() const { return (TypeID)(IDAndSubclassData & 0xFF); }
138 
139  /// isVoidTy - Return true if this is 'void'.
140  bool isVoidTy() const { return getTypeID() == VoidTyID; }
141 
142  /// isHalfTy - Return true if this is 'half', a 16-bit IEEE fp type.
143  bool isHalfTy() const { return getTypeID() == HalfTyID; }
144 
145  /// isFloatTy - Return true if this is 'float', a 32-bit IEEE fp type.
146  bool isFloatTy() const { return getTypeID() == FloatTyID; }
147 
148  /// isDoubleTy - Return true if this is 'double', a 64-bit IEEE fp type.
149  bool isDoubleTy() const { return getTypeID() == DoubleTyID; }
150 
151  /// isX86_FP80Ty - Return true if this is x86 long double.
152  bool isX86_FP80Ty() const { return getTypeID() == X86_FP80TyID; }
153 
154  /// isFP128Ty - Return true if this is 'fp128'.
155  bool isFP128Ty() const { return getTypeID() == FP128TyID; }
156 
157  /// isPPC_FP128Ty - Return true if this is powerpc long double.
158  bool isPPC_FP128Ty() const { return getTypeID() == PPC_FP128TyID; }
159 
160  /// isFloatingPointTy - Return true if this is one of the six floating point
161  /// types
162  bool isFloatingPointTy() const {
163  return getTypeID() == HalfTyID || getTypeID() == FloatTyID ||
164  getTypeID() == DoubleTyID ||
165  getTypeID() == X86_FP80TyID || getTypeID() == FP128TyID ||
167  }
168 
169  const fltSemantics &getFltSemantics() const {
170  switch (getTypeID()) {
171  case HalfTyID: return APFloat::IEEEhalf;
172  case FloatTyID: return APFloat::IEEEsingle;
173  case DoubleTyID: return APFloat::IEEEdouble;
175  case FP128TyID: return APFloat::IEEEquad;
177  default: llvm_unreachable("Invalid floating type");
178  }
179  }
180 
181  /// isX86_MMXTy - Return true if this is X86 MMX.
182  bool isX86_MMXTy() const { return getTypeID() == X86_MMXTyID; }
183 
184  /// isFPOrFPVectorTy - Return true if this is a FP type or a vector of FP.
185  ///
186  bool isFPOrFPVectorTy() const { return getScalarType()->isFloatingPointTy(); }
187 
188  /// isLabelTy - Return true if this is 'label'.
189  bool isLabelTy() const { return getTypeID() == LabelTyID; }
190 
191  /// isMetadataTy - Return true if this is 'metadata'.
192  bool isMetadataTy() const { return getTypeID() == MetadataTyID; }
193 
194  /// isIntegerTy - True if this is an instance of IntegerType.
195  ///
196  bool isIntegerTy() const { return getTypeID() == IntegerTyID; }
197 
198  /// isIntegerTy - Return true if this is an IntegerType of the given width.
199  bool isIntegerTy(unsigned Bitwidth) const;
200 
201  /// isIntOrIntVectorTy - Return true if this is an integer type or a vector of
202  /// integer types.
203  ///
204  bool isIntOrIntVectorTy() const { return getScalarType()->isIntegerTy(); }
205 
206  /// isFunctionTy - True if this is an instance of FunctionType.
207  ///
208  bool isFunctionTy() const { return getTypeID() == FunctionTyID; }
209 
210  /// isStructTy - True if this is an instance of StructType.
211  ///
212  bool isStructTy() const { return getTypeID() == StructTyID; }
213 
214  /// isArrayTy - True if this is an instance of ArrayType.
215  ///
216  bool isArrayTy() const { return getTypeID() == ArrayTyID; }
217 
218  /// isPointerTy - True if this is an instance of PointerType.
219  ///
220  bool isPointerTy() const { return getTypeID() == PointerTyID; }
221 
222  /// isPtrOrPtrVectorTy - Return true if this is a pointer type or a vector of
223  /// pointer types.
224  ///
225  bool isPtrOrPtrVectorTy() const { return getScalarType()->isPointerTy(); }
226 
227  /// isVectorTy - True if this is an instance of VectorType.
228  ///
229  bool isVectorTy() const { return getTypeID() == VectorTyID; }
230 
231  /// canLosslesslyBitCastTo - Return true if this type could be converted
232  /// with a lossless BitCast to type 'Ty'. For example, i8* to i32*. BitCasts
233  /// are valid for types of the same size only where no re-interpretation of
234  /// the bits is done.
235  /// @brief Determine if this type could be losslessly bitcast to Ty
236  bool canLosslesslyBitCastTo(Type *Ty) const;
237 
238  /// isEmptyTy - Return true if this type is empty, that is, it has no
239  /// elements or all its elements are empty.
240  bool isEmptyTy() const;
241 
242  /// Here are some useful little methods to query what type derived types are
243  /// Note that all other types can just compare to see if this == Type::xxxTy;
244  ///
245  bool isPrimitiveType() const { return getTypeID() <= LastPrimitiveTyID; }
246  bool isDerivedType() const { return getTypeID() >= FirstDerivedTyID; }
247 
248  /// isFirstClassType - Return true if the type is "first class", meaning it
249  /// is a valid type for a Value.
250  ///
251  bool isFirstClassType() const {
252  return getTypeID() != FunctionTyID && getTypeID() != VoidTyID;
253  }
254 
255  /// isSingleValueType - Return true if the type is a valid type for a
256  /// register in codegen. This includes all first-class types except struct
257  /// and array types.
258  ///
259  bool isSingleValueType() const {
260  return (getTypeID() != VoidTyID && isPrimitiveType()) ||
262  getTypeID() == VectorTyID;
263  }
264 
265  /// isAggregateType - Return true if the type is an aggregate type. This
266  /// means it is valid as the first operand of an insertvalue or
267  /// extractvalue instruction. This includes struct and array types, but
268  /// does not include vector types.
269  ///
270  bool isAggregateType() const {
271  return getTypeID() == StructTyID || getTypeID() == ArrayTyID;
272  }
273 
274  /// isSized - Return true if it makes sense to take the size of this type. To
275  /// get the actual size for a particular target, it is reasonable to use the
276  /// DataLayout subsystem to do this.
277  ///
278  bool isSized() const {
279  // If it's a primitive, it is always sized.
280  if (getTypeID() == IntegerTyID || isFloatingPointTy() ||
281  getTypeID() == PointerTyID ||
282  getTypeID() == X86_MMXTyID)
283  return true;
284  // If it is not something that can have a size (e.g. a function or label),
285  // it doesn't have a size.
286  if (getTypeID() != StructTyID && getTypeID() != ArrayTyID &&
287  getTypeID() != VectorTyID)
288  return false;
289  // Otherwise we have to try harder to decide.
290  return isSizedDerivedType();
291  }
292 
293  /// getPrimitiveSizeInBits - Return the basic size of this type if it is a
294  /// primitive type. These are fixed by LLVM and are not target dependent.
295  /// This will return zero if the type does not have a size or is not a
296  /// primitive type.
297  ///
298  /// Note that this may not reflect the size of memory allocated for an
299  /// instance of the type or the number of bytes that are written when an
300  /// instance of the type is stored to memory. The DataLayout class provides
301  /// additional query functions to provide this information.
302  ///
303  unsigned getPrimitiveSizeInBits() const;
304 
305  /// getScalarSizeInBits - If this is a vector type, return the
306  /// getPrimitiveSizeInBits value for the element type. Otherwise return the
307  /// getPrimitiveSizeInBits value for this type.
308  unsigned getScalarSizeInBits();
309 
310  /// getFPMantissaWidth - Return the width of the mantissa of this type. This
311  /// is only valid on floating point types. If the FP type does not
312  /// have a stable mantissa (e.g. ppc long double), this method returns -1.
313  int getFPMantissaWidth() const;
314 
315  /// getScalarType - If this is a vector type, return the element type,
316  /// otherwise return 'this'.
317  const Type *getScalarType() const;
318  Type *getScalarType();
319 
320  //===--------------------------------------------------------------------===//
321  // Type Iteration support.
322  //
323  typedef Type * const *subtype_iterator;
326 
327  typedef std::reverse_iterator<subtype_iterator> subtype_reverse_iterator;
330  }
333  }
334 
335  /// getContainedType - This method is used to implement the type iterator
336  /// (defined a the end of the file). For derived types, this returns the
337  /// types 'contained' in the derived type.
338  ///
339  Type *getContainedType(unsigned i) const {
340  assert(i < NumContainedTys && "Index out of range!");
341  return ContainedTys[i];
342  }
343 
344  /// getNumContainedTypes - Return the number of types in the derived type.
345  ///
346  unsigned getNumContainedTypes() const { return NumContainedTys; }
347 
348  //===--------------------------------------------------------------------===//
349  // Helper methods corresponding to subclass methods. This forces a cast to
350  // the specified subclass and calls its accessor. "getVectorNumElements" (for
351  // example) is shorthand for cast<VectorType>(Ty)->getNumElements(). This is
352  // only intended to cover the core methods that are frequently used, helper
353  // methods should not be added here.
354 
355  unsigned getIntegerBitWidth() const;
356 
357  Type *getFunctionParamType(unsigned i) const;
358  unsigned getFunctionNumParams() const;
359  bool isFunctionVarArg() const;
360 
361  StringRef getStructName() const;
362  unsigned getStructNumElements() const;
363  Type *getStructElementType(unsigned N) const;
364 
366 
367  uint64_t getArrayNumElements() const;
369 
370  unsigned getVectorNumElements() const;
372 
374 
375  /// \brief Get the address space of this pointer or pointer vector type.
376  unsigned getPointerAddressSpace() const;
377 
378  //===--------------------------------------------------------------------===//
379  // Static members exported by the Type class itself. Useful for getting
380  // instances of Type.
381  //
382 
383  /// getPrimitiveType - Return a type based on an identifier.
384  static Type *getPrimitiveType(LLVMContext &C, TypeID IDNumber);
385 
386  //===--------------------------------------------------------------------===//
387  // These are the builtin types that are always available.
388  //
389  static Type *getVoidTy(LLVMContext &C);
390  static Type *getLabelTy(LLVMContext &C);
391  static Type *getHalfTy(LLVMContext &C);
392  static Type *getFloatTy(LLVMContext &C);
393  static Type *getDoubleTy(LLVMContext &C);
394  static Type *getMetadataTy(LLVMContext &C);
395  static Type *getX86_FP80Ty(LLVMContext &C);
396  static Type *getFP128Ty(LLVMContext &C);
397  static Type *getPPC_FP128Ty(LLVMContext &C);
398  static Type *getX86_MMXTy(LLVMContext &C);
399  static IntegerType *getIntNTy(LLVMContext &C, unsigned N);
405 
406  //===--------------------------------------------------------------------===//
407  // Convenience methods for getting pointer types with one of the above builtin
408  // types as pointee.
409  //
410  static PointerType *getHalfPtrTy(LLVMContext &C, unsigned AS = 0);
411  static PointerType *getFloatPtrTy(LLVMContext &C, unsigned AS = 0);
412  static PointerType *getDoublePtrTy(LLVMContext &C, unsigned AS = 0);
413  static PointerType *getX86_FP80PtrTy(LLVMContext &C, unsigned AS = 0);
414  static PointerType *getFP128PtrTy(LLVMContext &C, unsigned AS = 0);
415  static PointerType *getPPC_FP128PtrTy(LLVMContext &C, unsigned AS = 0);
416  static PointerType *getX86_MMXPtrTy(LLVMContext &C, unsigned AS = 0);
417  static PointerType *getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS = 0);
418  static PointerType *getInt1PtrTy(LLVMContext &C, unsigned AS = 0);
419  static PointerType *getInt8PtrTy(LLVMContext &C, unsigned AS = 0);
420  static PointerType *getInt16PtrTy(LLVMContext &C, unsigned AS = 0);
421  static PointerType *getInt32PtrTy(LLVMContext &C, unsigned AS = 0);
422  static PointerType *getInt64PtrTy(LLVMContext &C, unsigned AS = 0);
423 
424  /// getPointerTo - Return a pointer to the current type. This is equivalent
425  /// to PointerType::get(Foo, AddrSpace).
426  PointerType *getPointerTo(unsigned AddrSpace = 0);
427 
428 private:
429  /// isSizedDerivedType - Derived types like structures and arrays are sized
430  /// iff all of the members of the type are sized as well. Since asking for
431  /// their size is relatively uncommon, move this operation out of line.
432  bool isSizedDerivedType() const;
433 };
434 
435 // Printing of types.
436 static inline raw_ostream &operator<<(raw_ostream &OS, Type &T) {
437  T.print(OS);
438  return OS;
439 }
440 
441 // allow isa<PointerType>(x) to work without DerivedTypes.h included.
442 template <> struct isa_impl<PointerType, Type> {
443  static inline bool doit(const Type &Ty) {
444  return Ty.getTypeID() == Type::PointerTyID;
445  }
446 };
447 
448 
449 //===----------------------------------------------------------------------===//
450 // Provide specializations of GraphTraits to be able to treat a type as a
451 // graph of sub types.
452 
453 
454 template <> struct GraphTraits<Type*> {
455  typedef Type NodeType;
457 
458  static inline NodeType *getEntryNode(Type *T) { return T; }
459  static inline ChildIteratorType child_begin(NodeType *N) {
460  return N->subtype_begin();
461  }
462  static inline ChildIteratorType child_end(NodeType *N) {
463  return N->subtype_end();
464  }
465 };
466 
467 template <> struct GraphTraits<const Type*> {
468  typedef const Type NodeType;
470 
471  static inline NodeType *getEntryNode(NodeType *T) { return T; }
472  static inline ChildIteratorType child_begin(NodeType *N) {
473  return N->subtype_begin();
474  }
475  static inline ChildIteratorType child_end(NodeType *N) {
476  return N->subtype_end();
477  }
478 };
479 
480 // Create wrappers for C Binding types (see CBindingWrapping.h).
482 
483 /* Specialized opaque type conversions.
484  */
486  return reinterpret_cast<Type**>(Tys);
487 }
488 
489 inline LLVMTypeRef *wrap(Type **Tys) {
490  return reinterpret_cast<LLVMTypeRef*>(const_cast<Type**>(Tys));
491 }
492 
493 } // End llvm namespace
494 
495 #endif
COFF::RelocationTypeX86 Type
Definition: COFFYAML.cpp:227
7: Labels
Definition: Type.h:62
struct LLVMOpaqueType * LLVMTypeRef
Definition: Core.h:87
static Type * getDoubleTy(LLVMContext &C)
Definition: Type.cpp:231
static IntegerType * getInt1Ty(LLVMContext &C)
Definition: Type.cpp:238
unsigned getStructNumElements() const
Definition: Type.cpp:198
Type * getSequentialElementType() const
Definition: Type.cpp:206
bool isPrimitiveType() const
Definition: Type.h:245
void dump() const
Definition: AsmWriter.cpp:2215
unsigned getScalarSizeInBits()
Definition: Type.cpp:135
static const fltSemantics IEEEdouble
Definition: APFloat.h:133
2: 32-bit floating point type
Definition: Type.h:57
static NodeType * getEntryNode(Type *T)
Definition: Type.h:458
Type::TypeID TypeID
bool isDerivedType() const
Definition: Type.h:246
static PointerType * getInt32PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:292
static ChildIteratorType child_begin(NodeType *N)
Definition: Type.h:459
bool isDoubleTy() const
isDoubleTy - Return true if this is 'double', a 64-bit IEEE fp type.
Definition: Type.h:149
bool isPtrOrPtrVectorTy() const
Definition: Type.h:225
int getFPMantissaWidth() const
Definition: Type.cpp:142
12: Structures
Definition: Type.h:70
4: 80-bit floating point type (X87)
Definition: Type.h:59
LLVMContext ** unwrap(LLVMContextRef *Tys)
Definition: LLVMContext.h:119
subtype_reverse_iterator subtype_rend() const
Definition: Type.h:331
1: 16-bit floating point type
Definition: Type.h:56
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:242
static Type * getMetadataTy(LLVMContext &C)
Definition: Type.cpp:232
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
Definition: Type.cpp:218
14: Pointers
Definition: Type.h:72
static IntegerType * getInt16Ty(LLVMContext &C)
Definition: Type.cpp:240
static Type * getX86_MMXTy(LLVMContext &C)
Definition: Type.cpp:236
static PointerType * getX86_MMXPtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:272
11: Functions
Definition: Type.h:69
subtype_iterator subtype_end() const
Definition: Type.h:325
static PointerType * getInt64PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:296
static Type * getX86_FP80Ty(LLVMContext &C)
Definition: Type.cpp:233
Type *const * ContainedTys
Definition: Type.h:121
Type * getPointerElementType() const
Definition: Type.h:373
bool isSingleValueType() const
Definition: Type.h:259
void print(raw_ostream &O) const
Definition: AsmWriter.cpp:2146
static const fltSemantics x87DoubleExtended
Definition: APFloat.h:136
static Type * getFloatTy(LLVMContext &C)
Definition: Type.cpp:230
#define llvm_unreachable(msg)
Type * getArrayElementType() const
Definition: Type.h:368
bool canLosslesslyBitCastTo(Type *Ty) const
Determine if this type could be losslessly bitcast to Ty.
Definition: Type.cpp:65
TypeID
Definition: Type.h:53
StringRef getStructName() const
Definition: Type.cpp:194
static PointerType * getInt16PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:288
static const fltSemantics IEEEquad
Definition: APFloat.h:134
ID
LLVM Calling Convention Representation.
Definition: CallingConv.h:26
Type * getVectorElementType() const
Definition: Type.h:371
Type * getFunctionParamType(unsigned i) const
Definition: Type.cpp:186
static Type * getPPC_FP128Ty(LLVMContext &C)
Definition: Type.cpp:235
#define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref)
static Type * getLabelTy(LLVMContext &C)
Definition: Type.cpp:228
LLVMContext & getContext() const
getContext - Return the LLVMContext in which this type was uniqued.
Definition: Type.h:128
bool isHalfTy() const
isHalfTy - Return true if this is 'half', a 16-bit IEEE fp type.
Definition: Type.h:143
#define T
static bool doit(const Type &Ty)
Definition: Type.h:443
static PointerType * getDoublePtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:256
bool isFirstClassType() const
Definition: Type.h:251
TypeID getTypeID() const
Definition: Type.h:137
bool isFloatingPointTy() const
Definition: Type.h:162
bool isArrayTy() const
Definition: Type.h:216
unsigned getSubclassData() const
Definition: Type.h:104
Type(LLVMContext &C, TypeID tid)
Definition: Type.h:92
bool isPPC_FP128Ty() const
isPPC_FP128Ty - Return true if this is powerpc long double.
Definition: Type.h:158
10: Arbitrary bit width integers
Definition: Type.h:68
static ChildIteratorType child_begin(NodeType *N)
Definition: Type.h:472
unsigned getFunctionNumParams() const
Definition: Type.cpp:190
0: type with no size
Definition: Type.h:55
bool isX86_MMXTy() const
isX86_MMXTy - Return true if this is X86 MMX.
Definition: Type.h:182
bool isIntOrIntVectorTy() const
Definition: Type.h:204
always inline
bool isVectorTy() const
Definition: Type.h:229
static ChildIteratorType child_end(NodeType *N)
Definition: Type.h:475
Type * getContainedType(unsigned i) const
Definition: Type.h:339
bool isFloatTy() const
isFloatTy - Return true if this is 'float', a 32-bit IEEE fp type.
Definition: Type.h:146
This file declares a class to represent arbitrary precision floating point values and provide a varie...
static Type * getVoidTy(LLVMContext &C)
Definition: Type.cpp:227
6: 128-bit floating point type (two 64-bits, PowerPC)
Definition: Type.h:61
Integer representation type.
Definition: DerivedTypes.h:37
Type::subtype_iterator ChildIteratorType
Definition: Type.h:456
static PointerType * getPPC_FP128PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:268
Type::subtype_iterator ChildIteratorType
Definition: Type.h:469
unsigned getNumContainedTypes() const
Definition: Type.h:346
bool isFP128Ty() const
isFP128Ty - Return true if this is 'fp128'.
Definition: Type.h:155
bool isPointerTy() const
Definition: Type.h:220
static PointerType * getFloatPtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:252
bool isFPOrFPVectorTy() const
Definition: Type.h:186
PointerType * getPointerTo(unsigned AddrSpace=0)
Definition: Type.cpp:756
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:284
static const fltSemantics IEEEhalf
Definition: APFloat.h:131
static Type * getFP128Ty(LLVMContext &C)
Definition: Type.cpp:234
static PointerType * getX86_FP80PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:260
13: Arrays
Definition: Type.h:71
static Type * getHalfTy(LLVMContext &C)
Definition: Type.cpp:229
static const fltSemantics PPCDoubleDouble
Definition: APFloat.h:135
static PointerType * getInt1PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:280
unsigned getIntegerBitWidth() const
Definition: Type.cpp:178
bool isFunctionTy() const
Definition: Type.h:208
15: SIMD 'packed' format, or other vector type
Definition: Type.h:73
unsigned getVectorNumElements() const
Definition: Type.cpp:214
bool isFunctionVarArg() const
Definition: Type.cpp:182
Type *const * subtype_iterator
Definition: Type.h:323
~Type()
Definition: Type.h:97
LLVMContextRef * wrap(const LLVMContext **Tys)
Definition: LLVMContext.h:123
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
Definition: Type.cpp:244
static PointerType * getHalfPtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:248
static Type * getPrimitiveType(LLVMContext &C, TypeID IDNumber)
getPrimitiveType - Return a type based on an identifier.
Definition: Type.cpp:26
const fltSemantics & getFltSemantics() const
Definition: Type.h:169
static PointerType * getFP128PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:264
8: Metadata
Definition: Type.h:63
bool isIntegerTy() const
Definition: Type.h:196
bool isStructTy() const
Definition: Type.h:212
static const fltSemantics IEEEsingle
Definition: APFloat.h:132
bool isX86_FP80Ty() const
isX86_FP80Ty - Return true if this is x86 long double.
Definition: Type.h:152
bool isAggregateType() const
Definition: Type.h:270
void setTypeID(TypeID ID)
Definition: Type.h:99
static IntegerType * getInt32Ty(LLVMContext &C)
Definition: Type.cpp:241
#define N
const Type * getScalarType() const
Definition: Type.cpp:51
uint64_t getArrayNumElements() const
Definition: Type.cpp:210
unsigned getPrimitiveSizeInBits() const
Definition: Type.cpp:117
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
Definition: APInt.h:1688
static PointerType * getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS=0)
Definition: Type.cpp:276
3: 64-bit floating point type
Definition: Type.h:58
void setSubclassData(unsigned val)
Definition: Type.h:106
static NodeType * getEntryNode(NodeType *T)
Definition: Type.h:471
bool isEmptyTy() const
Definition: Type.cpp:98
bool isLabelTy() const
isLabelTy - Return true if this is 'label'.
Definition: Type.h:189
bool isSized() const
Definition: Type.h:278
static ChildIteratorType child_end(NodeType *N)
Definition: Type.h:462
std::reverse_iterator< subtype_iterator > subtype_reverse_iterator
Definition: Type.h:327
Type * getStructElementType(unsigned N) const
Definition: Type.cpp:202
9: MMX vectors (64 bits, X86 specific)
Definition: Type.h:64
subtype_reverse_iterator subtype_rbegin() const
Definition: Type.h:328
static IntegerType * getInt8Ty(LLVMContext &C)
Definition: Type.cpp:239
unsigned NumContainedTys
Definition: Type.h:114
subtype_iterator subtype_begin() const
Definition: Type.h:324
bool isVoidTy() const
isVoidTy - Return true if this is 'void'.
Definition: Type.h:140
5: 128-bit floating point type (112-bit mantissa)
Definition: Type.h:60
bool isMetadataTy() const
isMetadataTy - Return true if this is 'metadata'.
Definition: Type.h:192