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

Benjamin Kramer benny.kra at googlemail.com
Tue Jan 5 12:04:49 PST 2010


Author: d0k
Date: Tue Jan  5 14:04:48 2010
New Revision: 92759

URL: http://llvm.org/viewvc/llvm-project?rev=92759&view=rev
Log:
Add a new predicate for integer type equality tests.

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=92759&r1=92758&r2=92759&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Type.h (original)
+++ llvm/trunk/include/llvm/Type.h Tue Jan  5 14:04:48 2010
@@ -217,6 +217,9 @@
   ///
   bool isInteger() const { return ID == IntegerTyID; } 
 
+  /// isInteger - Return true if this is an IntegerType of the specified width.
+  bool isInteger(unsigned Bitwidth) const;
+
   /// isIntOrIntVector - Return true if this is an integer type or a vector of
   /// integer types.
   ///

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

==============================================================================
--- llvm/trunk/lib/VMCore/Type.cpp (original)
+++ llvm/trunk/lib/VMCore/Type.cpp Tue Jan  5 14:04:48 2010
@@ -124,6 +124,11 @@
   return this;
 }
 
+/// isInteger - Return true if this is an IntegerType of the specified width.
+bool Type::isInteger(unsigned Bitwidth) const {
+  return isInteger() && cast<IntegerType>(this)->getBitWidth() == Bitwidth;
+}
+
 /// isIntOrIntVector - Return true if this is an integer type or a vector of
 /// integer types.
 ///





More information about the llvm-commits mailing list