[llvm-commits] [llvm] r41190 - in /llvm/trunk: include/llvm/Type.h lib/VMCore/Type.cpp

Dan Gohman djg at cray.com
Mon Aug 20 12:25:59 PDT 2007


Author: djg
Date: Mon Aug 20 14:25:59 2007
New Revision: 41190

URL: http://llvm.org/viewvc/llvm-project?rev=41190&view=rev
Log:
Add Type::isIntOrIntVector, like Type::isFPOrFPVector.

Modified:
    llvm/trunk/include/llvm/Type.h
    llvm/trunk/lib/VMCore/Type.cpp

Modified: llvm/trunk/include/llvm/Type.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=41190&r1=41189&r2=41190&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Type.h (original)
+++ llvm/trunk/include/llvm/Type.h Mon Aug 20 14:25:59 2007
@@ -180,6 +180,11 @@
   ///
   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 ||

Modified: llvm/trunk/lib/VMCore/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=41190&r1=41189&r2=41190&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Type.cpp (original)
+++ llvm/trunk/lib/VMCore/Type.cpp Mon Aug 20 14:25:59 2007
@@ -126,6 +126,17 @@
     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 {





More information about the llvm-commits mailing list