LLVM API Documentation
#include <Type.h>
Public Types | |
| enum | TypeID { VoidTyID = 0, FloatTyID, DoubleTyID, X86_FP80TyID, FP128TyID, PPC_FP128TyID, LabelTyID, MetadataTyID, IntegerTyID, FunctionTyID, StructTyID, ArrayTyID, PointerTyID, OpaqueTyID, VectorTyID, NumTypeIDs, LastPrimitiveTyID = LabelTyID, FirstDerivedTyID = IntegerTyID } |
| typedef PATypeHandle * | subtype_iterator |
Public Member Functions | |
| void | print (raw_ostream &O) const |
| void | print (std::ostream &O) const |
| void | dump () const |
| Debugging support: print to stderr. | |
| void | dump (const Module *Context) const |
| Debugging support: print to stderr (use type names from context module). | |
| LLVMContext & | getContext () const |
| getContext - Fetch the LLVMContext in which this type was uniqued. | |
| TypeID | getTypeID () const |
| std::string | getDescription () const |
| getDescription - Return the string representation of the type. | |
| bool | isInteger () const |
| bool | isIntOrIntVector () const |
| bool | isFloatingPoint () const |
| bool | isFPOrFPVector () const |
| bool | isAbstract () const |
| bool | canLosslesslyBitCastTo (const Type *Ty) const |
| Determine if this type could be losslessly bitcast to Ty. | |
| bool | isPrimitiveType () const |
| bool | isDerivedType () const |
| bool | isFirstClassType () const |
| bool | isSingleValueType () const |
| bool | isAggregateType () const |
| bool | isSized () const |
| unsigned | getPrimitiveSizeInBits () const |
| unsigned | getScalarSizeInBits () const |
| int | getFPMantissaWidth () const |
| const Type * | getForwardedType () const |
| const Type * | getVAArgsPromotedType (LLVMContext &C) const |
| const Type * | getScalarType () const |
| subtype_iterator | subtype_begin () const |
| subtype_iterator | subtype_end () const |
| const Type * | getContainedType (unsigned i) const |
| unsigned | getNumContainedTypes () const |
| void | addRef () const |
| void | dropRef () const |
| void | addAbstractTypeUser (AbstractTypeUser *U) const |
| void | removeAbstractTypeUser (AbstractTypeUser *U) const |
| PointerType * | getPointerTo (unsigned AddrSpace=0) const |
Static Public Member Functions | |
| static const Type * | getPrimitiveType (LLVMContext &C, TypeID IDNumber) |
| getPrimitiveType - Return a type based on an identifier. | |
| static const Type * | getVoidTy (LLVMContext &C) |
| static const Type * | getLabelTy (LLVMContext &C) |
| static const Type * | getFloatTy (LLVMContext &C) |
| static const Type * | getDoubleTy (LLVMContext &C) |
| static const Type * | getMetadataTy (LLVMContext &C) |
| static const Type * | getX86_FP80Ty (LLVMContext &C) |
| static const Type * | getFP128Ty (LLVMContext &C) |
| static const Type * | getPPC_FP128Ty (LLVMContext &C) |
| static const IntegerType * | getInt1Ty (LLVMContext &C) |
| static const IntegerType * | getInt8Ty (LLVMContext &C) |
| static const IntegerType * | getInt16Ty (LLVMContext &C) |
| static const IntegerType * | getInt32Ty (LLVMContext &C) |
| static const IntegerType * | getInt64Ty (LLVMContext &C) |
| static bool | classof (const Type *) |
| Methods for support type inquiry through isa, cast, and dyn_cast:. | |
Protected Member Functions | |
| Type (LLVMContext &C, TypeID id) | |
| virtual | ~Type () |
| void | setAbstract (bool Val) |
| unsigned | getRefCount () const |
| unsigned | getSubclassData () const |
| void | setSubclassData (unsigned val) |
| void | PromoteAbstractToConcrete () |
Protected Attributes | |
| const Type * | ForwardType |
| std::vector< AbstractTypeUser * > | AbstractTypeUsers |
| unsigned | NumContainedTys |
| PATypeHandle * | ContainedTys |
Friends | |
| class | LLVMContextImpl |
| class | TypeMapBase |
This file contains the declaration of the Type class. For more "Type" type stuff, look in DerivedTypes.h.
The instances of the Type class are immutable: once they are created, they are never changed. Also note that only one instance of a particular type is ever created. Thus seeing if two types are equal is a matter of doing a trivial pointer comparison. To enforce that no two equal instances are created, Type instances can only be created via static factory methods in class Type and in derived classes.
Once allocated, Types are never free'd, unless they are an abstract type that is resolved to a more concrete type.
Types themself don't have a name, and can be named either by:
Opaque types are simple derived types with no state. There may be many different Opaque type objects floating around, but two are only considered identical if they are pointer equals of each other. This allows us to have two opaque types that end up resolving to different concrete types later.
Opaque types are also kinda weird and scary and different because they have to keep a list of uses of the type. When, through linking, parsing, or bitcode reading, they become resolved, they need to find and update all users of the unknown type, causing them to reference a new, more concrete type. Opaque types are deleted when their use list dwindles to zero users.
Definition at line 63 of file Type.h.
| typedef PATypeHandle* llvm::Type::subtype_iterator |
| enum llvm::Type::TypeID |
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! Also update LLVMTypeKind and LLVMGetTypeKind () in the C binding.
| llvm::Type::Type | ( | LLVMContext & | C, | |
| TypeID | id | |||
| ) | [inline, explicit, protected] |
| virtual llvm::Type::~Type | ( | ) | [inline, protected, virtual] |
| void llvm::Type::setAbstract | ( | bool | Val | ) | [inline, protected] |
| unsigned llvm::Type::getRefCount | ( | ) | const [inline, protected] |
| unsigned llvm::Type::getSubclassData | ( | ) | const [inline, protected] |
Definition at line 136 of file Type.h.
Referenced by llvm::IntegerType::getBitWidth(), getVAArgsPromotedType(), and llvm::StructType::isPacked().
| void llvm::Type::setSubclassData | ( | unsigned | val | ) | [inline, protected] |
| void Type::print | ( | raw_ostream & | O | ) | const |
| void Type::print | ( | std::ostream & | O | ) | const |
| void Type::dump | ( | ) | const [virtual] |
Debugging support: print to stderr.
Implements llvm::AbstractTypeUser.
Reimplemented in llvm::DerivedType.
Definition at line 2104 of file AsmWriter.cpp.
| void Type::dump | ( | const Module * | Context | ) | const |
Debugging support: print to stderr (use type names from context module).
Definition at line 2098 of file AsmWriter.cpp.
References llvm::errs(), and llvm::WriteTypeSymbolic().
| LLVMContext& llvm::Type::getContext | ( | ) | const [inline] |
getContext - Fetch the LLVMContext in which this type was uniqued.
Definition at line 181 of file Type.h.
References Context.
Referenced by addAbstractTypeUser(), llvm::AllocationInst::AllocationInst(), ComputeValueVTs(), llvm::ConstantCreator< MDNode, Type, std::vector< Value * > >::create(), llvm::ConstantExpr::destroyConstant(), llvm::UndefValue::destroyConstant(), llvm::ConstantPointerNull::destroyConstant(), llvm::ConstantVector::destroyConstant(), llvm::ConstantStruct::destroyConstant(), llvm::ConstantArray::destroyConstant(), llvm::ConstantAggregateZero::destroyConstant(), llvm::DerivedType::dropAllTypeUses(), dyn_castFoldableMul(), executeFCMP_ORD(), executeFCMP_UNO(), foldConstantCastPair(), llvm::PointerType::get(), llvm::VectorType::get(), llvm::ArrayType::get(), llvm::FunctionType::get(), llvm::UndefValue::get(), llvm::ConstantPointerNull::get(), llvm::ConstantAggregateZero::get(), llvm::ConstantVector::get(), llvm::ConstantStruct::get(), llvm::ConstantArray::get(), llvm::ConstantFP::get(), llvm::ConstantInt::get(), llvm::ConstantExpr::getAlignOf(), llvm::Constant::getAllOnesValue(), llvm::ExecutionEngine::getConstantValue(), llvm::Function::getContext(), llvm::BasicBlock::getContext(), getDescription(), llvm::EVT::getEVT(), llvm::VectorType::getExtendedElementVectorType(), llvm::ConstantExpr::getExtractElementTy(), llvm::ConstantExpr::getExtractValueTy(), getFoldedCast(), llvm::ConstantExpr::getGetElementPtrTy(), llvm::TargetData::getIndexedOffset(), llvm::ConstantExpr::getInsertElementTy(), llvm::ConstantExpr::getInsertValueTy(), llvm::VectorType::getInteger(), llvm::Constant::getIntegerValue(), llvm::ConstantFP::getNegativeZero(), llvm::Constant::getNullValue(), llvm::ConstantExpr::getOffsetOf(), getPromotedType(), llvm::ConstantExpr::getSelectTy(), llvm::ConstantExpr::getShuffleVectorTy(), llvm::ConstantExpr::getSizeOf(), llvm::VectorType::getTruncatedElementVectorType(), llvm::ConstantExpr::getTy(), llvm::FunctionType::isValidArgumentType(), llvm::PointerType::isValidElementType(), llvm::StructType::isValidElementType(), llvm::ArrayType::isValidElementType(), llvm::FunctionType::isValidReturnType(), llvm::ConstantInt::isValueValidForType(), llvm::X86TargetLowering::isZExtFree(), lle_X_scanf(), lle_X_sscanf(), llvm::TargetLowering::LowerCallTo(), llvm::DerivedType::notifyUsesThatTypeBecameConcrete(), llvm::PointerType::refineAbstractType(), llvm::StructType::refineAbstractType(), llvm::VectorType::refineAbstractType(), llvm::ArrayType::refineAbstractType(), llvm::FunctionType::refineAbstractType(), llvm::DerivedType::refineAbstractTypeTo(), removeAbstractTypeUser(), llvm::ConstantStruct::replaceUsesOfWithOnConstant(), llvm::ConstantArray::replaceUsesOfWithOnConstant(), llvm::ExecutionEngine::runFunctionAsMain(), llvm::PointerType::typeBecameConcrete(), llvm::StructType::typeBecameConcrete(), llvm::VectorType::typeBecameConcrete(), llvm::ArrayType::typeBecameConcrete(), llvm::FunctionType::typeBecameConcrete(), TypeToFloatSemantics(), llvm::DerivedType::unlockedRefineAbstractTypeTo(), UpgradeIntrinsicFunction1(), llvm::Value::Value(), llvm::InlineAsm::Verify(), WriteConstants(), and llvm::MDNode::~MDNode().
| TypeID llvm::Type::getTypeID | ( | ) | const [inline] |
getTypeID - Return the type id for the type. This will return one of the TypeID enum elements defined above.
Definition at line 191 of file Type.h.
References ID.
Referenced by llvm::OpaqueType::classof(), llvm::PointerType::classof(), llvm::VectorType::classof(), llvm::ArrayType::classof(), llvm::SequentialType::classof(), llvm::StructType::classof(), llvm::CompositeType::classof(), llvm::FunctionType::classof(), llvm::IntegerType::classof(), CompareTypes(), llvm::ConstantArray::ConstantArray(), llvm::ConstantStruct::ConstantStruct(), llvm::ConstantVector::ConstantVector(), executeFAddInst(), executeFCMP_OEQ(), executeFCMP_OGE(), executeFCMP_OGT(), executeFCMP_OLE(), executeFCMP_OLT(), executeFCMP_ONE(), executeFDivInst(), executeFMulInst(), executeFRemInst(), executeFSubInst(), executeICMP_EQ(), executeICMP_NE(), executeICMP_SGE(), executeICMP_SGT(), executeICMP_SLE(), executeICMP_SLT(), executeICMP_UGE(), executeICMP_UGT(), executeICMP_ULE(), executeICMP_ULT(), ffiInvoke(), ffiTypeFor(), ffiValueFor(), llvm::MSILWriter::getArrayTypeName(), llvm::ExecutionEngine::getConstantValue(), llvm::EVT::getEVT(), getFloatBitCastField(), llvm::ConstantExpr::getFPExtend(), llvm::ConstantExpr::getFPToSI(), llvm::ConstantExpr::getFPToUI(), llvm::ConstantExpr::getFPTrunc(), llvm::Constant::getNullValue(), getPrimitiveSizeInBits(), llvm::MSILWriter::getPrimitiveTypeName(), llvm::ConstantExpr::getSExt(), llvm::ConstantExpr::getSIToFP(), llvm::getSubElementHash(), llvm::ConstantExpr::getTrunc(), getTypeID(), llvm::MSILWriter::getTypeName(), llvm::MSILWriter::getTypePostfix(), getTypePrefix(), llvm::TargetData::getTypeSizeInBits(), llvm::ConstantExpr::getUIToFP(), llvm::ConstantExpr::getZExt(), hash(), llvm::MachOWriter::InitMem(), llvm::PIC16TargetLowering::InitReservedFrameCount(), isEquivalentType(), llvm::XCoreTargetLowering::isLegalAddressingMode(), llvm::ConstantFP::isValueValidForType(), llvm::ExecutionEngine::LoadValueFromMemory(), llvm::AsmPrinter::printDataDirective(), llvm::MSILWriter::printModuleStartup(), llvm::MSILWriter::printStaticConstant(), llvm::MSILWriter::printStaticInitializer(), RecursiveResolveTypesI(), ReplaceFPIntrinsicWithCall(), llvm::JIT::runFunction(), llvm::ExecutionEngine::StoreValueToMemory(), TypesEqual(), llvm::Interpreter::visitVAArgInst(), and WriteTypeTable().
| std::string Type::getDescription | ( | ) | const |
getDescription - Return the string representation of the type.
Definition at line 263 of file Type.cpp.
References llvm::LLVMContextImpl::AbstractTypeDescriptions, llvm::LLVMContextImpl::ConcreteTypeDescriptions, getContext(), isAbstract(), llvm::LLVMContext::pImpl, llvm::TypePrinting::print(), and llvm::raw_string_ostream::str().
Referenced by llvm::Interpreter::callExternalFunction(), and llvm::TypeSymbolTable::insert().
| bool llvm::Type::isInteger | ( | ) | const [inline] |
isInteger - True if this is an instance of IntegerType.
Definition at line 198 of file Type.h.
References ID, and IntegerTyID.
Referenced by AddModuleTypesToPrinter(), llvm::CastInst::castIsValid(), llvm::ComputeMaskedBits(), llvm::CastInst::CreateIntegerCast(), llvm::CastInst::CreatePointerCast(), dyn_castFoldableMul(), dyn_castNegVal(), evaluateICmpRelation(), FoldBitCast(), llvm::CastInst::getCastOpcode(), llvm::ScalarEvolution::getEffectiveSCEVType(), llvm::ConstantExpr::getIntToPtr(), llvm::ScalarEvolution::getNoopOrAnyExtend(), llvm::ScalarEvolution::getNoopOrSignExtend(), llvm::ScalarEvolution::getNoopOrZeroExtend(), llvm::SCEVExpander::getOrInsertCanonicalInductionVariable(), llvm::ConstantExpr::getPointerCast(), llvm::ConstantExpr::getPtrToInt(), llvm::ScalarEvolution::getTruncateOrNoop(), llvm::ScalarEvolution::getTruncateOrSignExtend(), llvm::ScalarEvolution::getTruncateOrZeroExtend(), llvm::MSILWriter::getTypeName(), llvm::ScalarEvolution::getTypeSizeInBits(), InstCombineLoadCast(), InstCombineStoreToCast(), llvm::CastInst::isCastable(), llvm::CastInst::isEliminableCastPair(), isFPIntBitCast(), llvm::CastInst::isIntegerCast(), isIntOrIntVector(), llvm::ScalarEvolution::isSCEVable(), llvm::X86TargetLowering::isTruncateFree(), llvm::VectorType::isValidElementType(), LowerBSWAP(), LowerCTPOP(), LowerToBSwap(), llvm::MSILWriter::printModuleStartup(), ShouldNukeSymtabEntry(), llvm::Attribute::typeIncompatible(), and llvm::Interpreter::visitCallSite().
| bool Type::isIntOrIntVector | ( | ) | const |
isIntOrIntVector - Return true if this is an integer type or a vector of integer types.
isIntOrIntVector - Return true if this is an integer type or a vector of integer types.
Definition at line 126 of file Type.cpp.
References isInteger(), and VectorTyID.
Referenced by llvm::CastInst::castIsValid(), llvm::ComputeMaskedBits(), llvm::ComputeNumSignBits(), llvm::CastInst::CreateIntegerCast(), llvm::ConstantExpr::get(), llvm::ConstantExpr::getFPToSI(), llvm::ConstantExpr::getFPToUI(), llvm::ConstantExpr::getIntegerCast(), llvm::ConstantExpr::getNeg(), llvm::ConstantExpr::getNot(), llvm::ConstantExpr::getSExt(), llvm::ConstantExpr::getSIToFP(), llvm::ConstantExpr::getTrunc(), llvm::ConstantExpr::getUIToFP(), and llvm::ConstantExpr::getZExt().
| bool llvm::Type::isFloatingPoint | ( | ) | const [inline] |
isFloatingPoint - Return true if this is one of the five floating point types
Definition at line 207 of file Type.h.
References DoubleTyID, FloatTyID, FP128TyID, ID, PPC_FP128TyID, and X86_FP80TyID.
Referenced by llvm::ConstantFoldCompareInstruction(), dyn_castFNegVal(), FoldBitCast(), llvm::CastInst::getCastOpcode(), llvm::ExecutionEngine::getConstantValue(), getFPMantissaWidth(), llvm::ConstantFP::getZeroValueForNegation(), llvm::CastInst::isCastable(), llvm::CastInst::isEliminableCastPair(), isFPIntBitCast(), isSized(), llvm::VectorType::isValidElementType(), and TryToShrinkGlobalToBoolean().
| bool Type::isFPOrFPVector | ( | ) | const |
isFPOrFPVector - Return true if this is a FP type or a vector of FP types.
Definition at line 136 of file Type.cpp.
References DoubleTyID, FloatTyID, FP128TyID, PPC_FP128TyID, VectorTyID, and X86_FP80TyID.
Referenced by AdjustIType(), llvm::CastInst::castIsValid(), llvm::CastInst::CreateFPCast(), llvm::ConstantExpr::get(), GetDecodedBinaryOpcode(), llvm::ConstantExpr::getFNeg(), llvm::ConstantExpr::getFPCast(), llvm::ConstantExpr::getFPExtend(), llvm::ConstantExpr::getFPToSI(), llvm::ConstantExpr::getFPToUI(), llvm::ConstantExpr::getFPTrunc(), llvm::ConstantExpr::getNeg(), llvm::ConstantExpr::getSIToFP(), and llvm::ConstantExpr::getUIToFP().
| bool llvm::Type::isAbstract | ( | ) | const [inline] |
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 217 of file Type.h.
Referenced by AbstractTypeHasCycleThrough(), addAbstractTypeUser(), addRef(), llvm::GraphTraits< TypePromotionGraph >::child_begin(), llvm::ConstantArray::ConstantArray(), llvm::ConstantStruct::ConstantStruct(), llvm::ConstantVector::ConstantVector(), dropRef(), getDescription(), getIndexedTypeInternal(), llvm::TypeSymbolTable::insert(), isSized(), PromoteAbstractToConcrete(), RecursiveResolveTypesI(), removeAbstractTypeUser(), llvm::TypeMapBase::TypeBecameConcrete(), TypeHasCycleThroughItself(), and llvm::DerivedType::unlockedRefineAbstractTypeTo().
Determine if this type could be losslessly bitcast to Ty.
canLosslesslyBitCastTo - Return true if this type could be converted with a lossless BitCast to type 'Ty'. For example, i8* to i32*. BitCasts are valid for types of the same size only where no re-interpretation of the bits is done.
Definition at line 149 of file Type.cpp.
References isFirstClassType().
| bool llvm::Type::isPrimitiveType | ( | ) | const [inline] |
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 230 of file Type.h.
References ID, and LastPrimitiveTyID.
Referenced by AddModuleTypesToPrinter(), llvm::MSILWriter::getTypeName(), and ShouldNukeSymtabEntry().
| bool llvm::Type::isDerivedType | ( | ) | const [inline] |
Definition at line 231 of file Type.h.
References FirstDerivedTyID, and ID.
Referenced by llvm::DerivedType::classof().
| bool llvm::Type::isFirstClassType | ( | ) | const [inline] |
isFirstClassType - Return true if the type is "first class", meaning it is a valid type for a Value.
Definition at line 236 of file Type.h.
References FunctionTyID, ID, OpaqueTyID, and VoidTyID.
Referenced by canLosslesslyBitCastTo(), llvm::CastInst::castIsValid(), foldConstantCastPair(), llvm::ConstantExpr::getCast(), llvm::CastInst::getCastOpcode(), llvm::ConstantExpr::getExtractValue(), llvm::ConstantExpr::getExtractValueTy(), getFoldedCast(), llvm::ConstantExpr::getInsertValue(), llvm::ConstantExpr::getInsertValueTy(), llvm::ExecutionEngine::InitializeMemory(), llvm::CastInst::isCastable(), llvm::FunctionType::isValidArgumentType(), and llvm::FunctionType::isValidReturnType().
| bool llvm::Type::isSingleValueType | ( | ) | const [inline] |
isSingleValueType - Return true if the type is a valid type for a virtual register in codegen. This includes all first-class types except struct and array types.
Definition at line 246 of file Type.h.
References ID, IntegerTyID, LastPrimitiveTyID, PointerTyID, VectorTyID, and VoidTyID.
Referenced by llvm::SDISelAsmOperandInfo::getCallOperandValEVT(), and llvm::MachOWriter::InitMem().
| bool llvm::Type::isAggregateType | ( | ) | const [inline] |
isAggregateType - Return true if the type is an aggregate type. This means it is valid as the first operand of an insertvalue or extractvalue instruction. This includes struct and array types, but does not include vector types.
Definition at line 256 of file Type.h.
References ArrayTyID, ID, and StructTyID.
Referenced by llvm::SelectionDAGLowering::getValue().
| bool llvm::Type::isSized | ( | ) | const [inline] |
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 264 of file Type.h.
References ArrayTyID, ID, IntegerTyID, isAbstract(), isFloatingPoint(), PointerTyID, StructTyID, and VectorTyID.
Referenced by llvm::ComputeMaskedBits(), FindElementAtOffset(), llvm::ScalarEvolution::getAllocSizeExpr(), llvm::SDISelAsmOperandInfo::getCallOperandValEVT(), getIndexedTypeInternal(), llvm::TargetData::getTypeSizeInBits(), isObjectSmallerThan(), isSafeToEliminateVarargsCast(), and TryToOptimizeStoreOfMallocToGlobal().
| unsigned Type::getPrimitiveSizeInBits | ( | ) | const |
getPrimitiveSizeInBits - 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.
Note that this may not reflect the size of memory allocated for an instance of the type or the number of bytes that are written when an instance of the type is stored to memory. The TargetData class provides additional query functions to provide this information.
Definition at line 172 of file Type.cpp.
References DoubleTyID, FloatTyID, FP128TyID, getTypeID(), IntegerTyID, PPC_FP128TyID, VectorTyID, and X86_FP80TyID.
Referenced by llvm::CastInst::castIsValid(), CollectBSwapParts(), llvm::ConstantFoldCastInstruction(), llvm::ConstantFoldGetElementPtr(), EvaluateGEPOffsetExpression(), FoldBitCast(), llvm::ConstantExpr::getBitCast(), llvm::MSILWriter::getBitWidth(), llvm::VectorType::getExtendedElementVectorType(), llvm::VectorType::getInteger(), getScalarSizeInBits(), llvm::VectorType::getTruncatedElementVectorType(), llvm::ScalarEvolution::getTypeSizeInBits(), InstCombineLoadCast(), isSafeIntegerType(), isSignBitCheck(), llvm::X86TargetLowering::isTruncateFree(), LowerBSWAP(), LowerCTLZ(), LowerCTPOP(), and MergeInType().
| unsigned Type::getScalarSizeInBits | ( | ) | const |
getScalarSizeInBits - If this is a vector type, return the getPrimitiveSizeInBits value for the element type. Otherwise return the getPrimitiveSizeInBits value for this type.
getScalarSizeInBits - If this is a vector type, return the getPrimitiveSizeInBits value for the element type. Otherwise return the getPrimitiveSizeInBits value for this type.
Definition at line 188 of file Type.cpp.
References getPrimitiveSizeInBits(), and getScalarType().
Referenced by llvm::CastInst::castIsValid(), llvm::ComputeMaskedBits(), llvm::ComputeNumSignBits(), llvm::ConstantFoldInstOperands(), llvm::CastInst::CreateFPCast(), llvm::CastInst::CreateIntegerCast(), llvm::CastInst::CreateSExtOrBitCast(), llvm::CastInst::CreateTruncOrBitCast(), llvm::CastInst::CreateZExtOrBitCast(), llvm::CastInst::getCastOpcode(), llvm::ConstantExpr::getFPCast(), llvm::ConstantExpr::getFPExtend(), llvm::ConstantExpr::getFPTrunc(), llvm::ConstantExpr::getIntegerCast(), llvm::ConstantExpr::getSExt(), llvm::ConstantExpr::getSExtOrBitCast(), llvm::ConstantExpr::getTrunc(), llvm::ConstantExpr::getTruncOrBitCast(), llvm::ConstantExpr::getZExt(), llvm::ConstantExpr::getZExtOrBitCast(), InsertCastToIntPtrTy(), llvm::CastInst::isCastable(), llvm::CastInst::isEliminableCastPair(), and llvm::CastInst::isNoopCast().
| int Type::getFPMantissaWidth | ( | ) | const |
getFPMantissaWidth - Return the width of the mantissa of this type. This is only valid on floating point types. If the FP type does not have a stable mantissa (e.g. ppc long double), this method returns -1.
getFPMantissaWidth - Return the width of the mantissa of this type. This is only valid on floating point types. If the FP type does not have a stable mantissa (e.g. ppc long double), this method returns -1.
Definition at line 195 of file Type.cpp.
References DoubleTyID, FloatTyID, FP128TyID, isFloatingPoint(), PPC_FP128TyID, and X86_FP80TyID.
| const Type* llvm::Type::getForwardedType | ( | ) | const [inline] |
getForwardedType - 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 303 of file Type.h.
References ForwardType.
Referenced by llvm::PATypeHolder::get(), and getIndexedTypeInternal().
| const Type * Type::getVAArgsPromotedType | ( | LLVMContext & | C | ) | const |
getVAArgsPromotedType - Return the type an argument of this type will be promoted to if passed through a variable argument function.
Definition at line 106 of file Type.cpp.
References FloatTyID, getDoubleTy(), getInt32Ty(), getSubclassData(), and IntegerTyID.
| const Type * Type::getScalarType | ( | ) | const |
getScalarType - If this is a vector type, return the element type, otherwise return this.
getScalarType - If this is a vector type, return the element type, otherwise return this.
Definition at line 117 of file Type.cpp.
Referenced by llvm::ComputeMaskedBits(), llvm::ComputeNumSignBits(), llvm::ConstantFP::get(), llvm::ConstantInt::get(), llvm::Constant::getIntegerValue(), and getScalarSizeInBits().
| subtype_iterator llvm::Type::subtype_begin | ( | ) | const [inline] |
Definition at line 321 of file Type.h.
References ContainedTys.
Referenced by AbstractTypeHasCycleThrough(), llvm::GraphTraits< const Type * >::child_begin(), llvm::GraphTraits< Type * >::child_begin(), llvm::GraphTraits< TypePromotionGraph >::child_begin(), ConcreteTypeHasCycleThrough(), llvm::getSubElementHash(), PromoteAbstractToConcrete(), llvm::TypeMapBase::TypeBecameConcrete(), and TypeHasCycleThroughItself().
| subtype_iterator llvm::Type::subtype_end | ( | ) | const [inline] |
Definition at line 322 of file Type.h.
References ContainedTys, and NumContainedTys.
Referenced by AbstractTypeHasCycleThrough(), llvm::GraphTraits< TypePromotionGraph >::child_begin(), llvm::GraphTraits< const Type * >::child_end(), llvm::GraphTraits< Type * >::child_end(), llvm::GraphTraits< TypePromotionGraph >::child_end(), ConcreteTypeHasCycleThrough(), llvm::getSubElementHash(), PromoteAbstractToConcrete(), llvm::TypeMapBase::TypeBecameConcrete(), and TypeHasCycleThroughItself().
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 328 of file Type.h.
References ContainedTys, llvm::PATypeHandle::get(), and NumContainedTys.
Referenced by lookupFunction().
| unsigned llvm::Type::getNumContainedTypes | ( | ) | const [inline] |
getNumContainedTypes - Return the number of types in the derived type.
Definition at line 335 of file Type.h.
References NumContainedTys.
Referenced by lookupFunction(), and RecursiveResolveTypesI().
| const Type * Type::getPrimitiveType | ( | LLVMContext & | C, | |
| TypeID | IDNumber | |||
| ) | [static] |
getPrimitiveType - Return a type based on an identifier.
Definition at line 91 of file Type.cpp.
References DoubleTyID, FloatTyID, FP128TyID, getDoubleTy(), getFloatTy(), getFP128Ty(), getLabelTy(), getMetadataTy(), getPPC_FP128Ty(), getVoidTy(), getX86_FP80Ty(), LabelTyID, MetadataTyID, PPC_FP128TyID, VoidTyID, and X86_FP80TyID.
| const Type * Type::getVoidTy | ( | LLVMContext & | C | ) | [static] |
Definition at line 306 of file Type.cpp.
References llvm::LLVMContext::pImpl, and llvm::LLVMContextImpl::VoidTy.
Referenced by llvm::IntrinsicLowering::AddPrototypes(), llvm::AllocationInst::AllocationInst(), llvm::TypeBuilder< void, cross >::get(), llvm::PointerType::get(), llvm::SelectionDAG::getMemcpy(), llvm::SelectionDAG::getMemmove(), llvm::SelectionDAG::getMemset(), getPrimitiveType(), llvm::EVT::getTypeForEVT(), llvm::IRBuilder< true, llvm::TargetFolder >::getVoidTy(), llvm::ValueEnumerator::incorporateFunction(), llvm::PointerType::isValidElementType(), llvm::StructType::isValidElementType(), llvm::ArrayType::isValidElementType(), llvm::FunctionType::isValidReturnType(), llvm::IntrinsicLowering::LowerIntrinsicCall(), NumRetVals(), llvm::PointerMayBeCaptured(), llvm::MSILWriter::printBasicBlock(), llvm::MSILWriter::printLocalVariables(), llvm::RemoveSuccessor(), llvm::JIT::runFunction(), llvm::ExecutionEngine::runFunctionAsMain(), llvm::UnifyFunctionExitNodes::runOnFunction(), llvm::Value::setName(), ThunkGToF(), llvm::Value::Value(), llvm::InlineAsm::Verify(), and llvm::Interpreter::visitReturnInst().
| const Type * Type::getLabelTy | ( | LLVMContext & | C | ) | [static] |
Definition at line 310 of file Type.cpp.
References llvm::LLVMContextImpl::LabelTy, and llvm::LLVMContext::pImpl.
Referenced by getPrimitiveType(), llvm::PointerType::isValidElementType(), llvm::StructType::isValidElementType(), and llvm::ArrayType::isValidElementType().
| const Type * Type::getFloatTy | ( | LLVMContext & | C | ) | [static] |
Definition at line 314 of file Type.cpp.
References llvm::LLVMContextImpl::FloatTy, and llvm::LLVMContext::pImpl.
Referenced by ByteswapSCANFResults(), ConstantFoldBinaryFP(), llvm::ConstantFoldCall(), llvm::ConstantFoldCastInstruction(), ConstantFoldFP(), executeFCMP_ORD(), executeFCMP_UNO(), llvm::TypeBuilder< types::ieee_float, cross >::get(), llvm::TypeBuilder< float, false >::get(), llvm::ConstantFP::get(), llvm::ExecutionEngine::getConstantValue(), llvm::IRBuilder< true, llvm::TargetFolder >::getFloatTy(), getPrimitiveType(), llvm::EVT::getTypeForEVT(), ReplaceFPIntrinsicWithCall(), and TypeToFloatSemantics().
| const Type * Type::getDoubleTy | ( | LLVMContext & | C | ) | [static] |
Definition at line 318 of file Type.cpp.
References llvm::LLVMContextImpl::DoubleTy, and llvm::LLVMContext::pImpl.
Referenced by ByteswapSCANFResults(), llvm::ComputeMaskedBits(), ConstantFoldBinaryFP(), llvm::ConstantFoldCall(), llvm::ConstantFoldCastInstruction(), ConstantFoldFP(), llvm::TypeBuilder< types::ieee_double, cross >::get(), llvm::TypeBuilder< double, false >::get(), llvm::ConstantFP::get(), llvm::ExecutionEngine::getConstantValue(), llvm::IRBuilder< true, llvm::TargetFolder >::getDoubleTy(), getPrimitiveType(), llvm::EVT::getTypeForEVT(), getVAArgsPromotedType(), ReplaceFPIntrinsicWithCall(), TypeToFloatSemantics(), and llvm::UpgradeIntrinsicCall().
| const Type * Type::getMetadataTy | ( | LLVMContext & | C | ) | [static] |
Definition at line 322 of file Type.cpp.
References llvm::LLVMContextImpl::MetadataTy, and llvm::LLVMContext::pImpl.
Referenced by llvm::MDNode::get(), getPrimitiveType(), llvm::BitcodeReaderMDValueList::getValueFwdRef(), llvm::FunctionType::isValidArgumentType(), llvm::PointerType::isValidElementType(), llvm::StructType::isValidElementType(), llvm::ArrayType::isValidElementType(), and llvm::FunctionType::isValidReturnType().
| const Type * Type::getX86_FP80Ty | ( | LLVMContext & | C | ) | [static] |
Definition at line 326 of file Type.cpp.
References llvm::LLVMContext::pImpl, and llvm::LLVMContextImpl::X86_FP80Ty.
Referenced by llvm::ConstantFoldCastInstruction(), llvm::TypeBuilder< types::x86_fp80, cross >::get(), llvm::ConstantFP::get(), llvm::ExecutionEngine::getConstantValue(), getPrimitiveType(), llvm::EVT::getTypeForEVT(), and TypeToFloatSemantics().
| const Type * Type::getFP128Ty | ( | LLVMContext & | C | ) | [static] |
Definition at line 330 of file Type.cpp.
References llvm::LLVMContextImpl::FP128Ty, and llvm::LLVMContext::pImpl.
Referenced by llvm::ConstantFoldCastInstruction(), llvm::TypeBuilder< types::fp128, cross >::get(), llvm::ConstantFP::get(), getPrimitiveType(), llvm::EVT::getTypeForEVT(), and TypeToFloatSemantics().
| const Type * Type::getPPC_FP128Ty | ( | LLVMContext & | C | ) | [static] |
Definition at line 334 of file Type.cpp.
References llvm::LLVMContext::pImpl, and llvm::LLVMContextImpl::PPC_FP128Ty.
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldCastInstruction(), llvm::ConstantFoldCompareInstruction(), evaluateFCmpRelation(), llvm::TypeBuilder< types::ppc_fp128, cross >::get(), llvm::ConstantFP::get(), getPrimitiveType(), llvm::EVT::getTypeForEVT(), and TypeToFloatSemantics().
| const IntegerType * Type::getInt1Ty | ( | LLVMContext & | C | ) | [static] |
Definition at line 338 of file Type.cpp.
References llvm::LLVMContextImpl::Int1Ty, and llvm::LLVMContext::pImpl.
Referenced by llvm::SelectInst::areInvalidOperands(), llvm::ConstantFoldCompareInstruction(), llvm::DIFactory::CreateCompileUnit(), llvm::DIFactory::CreateGlobalVariable(), llvm::DIFactory::CreateSubprogram(), llvm::IntegerType::get(), llvm::ConstantExpr::getFCmp(), llvm::ConstantExpr::getICmp(), llvm::IRBuilder< true, llvm::TargetFolder >::getInt1Ty(), llvm::ConstantExpr::getTy(), llvm::EVT::getTypeForEVT(), llvm::ConstantInt::isValueValidForType(), OptimizeGlobalAddressOfMalloc(), SimplifyCondBranchToCondBranch(), and TryToShrinkGlobalToBoolean().
| const IntegerType * Type::getInt8Ty | ( | LLVMContext & | C | ) | [static] |
Definition at line 342 of file Type.cpp.
References llvm::LLVMContextImpl::Int8Ty, and llvm::LLVMContext::pImpl.
Referenced by llvm::IntrinsicLowering::AddPrototypes(), ByteswapSCANFResults(), llvm::ConstantFoldGetElementPtr(), CreateArgv(), llvm::PointerTracking::doInitialization(), llvm::IntegerType::get(), llvm::ConstantArray::get(), llvm::ConstantExpr::getAlignOf(), llvm::PointerTracking::getAllocationSizeInBytes(), llvm::GetConstantStringInfo(), llvm::IRBuilder< true, llvm::TargetFolder >::getInt8Ty(), llvm::EVT::getTypeForEVT(), llvm::InlineFunction(), llvm::InsertProfilingInitCall(), llvm::ConstantArray::isCString(), llvm::ConstantArray::isString(), and llvm::ExecutionEngine::runFunctionAsMain().
| const IntegerType * Type::getInt16Ty | ( | LLVMContext & | C | ) | [static] |
Definition at line 346 of file Type.cpp.
References llvm::LLVMContextImpl::Int16Ty, and llvm::LLVMContext::pImpl.
Referenced by ByteswapSCANFResults(), llvm::X86TargetLowering::ExpandInlineAsm(), llvm::IntegerType::get(), llvm::IRBuilder< true, llvm::TargetFolder >::getInt16Ty(), and llvm::EVT::getTypeForEVT().
| const IntegerType * Type::getInt32Ty | ( | LLVMContext & | C | ) | [static] |
Definition at line 350 of file Type.cpp.
References llvm::LLVMContextImpl::Int32Ty, and llvm::LLVMContext::pImpl.
Referenced by llvm::IntrinsicLowering::AddPrototypes(), ByteswapSCANFResults(), llvm::DIFactory::CreateBasicType(), llvm::DIFactory::CreateCompileUnit(), llvm::DIFactory::CreateCompositeType(), llvm::IRBuilder< true, llvm::TargetFolder >::CreateConstGEP1_32(), llvm::IRBuilder< true, llvm::TargetFolder >::CreateConstGEP2_32(), llvm::IRBuilder< true, llvm::TargetFolder >::CreateConstInBoundsGEP1_32(), llvm::IRBuilder< true, llvm::TargetFolder >::CreateConstInBoundsGEP2_32(), llvm::DIFactory::CreateDerivedType(), llvm::IRBuilder< true, llvm::TargetFolder >::CreateGlobalStringPtr(), llvm::DIFactory::CreateGlobalVariable(), llvm::DIFactory::CreateSubprogram(), llvm::DIFactory::CreateVariable(), llvm::PointerTracking::doInitialization(), llvm::DerivedType::dropAllTypeUses(), llvm::Thumb2RegisterInfo::emitLoadConstPool(), llvm::Thumb1RegisterInfo::emitLoadConstPool(), llvm::ARMBaseRegisterInfo::emitLoadConstPool(), llvm::X86InstrInfo::foldMemoryOperandImpl(), llvm::IntegerType::get(), getAISize(), llvm::ConstantExpr::getAlignOf(), llvm::ExecutionEngine::getConstantValue(), llvm::ConstantExpr::getExtractElement(), llvm::TargetData::getIndexedOffset(), llvm::ConstantExpr::getInsertElement(), llvm::IRBuilder< true, llvm::TargetFolder >::getInt32Ty(), llvm::SelectionDAG::getMemset(), llvm::ConstantExpr::getOffsetOf(), llvm::ConstantExpr::getSizeOf(), llvm::EVT::getTypeForEVT(), getVAArgsPromotedType(), GetZeroSCEV(), llvm::RSProfilers_std::IncrementCounterInBlock(), llvm::IncrementCounterInBlock(), llvm::StructType::indexValid(), llvm::InlineFunction(), llvm::InsertProfilingInitCall(), llvm::DIFactory::InsertStopPoint(), llvm::ShuffleVectorInst::isValidOperands(), llvm::InsertElementInst::isValidOperands(), llvm::ExtractElementInst::isValidOperands(), llvm::X86TargetLowering::isZExtFree(), llvm::X86TargetLowering::LowerAsmOperandForConstraint(), LowerBSWAP(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::MachineFunction::MachineFunction(), OptimizeGlobalAddressOfMalloc(), llvm::JIT::runFunction(), llvm::ExecutionEngine::runFunctionAsMain(), SRAGlobal(), TryToOptimizeStoreOfMallocToGlobal(), and llvm::UpgradeIntrinsicCall().
| const IntegerType * Type::getInt64Ty | ( | LLVMContext & | C | ) | [static] |
Definition at line 354 of file Type.cpp.
References llvm::LLVMContextImpl::Int64Ty, and llvm::LLVMContext::pImpl.
Referenced by ByteswapSCANFResults(), llvm::ComputeMaskedBits(), llvm::ConstantFoldGetElementPtr(), llvm::DIFactory::CreateBasicType(), llvm::DIFactory::CreateCompositeType(), llvm::IRBuilder< true, llvm::TargetFolder >::CreateConstGEP1_64(), llvm::IRBuilder< true, llvm::TargetFolder >::CreateConstGEP2_64(), llvm::IRBuilder< true, llvm::TargetFolder >::CreateConstInBoundsGEP1_64(), llvm::IRBuilder< true, llvm::TargetFolder >::CreateConstInBoundsGEP2_64(), llvm::DIFactory::CreateDerivedType(), llvm::DIFactory::CreateEnumerator(), llvm::IRBuilder< true, llvm::TargetFolder >::CreatePtrDiff(), llvm::PointerTracking::doInitialization(), llvm::X86TargetLowering::ExpandInlineAsm(), llvm::IntegerType::get(), llvm::ExecutionEngine::getConstantValue(), llvm::ScalarEvolution::getEffectiveSCEVType(), llvm::IRBuilder< true, llvm::TargetFolder >::getInt64Ty(), llvm::ConstantExpr::getOffsetOf(), llvm::DIFactory::GetOrCreateSubrange(), llvm::ConstantExpr::getSizeOf(), llvm::EVT::getTypeForEVT(), IdxCompare(), IndexOperandsEqual(), llvm::InlineFunction(), llvm::X86TargetLowering::isZExtFree(), LowerBSWAP(), llvm::IntrinsicLowering::LowerIntrinsicCall(), and llvm::JIT::runFunction().
Methods for support type inquiry through isa, cast, and dyn_cast:.
Reimplemented in llvm::DerivedType, llvm::IntegerType, llvm::FunctionType, llvm::CompositeType, llvm::StructType, llvm::SequentialType, llvm::ArrayType, llvm::VectorType, llvm::PointerType, and llvm::OpaqueType.
| void llvm::Type::addRef | ( | ) | const [inline] |
Definition at line 365 of file Type.h.
References llvm::sys::AtomicIncrement(), isAbstract(), and RefCount.
Referenced by llvm::DerivedType::unlockedRefineAbstractTypeTo().
| void llvm::Type::dropRef | ( | ) | const [inline] |
Definition at line 370 of file Type.h.
References AbstractTypeUsers, llvm::sys::AtomicDecrement(), isAbstract(), and RefCount.
| void Type::addAbstractTypeUser | ( | AbstractTypeUser * | U | ) | const |
addAbstractTypeUser - Notify an abstract type that there is a new user of it. This function is called primarily by the PATypeHandle class.
Definition at line 975 of file Type.cpp.
References AbstractTypeUsers, llvm::LLVMContextImpl::AbstractTypeUsersLock, llvm::sys::SmartMutex< mt_only >::acquire(), getContext(), isAbstract(), llvm::LLVMContext::pImpl, and llvm::sys::SmartMutex< mt_only >::release().
| void Type::removeAbstractTypeUser | ( | AbstractTypeUser * | U | ) | const |
removeAbstractTypeUser - Notify an abstract type that a user of the class no longer has a handle to the type. This function is called primarily by the PATypeHandle class. When there are no users of the abstract type, it is annihilated, because there is no way to get a reference to it ever again.
Definition at line 989 of file Type.cpp.
References AbstractTypeUsers, llvm::LLVMContextImpl::AbstractTypeUsersLock, llvm::sys::SmartMutex< mt_only >::acquire(), DOUT, getContext(), getRefCount(), isAbstract(), llvm::LLVMContext::pImpl, and llvm::sys::SmartMutex< mt_only >::release().
Referenced by llvm::TypeMapBase::TypeBecameConcrete(), and llvm::ValueMap< std::vector< llvm::Constant * >, llvm::StructType, llvm::ConstantStruct, true >::typeBecameConcrete().
| PointerType * Type::getPointerTo | ( | unsigned | AddrSpace = 0 |
) | const |
getPointerTo - Return a pointer to the current type. This is equivalent to PointerType::get(Foo, AddrSpace).
Definition at line 952 of file Type.cpp.
References llvm::PointerType::get().
Referenced by llvm::ConstantExpr::getAlignOf().
| void Type::PromoteAbstractToConcrete | ( | ) | [protected] |
Definition at line 554 of file Type.cpp.
References isAbstract(), llvm::scc_begin(), llvm::scc_end(), SE, subtype_begin(), and subtype_end().
Referenced by llvm::TypeMapBase::TypeBecameConcrete().
friend class LLVMContextImpl [friend] |
friend class TypeMapBase [friend] |
const Type* llvm::Type::ForwardType [mutable, protected] |
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 142 of file Type.h.
Referenced by getForwardedType(), and llvm::DerivedType::unlockedRefineAbstractTypeTo().
std::vector<AbstractTypeUser *> llvm::Type::AbstractTypeUsers [mutable, protected] |
AbstractTypeUsers - Implement a list of the users that need to be notified if I am a type, and I get resolved into a more concrete type.
Definition at line 148 of file Type.h.
Referenced by addAbstractTypeUser(), dropRef(), llvm::DerivedType::notifyUsesThatTypeBecameConcrete(), removeAbstractTypeUser(), llvm::DerivedType::unlockedRefineAbstractTypeTo(), ~Type(), and llvm::TypeMapBase::~TypeMapBase().
unsigned llvm::Type::NumContainedTys [protected] |
NumContainedTys - Keeps track of how many PATypeHandle instances there are at the end of this type instance for the list of contained types. It is the subclasses responsibility to set this up. Set to 0 if there are no contained types in this type.
Definition at line 154 of file Type.h.
Referenced by llvm::StructType::element_end(), getContainedType(), llvm::StructType::getElementType(), getNumContainedTypes(), llvm::StructType::getNumElements(), llvm::FunctionType::getNumParams(), llvm::FunctionType::param_end(), llvm::SequentialType::SequentialType(), and subtype_end().
PATypeHandle* llvm::Type::ContainedTys [protected] |
ContainedTys - A pointer to the array of Types (PATypeHandle) contained by this Type. For example, this includes the arguments of a function type, the elements of a structure, the pointee of a pointer, the element type of an array, etc. This pointer may be 0 for types that don't contain other types (Integer, Double, Float). In general, the subclass should arrange for space for the PATypeHandles to be included in the allocation of the type object and set this pointer to the address of the first element. This allows the Type class to manipulate the ContainedTys without understanding the subclass's placement for this array. keeping it here also allows the subtype_* members to be implemented MUCH more efficiently, and dynamically very few types do not contain any elements.
Definition at line 167 of file Type.h.
Referenced by llvm::DerivedType::dropAllTypeUses(), llvm::StructType::element_begin(), llvm::StructType::element_end(), getContainedType(), llvm::SequentialType::getElementType(), llvm::StructType::getElementType(), llvm::FunctionType::getParamType(), llvm::FunctionType::getReturnType(), llvm::SequentialType::getTypeAtIndex(), llvm::StructType::getTypeAtIndex(), llvm::FunctionType::param_begin(), llvm::FunctionType::param_end(), llvm::SequentialType::SequentialType(), subtype_begin(), and subtype_end().