LLVM API Documentation
#include <Type.h>
Inheritance diagram for llvm::Type:
Public Types | |
typedef std::vector< PATypeHandle >::const_iterator | subtype_iterator |
enum | TypeID { VoidTyID = 0, BoolTyID, UByteTyID, SByteTyID, UShortTyID, ShortTyID, UIntTyID, IntTyID, ULongTyID, LongTyID, FloatTyID, DoubleTyID, LabelTyID, FunctionTyID, StructTyID, ArrayTyID, PointerTyID, OpaqueTyID, PackedTyID, NumTypeIDs, LastPrimitiveTyID = LabelTyID, FirstDerivedTyID = FunctionTyID } |
Public Member Functions | |
virtual void | print (std::ostream &O) const |
virtual void | dump () const |
Debugging support: print to stderr. | |
TypeID | getTypeID () const |
const std::string & | getDescription () const |
getDescription - Return the string representation of the type... | |
bool | isSigned () const |
bool | isUnsigned () const |
bool | isInteger () const |
bool | isIntegral () const |
bool | isFloatingPoint () const |
bool | isAbstract () const |
bool | isLosslesslyConvertibleTo (const Type *Ty) const |
bool | isPrimitiveType () const |
bool | isDerivedType () const |
bool | isFirstClassType () const |
bool | isSized () const |
unsigned | getPrimitiveSize () const |
const Type * | getUnsignedVersion () const |
const Type * | getSignedVersion () const |
const Type * | getForwardedType () const |
subtype_iterator | subtype_begin () const |
subtype_iterator | subtype_end () const |
const Type * | getContainedType (unsigned i) const |
unsigned | getNumContainedTypes () const |
virtual void | addAbstractTypeUser (AbstractTypeUser *U) const |
virtual void | removeAbstractTypeUser (AbstractTypeUser *U) const |
void | addRef () const |
void | dropRef () const |
Static Public Member Functions | |
static const Type * | getPrimitiveType (TypeID IDNumber) |
getPrimitiveType - Return a type based on an identifier. | |
static bool | classof (const Type *T) |
Methods for support type inquiry through isa, cast, and dyn_cast:. | |
static void | clearAllTypeMaps () |
Static Public Attributes | |
static Type * | VoidTy = &TheVoidTy |
static Type * | BoolTy = &TheBoolTy |
static Type * | SByteTy = &TheSByteTy |
static Type * | UByteTy = &TheUByteTy |
static Type * | ShortTy = &TheShortTy |
static Type * | UShortTy = &TheUShortTy |
static Type * | IntTy = &TheIntTy |
static Type * | UIntTy = &TheUIntTy |
static Type * | LongTy = &TheLongTy |
static Type * | ULongTy = &TheULongTy |
static Type * | FloatTy = &TheFloatTy |
static Type * | DoubleTy = &TheDoubleTy |
static Type * | LabelTy = &TheLabelTy |
Protected Member Functions | |
Type (const std::string &Name, TypeID id) | |
virtual | ~Type () |
void | setAbstract (bool Val) |
void | PromoteAbstractToConcrete () |
unsigned | getRefCount () const |
Protected Attributes | |
const Type * | ForwardType |
std::vector< PATypeHandle > | ContainedTys |
Definition at line 53 of file Type.h.
|
|
|
===-------------------------------------------------------------------===// Definitions of all of the base types for the Type system. Based on this value, you can cast to a "DerivedType" subclass (see DerivedTypes.h) Note: If you add an element to this, you need to add an element to the Type::getPrimitiveType function, or else things will break! |
|
Definition at line 45 of file Type.cpp. References ConcreteTypeDescriptions. |
|
|
|
Reimplemented in llvm::DerivedType. |
|
Definition at line 349 of file Type.h. Referenced by llvm::DerivedType::refineAbstractTypeTo(). |
|
Methods for support type inquiry through isa, cast, and dyn_cast:.
Reimplemented in llvm::DerivedType, llvm::FunctionType, llvm::CompositeType, llvm::StructType, llvm::SequentialType, llvm::ArrayType, llvm::PackedType, llvm::PointerType, and llvm::OpaqueType. |
|
clearAllTypeMaps - This method frees all internal memory used by the type subsystem, which can be used in environments where this memory is otherwise reported as a leak. Definition at line 1321 of file Type.cpp. References llvm::TypeMap< ValType, TypeClass >::clear(), E, and I. |
|
Definition at line 354 of file Type.h. References getForwardedType(). |
|
Debugging support: print to stderr.
Reimplemented in llvm::DerivedType. Definition at line 1249 of file AsmWriter.cpp. References print(). Referenced by llvm::DerivedType::dump(). |
|
getContainedType - This method is used to implement the type iterator (defined a the end of the file). For derived types, this returns the types 'contained' in the derived type. Definition at line 242 of file Type.h. References ContainedTys. Referenced by getStructOffsetStep(), and lookupFunction(). |
|
getDescription - Return the string representation of the type...
Definition at line 298 of file Type.cpp. References AbstractTypeDescriptions, ConcreteTypeDescriptions, getOrCreateDesc(), and isAbstract(). Referenced by calcTypeName(), llvm::Interpreter::callExternalFunction(), HandleUpRefs(), llvm::BytecodeReader::ParseConstantPool(), llvm::BytecodeReader::ParseConstantValue(), llvm::BytecodeReader::ParseFunction(), print(), llvm::Constant::print(), printTypeInt(), ResolveDefinitions(), setTypeName(), setValueName(), WriteAsOperandInternal(), and llvm::WriteTypeSymbolic(). |
|
getForwaredType - Return the type that this type has been resolved to if it has been resolved to anything. This is used to implement the union-find algorithm for type resolution, and shouldn't be used by general purpose clients. Definition at line 226 of file Type.h. References ForwardType. Referenced by dropRef(). |
|
getNumContainedTypes - Return the number of types in the derived type. Definition at line 249 of file Type.h. References ContainedTys. Referenced by lookupFunction(). |
|
getPrimitiveSize - Return the basic size of this type if it is a primitive type. These are fixed by LLVM and are not target dependent. This will return zero if the type does not have a size or is not a primitive type. Definition at line 139 of file Type.cpp. References getTypeID(). Referenced by llvm::SparcV9FunctionInfo::computeOffsetforLocalVar(), llvm::ConstantFoldGetElementPtr(), findOptimalStorageSize(), llvm::ConstantIntegral::getAllOnesValue(), getCastType(), llvm::ConstantIntegral::getMaxValue(), llvm::ConstantIntegral::getMinValue(), llvm::ConstantExpr::getSignExtend(), getSize(), getTruncateOrZeroExtend(), getTypeSizeInBits(), llvm::ConstantExpr::getZeroExtend(), InsertSignExtendToPtrTy(), llvm::ConstantUInt::isAllOnesValue(), isSignBit(), isSignBitCheck(), RemoveNoopCast(), llvm::ConstantRange::truncate(), llvm::Interpreter::visitCallSite(), and llvm::ConstantRange::zeroExtend(). |
|
getPrimitiveType - Return a type based on an identifier.
Definition at line 53 of file Type.cpp. References BoolTy, BoolTyID, DoubleTy, DoubleTyID, FloatTy, FloatTyID, IntTy, IntTyID, LabelTy, LabelTyID, LongTy, LongTyID, SByteTy, SByteTyID, ShortTy, ShortTyID, UByteTy, UByteTyID, UIntTy, UIntTyID, ULongTy, ULongTyID, UShortTy, UShortTyID, VoidTy, and VoidTyID. Referenced by llvm::BytecodeReader::ParseType(), and llvm::SlotCalculator::SlotCalculator(). |
|
Definition at line 108 of file Type.h. Referenced by llvm::DerivedType::removeAbstractTypeUser(). |
|
getSignedVersion - If this is an integer type, return the signed variant of this type. For example uint -> int. Definition at line 119 of file Type.cpp. References getTypeID(), IntTy, IntTyID, isInteger(), LongTy, LongTyID, SByteTy, SByteTyID, ShortTy, ShortTyID, UByteTyID, UIntTyID, ULongTyID, and UShortTyID. Referenced by llvm::SCEVUnknown::getIntegerSCEV(), llvm::ConstantExpr::getSignExtend(), llvm::ConstantExpr::getSShr(), InsertSignExtendToPtrTy(), and SolveQuadraticEquation(). |
|
|
getUnsignedVersion - If this is an integer type, return the unsigned variant of this type. For example int -> uint. Definition at line 102 of file Type.cpp. References getTypeID(), IntTyID, isInteger(), LongTyID, SByteTyID, ShortTyID, UByteTy, UByteTyID, UIntTy, UIntTyID, ULongTy, ULongTyID, UShortTy, and UShortTyID. Referenced by llvm::SCEVUDivExpr::get(), llvm::SCEVConstant::get(), llvm::SCEVUDivExpr::getType(), llvm::ConstantExpr::getUShr(), llvm::SCEV::getValueRange(), llvm::ConstantExpr::getZeroExtend(), SolveQuadraticEquation(), and llvm::ConstantRange::zeroExtend(). |
|
isAbstract - True if the type is either an Opaque type, or is a derived type that includes an opaque type somewhere in it. Definition at line 178 of file Type.h. Referenced by AbstractTypeHasCycleThrough(), llvm::DerivedType::addAbstractTypeUser(), llvm::ArrayType::ArrayType(), llvm::GraphTraits< TypePromotionGraph >::child_begin(), llvm::ConstantArray::ConstantArray(), llvm::ConstantPacked::ConstantPacked(), llvm::ConstantStruct::ConstantStruct(), llvm::TypeMap< ValType, TypeClass >::finishRefinement(), llvm::FunctionType::FunctionType(), getDescription(), HandleUpRefs(), llvm::PointerType::PointerType(), PromoteAbstractToConcrete(), llvm::DerivedType::refineAbstractTypeTo(), llvm::DerivedType::removeAbstractTypeUser(), llvm::StructType::StructType(), and TypeHasCycleThroughItself(). |
|
Definition at line 190 of file Type.h. References FirstDerivedTyID. Referenced by llvm::DerivedType::classof(). |
|
isFirstClassType - Return true if the value is holdable in a register. Definition at line 194 of file Type.h. References LastPrimitiveTyID, PackedTyID, PointerTyID, and VoidTyID. Referenced by llvm::ConvertExpressionToType(), ConvertOperandToType(), llvm::ExpressionConvertibleToType(), llvm::FunctionType::FunctionType(), llvm::ConstantExpr::getCast(), llvm::GetElementPtrInst::getIndexedType(), llvm::ConstantExpr::getSelectTy(), and OperandConvertibleToType(). |
|
isFloatingPoint - Return true if this is one of the two floating point types Definition at line 173 of file Type.h. References DoubleTyID, and FloatTyID. Referenced by llvm::ClassifyExpr(), llvm::ConstantFP::classof(), llvm::ConstantFoldCastInstruction(), llvm::BinaryOperator::createNeg(), llvm::ExpressionConvertibleToType(), llvm::ConstantExpr::get(), llvm::SCEVUnknown::getIntegerSCEV(), llvm::ConstantExpr::getNeg(), getPrintfCodeFor(), llvm::Instruction::isAssociative(), OperandConvertibleToType(), and llvm::PackedType::PackedType(). |
|
|
isIntegral - Returns true if this is an integral type, which is either BoolTy or one of the Integer types. Definition at line 169 of file Type.h. References BoolTy, and isInteger(). Referenced by llvm::ConstantIntegral::classof(), llvm::SparcV9IntCCRegClass::colorIGNode(), llvm::SparcV9FunctionInfo::computeOffsetforLocalVar(), llvm::ConstantRange::ConstantRange(), ConstantTypeMustBeLoaded(), llvm::ConvertConstantToIntType(), findOptimalStorageSize(), llvm::ConstantExpr::get(), getCastType(), llvm::ExecutionEngine::getConstantValue(), getPrintfCodeFor(), llvm::ConstantExpr::getShiftTy(), OperandConvertibleToType(), llvm::PackedType::PackedType(), and llvm::Interpreter::visitCallSite(). |
|
isLosslesslyConvertibleTo - Return true if this type can be converted to 'Ty' without any reinterpretation of bits. For example, uint to int. Definition at line 76 of file Type.cpp. References getTypeID(), IntTy, IntTyID, isPrimitiveType(), LongTy, LongTyID, PointerTyID, SByteTy, SByteTyID, ShortTy, ShortTyID, UByteTy, UByteTyID, UIntTy, UIntTyID, ULongTy, ULongTyID, UShortTy, and UShortTyID. Referenced by llvm::ClassifyExpr(), ElementTypesAreCompatible(), evaluateRelation(), llvm::ExpressionConvertibleToType(), isEliminableCastOfCast(), isReinterpretingCast(), and OperandConvertibleToType(). |
|
Here are some useful little methods to query what type derived types are Note that all other types can just compare to see if this == Type::xxxTy; Definition at line 189 of file Type.h. References LastPrimitiveTyID. Referenced by calcTypeName(), ConstantTypeMustBeLoaded(), isLosslesslyConvertibleTo(), printTypeInt(), and ShouldNukeSymtabEntry(). |
|
isSigned - Return whether an integral numeric type is signed. This is true for SByteTy, ShortTy, IntTy, LongTy. Note that this is not true for Float and Double. Definition at line 147 of file Type.h. References IntTyID, LongTyID, SByteTyID, and ShortTyID. Referenced by llvm::ConstantSInt::classof(), llvm::ConstantSInt::ConstantSInt(), llvm::ConvertConstantToIntType(), ConvertOperandToType(), llvm::ExpressionConvertibleToType(), llvm::SCEVUDivExpr::get(), llvm::SCEVConstant::get(), llvm::ConstantInt::get(), getCastType(), llvm::SCEVUnknown::getIntegerSCEV(), llvm::ConstantExpr::getSShr(), llvm::SCEVUDivExpr::getType(), InsertSignExtendToPtrTy(), isInsertShiftHalf(), isSignBitCheck(), LoadNeedsSignExtend(), and OperandConvertibleToType(). |
|
isSized - Return true if it makes sense to take the size of this type. To get the actual size for a particular target, it is reasonable to use the TargetData subsystem to do this. Definition at line 203 of file Type.h. References BoolTyID, DoubleTyID, and PointerTyID. Referenced by llvm::ExpressionConvertibleToType(), getTypeInfo(), InstCombineLoadCast(), llvm::DSNode::mergeTypeInfo(), and ProcessGlobalsWithSameName(). |
|
isUnsigned - Return whether a numeric type is unsigned. This is not quite the complement of isSigned... nonnumeric types return false as they do with isSigned. This returns true for UByteTy, UShortTy, UIntTy, and ULongTy Definition at line 157 of file Type.h. References UByteTyID, UIntTyID, ULongTyID, and UShortTyID. Referenced by AddWithOverflow(), llvm::ConstantUInt::classof(), llvm::ConstantUInt::ConstantUInt(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), llvm::ConstantExpr::getUShr(), and llvm::ConstantRange::zeroExtend(). |
|
Definition at line 1231 of file AsmWriter.cpp. References getDescription(). Referenced by dump(), and llvm::operator<<(). |
|
Definition at line 485 of file Type.cpp. References E, isAbstract(), llvm::scc_begin(), llvm::scc_end(), subtype_begin(), and subtype_end(). |
|
Reimplemented in llvm::DerivedType. |
|
Types can become nonabstract later, if they are refined. Definition at line 102 of file Type.h. Referenced by llvm::ArrayType::ArrayType(), llvm::FunctionType::FunctionType(), llvm::OpaqueType::OpaqueType(), llvm::PointerType::PointerType(), and llvm::StructType::StructType(). |
|
Definition at line 235 of file Type.h. References ContainedTys. Referenced by AbstractTypeHasCycleThrough(), llvm::GraphTraits< TypePromotionGraph >::child_begin(), ConcreteTypeHasCycleThrough(), PromoteAbstractToConcrete(), TypeContains(), and TypeHasCycleThroughItself(). |
|
Definition at line 236 of file Type.h. References ContainedTys. Referenced by AbstractTypeHasCycleThrough(), llvm::GraphTraits< TypePromotionGraph >::child_begin(), llvm::GraphTraits< TypePromotionGraph >::child_end(), ConcreteTypeHasCycleThrough(), PromoteAbstractToConcrete(), TypeContains(), and TypeHasCycleThroughItself(). |
|
|
|
|
Definition at line 358 of file Type.cpp. Referenced by ByteswapSCANFResults(), llvm::ConstantCreator< ConstantFP, Type, uint32_t >::create(), llvm::ConstantFP::get(), llvm::Constant::getNullValue(), and getPrimitiveType(). |
|
ForwardType - This field is used to implement the union find scheme for abstract types. When types are refined to other types, this field is set to the more refined type. Only abstract types can be forwarded. Definition at line 113 of file Type.h. Referenced by getForwardedType(), and llvm::DerivedType::refineAbstractTypeTo(). |
|
|
Definition at line 360 of file Type.cpp. Referenced by getPrimitiveType(). |
|
|
|
Definition at line 352 of file Type.cpp. Referenced by llvm::Constant::getNullValue(), getPrimitiveType(), getSignedVersion(), isLosslesslyConvertibleTo(), and llvm::Interpreter::visitCallSite(). |
|
|
|
|
Definition at line 353 of file Type.cpp. Referenced by ByteswapSCANFResults(), llvm::TargetData::getIntPtrType(), llvm::Constant::getNullValue(), getPrimitiveType(), getUnsignedVersion(), isLosslesslyConvertibleTo(), and llvm::Interpreter::visitCallSite(). |
|