summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/ValueTypes.h
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2012-12-22 08:16:17 +0000
committerCraig Topper <craig.topper@gmail.com>2012-12-22 08:16:17 +0000
commit3f92b1bda0b756d2034577f3e4165f16061bfe65 (patch)
tree1736d70bd2d73e7bc54ef305574a4cd737897ba3 /include/llvm/CodeGen/ValueTypes.h
parentbf50d07625495f9185d3eba7be9e35df3e30ba65 (diff)
downloadllvm-3f92b1bda0b756d2034577f3e4165f16061bfe65.tar.gz
llvm-3f92b1bda0b756d2034577f3e4165f16061bfe65.tar.bz2
llvm-3f92b1bda0b756d2034577f3e4165f16061bfe65.tar.xz
Use a negative value to represent INVALID_SIMPLE_VALUE_TYPE instead of 256. Its much cheaper for the isSimple() checks to look for values less than 0 rather than a value greater than 255. This shaves ~8k off the size of the llc binary on x86-64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170981 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/ValueTypes.h')
-rw-r--r--include/llvm/CodeGen/ValueTypes.h21
1 files changed, 9 insertions, 12 deletions
diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h
index ed3acdc0d7..c25855528a 100644
--- a/include/llvm/CodeGen/ValueTypes.h
+++ b/include/llvm/CodeGen/ValueTypes.h
@@ -33,6 +33,10 @@ namespace llvm {
class MVT {
public:
enum SimpleValueType {
+ // INVALID_SIMPLE_VALUE_TYPE - Simple value types less than zero are
+ // considered extended value types.
+ INVALID_SIMPLE_VALUE_TYPE = -1
+
// If you change this numbering, you must change the values in
// ValueTypes.td as well!
Other = 0, // This is a non-standard value
@@ -138,13 +142,6 @@ namespace llvm {
// iPTR - An int value the size of the pointer of the current
// target. This should only be used internal to tblgen!
iPTR = 255,
-
- // LastSimpleValueType - The greatest valid SimpleValueType value.
- LastSimpleValueType = 255,
-
- // INVALID_SIMPLE_VALUE_TYPE - Simple value types greater than or equal
- // to this are considered extended value types.
- INVALID_SIMPLE_VALUE_TYPE = LastSimpleValueType + 1
};
SimpleValueType SimpleTy;
@@ -531,7 +528,7 @@ namespace llvm {
bool operator!=(EVT VT) const {
if (V.SimpleTy != VT.V.SimpleTy)
return true;
- if (V.SimpleTy == MVT::INVALID_SIMPLE_VALUE_TYPE)
+ if (V.SimpleTy < 0)
return LLVMTy != VT.LLVMTy;
return false;
}
@@ -547,7 +544,7 @@ namespace llvm {
/// number of bits.
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth) {
MVT M = MVT::getIntegerVT(BitWidth);
- if (M.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE)
+ if (M.SimpleTy >= 0)
return M;
return getExtendedIntegerVT(Context, BitWidth);
}
@@ -556,7 +553,7 @@ namespace llvm {
/// length, where each element is of type VT.
static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements) {
MVT M = MVT::getVectorVT(VT.V, NumElements);
- if (M.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE)
+ if (M.SimpleTy >= 0)
return M;
return getExtendedVectorVT(Context, VT, NumElements);
}
@@ -571,7 +568,7 @@ namespace llvm {
unsigned BitWidth = EltTy.getSizeInBits();
MVT IntTy = MVT::getIntegerVT(BitWidth);
MVT VecTy = MVT::getVectorVT(IntTy, getVectorNumElements());
- assert(VecTy != MVT::INVALID_SIMPLE_VALUE_TYPE &&
+ assert(VecTy.SimpleTy >= 0 &&
"Simple vector VT not representable by simple integer vector VT!");
return VecTy;
}
@@ -579,7 +576,7 @@ namespace llvm {
/// isSimple - Test if the given EVT is simple (as opposed to being
/// extended).
bool isSimple() const {
- return V.SimpleTy <= MVT::LastSimpleValueType;
+ return V.SimpleTy >= 0;
}
/// isExtended - Test if the given EVT is extended (as opposed to