Add Type::isIntOrIntVector, like Type::isFPOrFPVector.
authorDan Gohman <gohman@apple.com>
Mon, 20 Aug 2007 19:25:59 +0000 (19:25 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 20 Aug 2007 19:25:59 +0000 (19:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41190 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Type.h
lib/VMCore/Type.cpp

index bd264a0ea0fca2e00356e732d0a3eaceccd44b1b..72e70b44a95a728ed7c8db0f154ed7d68525d66c 100644 (file)
@@ -180,6 +180,11 @@ public:
   ///
   bool isInteger() const { return ID == IntegerTyID; } 
 
+  /// isIntOrIntVector - Return true if this is an integer type or a vector of
+  /// integer types.
+  ///
+  bool isIntOrIntVector() const;
+  
   /// isFloatingPoint - Return true if this is one of the two floating point
   /// types
   bool isFloatingPoint() const { return ID == FloatTyID || ID == DoubleTyID ||
index 3f8643e7e6d25e03d35b54c7bf614b0216329987..3e085f4027feb69d994042b38ea218ced53a183a 100644 (file)
@@ -126,6 +126,17 @@ const Type *Type::getVAArgsPromotedType() const {
     return this;
 }
 
+/// isIntOrIntVector - Return true if this is an integer type or a vector of
+/// integer types.
+///
+bool Type::isIntOrIntVector() const {
+  if (isInteger())
+    return true;
+  if (ID != Type::VectorTyID) return false;
+  
+  return cast<VectorType>(this)->getElementType()->isInteger();
+}
+
 /// isFPOrFPVector - Return true if this is a FP type or a vector of FP types.
 ///
 bool Type::isFPOrFPVector() const {