Add a new predicate for integer type equality tests.

llvm-svn: 92759
This commit is contained in:
Benjamin Kramer 2010-01-05 20:04:48 +00:00
parent 19324a5b81
commit 6a11532b00
2 changed files with 8 additions and 0 deletions

View File

@ -217,6 +217,9 @@ public:
///
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.
///

View File

@ -124,6 +124,11 @@ const Type *Type::getScalarType() const {
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.
///