X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FVMCore%2FType.cpp;h=1bbd2c6cf0b554adcde37e5cb6e892583ccc2d34;hb=ece6c6bb6329748b92403c06ac87f45c43485911;hp=3ef47277a1166a6a3fac2d013955468248994392;hpb=7e2c793a2b5c746344652b6579e958ee42fafdcc;p=oota-llvm.git diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 3ef47277a11..1bbd2c6cf0b 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -47,35 +47,17 @@ Type *Type::getScalarType() { return this; } +const Type *Type::getScalarType() const { + if (const VectorType *VTy = dyn_cast(this)) + return VTy->getElementType(); + return this; +} + /// isIntegerTy - Return true if this is an IntegerType of the specified width. bool Type::isIntegerTy(unsigned Bitwidth) const { return isIntegerTy() && cast(this)->getBitWidth() == Bitwidth; } -/// isIntOrIntVectorTy - Return true if this is an integer type or a vector of -/// integer types. -/// -bool Type::isIntOrIntVectorTy() const { - if (isIntegerTy()) - return true; - if (getTypeID() != Type::VectorTyID) return false; - - return cast(this)->getElementType()->isIntegerTy(); -} - -/// isFPOrFPVectorTy - Return true if this is a FP type or a vector of FP types. -/// -bool Type::isFPOrFPVectorTy() const { - if (getTypeID() == Type::HalfTyID || getTypeID() == Type::FloatTyID || - getTypeID() == Type::DoubleTyID || - getTypeID() == Type::FP128TyID || getTypeID() == Type::X86_FP80TyID || - getTypeID() == Type::PPC_FP128TyID) - return true; - if (getTypeID() != Type::VectorTyID) return false; - - return cast(this)->getElementType()->isFloatingPointTy(); -} - // canLosslesslyBitCastTo - Return true if this type can be converted to // 'Ty' without any reinterpretation of bits. For example, i8* to i32*. // @@ -170,7 +152,7 @@ int Type::getFPMantissaWidth() const { } /// isSizedDerivedType - Derived types like structures and arrays are sized -/// if all of the members of the type are sized as well. Since asking for +/// iff all of the members of the type are sized as well. Since asking for /// their size is relatively uncommon, move this operation out of line. bool Type::isSizedDerivedType() const { if (this->isIntegerTy())