mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-12 06:06:19 +00:00
Fix up LoadExtActions, TruncStoreActions, and IndexedModeActions representation and setter and getter's so they will continue to work if the number of scalar ValueType's exceeds 31.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103742 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c9c4dacd03
commit
b21f5a5511
@ -385,35 +385,31 @@ public:
|
|||||||
/// either it is legal, needs to be promoted to a larger size, needs to be
|
/// either it is legal, needs to be promoted to a larger size, needs to be
|
||||||
/// expanded to some other code sequence, or the target has a custom expander
|
/// expanded to some other code sequence, or the target has a custom expander
|
||||||
/// for it.
|
/// for it.
|
||||||
LegalizeAction getLoadExtAction(unsigned LType, EVT VT) const {
|
LegalizeAction getLoadExtAction(unsigned ExtType, EVT VT) const {
|
||||||
assert(LType < array_lengthof(LoadExtActions) &&
|
assert(ExtType < ISD::LAST_LOADEXT_TYPE &&
|
||||||
(unsigned)VT.getSimpleVT().SimpleTy < sizeof(LoadExtActions[0])*4 &&
|
(unsigned)VT.getSimpleVT().SimpleTy < MVT::LAST_VALUETYPE &&
|
||||||
"Table isn't big enough!");
|
"Table isn't big enough!");
|
||||||
return (LegalizeAction)((LoadExtActions[LType] >>
|
return (LegalizeAction)LoadExtActions[VT.getSimpleVT().SimpleTy][ExtType];
|
||||||
(2*VT.getSimpleVT().SimpleTy)) & 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isLoadExtLegal - Return true if the specified load with extension is legal
|
/// isLoadExtLegal - Return true if the specified load with extension is legal
|
||||||
/// on this target.
|
/// on this target.
|
||||||
bool isLoadExtLegal(unsigned LType, EVT VT) const {
|
bool isLoadExtLegal(unsigned ExtType, EVT VT) const {
|
||||||
return VT.isSimple() &&
|
return VT.isSimple() &&
|
||||||
(getLoadExtAction(LType, VT) == Legal ||
|
(getLoadExtAction(ExtType, VT) == Legal ||
|
||||||
getLoadExtAction(LType, VT) == Custom);
|
getLoadExtAction(ExtType, VT) == Custom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getTruncStoreAction - Return how this store with truncation should be
|
/// getTruncStoreAction - Return how this store with truncation should be
|
||||||
/// treated: either it is legal, needs to be promoted to a larger size, needs
|
/// treated: either it is legal, needs to be promoted to a larger size, needs
|
||||||
/// to be expanded to some other code sequence, or the target has a custom
|
/// to be expanded to some other code sequence, or the target has a custom
|
||||||
/// expander for it.
|
/// expander for it.
|
||||||
LegalizeAction getTruncStoreAction(EVT ValVT,
|
LegalizeAction getTruncStoreAction(EVT ValVT, EVT MemVT) const {
|
||||||
EVT MemVT) const {
|
assert((unsigned)ValVT.getSimpleVT().SimpleTy < MVT::LAST_VALUETYPE &&
|
||||||
assert((unsigned)ValVT.getSimpleVT().SimpleTy <
|
(unsigned)MemVT.getSimpleVT().SimpleTy < MVT::LAST_VALUETYPE &&
|
||||||
array_lengthof(TruncStoreActions) &&
|
|
||||||
(unsigned)MemVT.getSimpleVT().SimpleTy <
|
|
||||||
sizeof(TruncStoreActions[0])*4 &&
|
|
||||||
"Table isn't big enough!");
|
"Table isn't big enough!");
|
||||||
return (LegalizeAction)((TruncStoreActions[ValVT.getSimpleVT().SimpleTy] >>
|
return (LegalizeAction)TruncStoreActions[ValVT.getSimpleVT().SimpleTy]
|
||||||
(2*MemVT.getSimpleVT().SimpleTy)) & 3);
|
[MemVT.getSimpleVT().SimpleTy];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isTruncStoreLegal - Return true if the specified store with truncation is
|
/// isTruncStoreLegal - Return true if the specified store with truncation is
|
||||||
@ -430,11 +426,11 @@ public:
|
|||||||
/// for it.
|
/// for it.
|
||||||
LegalizeAction
|
LegalizeAction
|
||||||
getIndexedLoadAction(unsigned IdxMode, EVT VT) const {
|
getIndexedLoadAction(unsigned IdxMode, EVT VT) const {
|
||||||
assert( IdxMode < array_lengthof(IndexedModeActions[0][0]) &&
|
assert( IdxMode < ISD::LAST_INDEXED_MODE &&
|
||||||
((unsigned)VT.getSimpleVT().SimpleTy) < MVT::LAST_VALUETYPE &&
|
((unsigned)VT.getSimpleVT().SimpleTy) < MVT::LAST_VALUETYPE &&
|
||||||
"Table isn't big enough!");
|
"Table isn't big enough!");
|
||||||
return (LegalizeAction)((IndexedModeActions[
|
unsigned Ty = (unsigned)VT.getSimpleVT().SimpleTy;
|
||||||
(unsigned)VT.getSimpleVT().SimpleTy][0][IdxMode]));
|
return (LegalizeAction)((IndexedModeActions[Ty][IdxMode] & 0xf0) >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isIndexedLoadLegal - Return true if the specified indexed load is legal
|
/// isIndexedLoadLegal - Return true if the specified indexed load is legal
|
||||||
@ -451,11 +447,11 @@ public:
|
|||||||
/// for it.
|
/// for it.
|
||||||
LegalizeAction
|
LegalizeAction
|
||||||
getIndexedStoreAction(unsigned IdxMode, EVT VT) const {
|
getIndexedStoreAction(unsigned IdxMode, EVT VT) const {
|
||||||
assert(IdxMode < array_lengthof(IndexedModeActions[0][1]) &&
|
assert( IdxMode < ISD::LAST_INDEXED_MODE &&
|
||||||
(unsigned)VT.getSimpleVT().SimpleTy < MVT::LAST_VALUETYPE &&
|
((unsigned)VT.getSimpleVT().SimpleTy) < MVT::LAST_VALUETYPE &&
|
||||||
"Table isn't big enough!");
|
"Table isn't big enough!");
|
||||||
return (LegalizeAction)((IndexedModeActions[
|
unsigned Ty = (unsigned)VT.getSimpleVT().SimpleTy;
|
||||||
(unsigned)VT.getSimpleVT().SimpleTy][1][IdxMode]));
|
return (LegalizeAction)(IndexedModeActions[Ty][IdxMode] & 0x0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isIndexedStoreLegal - Return true if the specified indexed load is legal
|
/// isIndexedStoreLegal - Return true if the specified indexed load is legal
|
||||||
@ -1000,23 +996,21 @@ protected:
|
|||||||
/// setLoadExtAction - Indicate that the specified load with extension does
|
/// setLoadExtAction - Indicate that the specified load with extension does
|
||||||
/// not work with the specified type and indicate what to do about it.
|
/// not work with the specified type and indicate what to do about it.
|
||||||
void setLoadExtAction(unsigned ExtType, MVT VT,
|
void setLoadExtAction(unsigned ExtType, MVT VT,
|
||||||
LegalizeAction Action) {
|
LegalizeAction Action) {
|
||||||
assert((unsigned)VT.SimpleTy*2 < 63 &&
|
assert(ExtType < ISD::LAST_LOADEXT_TYPE &&
|
||||||
ExtType < array_lengthof(LoadExtActions) &&
|
(unsigned)VT.SimpleTy < MVT::LAST_VALUETYPE &&
|
||||||
"Table isn't big enough!");
|
"Table isn't big enough!");
|
||||||
LoadExtActions[ExtType] &= ~(uint64_t(3UL) << VT.SimpleTy*2);
|
LoadExtActions[VT.SimpleTy][ExtType] = (uint8_t)Action;
|
||||||
LoadExtActions[ExtType] |= (uint64_t)Action << VT.SimpleTy*2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// setTruncStoreAction - Indicate that the specified truncating store does
|
/// setTruncStoreAction - Indicate that the specified truncating store does
|
||||||
/// not work with the specified type and indicate what to do about it.
|
/// not work with the specified type and indicate what to do about it.
|
||||||
void setTruncStoreAction(MVT ValVT, MVT MemVT,
|
void setTruncStoreAction(MVT ValVT, MVT MemVT,
|
||||||
LegalizeAction Action) {
|
LegalizeAction Action) {
|
||||||
assert((unsigned)ValVT.SimpleTy < array_lengthof(TruncStoreActions) &&
|
assert((unsigned)ValVT.SimpleTy < MVT::LAST_VALUETYPE &&
|
||||||
(unsigned)MemVT.SimpleTy*2 < 63 &&
|
(unsigned)MemVT.SimpleTy < MVT::LAST_VALUETYPE &&
|
||||||
"Table isn't big enough!");
|
"Table isn't big enough!");
|
||||||
TruncStoreActions[ValVT.SimpleTy] &= ~(uint64_t(3UL) << MemVT.SimpleTy*2);
|
TruncStoreActions[ValVT.SimpleTy][MemVT.SimpleTy] = (uint8_t)Action;
|
||||||
TruncStoreActions[ValVT.SimpleTy] |= (uint64_t)Action << MemVT.SimpleTy*2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// setIndexedLoadAction - Indicate that the specified indexed load does or
|
/// setIndexedLoadAction - Indicate that the specified indexed load does or
|
||||||
@ -1026,9 +1020,12 @@ protected:
|
|||||||
void setIndexedLoadAction(unsigned IdxMode, MVT VT,
|
void setIndexedLoadAction(unsigned IdxMode, MVT VT,
|
||||||
LegalizeAction Action) {
|
LegalizeAction Action) {
|
||||||
assert((unsigned)VT.SimpleTy < MVT::LAST_VALUETYPE &&
|
assert((unsigned)VT.SimpleTy < MVT::LAST_VALUETYPE &&
|
||||||
IdxMode < array_lengthof(IndexedModeActions[0][0]) &&
|
IdxMode < ISD::LAST_INDEXED_MODE &&
|
||||||
|
(unsigned)Action < 0xf &&
|
||||||
"Table isn't big enough!");
|
"Table isn't big enough!");
|
||||||
IndexedModeActions[(unsigned)VT.SimpleTy][0][IdxMode] = (uint8_t)Action;
|
// Load action are kept in the upper half.
|
||||||
|
IndexedModeActions[(unsigned)VT.SimpleTy][IdxMode] &= ~0xf0;
|
||||||
|
IndexedModeActions[(unsigned)VT.SimpleTy][IdxMode] |= ((uint8_t)Action) <<4;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// setIndexedStoreAction - Indicate that the specified indexed store does or
|
/// setIndexedStoreAction - Indicate that the specified indexed store does or
|
||||||
@ -1038,9 +1035,12 @@ protected:
|
|||||||
void setIndexedStoreAction(unsigned IdxMode, MVT VT,
|
void setIndexedStoreAction(unsigned IdxMode, MVT VT,
|
||||||
LegalizeAction Action) {
|
LegalizeAction Action) {
|
||||||
assert((unsigned)VT.SimpleTy < MVT::LAST_VALUETYPE &&
|
assert((unsigned)VT.SimpleTy < MVT::LAST_VALUETYPE &&
|
||||||
IdxMode < array_lengthof(IndexedModeActions[0][1] ) &&
|
IdxMode < ISD::LAST_INDEXED_MODE &&
|
||||||
|
(unsigned)Action < 0xf &&
|
||||||
"Table isn't big enough!");
|
"Table isn't big enough!");
|
||||||
IndexedModeActions[(unsigned)VT.SimpleTy][1][IdxMode] = (uint8_t)Action;
|
// Store action are kept in the lower half.
|
||||||
|
IndexedModeActions[(unsigned)VT.SimpleTy][IdxMode] &= ~0x0f;
|
||||||
|
IndexedModeActions[(unsigned)VT.SimpleTy][IdxMode] |= ((uint8_t)Action);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// setCondCodeAction - Indicate that the specified condition code is or isn't
|
/// setCondCodeAction - Indicate that the specified condition code is or isn't
|
||||||
@ -1596,22 +1596,22 @@ private:
|
|||||||
uint64_t OpActions[MVT::MAX_ALLOWED_VALUETYPE/(sizeof(uint64_t)*4)]
|
uint64_t OpActions[MVT::MAX_ALLOWED_VALUETYPE/(sizeof(uint64_t)*4)]
|
||||||
[ISD::BUILTIN_OP_END];
|
[ISD::BUILTIN_OP_END];
|
||||||
|
|
||||||
/// LoadExtActions - For each load of 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
|
||||||
/// with the load.
|
/// with a load of a specific value type and extension type.
|
||||||
uint64_t LoadExtActions[ISD::LAST_LOADEXT_TYPE];
|
uint8_t LoadExtActions[MVT::LAST_VALUETYPE][ISD::LAST_LOADEXT_TYPE];
|
||||||
|
|
||||||
/// TruncStoreActions - For each truncating store, keep a LegalizeAction that
|
/// TruncStoreActions - For each value type pair keep a LegalizeAction that
|
||||||
/// indicates how instruction selection should deal with the store.
|
/// indicates whether a truncating store of a specific value type and
|
||||||
uint64_t TruncStoreActions[MVT::LAST_VALUETYPE];
|
/// truncating type is legal.
|
||||||
|
uint8_t TruncStoreActions[MVT::LAST_VALUETYPE][MVT::LAST_VALUETYPE];
|
||||||
|
|
||||||
/// IndexedModeActions - For each indexed mode and each value type,
|
/// IndexedModeActions - For each indexed mode and each value type,
|
||||||
/// keep a pair of LegalizeAction that indicates how instruction
|
/// keep a pair of LegalizeAction that indicates how instruction
|
||||||
/// selection should deal with the load / store. The first
|
/// selection should deal with the load / store. The first dimension is the
|
||||||
/// dimension is now the value_type for the reference. The second
|
/// value_type for the reference. The second dimension represents the various
|
||||||
/// dimension is the load [0] vs. store[1]. The third dimension
|
/// modes for load store.
|
||||||
/// represents the various modes for load store.
|
uint8_t IndexedModeActions[MVT::LAST_VALUETYPE][ISD::LAST_INDEXED_MODE];
|
||||||
uint8_t IndexedModeActions[MVT::LAST_VALUETYPE][2][ISD::LAST_INDEXED_MODE];
|
|
||||||
|
|
||||||
/// CondCodeActions - For each condition code (ISD::CondCode) keep a
|
/// CondCodeActions - For each condition code (ISD::CondCode) keep a
|
||||||
/// LegalizeAction that indicates how instruction selection should
|
/// LegalizeAction that indicates how instruction selection should
|
||||||
|
Loading…
Reference in New Issue
Block a user