diff options
author | Owen Anderson <resistor@mac.com> | 2009-08-10 22:56:29 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-08-10 22:56:29 +0000 |
commit | e50ed30282bb5b4a9ed952580523f2dda16215ac (patch) | |
tree | fa8e46b304328a852135fef969e13d47e51196d0 /lib/VMCore | |
parent | a8c6908995c39094fc071e5c629c40773197d571 (diff) | |
download | external_llvm-e50ed30282bb5b4a9ed952580523f2dda16215ac.zip external_llvm-e50ed30282bb5b4a9ed952580523f2dda16215ac.tar.gz external_llvm-e50ed30282bb5b4a9ed952580523f2dda16215ac.tar.bz2 |
Rename MVT to EVT, in preparation for splitting SimpleValueType out into its own struct type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78610 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Function.cpp | 4 | ||||
-rw-r--r-- | lib/VMCore/ValueTypes.cpp | 204 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 26 |
3 files changed, 117 insertions, 117 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index 9fc3000..4813005 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -327,10 +327,10 @@ std::string Intrinsic::getName(ID id, const Type **Tys, unsigned numTys) { for (unsigned i = 0; i < numTys; ++i) { if (const PointerType* PTyp = dyn_cast<PointerType>(Tys[i])) { Result += ".p" + llvm::utostr(PTyp->getAddressSpace()) + - MVT::getMVT(PTyp->getElementType()).getMVTString(); + EVT::getEVT(PTyp->getElementType()).getEVTString(); } else if (Tys[i]) - Result += "." + MVT::getMVT(Tys[i]).getMVTString(); + Result += "." + EVT::getEVT(Tys[i]).getEVTString(); } return Result; } diff --git a/lib/VMCore/ValueTypes.cpp b/lib/VMCore/ValueTypes.cpp index 2446596..de3b640 100644 --- a/lib/VMCore/ValueTypes.cpp +++ b/lib/VMCore/ValueTypes.cpp @@ -1,4 +1,4 @@ -//===----------- ValueTypes.cpp - Implementation of MVT methods -----------===// +//===----------- ValueTypes.cpp - Implementation of EVT methods -----------===// // // The LLVM Compiler Infrastructure // @@ -19,58 +19,58 @@ #include "llvm/Support/ErrorHandling.h" using namespace llvm; -MVT MVT::getExtendedIntegerVT(unsigned BitWidth) { - MVT VT; +EVT EVT::getExtendedIntegerVT(unsigned BitWidth) { + EVT VT; VT.LLVMTy = IntegerType::get(BitWidth); assert(VT.isExtended() && "Type is not extended!"); return VT; } -MVT MVT::getExtendedVectorVT(MVT VT, unsigned NumElements) { - MVT ResultVT; - ResultVT.LLVMTy = VectorType::get(VT.getTypeForMVT(), NumElements); +EVT EVT::getExtendedVectorVT(EVT VT, unsigned NumElements) { + EVT ResultVT; + ResultVT.LLVMTy = VectorType::get(VT.getTypeForEVT(), NumElements); assert(ResultVT.isExtended() && "Type is not extended!"); return ResultVT; } -bool MVT::isExtendedFloatingPoint() const { +bool EVT::isExtendedFloatingPoint() const { assert(isExtended() && "Type is not extended!"); return LLVMTy->isFPOrFPVector(); } -bool MVT::isExtendedInteger() const { +bool EVT::isExtendedInteger() const { assert(isExtended() && "Type is not extended!"); return LLVMTy->isIntOrIntVector(); } -bool MVT::isExtendedVector() const { +bool EVT::isExtendedVector() const { assert(isExtended() && "Type is not extended!"); return isa<VectorType>(LLVMTy); } -bool MVT::isExtended64BitVector() const { +bool EVT::isExtended64BitVector() const { return isExtendedVector() && getSizeInBits() == 64; } -bool MVT::isExtended128BitVector() const { +bool EVT::isExtended128BitVector() const { return isExtendedVector() && getSizeInBits() == 128; } -bool MVT::isExtended256BitVector() const { +bool EVT::isExtended256BitVector() const { return isExtendedVector() && getSizeInBits() == 256; } -MVT MVT::getExtendedVectorElementType() const { +EVT EVT::getExtendedVectorElementType() const { assert(isExtended() && "Type is not extended!"); - return MVT::getMVT(cast<VectorType>(LLVMTy)->getElementType()); + return EVT::getEVT(cast<VectorType>(LLVMTy)->getElementType()); } -unsigned MVT::getExtendedVectorNumElements() const { +unsigned EVT::getExtendedVectorNumElements() const { assert(isExtended() && "Type is not extended!"); return cast<VectorType>(LLVMTy)->getNumElements(); } -unsigned MVT::getExtendedSizeInBits() const { +unsigned EVT::getExtendedSizeInBits() const { assert(isExtended() && "Type is not extended!"); if (const IntegerType *ITy = dyn_cast<IntegerType>(LLVMTy)) return ITy->getBitWidth(); @@ -80,119 +80,119 @@ unsigned MVT::getExtendedSizeInBits() const { return 0; // Suppress warnings. } -/// getMVTString - This function returns value type as a string, e.g. "i32". -std::string MVT::getMVTString() const { +/// getEVTString - This function returns value type as a string, e.g. "i32". +std::string EVT::getEVTString() const { switch (V) { default: if (isVector()) return "v" + utostr(getVectorNumElements()) + - getVectorElementType().getMVTString(); + getVectorElementType().getEVTString(); if (isInteger()) return "i" + utostr(getSizeInBits()); - llvm_unreachable("Invalid MVT!"); + llvm_unreachable("Invalid EVT!"); return "?"; - case MVT::i1: return "i1"; - case MVT::i8: return "i8"; - case MVT::i16: return "i16"; - case MVT::i32: return "i32"; - case MVT::i64: return "i64"; - case MVT::i128: return "i128"; - case MVT::f32: return "f32"; - case MVT::f64: return "f64"; - case MVT::f80: return "f80"; - case MVT::f128: return "f128"; - case MVT::ppcf128: return "ppcf128"; - case MVT::isVoid: return "isVoid"; - case MVT::Other: return "ch"; - case MVT::Flag: return "flag"; - case MVT::v2i8: return "v2i8"; - case MVT::v4i8: return "v4i8"; - case MVT::v8i8: return "v8i8"; - case MVT::v16i8: return "v16i8"; - case MVT::v32i8: return "v32i8"; - case MVT::v2i16: return "v2i16"; - case MVT::v4i16: return "v4i16"; - case MVT::v8i16: return "v8i16"; - case MVT::v16i16: return "v16i16"; - case MVT::v2i32: return "v2i32"; - case MVT::v4i32: return "v4i32"; - case MVT::v8i32: return "v8i32"; - case MVT::v1i64: return "v1i64"; - case MVT::v2i64: return "v2i64"; - case MVT::v4i64: return "v4i64"; - case MVT::v2f32: return "v2f32"; - case MVT::v4f32: return "v4f32"; - case MVT::v8f32: return "v8f32"; - case MVT::v2f64: return "v2f64"; - case MVT::v4f64: return "v4f64"; + case EVT::i1: return "i1"; + case EVT::i8: return "i8"; + case EVT::i16: return "i16"; + case EVT::i32: return "i32"; + case EVT::i64: return "i64"; + case EVT::i128: return "i128"; + case EVT::f32: return "f32"; + case EVT::f64: return "f64"; + case EVT::f80: return "f80"; + case EVT::f128: return "f128"; + case EVT::ppcf128: return "ppcf128"; + case EVT::isVoid: return "isVoid"; + case EVT::Other: return "ch"; + case EVT::Flag: return "flag"; + case EVT::v2i8: return "v2i8"; + case EVT::v4i8: return "v4i8"; + case EVT::v8i8: return "v8i8"; + case EVT::v16i8: return "v16i8"; + case EVT::v32i8: return "v32i8"; + case EVT::v2i16: return "v2i16"; + case EVT::v4i16: return "v4i16"; + case EVT::v8i16: return "v8i16"; + case EVT::v16i16: return "v16i16"; + case EVT::v2i32: return "v2i32"; + case EVT::v4i32: return "v4i32"; + case EVT::v8i32: return "v8i32"; + case EVT::v1i64: return "v1i64"; + case EVT::v2i64: return "v2i64"; + case EVT::v4i64: return "v4i64"; + case EVT::v2f32: return "v2f32"; + case EVT::v4f32: return "v4f32"; + case EVT::v8f32: return "v8f32"; + case EVT::v2f64: return "v2f64"; + case EVT::v4f64: return "v4f64"; } } -/// getTypeForMVT - This method returns an LLVM type corresponding to the -/// specified MVT. For integer types, this returns an unsigned type. Note +/// 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 *MVT::getTypeForMVT() const { +const Type *EVT::getTypeForEVT() const { switch (V) { default: assert(isExtended() && "Type is not extended!"); return LLVMTy; - case MVT::isVoid: return Type::VoidTy; - case MVT::i1: return Type::Int1Ty; - case MVT::i8: return Type::Int8Ty; - case MVT::i16: return Type::Int16Ty; - case MVT::i32: return Type::Int32Ty; - case MVT::i64: return Type::Int64Ty; - case MVT::i128: return IntegerType::get(128); - case MVT::f32: return Type::FloatTy; - case MVT::f64: return Type::DoubleTy; - case MVT::f80: return Type::X86_FP80Ty; - case MVT::f128: return Type::FP128Ty; - case MVT::ppcf128: return Type::PPC_FP128Ty; - case MVT::v2i8: return VectorType::get(Type::Int8Ty, 2); - case MVT::v4i8: return VectorType::get(Type::Int8Ty, 4); - case MVT::v8i8: return VectorType::get(Type::Int8Ty, 8); - case MVT::v16i8: return VectorType::get(Type::Int8Ty, 16); - case MVT::v32i8: return VectorType::get(Type::Int8Ty, 32); - case MVT::v2i16: return VectorType::get(Type::Int16Ty, 2); - case MVT::v4i16: return VectorType::get(Type::Int16Ty, 4); - case MVT::v8i16: return VectorType::get(Type::Int16Ty, 8); - case MVT::v16i16: return VectorType::get(Type::Int16Ty, 16); - case MVT::v2i32: return VectorType::get(Type::Int32Ty, 2); - case MVT::v4i32: return VectorType::get(Type::Int32Ty, 4); - case MVT::v8i32: return VectorType::get(Type::Int32Ty, 8); - case MVT::v1i64: return VectorType::get(Type::Int64Ty, 1); - case MVT::v2i64: return VectorType::get(Type::Int64Ty, 2); - case MVT::v4i64: return VectorType::get(Type::Int64Ty, 4); - case MVT::v2f32: return VectorType::get(Type::FloatTy, 2); - case MVT::v4f32: return VectorType::get(Type::FloatTy, 4); - case MVT::v8f32: return VectorType::get(Type::FloatTy, 8); - case MVT::v2f64: return VectorType::get(Type::DoubleTy, 2); - case MVT::v4f64: return VectorType::get(Type::DoubleTy, 4); + case EVT::isVoid: return Type::VoidTy; + case EVT::i1: return Type::Int1Ty; + case EVT::i8: return Type::Int8Ty; + case EVT::i16: return Type::Int16Ty; + case EVT::i32: return Type::Int32Ty; + case EVT::i64: return Type::Int64Ty; + case EVT::i128: return IntegerType::get(128); + case EVT::f32: return Type::FloatTy; + case EVT::f64: return Type::DoubleTy; + case EVT::f80: return Type::X86_FP80Ty; + case EVT::f128: return Type::FP128Ty; + case EVT::ppcf128: return Type::PPC_FP128Ty; + case EVT::v2i8: return VectorType::get(Type::Int8Ty, 2); + case EVT::v4i8: return VectorType::get(Type::Int8Ty, 4); + case EVT::v8i8: return VectorType::get(Type::Int8Ty, 8); + case EVT::v16i8: return VectorType::get(Type::Int8Ty, 16); + case EVT::v32i8: return VectorType::get(Type::Int8Ty, 32); + case EVT::v2i16: return VectorType::get(Type::Int16Ty, 2); + case EVT::v4i16: return VectorType::get(Type::Int16Ty, 4); + case EVT::v8i16: return VectorType::get(Type::Int16Ty, 8); + case EVT::v16i16: return VectorType::get(Type::Int16Ty, 16); + case EVT::v2i32: return VectorType::get(Type::Int32Ty, 2); + case EVT::v4i32: return VectorType::get(Type::Int32Ty, 4); + case EVT::v8i32: return VectorType::get(Type::Int32Ty, 8); + case EVT::v1i64: return VectorType::get(Type::Int64Ty, 1); + case EVT::v2i64: return VectorType::get(Type::Int64Ty, 2); + case EVT::v4i64: return VectorType::get(Type::Int64Ty, 4); + case EVT::v2f32: return VectorType::get(Type::FloatTy, 2); + case EVT::v4f32: return VectorType::get(Type::FloatTy, 4); + case EVT::v8f32: return VectorType::get(Type::FloatTy, 8); + case EVT::v2f64: return VectorType::get(Type::DoubleTy, 2); + case EVT::v4f64: return VectorType::get(Type::DoubleTy, 4); } } -/// getMVT - Return the value type corresponding to the specified type. This -/// returns all pointers as MVT::iPTR. If HandleUnknown is true, unknown types +/// getEVT - Return the value type corresponding to the specified type. This +/// returns all pointers as EVT::iPTR. If HandleUnknown is true, unknown types /// are returned as Other, otherwise they are invalid. -MVT MVT::getMVT(const Type *Ty, bool HandleUnknown){ +EVT EVT::getEVT(const Type *Ty, bool HandleUnknown){ switch (Ty->getTypeID()) { default: - if (HandleUnknown) return MVT::Other; + if (HandleUnknown) return EVT::Other; llvm_unreachable("Unknown type!"); - return MVT::isVoid; + return EVT::isVoid; case Type::VoidTyID: - return MVT::isVoid; + return EVT::isVoid; case Type::IntegerTyID: return getIntegerVT(cast<IntegerType>(Ty)->getBitWidth()); - case Type::FloatTyID: return MVT::f32; - case Type::DoubleTyID: return MVT::f64; - case Type::X86_FP80TyID: return MVT::f80; - case Type::FP128TyID: return MVT::f128; - case Type::PPC_FP128TyID: return MVT::ppcf128; - case Type::PointerTyID: return MVT::iPTR; + case Type::FloatTyID: return EVT::f32; + case Type::DoubleTyID: return EVT::f64; + case Type::X86_FP80TyID: return EVT::f80; + case Type::FP128TyID: return EVT::f128; + case Type::PPC_FP128TyID: return EVT::ppcf128; + case Type::PointerTyID: return EVT::iPTR; case Type::VectorTyID: { const VectorType *VTy = cast<VectorType>(Ty); - return getVectorVT(getMVT(VTy->getElementType(), false), + return getVectorVT(getEVT(VTy->getElementType(), false), VTy->getNumElements()); } } diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 9ca0488..a601690 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -1559,7 +1559,7 @@ bool Verifier::PerformTypeCheck(Intrinsic::ID ID, Function *F, const Type *Ty, return false; } } - } else if (VT == MVT::iAny) { + } else if (VT == EVT::iAny) { if (!EltTy->isInteger()) { CheckFailed(IntrinsicParam(ArgNo, NumRets) + " is not " "an integer type.", F); @@ -1584,7 +1584,7 @@ bool Verifier::PerformTypeCheck(Intrinsic::ID ID, Function *F, const Type *Ty, } break; } - } else if (VT == MVT::fAny) { + } else if (VT == EVT::fAny) { if (!EltTy->isFloatingPoint()) { CheckFailed(IntrinsicParam(ArgNo, NumRets) + " is not " "a floating-point type.", F); @@ -1596,30 +1596,30 @@ bool Verifier::PerformTypeCheck(Intrinsic::ID ID, Function *F, const Type *Ty, if (EltTy != Ty) Suffix += "v" + utostr(NumElts); - Suffix += MVT::getMVT(EltTy).getMVTString(); - } else if (VT == MVT::iPTR) { + Suffix += EVT::getEVT(EltTy).getEVTString(); + } else if (VT == EVT::iPTR) { if (!isa<PointerType>(Ty)) { CheckFailed(IntrinsicParam(ArgNo, NumRets) + " is not a " "pointer and a pointer is required.", F); return false; } - } else if (VT == MVT::iPTRAny) { + } else if (VT == EVT::iPTRAny) { // Outside of TableGen, we don't distinguish iPTRAny (to any address space) // and iPTR. In the verifier, we can not distinguish which case we have so // allow either case to be legal. if (const PointerType* PTyp = dyn_cast<PointerType>(Ty)) { Suffix += ".p" + utostr(PTyp->getAddressSpace()) + - MVT::getMVT(PTyp->getElementType()).getMVTString(); + EVT::getEVT(PTyp->getElementType()).getEVTString(); } else { CheckFailed(IntrinsicParam(ArgNo, NumRets) + " is not a " "pointer and a pointer is required.", F); return false; } - } else if (MVT((MVT::SimpleValueType)VT).isVector()) { - MVT VVT = MVT((MVT::SimpleValueType)VT); + } else if (EVT((EVT::SimpleValueType)VT).isVector()) { + EVT VVT = EVT((EVT::SimpleValueType)VT); // If this is a vector argument, verify the number and type of elements. - if (VVT.getVectorElementType() != MVT::getMVT(EltTy)) { + if (VVT.getVectorElementType() != EVT::getEVT(EltTy)) { CheckFailed("Intrinsic prototype has incorrect vector element type!", F); return false; } @@ -1629,7 +1629,7 @@ bool Verifier::PerformTypeCheck(Intrinsic::ID ID, Function *F, const Type *Ty, "vector elements!", F); return false; } - } else if (MVT((MVT::SimpleValueType)VT).getTypeForMVT() != EltTy) { + } else if (EVT((EVT::SimpleValueType)VT).getTypeForEVT() != EltTy) { CheckFailed(IntrinsicParam(ArgNo, NumRets) + " is wrong!", F); return false; } else if (EltTy != Ty) { @@ -1671,7 +1671,7 @@ void Verifier::VerifyIntrinsicPrototype(Intrinsic::ID ID, Function *F, } for (unsigned ArgNo = 0; ArgNo < RetNum; ++ArgNo) { - int VT = va_arg(VA, int); // An MVT::SimpleValueType when non-negative. + int VT = va_arg(VA, int); // An EVT::SimpleValueType when non-negative. if (ST) Ty = ST->getElementType(ArgNo); @@ -1681,9 +1681,9 @@ void Verifier::VerifyIntrinsicPrototype(Intrinsic::ID ID, Function *F, // Verify the parameter types. for (unsigned ArgNo = 0; ArgNo < ParamNum; ++ArgNo) { - int VT = va_arg(VA, int); // An MVT::SimpleValueType when non-negative. + int VT = va_arg(VA, int); // An EVT::SimpleValueType when non-negative. - if (VT == MVT::isVoid && ArgNo > 0) { + if (VT == EVT::isVoid && ArgNo > 0) { if (!FTy->isVarArg()) CheckFailed("Intrinsic prototype has no '...'!", F); break; |