LLVM  mainline
llvm::IntegerType Class Reference

Class to represent integer types. More...

#include <DerivedTypes.h>

Inheritance diagram for llvm::IntegerType:
[legend]
Collaboration diagram for llvm::IntegerType:
[legend]

List of all members.

Public Types

enum  { MIN_INT_BITS = 1, MAX_INT_BITS = (1<<23)-1 }
This enum is just used to hold constants we need for IntegerType. More...

Public Member Functions

unsigned getBitWidth () const
Get the number of bits in this IntegerType.
getBitMask - Return a bitmask with ones set for all of the bits that can be set by an unsigned version of this type.
uint64_t getSignBit () const
getSignBit - Return a uint64_t with just the most significant bit set (the sign bit, if the value is treated as a signed number).
For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
bool isPowerOf2ByteWidth () const
This method determines if the width of this IntegerType is a power-of-2 in terms of 8 bit bytes.

Static Public Member Functions

static IntegerTypeget (LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
static bool classof (const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.

Protected Member Functions

IntegerType (LLVMContext &C, unsigned NumBits)

Friends

class LLVMContextImpl

Detailed Description

Class to represent integer types.

Note that this class is also used to represent the built-in integer types: Int1Ty, Int8Ty, Int16Ty, Int32Ty and Int64Ty. Integer representation type

Definition at line 37 of file DerivedTypes.h.

Member Enumeration Documentation

 anonymous enum

This enum is just used to hold constants we need for IntegerType.

Enumerator:
 MIN_INT_BITS Minimum number of bits that can be specified. MAX_INT_BITS Maximum number of bits that can be specified. Note that bit width is stored in the Type classes SubclassData field which has 23 bits. This yields a maximum bit width of 8,388,607 bits.

Definition at line 47 of file DerivedTypes.h.

Constructor & Destructor Documentation

 llvm::IntegerType::IntegerType ( LLVMContext & C, unsigned NumBits )  [inline, explicit, protected]

Definition at line 41 of file DerivedTypes.h.

References llvm::Type::setSubclassData().

Referenced by get().

Member Function Documentation

 static bool llvm::IntegerType::classof ( const Type * T )  [inline, static]

Methods for support type inquiry through isa, cast, and dyn_cast.

Definition at line 89 of file DerivedTypes.h.

References llvm::Type::getTypeID(), and llvm::Type::IntegerTyID.

 IntegerType * IntegerType::get ( LLVMContext & C, unsigned NumBits )  [static]

This static method is the primary way of constructing an IntegerType.

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. Get or create an IntegerType instance.

Definition at line 249 of file Type.cpp.

 uint64_t llvm::IntegerType::getBitMask ( ) const [inline]

getBitMask - Return a bitmask with ones set for all of the bits that can be set by an unsigned version of this type.

This is 0xFF for i8, 0xFFFF for i16, etc.

Definition at line 67 of file DerivedTypes.h.

References getBitWidth().

Referenced by insertFastDiv().

 unsigned llvm::IntegerType::getBitWidth ( ) const [inline]

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. Get a bit mask for this type.

Definition at line 278 of file Type.cpp.

References llvm::APInt::getAllOnesValue(), and getBitWidth().

 uint64_t llvm::IntegerType::getSignBit ( ) const [inline]

getSignBit - Return a uint64_t with just the most significant bit set (the sign bit, if the value is treated as a signed number).

Definition at line 73 of file DerivedTypes.h.

References getBitWidth().

 bool IntegerType::isPowerOf2ByteWidth ( ) const

This method determines if the width of this IntegerType is a power-of-2 in terms of 8 bit bytes.

Returns:
true if this is a power-of-2 byte width. Is this a power-of-2 byte-width IntegerType ?

Definition at line 273 of file Type.cpp.

References getBitWidth(), and llvm::isPowerOf2_32().

Friends And Related Function Documentation

 friend class LLVMContextImpl [friend]

Reimplemented from llvm::Type.

Definition at line 38 of file DerivedTypes.h.

The documentation for this class was generated from the following files: