[PATCH] D17674: Add isScalarInteger helper to EVT/MVT

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 26 22:11:17 PST 2016


arsenm created this revision.
arsenm added a subscriber: llvm-commits.

http://reviews.llvm.org/D17674

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

Index: lib/IR/ValueTypes.cpp
===================================================================
--- lib/IR/ValueTypes.cpp
+++ lib/IR/ValueTypes.cpp
@@ -55,6 +55,11 @@
   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();
Index: include/llvm/CodeGen/ValueTypes.h
===================================================================
--- include/llvm/CodeGen/ValueTypes.h
+++ include/llvm/CodeGen/ValueTypes.h
@@ -124,6 +124,11 @@
       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 @@
                                    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: include/llvm/CodeGen/MachineValueType.h
===================================================================
--- include/llvm/CodeGen/MachineValueType.h
+++ include/llvm/CodeGen/MachineValueType.h
@@ -210,6 +210,13 @@
                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 &&


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17674.49286.patch
Type: text/x-patch
Size: 2214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160227/1e8a73e6/attachment-0001.bin>


More information about the llvm-commits mailing list