LLVM API Documentation
Integer representation type. More...
#include <DerivedTypes.h>
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. | |
uint64_t | getBitMask () const |
uint64_t | getSignBit () const |
APInt | getMask () const |
Get a bit mask for this type. | |
bool | isPowerOf2ByteWidth () const |
Is this a power-of-2 byte-width IntegerType ? | |
Static Public Member Functions | |
static IntegerType * | get (LLVMContext &C, unsigned NumBits) |
Get or create an IntegerType instance. | |
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 |
Integer representation type.
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.
Definition at line 37 of file DerivedTypes.h.
anonymous enum |
This enum is just used to hold constants we need for IntegerType.
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 46 of file DerivedTypes.h.
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().
static bool llvm::IntegerType::classof | ( | const Type * | T | ) | [inline, static] |
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition at line 88 of file DerivedTypes.h.
References llvm::Type::getTypeID(), and llvm::Type::IntegerTyID.
IntegerType * IntegerType::get | ( | LLVMContext & | C, |
unsigned | NumBits | ||
) | [static] |
Get or create an IntegerType instance.
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.
Definition at line 303 of file Type.cpp.
References llvm::Type::getInt16Ty(), llvm::Type::getInt1Ty(), llvm::Type::getInt32Ty(), llvm::Type::getInt64Ty(), llvm::Type::getInt8Ty(), IntegerType(), llvm::LLVMContextImpl::IntegerTypes, MAX_INT_BITS, MIN_INT_BITS, llvm::LLVMContext::pImpl, and llvm::LLVMContextImpl::TypeAllocator.
Referenced by BinomialCoefficient(), BitCastConstantVector(), llvm::bypassSlowDivision(), CanShareConstantPoolEntry(), CoerceAvailableValueToLoadType(), CollectInsertionElements(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldCastInstruction(), llvm::ConstantFoldCompareInstruction(), llvm::ConstantFoldInsertElementInstruction(), llvm::ConstantFoldSelectInstruction(), llvm::ConstantFoldShuffleVectorInstruction(), llvm::MDBuilder::createRange(), DecodeFixedType(), ExtractConstantBytes(), llvm::FastISel::fastEmit_ri_(), FoldBitCast(), llvm::TypeBuilder< types::i< num_bits >, cross >::get(), getAccessType(), llvm::VectorType::getDoubleElementsVectorType(), llvm::VectorType::getExtendedElementVectorType(), getFoldedAlignOf(), getFoldedSizeOf(), llvm::VectorType::getHalfElementsVectorType(), llvm::VectorType::getInteger(), llvm::Type::getIntNTy(), llvm::DataLayout::getIntPtrType(), GetLoadValueForLoad(), GetMemInstValueForLoad(), getPreStartForSignExtend(), llvm::ScalarEvolution::getSignExtendExpr(), GetStoreValueForLoad(), llvm::VectorType::getTruncatedElementVectorType(), llvm::EVT::getTypeForEVT(), llvm::ScalarEvolution::getUDivExpr(), llvm::PointerType::getUnqual(), llvm::ScalarEvolution::getZeroExtendExpr(), isAddRecSExtable(), isAddSExtable(), isMulSExtable(), LLVMIntTypeInContext(), llvm::TargetLowering::ParseConstraints(), ProcessUGT_ADDCST_ADD(), stripAndComputeConstantOffsets(), and llvm::InstCombiner::visitICmpInstWithInstAndIntCst().
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 66 of file DerivedTypes.h.
References getBitWidth().
Referenced by insertFastDiv().
unsigned llvm::IntegerType::getBitWidth | ( | ) | const [inline] |
Get the number of bits in this IntegerType.
Definition at line 61 of file DerivedTypes.h.
References llvm::Type::getSubclassData().
Referenced by llvm::bypassSlowDivision(), llvm::IRBuilder< true, TargetFolder >::CreateExtractInteger(), DecodeFixedType(), llvm::ARMTargetLowering::ExpandInlineAsm(), extractInteger(), findCommonType(), llvm::InstCombiner::FoldAndOfICmps(), FoldReinterpretLoadFromConstPtr(), generateUnsignedDivisionCode(), llvm::ConstantInt::get(), getBitMask(), getMask(), getSignBit(), insertInteger(), isPowerOf2ByteWidth(), isRunOfOnes(), LLVMConstIntOfArbitraryPrecision(), llvm::InstCombiner::visitAdd(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), and llvm::InstCombiner::visitSelectInstWithICmp().
APInt IntegerType::getMask | ( | ) | const |
Get a bit mask for this type.
For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
Definition at line 331 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 72 of file DerivedTypes.h.
References getBitWidth().
bool IntegerType::isPowerOf2ByteWidth | ( | ) | const |
Is this a power-of-2 byte-width IntegerType ?
This method determines if the width of this IntegerType is a power-of-2 in terms of 8 bit bytes.
Definition at line 326 of file Type.cpp.
References getBitWidth(), and llvm::isPowerOf2_32().
friend class LLVMContextImpl [friend] |
Reimplemented from llvm::Type.
Definition at line 38 of file DerivedTypes.h.