mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-02 07:32:52 +00:00
Clean up the interface to ValueTypeActions, allowing Legalize to use a copy
of it more cleanly. Double the size of OpActions, allowing it to hold actions for any VT. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25782 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f38a05d67b
commit
e3bd778e4d
@ -127,14 +127,41 @@ public:
|
|||||||
return RegClassForVT[VT] != 0;
|
return RegClassForVT[VT] != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ValueTypeActionImpl {
|
||||||
|
/// ValueTypeActions - This is a bitvector that contains two bits for each
|
||||||
|
/// value type, where the two bits correspond to the LegalizeAction enum.
|
||||||
|
/// This can be queried with "getTypeAction(VT)".
|
||||||
|
uint32_t ValueTypeActions[2];
|
||||||
|
public:
|
||||||
|
ValueTypeActionImpl() {
|
||||||
|
ValueTypeActions[0] = ValueTypeActions[1] = 0;
|
||||||
|
}
|
||||||
|
ValueTypeActionImpl(const ValueTypeActionImpl &RHS) {
|
||||||
|
ValueTypeActions[0] = RHS.ValueTypeActions[0];
|
||||||
|
ValueTypeActions[1] = RHS.ValueTypeActions[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
LegalizeAction getTypeAction(MVT::ValueType VT) const {
|
||||||
|
return (LegalizeAction)((ValueTypeActions[VT>>4] >> ((2*VT) & 31)) & 3);
|
||||||
|
}
|
||||||
|
void setTypeAction(MVT::ValueType VT, LegalizeAction Action) {
|
||||||
|
assert(unsigned(VT >> 4) <
|
||||||
|
sizeof(ValueTypeActions)/sizeof(ValueTypeActions[0]));
|
||||||
|
ValueTypeActions[VT>>4] |= Action << ((VT*2) & 31);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const ValueTypeActionImpl &getValueTypeActions() const {
|
||||||
|
return ValueTypeActions;
|
||||||
|
}
|
||||||
|
|
||||||
/// getTypeAction - Return how we should legalize values of this type, either
|
/// getTypeAction - Return how we should legalize values of this type, either
|
||||||
/// it is already legal (return 'Legal') or we need to promote it to a larger
|
/// it is already legal (return 'Legal') or we need to promote it to a larger
|
||||||
/// type (return 'Promote'), or we need to expand it into multiple registers
|
/// type (return 'Promote'), or we need to expand it into multiple registers
|
||||||
/// of smaller integer type (return 'Expand'). 'Custom' is not an option.
|
/// of smaller integer type (return 'Expand'). 'Custom' is not an option.
|
||||||
LegalizeAction getTypeAction(MVT::ValueType VT) const {
|
LegalizeAction getTypeAction(MVT::ValueType VT) const {
|
||||||
return (LegalizeAction)((ValueTypeActions >> (2*VT)) & 3);
|
return ValueTypeActions.getTypeAction(VT);
|
||||||
}
|
}
|
||||||
unsigned long long getValueTypeActions() const { return ValueTypeActions; }
|
|
||||||
|
|
||||||
/// getTypeToTransformTo - For types supported by the target, this is an
|
/// getTypeToTransformTo - For types supported by the target, this is an
|
||||||
/// identity function. For types that must be promoted to larger types, this
|
/// identity function. For types that must be promoted to larger types, this
|
||||||
@ -236,8 +263,9 @@ public:
|
|||||||
/// such replacements don't generate code that causes an alignment error
|
/// such replacements don't generate code that causes an alignment error
|
||||||
/// (trap) on the target machine.
|
/// (trap) on the target machine.
|
||||||
/// @brief Determine if the target supports unaligned memory accesses.
|
/// @brief Determine if the target supports unaligned memory accesses.
|
||||||
bool allowsUnalignedMemoryAccesses() const
|
bool allowsUnalignedMemoryAccesses() const {
|
||||||
{ return allowUnalignedMemoryAccesses; }
|
return allowUnalignedMemoryAccesses;
|
||||||
|
}
|
||||||
|
|
||||||
/// usesUnderscoreSetJmpLongJmp - Determine if we should use _setjmp or setjmp
|
/// usesUnderscoreSetJmpLongJmp - Determine if we should use _setjmp or setjmp
|
||||||
/// to implement llvm.setjmp.
|
/// to implement llvm.setjmp.
|
||||||
@ -327,7 +355,7 @@ 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::ValueType VT,
|
void setOperationAction(unsigned Op, MVT::ValueType VT,
|
||||||
LegalizeAction Action) {
|
LegalizeAction Action) {
|
||||||
assert(VT < 16 && Op < sizeof(OpActions)/sizeof(OpActions[0]) &&
|
assert(VT < 32 && Op < sizeof(OpActions)/sizeof(OpActions[0]) &&
|
||||||
"Table isn't big enough!");
|
"Table isn't big enough!");
|
||||||
OpActions[Op] |= Action << VT*2;
|
OpActions[Op] |= Action << VT*2;
|
||||||
}
|
}
|
||||||
@ -473,11 +501,6 @@ private:
|
|||||||
TargetRegisterClass *RegClassForVT[MVT::LAST_VALUETYPE];
|
TargetRegisterClass *RegClassForVT[MVT::LAST_VALUETYPE];
|
||||||
unsigned char NumElementsForVT[MVT::LAST_VALUETYPE];
|
unsigned char NumElementsForVT[MVT::LAST_VALUETYPE];
|
||||||
|
|
||||||
/// ValueTypeActions - This is a bitvector that contains two bits for each
|
|
||||||
/// value type, where the two bits correspond to the LegalizeAction enum.
|
|
||||||
/// This can be queried with "getTypeAction(VT)".
|
|
||||||
unsigned long long ValueTypeActions;
|
|
||||||
|
|
||||||
/// TransformToType - For any value types we are promoting or expanding, this
|
/// TransformToType - For any value types we are promoting or expanding, this
|
||||||
/// contains the value type that we are changing to. For Expanded types, this
|
/// contains the value type that we are changing to. For Expanded types, this
|
||||||
/// contains one step of the expand (e.g. i64 -> i32), even if there are
|
/// contains one step of the expand (e.g. i64 -> i32), even if there are
|
||||||
@ -490,7 +513,9 @@ 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.
|
||||||
unsigned OpActions[128];
|
uint64_t OpActions[128];
|
||||||
|
|
||||||
|
ValueTypeActionImpl ValueTypeActions;
|
||||||
|
|
||||||
std::vector<double> LegalFPImmediates;
|
std::vector<double> LegalFPImmediates;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user