1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

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).

llvm-svn: 200036
This commit is contained in:
Craig Topper 2014-01-24 20:50:47 +00:00
parent 45b2cea1c9
commit 5d7d0716d7
5 changed files with 14 additions and 137 deletions

View File

@ -237,6 +237,12 @@ namespace llvm {
return (SimpleTy == MVT::v16i64);
}
/// isOverloaded - Return true if this is an overloaded type for TableGen.
bool isOverloaded() const {
return (SimpleTy==MVT::iAny || SimpleTy==MVT::fAny ||
SimpleTy==MVT::vAny || SimpleTy==MVT::iPTRAny);
}
/// isPow2VectorType - Returns true if the given vector is a power of 2.
bool isPow2VectorType() const {
unsigned NElts = getVectorNumElements();

View File

@ -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");

View File

@ -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;
}

View File

@ -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);

View File

@ -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();
}