From 9a6db347548a7862fd634c90b88fadba709bec91 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Tue, 1 Mar 2016 18:01:28 +0000 Subject: [PATCH] Add isScalarInteger helper to EVT/MVT git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262357 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineValueType.h | 7 +++++++ include/llvm/CodeGen/ValueTypes.h | 6 ++++++ lib/IR/ValueTypes.cpp | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/include/llvm/CodeGen/MachineValueType.h b/include/llvm/CodeGen/MachineValueType.h index 04d6ee3be53..8cfd5fe2b60 100644 --- a/include/llvm/CodeGen/MachineValueType.h +++ b/include/llvm/CodeGen/MachineValueType.h @@ -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 && diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h index 929eb88a039..b1400367971 100644 --- a/include/llvm/CodeGen/ValueTypes.h +++ b/include/llvm/CodeGen/ValueTypes.h @@ -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; diff --git a/lib/IR/ValueTypes.cpp b/lib/IR/ValueTypes.cpp index f2932302af2..ff1e431c2e9 100644 --- a/lib/IR/ValueTypes.cpp +++ b/lib/IR/ValueTypes.cpp @@ -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();