@@ -1479,27 +1479,31 @@ class LLVM_ABI TargetLoweringBase {
14791479 // / Return how this load with extension should be treated: either it is legal,
14801480 // / needs to be promoted to a larger size, needs to be expanded to some other
14811481 // / code sequence, or the target has a custom expander for it.
1482- LegalizeAction getLoadExtAction (unsigned ExtType, EVT ValVT,
1483- EVT MemVT ) const {
1482+ LegalizeAction getLoadExtAction (unsigned ExtType, EVT ValVT, EVT MemVT,
1483+ unsigned AddrSpace = 0 ) const {
14841484 if (ValVT.isExtended () || MemVT.isExtended ()) return Expand;
14851485 unsigned ValI = (unsigned ) ValVT.getSimpleVT ().SimpleTy ;
14861486 unsigned MemI = (unsigned ) MemVT.getSimpleVT ().SimpleTy ;
14871487 assert (ExtType < ISD::LAST_LOADEXT_TYPE && ValI < MVT::VALUETYPE_SIZE &&
14881488 MemI < MVT::VALUETYPE_SIZE && " Table isn't big enough!" );
14891489 unsigned Shift = 4 * ExtType;
1490- return (LegalizeAction)((LoadExtActions[ValI][MemI] >> Shift) & 0xf );
1490+ return (
1491+ LegalizeAction)((LoadExtActions.at (AddrSpace)[ValI][MemI] >> Shift) &
1492+ 0xf );
14911493 }
14921494
14931495 // / Return true if the specified load with extension is legal on this target.
1494- bool isLoadExtLegal (unsigned ExtType, EVT ValVT, EVT MemVT) const {
1495- return getLoadExtAction (ExtType, ValVT, MemVT) == Legal;
1496+ bool isLoadExtLegal (unsigned ExtType, EVT ValVT, EVT MemVT,
1497+ unsigned AddrSpace = 0 ) const {
1498+ return getLoadExtAction (ExtType, ValVT, MemVT, AddrSpace) == Legal;
14961499 }
14971500
14981501 // / Return true if the specified load with extension is legal or custom
14991502 // / on this target.
1500- bool isLoadExtLegalOrCustom (unsigned ExtType, EVT ValVT, EVT MemVT) const {
1501- return getLoadExtAction (ExtType, ValVT, MemVT) == Legal ||
1502- getLoadExtAction (ExtType, ValVT, MemVT) == Custom;
1503+ bool isLoadExtLegalOrCustom (unsigned ExtType, EVT ValVT, EVT MemVT,
1504+ unsigned AddrSpace = 0 ) const {
1505+ return getLoadExtAction (ExtType, ValVT, MemVT, AddrSpace) == Legal ||
1506+ getLoadExtAction (ExtType, ValVT, MemVT, AddrSpace) == Custom;
15031507 }
15041508
15051509 // / Same as getLoadExtAction, but for atomic loads.
@@ -2641,23 +2645,26 @@ class LLVM_ABI TargetLoweringBase {
26412645 // / Indicate that the specified load with extension does not work with the
26422646 // / specified type and indicate what to do about it.
26432647 void setLoadExtAction (unsigned ExtType, MVT ValVT, MVT MemVT,
2644- LegalizeAction Action) {
2648+ LegalizeAction Action, unsigned AddrSpace = 0 ) {
26452649 assert (ExtType < ISD::LAST_LOADEXT_TYPE && ValVT.isValid () &&
26462650 MemVT.isValid () && " Table isn't big enough!" );
26472651 assert ((unsigned )Action < 0x10 && " too many bits for bitfield array" );
26482652 unsigned Shift = 4 * ExtType;
2649- LoadExtActions[ValVT.SimpleTy ][MemVT.SimpleTy ] &= ~((uint16_t )0xF << Shift);
2650- LoadExtActions[ValVT.SimpleTy ][MemVT.SimpleTy ] |= (uint16_t )Action << Shift;
2653+ LoadExtActions[AddrSpace][ValVT.SimpleTy ][MemVT.SimpleTy ] &=
2654+ ~((uint16_t )0xF << Shift);
2655+ LoadExtActions[AddrSpace][ValVT.SimpleTy ][MemVT.SimpleTy ] |=
2656+ (uint16_t )Action << Shift;
26512657 }
26522658 void setLoadExtAction (ArrayRef<unsigned > ExtTypes, MVT ValVT, MVT MemVT,
2653- LegalizeAction Action) {
2659+ LegalizeAction Action, unsigned AddrSpace = 0 ) {
26542660 for (auto ExtType : ExtTypes)
2655- setLoadExtAction (ExtType, ValVT, MemVT, Action);
2661+ setLoadExtAction (ExtType, ValVT, MemVT, Action, AddrSpace );
26562662 }
26572663 void setLoadExtAction (ArrayRef<unsigned > ExtTypes, MVT ValVT,
2658- ArrayRef<MVT> MemVTs, LegalizeAction Action) {
2664+ ArrayRef<MVT> MemVTs, LegalizeAction Action,
2665+ unsigned AddrSpace = 0 ) {
26592666 for (auto MemVT : MemVTs)
2660- setLoadExtAction (ExtTypes, ValVT, MemVT, Action);
2667+ setLoadExtAction (ExtTypes, ValVT, MemVT, Action, AddrSpace );
26612668 }
26622669
26632670 // / Let target indicate that an extending atomic load of the specified type
@@ -3748,8 +3755,12 @@ class LLVM_ABI TargetLoweringBase {
37483755 // / For each load extension type and each value type, keep a LegalizeAction
37493756 // / that indicates how instruction selection should deal with a load of a
37503757 // / specific value type and extension type. Uses 4-bits to store the action
3751- // / for each of the 4 load ext types.
3752- uint16_t LoadExtActions[MVT::VALUETYPE_SIZE][MVT::VALUETYPE_SIZE];
3758+ // / for each of the 4 load ext types. These actions can be specified for each
3759+ // / address space.
3760+ using LoadExtActionMap =
3761+ std::map<unsigned , std::array<std::array<uint16_t , MVT::VALUETYPE_SIZE>,
3762+ MVT::VALUETYPE_SIZE>>;
3763+ LoadExtActionMap LoadExtActions;
37533764
37543765 // / Similar to LoadExtActions, but for atomic loads. Only Legal or Expand
37553766 // / (default) values are supported.
0 commit comments