/// Class to represent integer types. Note that this class is also used to
/// represent the built-in integer types: Int1Ty, Int8Ty, Int16Ty, Int32Ty and
/// Class to represent integer types. Note that this class is also used to
/// represent the built-in integer types: Int1Ty, Int8Ty, Int16Ty, Int32Ty and
/// If an IntegerType with the same NumBits value was previously instantiated,
/// that instance will be returned. Otherwise a new one will be created. Only
/// one instance with a given NumBits value is ever created.
/// If an IntegerType with the same NumBits value was previously instantiated,
/// that instance will be returned. Otherwise a new one will be created. Only
/// one instance with a given NumBits value is ever created.
/// For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
/// @returns a bit mask with ones set for all the bits of this type.
/// @brief Get a bit mask for this type.
APInt getMask() const;
/// This method determines if the width of this IntegerType is a power-of-2
/// For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
/// @returns a bit mask with ones set for all the bits of this type.
/// @brief Get a bit mask for this type.
APInt getMask() const;
/// This method determines if the width of this IntegerType is a power-of-2
/// @returns true if this is a power-of-2 byte width.
/// @brief Is this a power-of-2 byte-width IntegerType ?
bool isPowerOf2ByteWidth() const;
/// @returns true if this is a power-of-2 byte width.
/// @brief Is this a power-of-2 byte-width IntegerType ?
bool isPowerOf2ByteWidth() const;
///
static FunctionType *get(
const Type *Result, ///< The result type
const std::vector<const Type*> &Params, ///< The types of the parameters
bool isVarArg ///< Whether this is a variable argument length function
);
///
static FunctionType *get(
const Type *Result, ///< The result type
const std::vector<const Type*> &Params, ///< The types of the parameters
bool isVarArg ///< Whether this is a variable argument length function
);
+
+ /// FunctionType::get - Create a FunctionType taking no parameters.
+ ///
+ static FunctionType *get(
+ const Type *Result, ///< The result type
+ bool isVarArg ///< Whether this is a variable argument length function
+ ) {
+ return get(Result, std::vector<const Type *>(), isVarArg);
+ }
+
/// isValidReturnType - Return true if the specified type is valid as a return
/// type.
static bool isValidReturnType(const Type *RetTy);
/// isValidReturnType - Return true if the specified type is valid as a return
/// type.
static bool isValidReturnType(const Type *RetTy);
inline bool isVarArg() const { return isVarArgs; }
inline const Type *getReturnType() const { return ContainedTys[0]; }
inline bool isVarArg() const { return isVarArgs; }
inline const Type *getReturnType() const { return ContainedTys[0]; }
/// StructType::get - This static method is a convenience method for
/// creating structure types by specifying the elements as arguments.
/// Note that this method always returns a non-packed struct. To get
/// an empty struct, pass NULL, NULL.
static StructType *get(const Type *type, ...) END_WITH_NULL;
/// StructType::get - This static method is a convenience method for
/// creating structure types by specifying the elements as arguments.
/// Note that this method always returns a non-packed struct. To get
/// an empty struct, pass NULL, NULL.
static StructType *get(const Type *type, ...) END_WITH_NULL;
// Iterator access to the elements
typedef Type::subtype_iterator element_iterator;
element_iterator element_begin() const { return ContainedTys; }
// Iterator access to the elements
typedef Type::subtype_iterator element_iterator;
element_iterator element_begin() const { return ContainedTys; }
// avoiding warning: 'this' : used in base member initializer list
SequentialType* this_() { return this; }
protected:
// avoiding warning: 'this' : used in base member initializer list
SequentialType* this_() { return this; }
protected:
inline uint64_t getNumElements() const { return NumElements; }
// Implement the AbstractTypeUser interface.
inline uint64_t getNumElements() const { return NumElements; }
// Implement the AbstractTypeUser interface.
/// @brief Return the number of elements in the Vector type.
inline unsigned getNumElements() const { return NumElements; }
/// @brief Return the number of bits in the Vector type.
/// @brief Return the number of elements in the Vector type.
inline unsigned getNumElements() const { return NumElements; }
/// @brief Return the number of bits in the Vector type.
class PointerType : public SequentialType {
friend class TypeMap<PointerValType, PointerType>;
unsigned AddressSpace;
class PointerType : public SequentialType {
friend class TypeMap<PointerValType, PointerType>;
unsigned AddressSpace;
PointerType(const PointerType &); // Do not implement
const PointerType &operator=(const PointerType &); // Do not implement
explicit PointerType(const Type *ElType, unsigned AddrSpace);
public:
PointerType(const PointerType &); // Do not implement
const PointerType &operator=(const PointerType &); // Do not implement
explicit PointerType(const Type *ElType, unsigned AddrSpace);
public:
/// type in a numbered address space.
static PointerType *get(const Type *ElementType, unsigned AddressSpace);
/// type in a numbered address space.
static PointerType *get(const Type *ElementType, unsigned AddressSpace);
/// @brief Return the address space of the Pointer type.
inline unsigned getAddressSpace() const { return AddressSpace; }
/// @brief Return the address space of the Pointer type.
inline unsigned getAddressSpace() const { return AddressSpace; }