mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-19 17:33:29 +00:00
Get rid of the bit twiddling to read / set OpActions and ValueTypeActions. The small saving in memory isn't worth the increase in runtime and code complexity in my opinion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103768 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d11d59e35a
commit
0ebf356ddf
@ -180,11 +180,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ValueTypeActionImpl {
|
class ValueTypeActionImpl {
|
||||||
/// ValueTypeActions - This is a bitvector that contains two bits for each
|
/// ValueTypeActions - For each value type, keep a LegalizeAction enum
|
||||||
/// value type, where the two bits correspond to the LegalizeAction enum.
|
/// that indicates how instruction selection should deal with the type.
|
||||||
/// This can be queried with "getTypeAction(VT)".
|
uint8_t ValueTypeActions[MVT::LAST_VALUETYPE];
|
||||||
/// dimension by (MVT::MAX_ALLOWED_VALUETYPE/32) * 2
|
|
||||||
uint32_t ValueTypeActions[(MVT::MAX_ALLOWED_VALUETYPE/32)*2];
|
|
||||||
public:
|
public:
|
||||||
ValueTypeActionImpl() {
|
ValueTypeActionImpl() {
|
||||||
std::fill(ValueTypeActions, array_endof(ValueTypeActions), 0);
|
std::fill(ValueTypeActions, array_endof(ValueTypeActions), 0);
|
||||||
@ -201,15 +199,11 @@ public:
|
|||||||
return Legal;
|
return Legal;
|
||||||
}
|
}
|
||||||
unsigned I = VT.getSimpleVT().SimpleTy;
|
unsigned I = VT.getSimpleVT().SimpleTy;
|
||||||
assert(I<4*array_lengthof(ValueTypeActions)*sizeof(ValueTypeActions[0]));
|
return (LegalizeAction)ValueTypeActions[I];
|
||||||
unsigned Mask = (unsigned)MVT::MAX_ALLOWED_VALUETYPE-1;
|
|
||||||
return (LegalizeAction)((ValueTypeActions[I>>4] >> ((2*I) & Mask)) & 3);
|
|
||||||
}
|
}
|
||||||
void setTypeAction(EVT VT, LegalizeAction Action) {
|
void setTypeAction(EVT VT, LegalizeAction Action) {
|
||||||
unsigned I = VT.getSimpleVT().SimpleTy;
|
unsigned I = VT.getSimpleVT().SimpleTy;
|
||||||
assert(I<4*array_lengthof(ValueTypeActions)*sizeof(ValueTypeActions[0]));
|
ValueTypeActions[I] = Action;
|
||||||
unsigned Mask = (unsigned)MVT::MAX_ALLOWED_VALUETYPE-1;
|
|
||||||
ValueTypeActions[I>>4] |= Action << ((I*2) & Mask);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -358,13 +352,9 @@ public:
|
|||||||
/// for it.
|
/// for it.
|
||||||
LegalizeAction getOperationAction(unsigned Op, EVT VT) const {
|
LegalizeAction getOperationAction(unsigned Op, EVT VT) const {
|
||||||
if (VT.isExtended()) return Expand;
|
if (VT.isExtended()) return Expand;
|
||||||
assert(Op < array_lengthof(OpActions[0]) &&
|
assert(Op < array_lengthof(OpActions[0]) && "Table isn't big enough!");
|
||||||
(unsigned)VT.getSimpleVT().SimpleTy < sizeof(OpActions[0][0])*8 &&
|
|
||||||
"Table isn't big enough!");
|
|
||||||
unsigned I = (unsigned) VT.getSimpleVT().SimpleTy;
|
unsigned I = (unsigned) VT.getSimpleVT().SimpleTy;
|
||||||
unsigned J = I & ((unsigned)MVT::MAX_ALLOWED_VALUETYPE-1);
|
return (LegalizeAction)OpActions[I][Op];
|
||||||
I = I >> 5;
|
|
||||||
return (LegalizeAction)((OpActions[I][Op] >> (J*2)) & 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isOperationLegalOrCustom - Return true if the specified operation is
|
/// isOperationLegalOrCustom - Return true if the specified operation is
|
||||||
@ -988,11 +978,8 @@ protected:
|
|||||||
/// with the specified type and indicate what to do about it.
|
/// with the specified type and indicate what to do about it.
|
||||||
void setOperationAction(unsigned Op, MVT VT,
|
void setOperationAction(unsigned Op, MVT VT,
|
||||||
LegalizeAction Action) {
|
LegalizeAction Action) {
|
||||||
unsigned I = (unsigned)VT.SimpleTy;
|
assert(Op < array_lengthof(OpActions[0]) && "Table isn't big enough!");
|
||||||
unsigned J = I & ((unsigned)MVT::MAX_ALLOWED_VALUETYPE - 1);
|
OpActions[(unsigned)VT.SimpleTy][Op] = (uint8_t)Action;
|
||||||
I = I >> 5;
|
|
||||||
OpActions[I][Op] &= ~(uint64_t(3UL) << (J*2));
|
|
||||||
OpActions[I][Op] |= (uint64_t)Action << (J*2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// setLoadExtAction - Indicate that the specified load with extension does
|
/// setLoadExtAction - Indicate that the specified load with extension does
|
||||||
@ -1593,10 +1580,7 @@ private:
|
|||||||
/// Most operations are Legal (aka, supported natively by the target), but
|
/// Most operations are Legal (aka, supported natively by the target), but
|
||||||
/// operations that are not should be described. Note that operations on
|
/// operations that are not should be described. Note that operations on
|
||||||
/// non-legal value types are not described here.
|
/// non-legal value types are not described here.
|
||||||
/// This array is accessed using VT.getSimpleVT(), so it is subject to
|
uint8_t OpActions[MVT::LAST_VALUETYPE][ISD::BUILTIN_OP_END];
|
||||||
/// the MVT::MAX_ALLOWED_VALUETYPE * 2 bits.
|
|
||||||
uint64_t OpActions[MVT::MAX_ALLOWED_VALUETYPE/(sizeof(uint64_t)*4)]
|
|
||||||
[ISD::BUILTIN_OP_END];
|
|
||||||
|
|
||||||
/// LoadExtActions - For each load extension type and each value type,
|
/// LoadExtActions - For each load extension type and each value type,
|
||||||
/// keep a LegalizeAction that indicates how instruction selection should deal
|
/// keep a LegalizeAction that indicates how instruction selection should deal
|
||||||
|
Loading…
Reference in New Issue
Block a user