Add isScalarInteger helper to EVT/MVT
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Tue, 1 Mar 2016 18:01:28 +0000 (18:01 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Tue, 1 Mar 2016 18:01:28 +0000 (18:01 +0000)
llvm-svn: 262357

llvm/include/llvm/CodeGen/MachineValueType.h
llvm/include/llvm/CodeGen/ValueTypes.h
llvm/lib/IR/ValueTypes.cpp

index 04d6ee3..8cfd5fe 100644 (file)
@@ -210,6 +210,13 @@ class MVT {
                SimpleTy <= MVT::LAST_INTEGER_VECTOR_VALUETYPE));
     }
 
+    /// isScalarInteger - Return true if this is an integer, not including
+    /// vectors.
+    bool isScalarInteger() const {
+      return (SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
+              SimpleTy <= MVT::LAST_INTEGER_VALUETYPE);
+    }
+
     /// isVector - Return true if this is a vector value type.
     bool isVector() const {
       return (SimpleTy >= MVT::FIRST_VECTOR_VALUETYPE &&
index 929eb88..b140036 100644 (file)
@@ -124,6 +124,11 @@ namespace llvm {
       return isSimple() ? V.isInteger() : isExtendedInteger();
     }
 
+    /// isScalarInteger - Return true if this is an integer, but not a vector.
+    bool isScalarInteger() const {
+      return isSimple() ? V.isScalarInteger() : isExtendedScalarInteger();
+    }
+
     /// isVector - Return true if this is a vector value type.
     bool isVector() const {
       return isSimple() ? V.isVector() : isExtendedVector();
@@ -367,6 +372,7 @@ namespace llvm {
                                    unsigned NumElements);
     bool isExtendedFloatingPoint() const LLVM_READONLY;
     bool isExtendedInteger() const LLVM_READONLY;
+    bool isExtendedScalarInteger() const LLVM_READONLY;
     bool isExtendedVector() const LLVM_READONLY;
     bool isExtended16BitVector() const LLVM_READONLY;
     bool isExtended32BitVector() const LLVM_READONLY;
index f293230..ff1e431 100644 (file)
@@ -55,6 +55,11 @@ bool EVT::isExtendedInteger() const {
   return LLVMTy->isIntOrIntVectorTy();
 }
 
+bool EVT::isExtendedScalarInteger() const {
+  assert(isExtended() && "Type is not extended!");
+  return LLVMTy->isIntegerTy();
+}
+
 bool EVT::isExtendedVector() const {
   assert(isExtended() && "Type is not extended!");
   return LLVMTy->isVectorTy();