X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FVMCore%2FValueTypes.cpp;h=e13bd7df73754751bf2d6873282d87dce8cc9728;hb=0e64f810a521806838bf90d77f081d3a1da98b5e;hp=21a1f034446a41d926dbd17c7771c254903d8b24;hpb=109c22c06232358597afec5d8b7a6b6fd24e19b1;p=oota-llvm.git diff --git a/lib/VMCore/ValueTypes.cpp b/lib/VMCore/ValueTypes.cpp index 21a1f034446..e13bd7df737 100644 --- a/lib/VMCore/ValueTypes.cpp +++ b/lib/VMCore/ValueTypes.cpp @@ -19,6 +19,12 @@ #include "llvm/Support/ErrorHandling.h" using namespace llvm; +EVT EVT::changeExtendedVectorElementTypeToInteger() const { + LLVMContext &Context = LLVMTy->getContext(); + EVT IntTy = getIntegerVT(Context, getVectorElementType().getSizeInBits()); + return getVectorVT(Context, IntTy, getVectorNumElements()); +} + EVT EVT::getExtendedIntegerVT(LLVMContext &Context, unsigned BitWidth) { EVT VT; VT.LLVMTy = IntegerType::get(Context, BitWidth); @@ -77,9 +83,9 @@ unsigned EVT::getExtendedVectorNumElements() const { unsigned EVT::getExtendedSizeInBits() const { assert(isExtended() && "Type is not extended!"); - if (const IntegerType *ITy = dyn_cast(LLVMTy)) + if (IntegerType *ITy = dyn_cast(LLVMTy)) return ITy->getBitWidth(); - if (const VectorType *VTy = dyn_cast(LLVMTy)) + if (VectorType *VTy = dyn_cast(LLVMTy)) return VTy->getBitWidth(); assert(false && "Unrecognized extended type!"); return 0; // Suppress warnings. @@ -140,7 +146,7 @@ std::string EVT::getEVTString() const { /// getTypeForEVT - This method returns an LLVM type corresponding to the /// specified EVT. For integer types, this returns an unsigned type. Note /// that this will abort for types that cannot be represented. -const Type *EVT::getTypeForEVT(LLVMContext &Context) const { +Type *EVT::getTypeForEVT(LLVMContext &Context) const { switch (V.SimpleTy) { default: assert(isExtended() && "Type is not extended!"); @@ -186,7 +192,7 @@ const Type *EVT::getTypeForEVT(LLVMContext &Context) const { /// getEVT - Return the value type corresponding to the specified type. This /// returns all pointers as MVT::iPTR. If HandleUnknown is true, unknown types /// are returned as Other, otherwise they are invalid. -EVT EVT::getEVT(const Type *Ty, bool HandleUnknown){ +EVT EVT::getEVT(Type *Ty, bool HandleUnknown){ switch (Ty->getTypeID()) { default: if (HandleUnknown) return MVT(MVT::Other); @@ -204,7 +210,7 @@ EVT EVT::getEVT(const Type *Ty, bool HandleUnknown){ case Type::PPC_FP128TyID: return MVT(MVT::ppcf128); case Type::PointerTyID: return MVT(MVT::iPTR); case Type::VectorTyID: { - const VectorType *VTy = cast(Ty); + VectorType *VTy = cast(Ty); return getVectorVT(Ty->getContext(), getEVT(VTy->getElementType(), false), VTy->getNumElements()); }