Home | History | Annotate | Download | only in llvm

Lines Matching defs:Type

1 //===-- llvm/Type.h - Classes for handling data types -----------*- C++ -*-===//
10 // This file contains the declaration of the Type class. For more "Type"
30 /// The instances of the Type class are immutable: once they are created,
32 /// type is ever created. Thus seeing if two types are equal is a matter of
34 /// are created, Type instances can only be created via static factory methods
35 /// in class Type and in derived classes. Once allocated, Types are never
38 class Type {
41 /// Definitions of all of the base types for the Type system. Based on this
44 /// Type::getPrimitiveType function, or else things will break!
49 VoidTyID = 0, ///< 0: type with no size
50 FloatTyID, ///< 1: 32-bit floating point type
51 DoubleTyID, ///< 2: 64-bit floating point type
52 X86_FP80TyID, ///< 3: 80-bit floating point type (X87)
53 FP128TyID, ///< 4: 128-bit floating point type (112-bit mantissa)
54 PPC_FP128TyID, ///< 5: 128-bit floating point type (two 64-bits, PowerPC)
66 VectorTyID, ///< 14: SIMD 'packed' format, or other vector type
74 /// Context - This refers to the LLVMContext in which this type was uniqued.
77 TypeID ID : 8; // The current base type of this type.
82 explicit Type(LLVMContext &C, TypeID tid)
85 ~Type() {}
94 /// NumContainedTys - Keeps track of how many Type*'s there are in the
98 /// ContainedTys - A pointer to the array of Types contained by this Type.
99 /// For example, this includes the arguments of a function type, the elements
100 /// of a structure, the pointee of a pointer, the element type of an array,
103 Type * const *ContainedTys;
109 /// getContext - Return the LLVMContext in which this type was uniqued.
116 /// getTypeID - Return the type id for the type. This will return one
124 /// isFloatTy - Return true if this is 'float', a 32-bit IEEE fp type.
127 /// isDoubleTy - Return true if this is 'double', a 64-bit IEEE fp type.
149 /// isFPOrFPVectorTy - Return true if this is a FP type or a vector of FP.
166 /// isIntOrIntVectorTy - Return true if this is an integer type or a vector of
191 /// canLosslesslyBitCastTo - Return true if this type could be converted
192 /// with a lossless BitCast to type 'Ty'. For example, i8* to i32*. BitCasts
195 /// @brief Determine if this type could be losslessly bitcast to Ty
196 bool canLosslesslyBitCastTo(Type *Ty) const;
198 /// isEmptyTy - Return true if this type is empty, that is, it has no
202 /// Here are some useful little methods to query what type derived types are
203 /// Note that all other types can just compare to see if this == Type::xxxTy;
208 /// isFirstClassType - Return true if the type is "first class", meaning it
209 /// is a valid type for a Value.
215 /// isSingleValueType - Return true if the type is a valid type for a
224 /// isAggregateType - Return true if the type is an aggregate type. This
233 /// isSized - Return true if it makes sense to take the size of this type. To
250 /// getPrimitiveSizeInBits - Return the basic size of this type if it is a
251 /// primitive type. These are fixed by LLVM and are not target dependent.
252 /// This will return zero if the type does not have a size or is not a
253 /// primitive type.
256 /// instance of the type or the number of bytes that are written when an
257 /// instance of the type is stored to memory. The TargetData class provides
262 /// getScalarSizeInBits - If this is a vector type, return the
263 /// getPrimitiveSizeInBits value for the element type. Otherwise return the
264 /// getPrimitiveSizeInBits value for this type.
267 /// getFPMantissaWidth - Return the width of the mantissa of this type. This
268 /// is only valid on floating point types. If the FP type does not
272 /// getScalarType - If this is a vector type, return the element type,
274 Type *getScalarType();
277 // Type Iteration support.
279 typedef Type * const *subtype_iterator;
283 /// getContainedType - This method is used to implement the type iterator
285 /// types 'contained' in the derived type.
287 Type *getContainedType(unsigned i) const {
292 /// getNumContainedTypes - Return the number of types in the derived type.
297 // Static members exported by the Type class itself. Useful for getting
298 // instances of Type.
301 /// getPrimitiveType - Return a type based on an identifier.
302 static Type *getPrimitiveType(LLVMContext &C, TypeID IDNumber);
307 static Type *getVoidTy(LLVMContext &C);
308 static Type *getLabelTy(LLVMContext &C);
309 static Type *getFloatTy(LLVMContext &C);
310 static Type *getDoubleTy(LLVMContext &C);
311 static Type *getMetadataTy(LLVMContext &C);
312 static Type *getX86_FP80Ty(LLVMContext &C);
313 static Type *getFP128Ty(LLVMContext &C);
314 static Type *getPPC_FP128Ty(LLVMContext &C);
315 static Type *getX86_MMXTy(LLVMContext &C);
340 /// Methods for support type inquiry through isa, cast, and dyn_cast:
341 static inline bool classof(const Type *) { return true; }
343 /// getPointerTo - Return a pointer to the current type. This is equivalent
349 /// iff all of the members of the type are sized as well. Since asking for
355 static inline raw_ostream &operator<<(raw_ostream &OS, Type &T) {
361 template <> struct isa_impl<PointerType, Type> {
362 static inline bool doit(const Type &Ty) {
363 return Ty.getTypeID() == Type::PointerTyID;
369 // Provide specializations of GraphTraits to be able to treat a type as a
373 template <> struct GraphTraits<Type*> {
374 typedef Type NodeType;
375 typedef Type::subtype_iterator ChildIteratorType;
377 static inline NodeType *getEntryNode(Type *T) { return T; }
386 template <> struct GraphTraits<const Type*> {
387 typedef const Type NodeType;
388 typedef Type::subtype_iterator ChildIteratorType;