diff options
author | Owen Anderson <resistor@mac.com> | 2007-09-07 04:06:50 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2007-09-07 04:06:50 +0000 |
commit | 718cb665ca6ce2bc4d8e8479f46a45db91b49f86 (patch) | |
tree | 51ddca6b6eead9bf38aafd5507e6c3c06048f0ad /include/llvm/Target/TargetLowering.h | |
parent | af992f782fb2cac8d00b352c3dd73f6e782b5758 (diff) | |
download | external_llvm-718cb665ca6ce2bc4d8e8479f46a45db91b49f86.zip external_llvm-718cb665ca6ce2bc4d8e8479f46a45db91b49f86.tar.gz external_llvm-718cb665ca6ce2bc4d8e8479f46a45db91b49f86.tar.bz2 |
Add lengthof and endof templates that hide a lot of sizeof computations.
Patch by Sterling Stein!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41758 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target/TargetLowering.h')
-rw-r--r-- | include/llvm/Target/TargetLowering.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index f2f5bba..88b3823 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -25,6 +25,7 @@ #include "llvm/CodeGen/SelectionDAGNodes.h" #include "llvm/CodeGen/RuntimeLibcalls.h" #include "llvm/ADT/APFloat.h" +#include "llvm/ADT/STLExtras.h" #include <map> #include <vector> @@ -154,8 +155,7 @@ public: } void setTypeAction(MVT::ValueType VT, LegalizeAction Action) { assert(!MVT::isExtendedVT(VT)); - assert(unsigned(VT >> 4) < - sizeof(ValueTypeActions)/sizeof(ValueTypeActions[0])); + assert(unsigned(VT >> 4) < array_lengthof(ValueTypeActions)); ValueTypeActions[VT>>4] |= Action << ((VT*2) & 31); } }; @@ -711,7 +711,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 < sizeof(OpActions)/sizeof(OpActions[0]) && + assert(VT < 32 && Op < array_lengthof(OpActions) && "Table isn't big enough!"); OpActions[Op] &= ~(uint64_t(3UL) << VT*2); OpActions[Op] |= (uint64_t)Action << VT*2; @@ -721,7 +721,7 @@ 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 < sizeof(LoadXActions)/sizeof(LoadXActions[0]) && + assert(VT < 32 && ExtType < array_lengthof(LoadXActions) && "Table isn't big enough!"); LoadXActions[ExtType] &= ~(uint64_t(3UL) << VT*2); LoadXActions[ExtType] |= (uint64_t)Action << VT*2; @@ -742,7 +742,7 @@ protected: void setIndexedLoadAction(unsigned IdxMode, MVT::ValueType VT, LegalizeAction Action) { assert(VT < 32 && IdxMode < - sizeof(IndexedModeActions[0]) / sizeof(IndexedModeActions[0][0]) && + array_lengthof(IndexedModeActions[0]) && "Table isn't big enough!"); IndexedModeActions[0][IdxMode] &= ~(uint64_t(3UL) << VT*2); IndexedModeActions[0][IdxMode] |= (uint64_t)Action << VT*2; @@ -755,7 +755,7 @@ protected: void setIndexedStoreAction(unsigned IdxMode, MVT::ValueType VT, LegalizeAction Action) { assert(VT < 32 && IdxMode < - sizeof(IndexedModeActions[1]) / sizeof(IndexedModeActions[1][0]) && + 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; |