aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Target
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-05-13 23:25:21 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-05-13 23:25:21 +0000
commitb9c0e332b31c8834ef455dcf5fbd73803720110c (patch)
treeddab4a22b79caa27aa11bf5c934afe04496fb834 /include/llvm/Target
parentb21f5a55117b1fb8640aebb431c8d10e1719e509 (diff)
downloadexternal_llvm-b9c0e332b31c8834ef455dcf5fbd73803720110c.zip
external_llvm-b9c0e332b31c8834ef455dcf5fbd73803720110c.tar.gz
external_llvm-b9c0e332b31c8834ef455dcf5fbd73803720110c.tar.bz2
Eliminate use of magic numbers to access OpActions. It also has the effect of allowing more than 31 scalar value types. MAX_ALLOWED_VALUETYPE had already been updated to 64 a while back.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103743 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target')
-rw-r--r--include/llvm/Target/TargetLowering.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index 27017d4..84ae3ae 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -202,12 +202,14 @@ public:
}
unsigned I = VT.getSimpleVT().SimpleTy;
assert(I<4*array_lengthof(ValueTypeActions)*sizeof(ValueTypeActions[0]));
- return (LegalizeAction)((ValueTypeActions[I>>4] >> ((2*I) & 31)) & 3);
+ unsigned Mask = (unsigned)MVT::MAX_ALLOWED_VALUETYPE-1;
+ return (LegalizeAction)((ValueTypeActions[I>>4] >> ((2*I) & Mask)) & 3);
}
void setTypeAction(EVT VT, LegalizeAction Action) {
unsigned I = VT.getSimpleVT().SimpleTy;
assert(I<4*array_lengthof(ValueTypeActions)*sizeof(ValueTypeActions[0]));
- ValueTypeActions[I>>4] |= Action << ((I*2) & 31);
+ unsigned Mask = (unsigned)MVT::MAX_ALLOWED_VALUETYPE-1;
+ ValueTypeActions[I>>4] |= Action << ((I*2) & Mask);
}
};
@@ -360,9 +362,9 @@ public:
(unsigned)VT.getSimpleVT().SimpleTy < sizeof(OpActions[0][0])*8 &&
"Table isn't big enough!");
unsigned I = (unsigned) VT.getSimpleVT().SimpleTy;
- unsigned J = I & 31;
+ unsigned J = I & ((unsigned)MVT::MAX_ALLOWED_VALUETYPE-1);
I = I >> 5;
- return (LegalizeAction)((OpActions[I][Op] >> (J*2) ) & 3);
+ return (LegalizeAction)((OpActions[I][Op] >> (J*2)) & 3);
}
/// isOperationLegalOrCustom - Return true if the specified operation is
@@ -987,7 +989,7 @@ protected:
void setOperationAction(unsigned Op, MVT VT,
LegalizeAction Action) {
unsigned I = (unsigned)VT.SimpleTy;
- unsigned J = I & 31;
+ unsigned J = I & ((unsigned)MVT::MAX_ALLOWED_VALUETYPE - 1);
I = I >> 5;
OpActions[I][Op] &= ~(uint64_t(3UL) << (J*2));
OpActions[I][Op] |= (uint64_t)Action << (J*2);