[llvm] r200036 - 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).

Craig Topper craig.topper at gmail.com
Fri Jan 24 12:50:48 PST 2014


Author: ctopper
Date: Fri Jan 24 14:50:47 2014
New Revision: 200036

URL: http://llvm.org/viewvc/llvm-project?rev=200036&view=rev
Log:
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).

Removed:
    llvm/trunk/utils/TableGen/TGValueTypes.cpp
Modified:
    llvm/trunk/include/llvm/CodeGen/ValueTypes.h
    llvm/trunk/utils/TableGen/CodeGenRegisters.cpp
    llvm/trunk/utils/TableGen/CodeGenTarget.cpp
    llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp

Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ValueTypes.h?rev=200036&r1=200035&r2=200036&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/ValueTypes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/ValueTypes.h Fri Jan 24 14:50:47 2014
@@ -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();

Modified: llvm/trunk/utils/TableGen/CodeGenRegisters.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenRegisters.cpp?rev=200036&r1=200035&r2=200036&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenRegisters.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenRegisters.cpp Fri Jan 24 14:50:47 2014
@@ -712,7 +712,7 @@ CodeGenRegisterClass::CodeGenRegisterCla
   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");

Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=200036&r1=200035&r2=200036&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Fri Jan 24 14:50:47 2014
@@ -528,7 +528,7 @@ CodeGenIntrinsic::CodeGenIntrinsic(Recor
     } 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(Recor
     } else
       VT = getValueType(TyEl->getValueAsDef("VT"));
 
-    if (EVT(VT).isOverloaded()) {
+    if (MVT(VT).isOverloaded()) {
       OverloadedVTs.push_back(VT);
       isOverloaded = true;
     }

Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp?rev=200036&r1=200035&r2=200036&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Fri Jan 24 14:50:47 2014
@@ -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, s
   }
   }
 
-  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, s
     case 32: Sig.push_back(IIT_V32); break;
     }
 
-    return EncodeFixedValueType(VVT.getVectorElementType().
-                                getSimpleVT().SimpleTy, Sig);
+    return EncodeFixedValueType(VVT.getVectorElementType().SimpleTy, Sig);
   }
 
   EncodeFixedValueType(VT, Sig);

Removed: llvm/trunk/utils/TableGen/TGValueTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGValueTypes.cpp?rev=200035&view=auto
==============================================================================
--- llvm/trunk/utils/TableGen/TGValueTypes.cpp (original)
+++ llvm/trunk/utils/TableGen/TGValueTypes.cpp (removed)
@@ -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();
-}





More information about the llvm-commits mailing list