diff options
author | Craig Topper <craig.topper@gmail.com> | 2014-01-24 20:50:47 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2014-01-24 20:50:47 +0000 |
commit | f3474549ba401c05a6d3db3dc6b2cfe3a7f73314 (patch) | |
tree | b95e4ba3094c0d393c055dfcfc1053f47edede07 /utils | |
parent | 96172cb4a44d890263c9054df35739a60569d4a5 (diff) | |
download | llvm-f3474549ba401c05a6d3db3dc6b2cfe3a7f73314.tar.gz llvm-f3474549ba401c05a6d3db3dc6b2cfe3a7f73314.tar.bz2 llvm-f3474549ba401c05a6d3db3dc6b2cfe3a7f73314.tar.xz |
Replace tablegen uses of EVT with MVT. Add isOverloaded() to MVT to facilitate. Remove TGValueTypes.cpp since its unused now (and may have been before).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200036 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/CodeGenRegisters.cpp | 2 | ||||
-rw-r--r-- | utils/TableGen/CodeGenTarget.cpp | 4 | ||||
-rw-r--r-- | utils/TableGen/IntrinsicEmitter.cpp | 11 | ||||
-rw-r--r-- | utils/TableGen/TGValueTypes.cpp | 128 |
4 files changed, 8 insertions, 137 deletions
diff --git a/utils/TableGen/CodeGenRegisters.cpp b/utils/TableGen/CodeGenRegisters.cpp index f2eef4f68f..f491d57626 100644 --- a/utils/TableGen/CodeGenRegisters.cpp +++ b/utils/TableGen/CodeGenRegisters.cpp @@ -712,7 +712,7 @@ CodeGenRegisterClass::CodeGenRegisterClass(CodeGenRegBank &RegBank, Record *R) unsigned Size = R->getValueAsInt("Size"); Namespace = R->getValueAsString("Namespace"); - SpillSize = Size ? Size : EVT(VTs[0]).getSizeInBits(); + SpillSize = Size ? Size : MVT(VTs[0]).getSizeInBits(); SpillAlignment = R->getValueAsInt("Alignment"); CopyCost = R->getValueAsInt("CopyCost"); Allocatable = R->getValueAsBit("isAllocatable"); diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp index 4b8efff600..95d9f82b06 100644 --- a/utils/TableGen/CodeGenTarget.cpp +++ b/utils/TableGen/CodeGenTarget.cpp @@ -528,7 +528,7 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) { } else { VT = getValueType(TyEl->getValueAsDef("VT")); } - if (EVT(VT).isOverloaded()) { + if (MVT(VT).isOverloaded()) { OverloadedVTs.push_back(VT); isOverloaded = true; } @@ -562,7 +562,7 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) { } else VT = getValueType(TyEl->getValueAsDef("VT")); - if (EVT(VT).isOverloaded()) { + if (MVT(VT).isOverloaded()) { OverloadedVTs.push_back(VT); isOverloaded = true; } diff --git a/utils/TableGen/IntrinsicEmitter.cpp b/utils/TableGen/IntrinsicEmitter.cpp index 8f137f83d3..173e506532 100644 --- a/utils/TableGen/IntrinsicEmitter.cpp +++ b/utils/TableGen/IntrinsicEmitter.cpp @@ -268,8 +268,8 @@ enum IIT_Info { static void EncodeFixedValueType(MVT::SimpleValueType VT, std::vector<unsigned char> &Sig) { - if (EVT(VT).isInteger()) { - unsigned BitWidth = EVT(VT).getSizeInBits(); + if (MVT(VT).isInteger()) { + unsigned BitWidth = MVT(VT).getSizeInBits(); switch (BitWidth) { default: PrintFatalError("unhandled integer type width in intrinsic!"); case 1: return Sig.push_back(IIT_I1); @@ -350,8 +350,8 @@ static void EncodeFixedType(Record *R, std::vector<unsigned char> &ArgCodes, } } - if (EVT(VT).isVector()) { - EVT VVT = VT; + if (MVT(VT).isVector()) { + MVT VVT = VT; switch (VVT.getVectorNumElements()) { default: PrintFatalError("unhandled vector type width in intrinsic!"); case 1: Sig.push_back(IIT_V1); break; @@ -362,8 +362,7 @@ static void EncodeFixedType(Record *R, std::vector<unsigned char> &ArgCodes, case 32: Sig.push_back(IIT_V32); break; } - return EncodeFixedValueType(VVT.getVectorElementType(). - getSimpleVT().SimpleTy, Sig); + return EncodeFixedValueType(VVT.getVectorElementType().SimpleTy, Sig); } EncodeFixedValueType(VT, Sig); diff --git a/utils/TableGen/TGValueTypes.cpp b/utils/TableGen/TGValueTypes.cpp deleted file mode 100644 index f4893f50a6..0000000000 --- a/utils/TableGen/TGValueTypes.cpp +++ /dev/null @@ -1,128 +0,0 @@ -//===- ValueTypes.cpp - Tablegen extended ValueType implementation --------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// The EVT type is used by tablegen as well as in LLVM. In order to handle -// extended types, the EVT type uses support functions that call into -// LLVM's type system code. These aren't accessible in tablegen, so this -// file provides simple replacements. -// -//===----------------------------------------------------------------------===// - -#include "llvm/CodeGen/ValueTypes.h" -#include "llvm/Support/Casting.h" -#include <map> -using namespace llvm; - -namespace llvm { - -class Type { -protected: - enum TypeKind { - TK_ExtendedIntegerType, - TK_ExtendedVectorType - }; -private: - TypeKind Kind; -public: - TypeKind getKind() const { - return Kind; - } - Type(TypeKind K) : Kind(K) {} - virtual unsigned getSizeInBits() const = 0; - virtual ~Type(); -}; - -// Provide out-of-line definition to prevent weak vtable. -Type::~Type() {} - -} - -namespace { -class ExtendedIntegerType : public Type { - unsigned BitWidth; -public: - explicit ExtendedIntegerType(unsigned bits) - : Type(TK_ExtendedIntegerType), BitWidth(bits) {} - static bool classof(const Type *T) { - return T->getKind() == TK_ExtendedIntegerType; - } - virtual unsigned getSizeInBits() const { - return getBitWidth(); - } - unsigned getBitWidth() const { - return BitWidth; - } -}; - -class ExtendedVectorType : public Type { - EVT ElementType; - unsigned NumElements; -public: - ExtendedVectorType(EVT elty, unsigned num) - : Type(TK_ExtendedVectorType), ElementType(elty), NumElements(num) {} - static bool classof(const Type *T) { - return T->getKind() == TK_ExtendedVectorType; - } - virtual unsigned getSizeInBits() const { - return getNumElements() * getElementType().getSizeInBits(); - } - EVT getElementType() const { - return ElementType; - } - unsigned getNumElements() const { - return NumElements; - } -}; -} // end anonymous namespace - -static std::map<unsigned, const Type *> - ExtendedIntegerTypeMap; -static std::map<std::pair<uintptr_t, uintptr_t>, const Type *> - ExtendedVectorTypeMap; - -bool EVT::isExtendedFloatingPoint() const { - assert(isExtended() && "Type is not extended!"); - // Extended floating-point types are not supported yet. - return false; -} - -bool EVT::isExtendedInteger() const { - assert(isExtended() && "Type is not extended!"); - return isa<ExtendedIntegerType>(LLVMTy); -} - -bool EVT::isExtendedVector() const { - assert(isExtended() && "Type is not extended!"); - return isa<ExtendedVectorType>(LLVMTy); -} - -bool EVT::isExtended64BitVector() const { - assert(isExtended() && "Type is not extended!"); - return isExtendedVector() && getSizeInBits() == 64; -} - -bool EVT::isExtended128BitVector() const { - assert(isExtended() && "Type is not extended!"); - return isExtendedVector() && getSizeInBits() == 128; -} - -EVT EVT::getExtendedVectorElementType() const { - assert(isExtendedVector() && "Type is not an extended vector!"); - return static_cast<const ExtendedVectorType *>(LLVMTy)->getElementType(); -} - -unsigned EVT::getExtendedVectorNumElements() const { - assert(isExtendedVector() && "Type is not an extended vector!"); - return static_cast<const ExtendedVectorType *>(LLVMTy)->getNumElements(); -} - -unsigned EVT::getExtendedSizeInBits() const { - assert(isExtended() && "Type is not extended!"); - return LLVMTy->getSizeInBits(); -} |