[llvm-commits] [llvm] r46162 - /llvm/trunk/include/llvm/Target/TargetLowering.h
Chris Lattner
sabre at nondot.org
Fri Jan 18 09:13:03 PST 2008
Author: lattner
Date: Fri Jan 18 11:13:03 2008
New Revision: 46162
URL: http://llvm.org/viewvc/llvm-project?rev=46162&view=rev
Log:
remove magic numbers.
Modified:
llvm/trunk/include/llvm/Target/TargetLowering.h
Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=46162&r1=46161&r2=46162&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Fri Jan 18 11:13:03 2008
@@ -307,8 +307,8 @@
/// 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 @@
/// 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 @@
/// 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 @@
/// 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 @@
/// 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 @@
/// 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 @@
/// 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 @@
/// 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;
}
More information about the llvm-commits
mailing list