Add isScalarInteger helper to EVT/MVT

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262357 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matt Arsenault 2016-03-01 18:01:28 +00:00
parent 5bbcde0b92
commit 9a6db34754
3 changed files with 18 additions and 0 deletions

View File

@ -210,6 +210,13 @@ class MVT {
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 &&

View File

@ -124,6 +124,11 @@ namespace llvm {
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 @@ namespace llvm {
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;

View File

@ -55,6 +55,11 @@ bool EVT::isExtendedInteger() const {
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();