aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-01-18 17:13:03 +0000
committerChris Lattner <sabre@nondot.org>2008-01-18 17:13:03 +0000
commit112b254bdea19359c3ae4753275d94c53681b614 (patch)
tree3c46150755c59d0f07ec7c6f3d09e5cb3060be05
parentdf7a4ae623ea07eab341bd837d049de15c11a59a (diff)
downloadexternal_llvm-112b254bdea19359c3ae4753275d94c53681b614.zip
external_llvm-112b254bdea19359c3ae4753275d94c53681b614.tar.gz
external_llvm-112b254bdea19359c3ae4753275d94c53681b614.tar.bz2
remove magic numbers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46162 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/TargetLowering.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index 25456d7..f55c2d0 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -307,8 +307,8 @@ public:
/// expander for it.
LegalizeAction getTruncStoreAction(MVT::ValueType ValVT,
MVT::ValueType MemVT) const {
- assert(ValVT < MVT::LAST_VALUETYPE && MemVT < 32 &&
- "Table isn't big enough!");
+ assert(ValVT < array_lengthof(TruncStoreActions) &&
+ MemVT < sizeof(TruncStoreActions[0])*4 && "Table isn't big enough!");
return (LegalizeAction)((TruncStoreActions[ValVT] >> (2*MemVT)) & 3);
}
@@ -359,8 +359,8 @@ public:
/// for it.
LegalizeAction
getConvertAction(MVT::ValueType FromVT, MVT::ValueType ToVT) const {
- assert(FromVT < MVT::LAST_VALUETYPE && ToVT < 32 &&
- "Table isn't big enough!");
+ assert(FromVT < array_lengthof(ConvertActions) &&
+ ToVT < sizeof(ConvertActions[0])*4 && "Table isn't big enough!");
return (LegalizeAction)((ConvertActions[FromVT] >> (2*ToVT)) & 3);
}
@@ -747,7 +747,7 @@ protected:
/// with the specified type and indicate what to do about it.
void setOperationAction(unsigned Op, MVT::ValueType VT,
LegalizeAction Action) {
- assert(VT < 32 && Op < array_lengthof(OpActions) &&
+ assert(VT < sizeof(OpActions[0])*4 && Op < array_lengthof(OpActions) &&
"Table isn't big enough!");
OpActions[Op] &= ~(uint64_t(3UL) << VT*2);
OpActions[Op] |= (uint64_t)Action << VT*2;
@@ -757,7 +757,8 @@ protected:
/// work with the with specified type and indicate what to do about it.
void setLoadXAction(unsigned ExtType, MVT::ValueType VT,
LegalizeAction Action) {
- assert(VT < 32 && ExtType < array_lengthof(LoadXActions) &&
+ assert(VT < sizeof(LoadXActions[0])*4 &&
+ ExtType < array_lengthof(LoadXActions) &&
"Table isn't big enough!");
LoadXActions[ExtType] &= ~(uint64_t(3UL) << VT*2);
LoadXActions[ExtType] |= (uint64_t)Action << VT*2;
@@ -767,8 +768,8 @@ protected:
/// not work with the with specified type and indicate what to do about it.
void setTruncStoreAction(MVT::ValueType ValVT, MVT::ValueType MemVT,
LegalizeAction Action) {
- assert(ValVT < MVT::LAST_VALUETYPE && MemVT < 32 &&
- "Table isn't big enough!");
+ assert(ValVT < array_lengthof(TruncStoreActions) &&
+ MemVT < sizeof(TruncStoreActions[0])*4 && "Table isn't big enough!");
TruncStoreActions[ValVT] &= ~(uint64_t(3UL) << MemVT*2);
TruncStoreActions[ValVT] |= (uint64_t)Action << MemVT*2;
}
@@ -779,7 +780,7 @@ protected:
/// TargetLowering.cpp
void setIndexedLoadAction(unsigned IdxMode, MVT::ValueType VT,
LegalizeAction Action) {
- assert(VT < 32 && IdxMode <
+ assert(VT < sizeof(IndexedModeActions[0])*4 && IdxMode <
array_lengthof(IndexedModeActions[0]) &&
"Table isn't big enough!");
IndexedModeActions[0][IdxMode] &= ~(uint64_t(3UL) << VT*2);
@@ -792,8 +793,8 @@ protected:
/// TargetLowering.cpp
void setIndexedStoreAction(unsigned IdxMode, MVT::ValueType VT,
LegalizeAction Action) {
- assert(VT < 32 && IdxMode <
- array_lengthof(IndexedModeActions[1]) &&
+ assert(VT < sizeof(IndexedModeActions[1][0])*4 &&
+ IdxMode < array_lengthof(IndexedModeActions[1]) &&
"Table isn't big enough!");
IndexedModeActions[1][IdxMode] &= ~(uint64_t(3UL) << VT*2);
IndexedModeActions[1][IdxMode] |= (uint64_t)Action << VT*2;
@@ -803,8 +804,8 @@ protected:
/// not work with the with specified type and indicate what to do about it.
void setConvertAction(MVT::ValueType FromVT, MVT::ValueType ToVT,
LegalizeAction Action) {
- assert(FromVT < MVT::LAST_VALUETYPE && ToVT < 32 &&
- "Table isn't big enough!");
+ assert(FromVT < array_lengthof(ConvertActions) &&
+ ToVT < sizeof(ConvertActions[0])*4 && "Table isn't big enough!");
ConvertActions[FromVT] &= ~(uint64_t(3UL) << ToVT*2);
ConvertActions[FromVT] |= (uint64_t)Action << ToVT*2;
}