29#define GET_REGINFO_TARGET_DESC
30#include "AMDGPUGenRegisterInfo.inc"
33 "amdgpu-spill-sgpr-to-vgpr",
34 cl::desc(
"Enable spilling SGPRs to VGPRs"),
38std::array<std::vector<int16_t>, 16> SIRegisterInfo::RegSplitParts;
39std::array<std::array<uint16_t, 32>, 9> SIRegisterInfo::SubRegFromChannelTable;
46 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 9};
116 MI->getOperand(0).isKill(),
Index,
RS) {}
131 MovOpc = AMDGPU::S_MOV_B32;
132 NotOpc = AMDGPU::S_NOT_B32;
135 MovOpc = AMDGPU::S_MOV_B64;
136 NotOpc = AMDGPU::S_NOT_B64;
141 SuperReg != AMDGPU::EXEC &&
"exec should never spill");
172 assert(
RS &&
"Cannot spill SGPR to memory without RegScavenger");
201 IsWave32 ? AMDGPU::SGPR_32RegClass : AMDGPU::SGPR_64RegClass;
222 MI->emitError(
"unhandled SGPR spill to memory");
232 I->getOperand(2).setIsDead();
267 I->getOperand(2).setIsDead();
297 MI->emitError(
"unhandled SGPR spill to memory");
322 ST.getAMDGPUDwarfFlavour()),
325 assert(getSubRegIndexLaneMask(AMDGPU::sub0).getAsInteger() == 3 &&
326 getSubRegIndexLaneMask(AMDGPU::sub31).getAsInteger() == (3ULL << 62) &&
327 (getSubRegIndexLaneMask(AMDGPU::lo16) |
328 getSubRegIndexLaneMask(AMDGPU::hi16)).getAsInteger() ==
329 getSubRegIndexLaneMask(AMDGPU::sub0).getAsInteger() &&
330 "getNumCoveredRegs() will not work with generated subreg masks!");
332 RegPressureIgnoredUnits.
resize(getNumRegUnits());
334 for (
auto Reg : AMDGPU::VGPR_16RegClass) {
336 RegPressureIgnoredUnits.
set(*regunits(Reg).begin());
342 static auto InitializeRegSplitPartsOnce = [
this]() {
343 for (
unsigned Idx = 1, E = getNumSubRegIndices() - 1;
Idx < E; ++
Idx) {
344 unsigned Size = getSubRegIdxSize(
Idx);
347 std::vector<int16_t> &Vec = RegSplitParts[
Size / 32 - 1];
348 unsigned Pos = getSubRegIdxOffset(
Idx);
353 unsigned MaxNumParts = 1024 /
Size;
354 Vec.resize(MaxNumParts);
362 static auto InitializeSubRegFromChannelTableOnce = [
this]() {
363 for (
auto &Row : SubRegFromChannelTable)
364 Row.fill(AMDGPU::NoSubRegister);
365 for (
unsigned Idx = 1;
Idx < getNumSubRegIndices(); ++
Idx) {
366 unsigned Width = getSubRegIdxSize(
Idx) / 32;
367 unsigned Offset = getSubRegIdxOffset(
Idx) / 32;
372 unsigned TableIdx = Width - 1;
373 assert(TableIdx < SubRegFromChannelTable.size());
375 SubRegFromChannelTable[TableIdx][
Offset] =
Idx;
379 llvm::call_once(InitializeRegSplitPartsFlag, InitializeRegSplitPartsOnce);
381 InitializeSubRegFromChannelTableOnce);
399 : CSR_AMDGPU_SaveList;
401 return ST.
hasGFX90AInsts() ? CSR_AMDGPU_SI_Gfx_GFX90AInsts_SaveList
402 : CSR_AMDGPU_SI_Gfx_SaveList;
404 return CSR_AMDGPU_CS_ChainPreserve_SaveList;
407 static const MCPhysReg NoCalleeSavedReg = AMDGPU::NoRegister;
408 return &NoCalleeSavedReg;
425 : CSR_AMDGPU_RegMask;
427 return ST.
hasGFX90AInsts() ? CSR_AMDGPU_SI_Gfx_GFX90AInsts_RegMask
428 : CSR_AMDGPU_SI_Gfx_RegMask;
433 return AMDGPU_AllVGPRs_RegMask;
440 return CSR_AMDGPU_NoRegs_RegMask;
444 return VGPR >= AMDGPU::VGPR0 && VGPR < AMDGPU::VGPR8;
455 if (RC == &AMDGPU::VGPR_32RegClass || RC == &AMDGPU::AGPR_32RegClass)
456 return &AMDGPU::AV_32RegClass;
457 if (RC == &AMDGPU::VReg_64RegClass || RC == &AMDGPU::AReg_64RegClass)
458 return &AMDGPU::AV_64RegClass;
459 if (RC == &AMDGPU::VReg_64_Align2RegClass ||
460 RC == &AMDGPU::AReg_64_Align2RegClass)
461 return &AMDGPU::AV_64_Align2RegClass;
462 if (RC == &AMDGPU::VReg_96RegClass || RC == &AMDGPU::AReg_96RegClass)
463 return &AMDGPU::AV_96RegClass;
464 if (RC == &AMDGPU::VReg_96_Align2RegClass ||
465 RC == &AMDGPU::AReg_96_Align2RegClass)
466 return &AMDGPU::AV_96_Align2RegClass;
467 if (RC == &AMDGPU::VReg_128RegClass || RC == &AMDGPU::AReg_128RegClass)
468 return &AMDGPU::AV_128RegClass;
469 if (RC == &AMDGPU::VReg_128_Align2RegClass ||
470 RC == &AMDGPU::AReg_128_Align2RegClass)
471 return &AMDGPU::AV_128_Align2RegClass;
472 if (RC == &AMDGPU::VReg_160RegClass || RC == &AMDGPU::AReg_160RegClass)
473 return &AMDGPU::AV_160RegClass;
474 if (RC == &AMDGPU::VReg_160_Align2RegClass ||
475 RC == &AMDGPU::AReg_160_Align2RegClass)
476 return &AMDGPU::AV_160_Align2RegClass;
477 if (RC == &AMDGPU::VReg_192RegClass || RC == &AMDGPU::AReg_192RegClass)
478 return &AMDGPU::AV_192RegClass;
479 if (RC == &AMDGPU::VReg_192_Align2RegClass ||
480 RC == &AMDGPU::AReg_192_Align2RegClass)
481 return &AMDGPU::AV_192_Align2RegClass;
482 if (RC == &AMDGPU::VReg_256RegClass || RC == &AMDGPU::AReg_256RegClass)
483 return &AMDGPU::AV_256RegClass;
484 if (RC == &AMDGPU::VReg_256_Align2RegClass ||
485 RC == &AMDGPU::AReg_256_Align2RegClass)
486 return &AMDGPU::AV_256_Align2RegClass;
487 if (RC == &AMDGPU::VReg_512RegClass || RC == &AMDGPU::AReg_512RegClass)
488 return &AMDGPU::AV_512RegClass;
489 if (RC == &AMDGPU::VReg_512_Align2RegClass ||
490 RC == &AMDGPU::AReg_512_Align2RegClass)
491 return &AMDGPU::AV_512_Align2RegClass;
492 if (RC == &AMDGPU::VReg_1024RegClass || RC == &AMDGPU::AReg_1024RegClass)
493 return &AMDGPU::AV_1024RegClass;
494 if (RC == &AMDGPU::VReg_1024_Align2RegClass ||
495 RC == &AMDGPU::AReg_1024_Align2RegClass)
496 return &AMDGPU::AV_1024_Align2RegClass;
526 return AMDGPU_AllVGPRs_RegMask;
530 return AMDGPU_AllAGPRs_RegMask;
534 return AMDGPU_AllVectorRegs_RegMask;
538 return AMDGPU_AllAllocatableSRegs_RegMask;
545 assert(NumRegIndex &&
"Not implemented");
546 assert(Channel < SubRegFromChannelTable[NumRegIndex - 1].
size());
547 return SubRegFromChannelTable[NumRegIndex - 1][Channel];
552 const unsigned Align,
555 MCRegister BaseReg(AMDGPU::SGPR_32RegClass.getRegister(BaseIdx));
556 return getMatchingSuperReg(BaseReg, AMDGPU::sub0, RC);
574 reserveRegisterTuples(
Reserved, AMDGPU::EXEC);
575 reserveRegisterTuples(
Reserved, AMDGPU::FLAT_SCR);
578 reserveRegisterTuples(
Reserved, AMDGPU::M0);
581 reserveRegisterTuples(
Reserved, AMDGPU::SRC_VCCZ);
582 reserveRegisterTuples(
Reserved, AMDGPU::SRC_EXECZ);
583 reserveRegisterTuples(
Reserved, AMDGPU::SRC_SCC);
586 reserveRegisterTuples(
Reserved, AMDGPU::SRC_SHARED_BASE);
587 reserveRegisterTuples(
Reserved, AMDGPU::SRC_SHARED_LIMIT);
588 reserveRegisterTuples(
Reserved, AMDGPU::SRC_PRIVATE_BASE);
589 reserveRegisterTuples(
Reserved, AMDGPU::SRC_PRIVATE_LIMIT);
592 reserveRegisterTuples(
Reserved, AMDGPU::SRC_POPS_EXITING_WAVE_ID);
595 reserveRegisterTuples(
Reserved, AMDGPU::XNACK_MASK);
598 reserveRegisterTuples(
Reserved, AMDGPU::LDS_DIRECT);
601 reserveRegisterTuples(
Reserved, AMDGPU::TBA);
602 reserveRegisterTuples(
Reserved, AMDGPU::TMA);
603 reserveRegisterTuples(
Reserved, AMDGPU::TTMP0_TTMP1);
604 reserveRegisterTuples(
Reserved, AMDGPU::TTMP2_TTMP3);
605 reserveRegisterTuples(
Reserved, AMDGPU::TTMP4_TTMP5);
606 reserveRegisterTuples(
Reserved, AMDGPU::TTMP6_TTMP7);
607 reserveRegisterTuples(
Reserved, AMDGPU::TTMP8_TTMP9);
608 reserveRegisterTuples(
Reserved, AMDGPU::TTMP10_TTMP11);
609 reserveRegisterTuples(
Reserved, AMDGPU::TTMP12_TTMP13);
610 reserveRegisterTuples(
Reserved, AMDGPU::TTMP14_TTMP15);
613 reserveRegisterTuples(
Reserved, AMDGPU::SGPR_NULL64);
618 unsigned TotalNumSGPRs = AMDGPU::SGPR_32RegClass.getNumRegs();
621 unsigned NumRegs =
divideCeil(getRegSizeInBits(*RC), 32);
624 if (
Index + NumRegs > MaxNumSGPRs &&
Index < TotalNumSGPRs)
631 if (ScratchRSrcReg != AMDGPU::NoRegister) {
635 reserveRegisterTuples(
Reserved, ScratchRSrcReg);
639 if (LongBranchReservedReg)
640 reserveRegisterTuples(
Reserved, LongBranchReservedReg);
647 reserveRegisterTuples(
Reserved, StackPtrReg);
648 assert(!isSubRegister(ScratchRSrcReg, StackPtrReg));
653 reserveRegisterTuples(
Reserved, FrameReg);
654 assert(!isSubRegister(ScratchRSrcReg, FrameReg));
659 reserveRegisterTuples(
Reserved, BasePtrReg);
660 assert(!isSubRegister(ScratchRSrcReg, BasePtrReg));
667 reserveRegisterTuples(
Reserved, ExecCopyReg);
672 unsigned MaxNumAGPRs = MaxNumVGPRs;
673 unsigned TotalNumVGPRs = AMDGPU::VGPR_32RegClass.getNumRegs();
686 MaxNumAGPRs = MaxNumVGPRs;
688 if (MaxNumVGPRs > TotalNumVGPRs) {
689 MaxNumAGPRs = MaxNumVGPRs - TotalNumVGPRs;
690 MaxNumVGPRs = TotalNumVGPRs;
698 unsigned NumRegs =
divideCeil(getRegSizeInBits(*RC), 32);
701 if (
Index + NumRegs > MaxNumVGPRs)
712 unsigned NumRegs =
divideCeil(getRegSizeInBits(*RC), 32);
715 if (
Index + NumRegs > MaxNumAGPRs)
728 reserveRegisterTuples(
Reserved, Reg);
732 reserveRegisterTuples(
Reserved, Reg);
735 reserveRegisterTuples(
Reserved, Reg);
752 if (
Info->isBottomOfStack())
760 if (
Info->isEntryFunction()) {
794 AMDGPU::OpName::offset);
795 return MI->getOperand(OffIdx).getImm();
800 switch (
MI->getOpcode()) {
801 case AMDGPU::V_ADD_U32_e32:
802 case AMDGPU::V_ADD_U32_e64:
803 case AMDGPU::V_ADD_CO_U32_e32: {
804 int OtherIdx =
Idx == 1 ? 2 : 1;
808 case AMDGPU::V_ADD_CO_U32_e64: {
809 int OtherIdx =
Idx == 2 ? 3 : 2;
821 AMDGPU::OpName::vaddr) ||
823 AMDGPU::OpName::saddr))) &&
824 "Should never see frame index on non-address operand");
836 return Src1.
isImm() || (Src1.
isReg() &&
TRI.isVGPR(
MI.getMF()->getRegInfo(),
841 return Src0.
isImm() || (Src0.
isReg() &&
TRI.isVGPR(
MI.getMF()->getRegInfo(),
850 switch (
MI->getOpcode()) {
851 case AMDGPU::V_ADD_U32_e32: {
859 case AMDGPU::V_ADD_U32_e64:
869 case AMDGPU::V_ADD_CO_U32_e32:
875 return MI->getOperand(3).isDead();
876 case AMDGPU::V_ADD_CO_U32_e64:
878 return MI->getOperand(1).isDead();
890 return !
TII->isLegalMUBUFImmOffset(FullOffset);
903 DL = Ins->getDebugLoc();
909 : AMDGPU::V_MOV_B32_e32;
913 : &AMDGPU::VGPR_32RegClass);
921 Register OffsetReg =
MRI.createVirtualRegister(&AMDGPU::SReg_32_XM0RegClass);
925 : &AMDGPU::VGPR_32RegClass);
941 TII->getAddNoCarry(*
MBB, Ins,
DL, BaseReg)
953 switch (
MI.getOpcode()) {
954 case AMDGPU::V_ADD_U32_e32:
955 case AMDGPU::V_ADD_CO_U32_e32: {
961 if (!ImmOp->
isImm()) {
964 TII->legalizeOperandsVOP2(
MI.getMF()->getRegInfo(),
MI);
969 if (TotalOffset == 0) {
970 MI.setDesc(
TII->get(AMDGPU::COPY));
971 for (
unsigned I =
MI.getNumOperands() - 1;
I != 1; --
I)
974 MI.getOperand(1).ChangeToRegister(BaseReg,
false);
978 ImmOp->
setImm(TotalOffset);
990 MRI.createVirtualRegister(&AMDGPU::VGPR_32RegClass);
993 MI.getOperand(2).ChangeToRegister(BaseRegVGPR,
false);
995 MI.getOperand(2).ChangeToRegister(BaseReg,
false);
999 case AMDGPU::V_ADD_U32_e64:
1000 case AMDGPU::V_ADD_CO_U32_e64: {
1001 int Src0Idx =
MI.getNumExplicitDefs();
1007 if (!ImmOp->
isImm()) {
1009 TII->legalizeOperandsVOP3(
MI.getMF()->getRegInfo(),
MI);
1014 if (TotalOffset == 0) {
1015 MI.setDesc(
TII->get(AMDGPU::COPY));
1017 for (
unsigned I =
MI.getNumOperands() - 1;
I != 1; --
I)
1018 MI.removeOperand(
I);
1020 MI.getOperand(1).ChangeToRegister(BaseReg,
false);
1023 ImmOp->
setImm(TotalOffset);
1032 bool IsFlat =
TII->isFLATScratch(
MI);
1036 bool SeenFI =
false;
1048 TII->getNamedOperand(
MI, IsFlat ? AMDGPU::OpName::saddr
1049 : AMDGPU::OpName::vaddr);
1054 assert(FIOp && FIOp->
isFI() &&
"frame index must be address operand");
1060 "offset should be legal");
1062 OffsetOp->
setImm(NewOffset);
1071 assert(
TII->isLegalMUBUFImmOffset(NewOffset) &&
"offset should be legal");
1074 OffsetOp->
setImm(NewOffset);
1081 switch (
MI->getOpcode()) {
1082 case AMDGPU::V_ADD_U32_e32:
1083 case AMDGPU::V_ADD_CO_U32_e32:
1085 case AMDGPU::V_ADD_U32_e64:
1086 case AMDGPU::V_ADD_CO_U32_e64:
1099 return TII->isLegalMUBUFImmOffset(NewOffset);
1110 return &AMDGPU::VGPR_32RegClass;
1117 if (RC == &AMDGPU::SCC_CLASSRegClass)
1126 case AMDGPU::SI_SPILL_S1024_SAVE:
1127 case AMDGPU::SI_SPILL_S1024_RESTORE:
1128 case AMDGPU::SI_SPILL_V1024_SAVE:
1129 case AMDGPU::SI_SPILL_V1024_RESTORE:
1130 case AMDGPU::SI_SPILL_A1024_SAVE:
1131 case AMDGPU::SI_SPILL_A1024_RESTORE:
1132 case AMDGPU::SI_SPILL_AV1024_SAVE:
1133 case AMDGPU::SI_SPILL_AV1024_RESTORE:
1135 case AMDGPU::SI_SPILL_S512_SAVE:
1136 case AMDGPU::SI_SPILL_S512_RESTORE:
1137 case AMDGPU::SI_SPILL_V512_SAVE:
1138 case AMDGPU::SI_SPILL_V512_RESTORE:
1139 case AMDGPU::SI_SPILL_A512_SAVE:
1140 case AMDGPU::SI_SPILL_A512_RESTORE:
1141 case AMDGPU::SI_SPILL_AV512_SAVE:
1142 case AMDGPU::SI_SPILL_AV512_RESTORE:
1144 case AMDGPU::SI_SPILL_S384_SAVE:
1145 case AMDGPU::SI_SPILL_S384_RESTORE:
1146 case AMDGPU::SI_SPILL_V384_SAVE:
1147 case AMDGPU::SI_SPILL_V384_RESTORE:
1148 case AMDGPU::SI_SPILL_A384_SAVE:
1149 case AMDGPU::SI_SPILL_A384_RESTORE:
1150 case AMDGPU::SI_SPILL_AV384_SAVE:
1151 case AMDGPU::SI_SPILL_AV384_RESTORE:
1153 case AMDGPU::SI_SPILL_S352_SAVE:
1154 case AMDGPU::SI_SPILL_S352_RESTORE:
1155 case AMDGPU::SI_SPILL_V352_SAVE:
1156 case AMDGPU::SI_SPILL_V352_RESTORE:
1157 case AMDGPU::SI_SPILL_A352_SAVE:
1158 case AMDGPU::SI_SPILL_A352_RESTORE:
1159 case AMDGPU::SI_SPILL_AV352_SAVE:
1160 case AMDGPU::SI_SPILL_AV352_RESTORE:
1162 case AMDGPU::SI_SPILL_S320_SAVE:
1163 case AMDGPU::SI_SPILL_S320_RESTORE:
1164 case AMDGPU::SI_SPILL_V320_SAVE:
1165 case AMDGPU::SI_SPILL_V320_RESTORE:
1166 case AMDGPU::SI_SPILL_A320_SAVE:
1167 case AMDGPU::SI_SPILL_A320_RESTORE:
1168 case AMDGPU::SI_SPILL_AV320_SAVE:
1169 case AMDGPU::SI_SPILL_AV320_RESTORE:
1171 case AMDGPU::SI_SPILL_S288_SAVE:
1172 case AMDGPU::SI_SPILL_S288_RESTORE:
1173 case AMDGPU::SI_SPILL_V288_SAVE:
1174 case AMDGPU::SI_SPILL_V288_RESTORE:
1175 case AMDGPU::SI_SPILL_A288_SAVE:
1176 case AMDGPU::SI_SPILL_A288_RESTORE:
1177 case AMDGPU::SI_SPILL_AV288_SAVE:
1178 case AMDGPU::SI_SPILL_AV288_RESTORE:
1180 case AMDGPU::SI_SPILL_S256_SAVE:
1181 case AMDGPU::SI_SPILL_S256_RESTORE:
1182 case AMDGPU::SI_SPILL_V256_SAVE:
1183 case AMDGPU::SI_SPILL_V256_RESTORE:
1184 case AMDGPU::SI_SPILL_A256_SAVE:
1185 case AMDGPU::SI_SPILL_A256_RESTORE:
1186 case AMDGPU::SI_SPILL_AV256_SAVE:
1187 case AMDGPU::SI_SPILL_AV256_RESTORE:
1189 case AMDGPU::SI_SPILL_S224_SAVE:
1190 case AMDGPU::SI_SPILL_S224_RESTORE:
1191 case AMDGPU::SI_SPILL_V224_SAVE:
1192 case AMDGPU::SI_SPILL_V224_RESTORE:
1193 case AMDGPU::SI_SPILL_A224_SAVE:
1194 case AMDGPU::SI_SPILL_A224_RESTORE:
1195 case AMDGPU::SI_SPILL_AV224_SAVE:
1196 case AMDGPU::SI_SPILL_AV224_RESTORE:
1198 case AMDGPU::SI_SPILL_S192_SAVE:
1199 case AMDGPU::SI_SPILL_S192_RESTORE:
1200 case AMDGPU::SI_SPILL_V192_SAVE:
1201 case AMDGPU::SI_SPILL_V192_RESTORE:
1202 case AMDGPU::SI_SPILL_A192_SAVE:
1203 case AMDGPU::SI_SPILL_A192_RESTORE:
1204 case AMDGPU::SI_SPILL_AV192_SAVE:
1205 case AMDGPU::SI_SPILL_AV192_RESTORE:
1207 case AMDGPU::SI_SPILL_S160_SAVE:
1208 case AMDGPU::SI_SPILL_S160_RESTORE:
1209 case AMDGPU::SI_SPILL_V160_SAVE:
1210 case AMDGPU::SI_SPILL_V160_RESTORE:
1211 case AMDGPU::SI_SPILL_A160_SAVE:
1212 case AMDGPU::SI_SPILL_A160_RESTORE:
1213 case AMDGPU::SI_SPILL_AV160_SAVE:
1214 case AMDGPU::SI_SPILL_AV160_RESTORE:
1216 case AMDGPU::SI_SPILL_S128_SAVE:
1217 case AMDGPU::SI_SPILL_S128_RESTORE:
1218 case AMDGPU::SI_SPILL_V128_SAVE:
1219 case AMDGPU::SI_SPILL_V128_RESTORE:
1220 case AMDGPU::SI_SPILL_A128_SAVE:
1221 case AMDGPU::SI_SPILL_A128_RESTORE:
1222 case AMDGPU::SI_SPILL_AV128_SAVE:
1223 case AMDGPU::SI_SPILL_AV128_RESTORE:
1225 case AMDGPU::SI_SPILL_S96_SAVE:
1226 case AMDGPU::SI_SPILL_S96_RESTORE:
1227 case AMDGPU::SI_SPILL_V96_SAVE:
1228 case AMDGPU::SI_SPILL_V96_RESTORE:
1229 case AMDGPU::SI_SPILL_A96_SAVE:
1230 case AMDGPU::SI_SPILL_A96_RESTORE:
1231 case AMDGPU::SI_SPILL_AV96_SAVE:
1232 case AMDGPU::SI_SPILL_AV96_RESTORE:
1234 case AMDGPU::SI_SPILL_S64_SAVE:
1235 case AMDGPU::SI_SPILL_S64_RESTORE:
1236 case AMDGPU::SI_SPILL_V64_SAVE:
1237 case AMDGPU::SI_SPILL_V64_RESTORE:
1238 case AMDGPU::SI_SPILL_A64_SAVE:
1239 case AMDGPU::SI_SPILL_A64_RESTORE:
1240 case AMDGPU::SI_SPILL_AV64_SAVE:
1241 case AMDGPU::SI_SPILL_AV64_RESTORE:
1243 case AMDGPU::SI_SPILL_S32_SAVE:
1244 case AMDGPU::SI_SPILL_S32_RESTORE:
1245 case AMDGPU::SI_SPILL_V32_SAVE:
1246 case AMDGPU::SI_SPILL_V32_RESTORE:
1247 case AMDGPU::SI_SPILL_A32_SAVE:
1248 case AMDGPU::SI_SPILL_A32_RESTORE:
1249 case AMDGPU::SI_SPILL_AV32_SAVE:
1250 case AMDGPU::SI_SPILL_AV32_RESTORE:
1251 case AMDGPU::SI_SPILL_WWM_V32_SAVE:
1252 case AMDGPU::SI_SPILL_WWM_V32_RESTORE:
1253 case AMDGPU::SI_SPILL_WWM_AV32_SAVE:
1254 case AMDGPU::SI_SPILL_WWM_AV32_RESTORE:
1262 case AMDGPU::BUFFER_STORE_DWORD_OFFEN:
1263 return AMDGPU::BUFFER_STORE_DWORD_OFFSET;
1264 case AMDGPU::BUFFER_STORE_BYTE_OFFEN:
1265 return AMDGPU::BUFFER_STORE_BYTE_OFFSET;
1266 case AMDGPU::BUFFER_STORE_SHORT_OFFEN:
1267 return AMDGPU::BUFFER_STORE_SHORT_OFFSET;
1268 case AMDGPU::BUFFER_STORE_DWORDX2_OFFEN:
1269 return AMDGPU::BUFFER_STORE_DWORDX2_OFFSET;
1270 case AMDGPU::BUFFER_STORE_DWORDX3_OFFEN:
1271 return AMDGPU::BUFFER_STORE_DWORDX3_OFFSET;
1272 case AMDGPU::BUFFER_STORE_DWORDX4_OFFEN:
1273 return AMDGPU::BUFFER_STORE_DWORDX4_OFFSET;
1274 case AMDGPU::BUFFER_STORE_SHORT_D16_HI_OFFEN:
1275 return AMDGPU::BUFFER_STORE_SHORT_D16_HI_OFFSET;
1276 case AMDGPU::BUFFER_STORE_BYTE_D16_HI_OFFEN:
1277 return AMDGPU::BUFFER_STORE_BYTE_D16_HI_OFFSET;
1285 case AMDGPU::BUFFER_LOAD_DWORD_OFFEN:
1286 return AMDGPU::BUFFER_LOAD_DWORD_OFFSET;
1287 case AMDGPU::BUFFER_LOAD_UBYTE_OFFEN:
1288 return AMDGPU::BUFFER_LOAD_UBYTE_OFFSET;
1289 case AMDGPU::BUFFER_LOAD_SBYTE_OFFEN:
1290 return AMDGPU::BUFFER_LOAD_SBYTE_OFFSET;
1291 case AMDGPU::BUFFER_LOAD_USHORT_OFFEN:
1292 return AMDGPU::BUFFER_LOAD_USHORT_OFFSET;
1293 case AMDGPU::BUFFER_LOAD_SSHORT_OFFEN:
1294 return AMDGPU::BUFFER_LOAD_SSHORT_OFFSET;
1295 case AMDGPU::BUFFER_LOAD_DWORDX2_OFFEN:
1296 return AMDGPU::BUFFER_LOAD_DWORDX2_OFFSET;
1297 case AMDGPU::BUFFER_LOAD_DWORDX3_OFFEN:
1298 return AMDGPU::BUFFER_LOAD_DWORDX3_OFFSET;
1299 case AMDGPU::BUFFER_LOAD_DWORDX4_OFFEN:
1300 return AMDGPU::BUFFER_LOAD_DWORDX4_OFFSET;
1301 case AMDGPU::BUFFER_LOAD_UBYTE_D16_OFFEN:
1302 return AMDGPU::BUFFER_LOAD_UBYTE_D16_OFFSET;
1303 case AMDGPU::BUFFER_LOAD_UBYTE_D16_HI_OFFEN:
1304 return AMDGPU::BUFFER_LOAD_UBYTE_D16_HI_OFFSET;
1305 case AMDGPU::BUFFER_LOAD_SBYTE_D16_OFFEN:
1306 return AMDGPU::BUFFER_LOAD_SBYTE_D16_OFFSET;
1307 case AMDGPU::BUFFER_LOAD_SBYTE_D16_HI_OFFEN:
1308 return AMDGPU::BUFFER_LOAD_SBYTE_D16_HI_OFFSET;
1309 case AMDGPU::BUFFER_LOAD_SHORT_D16_OFFEN:
1310 return AMDGPU::BUFFER_LOAD_SHORT_D16_OFFSET;
1311 case AMDGPU::BUFFER_LOAD_SHORT_D16_HI_OFFEN:
1312 return AMDGPU::BUFFER_LOAD_SHORT_D16_HI_OFFSET;
1320 case AMDGPU::BUFFER_STORE_DWORD_OFFSET:
1321 return AMDGPU::BUFFER_STORE_DWORD_OFFEN;
1322 case AMDGPU::BUFFER_STORE_BYTE_OFFSET:
1323 return AMDGPU::BUFFER_STORE_BYTE_OFFEN;
1324 case AMDGPU::BUFFER_STORE_SHORT_OFFSET:
1325 return AMDGPU::BUFFER_STORE_SHORT_OFFEN;
1326 case AMDGPU::BUFFER_STORE_DWORDX2_OFFSET:
1327 return AMDGPU::BUFFER_STORE_DWORDX2_OFFEN;
1328 case AMDGPU::BUFFER_STORE_DWORDX3_OFFSET:
1329 return AMDGPU::BUFFER_STORE_DWORDX3_OFFEN;
1330 case AMDGPU::BUFFER_STORE_DWORDX4_OFFSET:
1331 return AMDGPU::BUFFER_STORE_DWORDX4_OFFEN;
1332 case AMDGPU::BUFFER_STORE_SHORT_D16_HI_OFFSET:
1333 return AMDGPU::BUFFER_STORE_SHORT_D16_HI_OFFEN;
1334 case AMDGPU::BUFFER_STORE_BYTE_D16_HI_OFFSET:
1335 return AMDGPU::BUFFER_STORE_BYTE_D16_HI_OFFEN;
1343 case AMDGPU::BUFFER_LOAD_DWORD_OFFSET:
1344 return AMDGPU::BUFFER_LOAD_DWORD_OFFEN;
1345 case AMDGPU::BUFFER_LOAD_UBYTE_OFFSET:
1346 return AMDGPU::BUFFER_LOAD_UBYTE_OFFEN;
1347 case AMDGPU::BUFFER_LOAD_SBYTE_OFFSET:
1348 return AMDGPU::BUFFER_LOAD_SBYTE_OFFEN;
1349 case AMDGPU::BUFFER_LOAD_USHORT_OFFSET:
1350 return AMDGPU::BUFFER_LOAD_USHORT_OFFEN;
1351 case AMDGPU::BUFFER_LOAD_SSHORT_OFFSET:
1352 return AMDGPU::BUFFER_LOAD_SSHORT_OFFEN;
1353 case AMDGPU::BUFFER_LOAD_DWORDX2_OFFSET:
1354 return AMDGPU::BUFFER_LOAD_DWORDX2_OFFEN;
1355 case AMDGPU::BUFFER_LOAD_DWORDX3_OFFSET:
1356 return AMDGPU::BUFFER_LOAD_DWORDX3_OFFEN;
1357 case AMDGPU::BUFFER_LOAD_DWORDX4_OFFSET:
1358 return AMDGPU::BUFFER_LOAD_DWORDX4_OFFEN;
1359 case AMDGPU::BUFFER_LOAD_UBYTE_D16_OFFSET:
1360 return AMDGPU::BUFFER_LOAD_UBYTE_D16_OFFEN;
1361 case AMDGPU::BUFFER_LOAD_UBYTE_D16_HI_OFFSET:
1362 return AMDGPU::BUFFER_LOAD_UBYTE_D16_HI_OFFEN;
1363 case AMDGPU::BUFFER_LOAD_SBYTE_D16_OFFSET:
1364 return AMDGPU::BUFFER_LOAD_SBYTE_D16_OFFEN;
1365 case AMDGPU::BUFFER_LOAD_SBYTE_D16_HI_OFFSET:
1366 return AMDGPU::BUFFER_LOAD_SBYTE_D16_HI_OFFEN;
1367 case AMDGPU::BUFFER_LOAD_SHORT_D16_OFFSET:
1368 return AMDGPU::BUFFER_LOAD_SHORT_D16_OFFEN;
1369 case AMDGPU::BUFFER_LOAD_SHORT_D16_HI_OFFSET:
1370 return AMDGPU::BUFFER_LOAD_SHORT_D16_HI_OFFEN;
1379 int Index,
unsigned Lane,
1380 unsigned ValueReg,
bool IsKill) {
1387 if (Reg == AMDGPU::NoRegister)
1390 bool IsStore =
MI->mayStore();
1394 unsigned Dst = IsStore ? Reg : ValueReg;
1395 unsigned Src = IsStore ? ValueReg : Reg;
1396 bool IsVGPR =
TRI->isVGPR(
MRI, Reg);
1398 if (IsVGPR ==
TRI->isVGPR(
MRI, ValueReg)) {
1408 unsigned Opc = (IsStore ^ IsVGPR) ? AMDGPU::V_ACCVGPR_WRITE_B32_e64
1409 : AMDGPU::V_ACCVGPR_READ_B32_e64;
1427 bool IsStore =
MI->mayStore();
1429 unsigned Opc =
MI->getOpcode();
1430 int LoadStoreOp = IsStore ?
1432 if (LoadStoreOp == -1)
1442 .
add(*
TII->getNamedOperand(*
MI, AMDGPU::OpName::srsrc))
1443 .
add(*
TII->getNamedOperand(*
MI, AMDGPU::OpName::soffset))
1450 AMDGPU::OpName::vdata_in);
1452 NewMI.
add(*VDataIn);
1457 unsigned LoadStoreOp,
1459 bool IsStore =
TII->get(LoadStoreOp).mayStore();
1466 LoadStoreOp = IsStore ? AMDGPU::SCRATCH_STORE_DWORD_SADDR
1467 : AMDGPU::SCRATCH_LOAD_DWORD_SADDR;
1470 LoadStoreOp = IsStore ? AMDGPU::SCRATCH_STORE_DWORDX2_SADDR
1471 : AMDGPU::SCRATCH_LOAD_DWORDX2_SADDR;
1474 LoadStoreOp = IsStore ? AMDGPU::SCRATCH_STORE_DWORDX3_SADDR
1475 : AMDGPU::SCRATCH_LOAD_DWORDX3_SADDR;
1478 LoadStoreOp = IsStore ? AMDGPU::SCRATCH_STORE_DWORDX4_SADDR
1479 : AMDGPU::SCRATCH_LOAD_DWORDX4_SADDR;
1495 unsigned LoadStoreOp,
int Index,
Register ValueReg,
bool IsKill,
1498 assert((!RS || !LiveUnits) &&
"Only RS or LiveUnits can be set but not both");
1506 bool IsStore =
Desc->mayStore();
1507 bool IsFlat =
TII->isFLATScratch(LoadStoreOp);
1509 bool CanClobberSCC =
false;
1510 bool Scavenged =
false;
1520 unsigned EltSize = (IsFlat && !IsAGPR) ? std::min(RegWidth, 16u) : 4u;
1521 unsigned NumSubRegs = RegWidth / EltSize;
1522 unsigned Size = NumSubRegs * EltSize;
1523 unsigned RemSize = RegWidth -
Size;
1524 unsigned NumRemSubRegs = RemSize ? 1 : 0;
1526 int64_t MaterializedOffset =
Offset;
1528 int64_t MaxOffset =
Offset +
Size + RemSize - EltSize;
1529 int64_t ScratchOffsetRegDelta = 0;
1531 if (IsFlat && EltSize > 4) {
1533 Desc = &
TII->get(LoadStoreOp);
1540 "unexpected VGPR spill offset");
1547 bool UseVGPROffset =
false;
1554 if (IsFlat && SGPRBase) {
1578 bool IsOffsetLegal =
1581 :
TII->isLegalMUBUFImmOffset(MaxOffset);
1593 CanClobberSCC = !RS->
isRegUsed(AMDGPU::SCC);
1594 }
else if (LiveUnits) {
1595 CanClobberSCC = LiveUnits->
available(AMDGPU::SCC);
1596 for (
MCRegister Reg : AMDGPU::SGPR_32RegClass) {
1604 if (ScratchOffsetReg != AMDGPU::NoRegister && !CanClobberSCC)
1608 UseVGPROffset =
true;
1614 for (
MCRegister Reg : AMDGPU::VGPR_32RegClass) {
1616 TmpOffsetVGPR = Reg;
1623 }
else if (!SOffset && CanClobberSCC) {
1634 if (!ScratchOffsetReg)
1636 SOffset = ScratchOffsetReg;
1637 ScratchOffsetRegDelta =
Offset;
1645 if (!IsFlat && !UseVGPROffset)
1648 if (!UseVGPROffset && !SOffset)
1651 if (UseVGPROffset) {
1653 MaterializeVOffset(ScratchOffsetReg, TmpOffsetVGPR,
Offset);
1654 }
else if (ScratchOffsetReg == AMDGPU::NoRegister) {
1659 .
addReg(ScratchOffsetReg)
1661 Add->getOperand(3).setIsDead();
1667 if (IsFlat && SOffset == AMDGPU::NoRegister) {
1669 &&
"Unexpected vaddr for flat scratch with a FI operand");
1671 if (UseVGPROffset) {
1678 Desc = &
TII->get(LoadStoreOp);
1681 for (
unsigned i = 0, e = NumSubRegs + NumRemSubRegs, RegOffset = 0; i != e;
1682 ++i, RegOffset += EltSize) {
1683 if (i == NumSubRegs) {
1687 Desc = &
TII->get(LoadStoreOp);
1689 if (!IsFlat && UseVGPROffset) {
1692 Desc = &
TII->get(NewLoadStoreOp);
1695 if (UseVGPROffset && TmpOffsetVGPR == TmpIntermediateVGPR) {
1702 MaterializeVOffset(ScratchOffsetReg, TmpOffsetVGPR, MaterializedOffset);
1705 unsigned NumRegs = EltSize / 4;
1711 unsigned SOffsetRegState = 0;
1713 const bool IsLastSubReg = i + 1 == e;
1714 const bool IsFirstSubReg = i == 0;
1723 bool NeedSuperRegDef = e > 1 && IsStore && IsFirstSubReg;
1724 bool NeedSuperRegImpOperand = e > 1;
1728 unsigned RemEltSize = EltSize;
1736 for (
int LaneS = (RegOffset + EltSize) / 4 - 1, Lane = LaneS,
1737 LaneE = RegOffset / 4;
1738 Lane >= LaneE; --Lane) {
1739 bool IsSubReg = e > 1 || EltSize > 4;
1744 if (!MIB.getInstr())
1746 if (NeedSuperRegDef || (IsSubReg && IsStore && Lane == LaneS && IsFirstSubReg)) {
1748 NeedSuperRegDef =
false;
1750 if ((IsSubReg || NeedSuperRegImpOperand) && (IsFirstSubReg || IsLastSubReg)) {
1751 NeedSuperRegImpOperand =
true;
1752 unsigned State = SrcDstRegState;
1753 if (!IsLastSubReg || (Lane != LaneE))
1754 State &= ~RegState::Kill;
1755 if (!IsFirstSubReg || (Lane != LaneS))
1756 State &= ~RegState::Define;
1765 if (RemEltSize != EltSize) {
1766 assert(IsFlat && EltSize > 4);
1768 unsigned NumRegs = RemEltSize / 4;
1775 unsigned FinalReg =
SubReg;
1780 if (!TmpIntermediateVGPR) {
1786 TII->get(AMDGPU::V_ACCVGPR_READ_B32_e64),
1787 TmpIntermediateVGPR)
1789 if (NeedSuperRegDef)
1793 SubReg = TmpIntermediateVGPR;
1794 }
else if (UseVGPROffset) {
1795 if (!TmpOffsetVGPR) {
1811 if (UseVGPROffset) {
1820 if (SOffset == AMDGPU::NoRegister) {
1822 if (UseVGPROffset && ScratchOffsetReg) {
1823 MIB.
addReg(ScratchOffsetReg);
1830 MIB.addReg(SOffset, SOffsetRegState);
1833 MIB.addImm(
Offset + RegOffset);
1840 MIB.addMemOperand(NewMMO);
1842 if (!IsAGPR && NeedSuperRegDef)
1845 if (!IsStore && IsAGPR && TmpIntermediateVGPR != AMDGPU::NoRegister) {
1852 if (NeedSuperRegImpOperand && (IsFirstSubReg || IsLastSubReg))
1876 if (!IsStore &&
MI !=
MBB.
end() &&
MI->isReturn() &&
1879 MIB->tieOperands(0, MIB->getNumOperands() - 1);
1883 if (ScratchOffsetRegDelta != 0) {
1887 .
addImm(-ScratchOffsetRegDelta);
1893 bool IsKill)
const {
1911 : AMDGPU::BUFFER_LOAD_DWORD_OFFSET;
1916 : AMDGPU::BUFFER_STORE_DWORD_OFFSET;
1927 bool SpillToPhysVGPRLane)
const {
1933 bool SpillToVGPR = !VGPRSpills.
empty();
1934 if (OnlyToVGPR && !SpillToVGPR)
1943 "Num of VGPR lanes should be equal to num of SGPRs spilled");
1945 for (
unsigned i = 0, e = SB.
NumSubRegs; i < e; ++i) {
1952 bool IsFirstSubreg = i == 0;
1954 bool UseKill = SB.
IsKill && IsLastSubreg;
1960 SB.
TII.get(AMDGPU::SI_SPILL_S32_TO_VGPR), Spill.VGPR)
1977 if (SB.
NumSubRegs > 1 && (IsFirstSubreg || IsLastSubreg))
1997 for (
unsigned i =
Offset * PVD.PerVGPR,
2007 SB.
TII.get(AMDGPU::SI_SPILL_S32_TO_VGPR), SB.
TmpVGPR)
2024 unsigned SuperKillState = 0;
2038 MI->eraseFromParent();
2050 bool SpillToPhysVGPRLane)
const {
2056 bool SpillToVGPR = !VGPRSpills.
empty();
2057 if (OnlyToVGPR && !SpillToVGPR)
2061 for (
unsigned i = 0, e = SB.
NumSubRegs; i < e; ++i) {
2069 SB.
TII.get(AMDGPU::SI_RESTORE_S32_FROM_VGPR),
SubReg)
2092 for (
unsigned i =
Offset * PVD.PerVGPR,
2100 bool LastSubReg = (i + 1 == e);
2102 SB.
TII.get(AMDGPU::SI_RESTORE_S32_FROM_VGPR),
SubReg)
2119 MI->eraseFromParent();
2139 for (
unsigned i =
Offset * PVD.PerVGPR,
2158 unsigned SuperKillState = 0;
2168 MI = RestoreMBB.
end();
2174 for (
unsigned i =
Offset * PVD.PerVGPR,
2181 bool LastSubReg = (i + 1 == e);
2202 switch (
MI->getOpcode()) {
2203 case AMDGPU::SI_SPILL_S1024_SAVE:
2204 case AMDGPU::SI_SPILL_S512_SAVE:
2205 case AMDGPU::SI_SPILL_S384_SAVE:
2206 case AMDGPU::SI_SPILL_S352_SAVE:
2207 case AMDGPU::SI_SPILL_S320_SAVE:
2208 case AMDGPU::SI_SPILL_S288_SAVE:
2209 case AMDGPU::SI_SPILL_S256_SAVE:
2210 case AMDGPU::SI_SPILL_S224_SAVE:
2211 case AMDGPU::SI_SPILL_S192_SAVE:
2212 case AMDGPU::SI_SPILL_S160_SAVE:
2213 case AMDGPU::SI_SPILL_S128_SAVE:
2214 case AMDGPU::SI_SPILL_S96_SAVE:
2215 case AMDGPU::SI_SPILL_S64_SAVE:
2216 case AMDGPU::SI_SPILL_S32_SAVE:
2217 return spillSGPR(
MI, FI, RS, Indexes, LIS,
true, SpillToPhysVGPRLane);
2218 case AMDGPU::SI_SPILL_S1024_RESTORE:
2219 case AMDGPU::SI_SPILL_S512_RESTORE:
2220 case AMDGPU::SI_SPILL_S384_RESTORE:
2221 case AMDGPU::SI_SPILL_S352_RESTORE:
2222 case AMDGPU::SI_SPILL_S320_RESTORE:
2223 case AMDGPU::SI_SPILL_S288_RESTORE:
2224 case AMDGPU::SI_SPILL_S256_RESTORE:
2225 case AMDGPU::SI_SPILL_S224_RESTORE:
2226 case AMDGPU::SI_SPILL_S192_RESTORE:
2227 case AMDGPU::SI_SPILL_S160_RESTORE:
2228 case AMDGPU::SI_SPILL_S128_RESTORE:
2229 case AMDGPU::SI_SPILL_S96_RESTORE:
2230 case AMDGPU::SI_SPILL_S64_RESTORE:
2231 case AMDGPU::SI_SPILL_S32_RESTORE:
2232 return restoreSGPR(
MI, FI, RS, Indexes, LIS,
true, SpillToPhysVGPRLane);
2239 int SPAdj,
unsigned FIOperandNum,
2248 assert(SPAdj == 0 &&
"unhandled SP adjustment in call sequence?");
2251 "unreserved scratch RSRC register");
2254 int Index =
MI->getOperand(FIOperandNum).getIndex();
2260 switch (
MI->getOpcode()) {
2262 case AMDGPU::SI_SPILL_S1024_SAVE:
2263 case AMDGPU::SI_SPILL_S512_SAVE:
2264 case AMDGPU::SI_SPILL_S384_SAVE:
2265 case AMDGPU::SI_SPILL_S352_SAVE:
2266 case AMDGPU::SI_SPILL_S320_SAVE:
2267 case AMDGPU::SI_SPILL_S288_SAVE:
2268 case AMDGPU::SI_SPILL_S256_SAVE:
2269 case AMDGPU::SI_SPILL_S224_SAVE:
2270 case AMDGPU::SI_SPILL_S192_SAVE:
2271 case AMDGPU::SI_SPILL_S160_SAVE:
2272 case AMDGPU::SI_SPILL_S128_SAVE:
2273 case AMDGPU::SI_SPILL_S96_SAVE:
2274 case AMDGPU::SI_SPILL_S64_SAVE:
2275 case AMDGPU::SI_SPILL_S32_SAVE: {
2280 case AMDGPU::SI_SPILL_S1024_RESTORE:
2281 case AMDGPU::SI_SPILL_S512_RESTORE:
2282 case AMDGPU::SI_SPILL_S384_RESTORE:
2283 case AMDGPU::SI_SPILL_S352_RESTORE:
2284 case AMDGPU::SI_SPILL_S320_RESTORE:
2285 case AMDGPU::SI_SPILL_S288_RESTORE:
2286 case AMDGPU::SI_SPILL_S256_RESTORE:
2287 case AMDGPU::SI_SPILL_S224_RESTORE:
2288 case AMDGPU::SI_SPILL_S192_RESTORE:
2289 case AMDGPU::SI_SPILL_S160_RESTORE:
2290 case AMDGPU::SI_SPILL_S128_RESTORE:
2291 case AMDGPU::SI_SPILL_S96_RESTORE:
2292 case AMDGPU::SI_SPILL_S64_RESTORE:
2293 case AMDGPU::SI_SPILL_S32_RESTORE: {
2298 case AMDGPU::SI_SPILL_V1024_SAVE:
2299 case AMDGPU::SI_SPILL_V512_SAVE:
2300 case AMDGPU::SI_SPILL_V384_SAVE:
2301 case AMDGPU::SI_SPILL_V352_SAVE:
2302 case AMDGPU::SI_SPILL_V320_SAVE:
2303 case AMDGPU::SI_SPILL_V288_SAVE:
2304 case AMDGPU::SI_SPILL_V256_SAVE:
2305 case AMDGPU::SI_SPILL_V224_SAVE:
2306 case AMDGPU::SI_SPILL_V192_SAVE:
2307 case AMDGPU::SI_SPILL_V160_SAVE:
2308 case AMDGPU::SI_SPILL_V128_SAVE:
2309 case AMDGPU::SI_SPILL_V96_SAVE:
2310 case AMDGPU::SI_SPILL_V64_SAVE:
2311 case AMDGPU::SI_SPILL_V32_SAVE:
2312 case AMDGPU::SI_SPILL_A1024_SAVE:
2313 case AMDGPU::SI_SPILL_A512_SAVE:
2314 case AMDGPU::SI_SPILL_A384_SAVE:
2315 case AMDGPU::SI_SPILL_A352_SAVE:
2316 case AMDGPU::SI_SPILL_A320_SAVE:
2317 case AMDGPU::SI_SPILL_A288_SAVE:
2318 case AMDGPU::SI_SPILL_A256_SAVE:
2319 case AMDGPU::SI_SPILL_A224_SAVE:
2320 case AMDGPU::SI_SPILL_A192_SAVE:
2321 case AMDGPU::SI_SPILL_A160_SAVE:
2322 case AMDGPU::SI_SPILL_A128_SAVE:
2323 case AMDGPU::SI_SPILL_A96_SAVE:
2324 case AMDGPU::SI_SPILL_A64_SAVE:
2325 case AMDGPU::SI_SPILL_A32_SAVE:
2326 case AMDGPU::SI_SPILL_AV1024_SAVE:
2327 case AMDGPU::SI_SPILL_AV512_SAVE:
2328 case AMDGPU::SI_SPILL_AV384_SAVE:
2329 case AMDGPU::SI_SPILL_AV352_SAVE:
2330 case AMDGPU::SI_SPILL_AV320_SAVE:
2331 case AMDGPU::SI_SPILL_AV288_SAVE:
2332 case AMDGPU::SI_SPILL_AV256_SAVE:
2333 case AMDGPU::SI_SPILL_AV224_SAVE:
2334 case AMDGPU::SI_SPILL_AV192_SAVE:
2335 case AMDGPU::SI_SPILL_AV160_SAVE:
2336 case AMDGPU::SI_SPILL_AV128_SAVE:
2337 case AMDGPU::SI_SPILL_AV96_SAVE:
2338 case AMDGPU::SI_SPILL_AV64_SAVE:
2339 case AMDGPU::SI_SPILL_AV32_SAVE:
2340 case AMDGPU::SI_SPILL_WWM_V32_SAVE:
2341 case AMDGPU::SI_SPILL_WWM_AV32_SAVE: {
2343 AMDGPU::OpName::vdata);
2344 assert(
TII->getNamedOperand(*
MI, AMDGPU::OpName::soffset)->getReg() ==
2348 : AMDGPU::BUFFER_STORE_DWORD_OFFSET;
2349 auto *
MBB =
MI->getParent();
2350 bool IsWWMRegSpill =
TII->isWWMRegSpillOpcode(
MI->getOpcode());
2351 if (IsWWMRegSpill) {
2357 TII->getNamedOperand(*
MI, AMDGPU::OpName::offset)->getImm(),
2358 *
MI->memoperands_begin(), RS);
2363 MI->eraseFromParent();
2366 case AMDGPU::SI_SPILL_V32_RESTORE:
2367 case AMDGPU::SI_SPILL_V64_RESTORE:
2368 case AMDGPU::SI_SPILL_V96_RESTORE:
2369 case AMDGPU::SI_SPILL_V128_RESTORE:
2370 case AMDGPU::SI_SPILL_V160_RESTORE:
2371 case AMDGPU::SI_SPILL_V192_RESTORE:
2372 case AMDGPU::SI_SPILL_V224_RESTORE:
2373 case AMDGPU::SI_SPILL_V256_RESTORE:
2374 case AMDGPU::SI_SPILL_V288_RESTORE:
2375 case AMDGPU::SI_SPILL_V320_RESTORE:
2376 case AMDGPU::SI_SPILL_V352_RESTORE:
2377 case AMDGPU::SI_SPILL_V384_RESTORE:
2378 case AMDGPU::SI_SPILL_V512_RESTORE:
2379 case AMDGPU::SI_SPILL_V1024_RESTORE:
2380 case AMDGPU::SI_SPILL_A32_RESTORE:
2381 case AMDGPU::SI_SPILL_A64_RESTORE:
2382 case AMDGPU::SI_SPILL_A96_RESTORE:
2383 case AMDGPU::SI_SPILL_A128_RESTORE:
2384 case AMDGPU::SI_SPILL_A160_RESTORE:
2385 case AMDGPU::SI_SPILL_A192_RESTORE:
2386 case AMDGPU::SI_SPILL_A224_RESTORE:
2387 case AMDGPU::SI_SPILL_A256_RESTORE:
2388 case AMDGPU::SI_SPILL_A288_RESTORE:
2389 case AMDGPU::SI_SPILL_A320_RESTORE:
2390 case AMDGPU::SI_SPILL_A352_RESTORE:
2391 case AMDGPU::SI_SPILL_A384_RESTORE:
2392 case AMDGPU::SI_SPILL_A512_RESTORE:
2393 case AMDGPU::SI_SPILL_A1024_RESTORE:
2394 case AMDGPU::SI_SPILL_AV32_RESTORE:
2395 case AMDGPU::SI_SPILL_AV64_RESTORE:
2396 case AMDGPU::SI_SPILL_AV96_RESTORE:
2397 case AMDGPU::SI_SPILL_AV128_RESTORE:
2398 case AMDGPU::SI_SPILL_AV160_RESTORE:
2399 case AMDGPU::SI_SPILL_AV192_RESTORE:
2400 case AMDGPU::SI_SPILL_AV224_RESTORE:
2401 case AMDGPU::SI_SPILL_AV256_RESTORE:
2402 case AMDGPU::SI_SPILL_AV288_RESTORE:
2403 case AMDGPU::SI_SPILL_AV320_RESTORE:
2404 case AMDGPU::SI_SPILL_AV352_RESTORE:
2405 case AMDGPU::SI_SPILL_AV384_RESTORE:
2406 case AMDGPU::SI_SPILL_AV512_RESTORE:
2407 case AMDGPU::SI_SPILL_AV1024_RESTORE:
2408 case AMDGPU::SI_SPILL_WWM_V32_RESTORE:
2409 case AMDGPU::SI_SPILL_WWM_AV32_RESTORE: {
2411 AMDGPU::OpName::vdata);
2412 assert(
TII->getNamedOperand(*
MI, AMDGPU::OpName::soffset)->getReg() ==
2416 : AMDGPU::BUFFER_LOAD_DWORD_OFFSET;
2417 auto *
MBB =
MI->getParent();
2418 bool IsWWMRegSpill =
TII->isWWMRegSpillOpcode(
MI->getOpcode());
2419 if (IsWWMRegSpill) {
2426 TII->getNamedOperand(*
MI, AMDGPU::OpName::offset)->getImm(),
2427 *
MI->memoperands_begin(), RS);
2432 MI->eraseFromParent();
2435 case AMDGPU::S_ADD_I32: {
2437 unsigned OtherOpIdx = FIOperandNum == 1 ? 2 : 1;
2444 Register MaterializedReg = FrameReg;
2447 bool DeadSCC =
MI->getOperand(3).isDead();
2462 MaterializedReg = TmpReg;
2465 int64_t
Offset = FrameInfo.getObjectOffset(
Index);
2470 if (OtherOp.
isImm()) {
2474 if (MaterializedReg)
2478 }
else if (MaterializedReg) {
2482 if (!TmpReg && MaterializedReg == FrameReg) {
2495 MaterializedReg = DstReg;
2507 if (DeadSCC && OtherOp.
isImm() && OtherOp.
getImm() == 0) {
2509 MI->removeOperand(3);
2510 MI->removeOperand(OtherOpIdx);
2511 MI->setDesc(
TII->get(FIOp.
isReg() ? AMDGPU::COPY : AMDGPU::S_MOV_B32));
2512 }
else if (DeadSCC && FIOp.
isImm() && FIOp.
getImm() == 0) {
2514 MI->removeOperand(3);
2515 MI->removeOperand(FIOperandNum);
2517 TII->get(OtherOp.
isReg() ? AMDGPU::COPY : AMDGPU::S_MOV_B32));
2527 int64_t
Offset = FrameInfo.getObjectOffset(
Index);
2529 if (
TII->isFLATScratch(*
MI)) {
2530 assert((int16_t)FIOperandNum ==
2532 AMDGPU::OpName::saddr));
2539 TII->getNamedOperand(*
MI, AMDGPU::OpName::offset);
2543 OffsetOp->
setImm(NewOffset);
2550 unsigned Opc =
MI->getOpcode();
2564 AMDGPU::OpName::vdst_in);
2565 bool TiedVDst = VDstIn != -1 &&
2566 MI->getOperand(VDstIn).isReg() &&
2567 MI->getOperand(VDstIn).isTied();
2569 MI->untieRegOperand(VDstIn);
2579 assert (NewVDst != -1 && NewVDstIn != -1 &&
"Must be tied!");
2580 MI->tieOperands(NewVDst, NewVDstIn);
2582 MI->setDesc(
TII->get(NewOpc));
2590 if (
TII->isImmOperandLegal(*
MI, FIOperandNum, FIOp))
2597 bool UseSGPR =
TII->isOperandLegal(*
MI, FIOperandNum, &FIOp);
2599 if (!
Offset && FrameReg && UseSGPR) {
2605 : &AMDGPU::VGPR_32RegClass;
2612 if ((!FrameReg || !
Offset) && TmpReg) {
2613 unsigned Opc = UseSGPR ? AMDGPU::S_MOV_B32 : AMDGPU::V_MOV_B32_e32;
2616 MIB.addReg(FrameReg);
2623 bool NeedSaveSCC = RS->
isRegUsed(AMDGPU::SCC) &&
2624 !
MI->definesRegister(AMDGPU::SCC,
nullptr);
2629 MI,
false, 0, !UseSGPR);
2633 if ((!TmpSReg && !FrameReg) || (!TmpReg && !UseSGPR))
2644 assert(!(
Offset & 0x1) &&
"Flat scratch offset must be aligned!");
2664 if (TmpSReg == FrameReg) {
2667 !
MI->registerDefIsDead(AMDGPU::SCC,
nullptr)) {
2691 bool IsMUBUF =
TII->isMUBUF(*
MI);
2697 bool LiveSCC = RS->
isRegUsed(AMDGPU::SCC) &&
2698 !
MI->definesRegister(AMDGPU::SCC,
nullptr);
2700 ? &AMDGPU::SReg_32RegClass
2701 : &AMDGPU::VGPR_32RegClass;
2702 bool IsCopy =
MI->getOpcode() == AMDGPU::V_MOV_B32_e32 ||
2703 MI->getOpcode() == AMDGPU::V_MOV_B32_e64 ||
2704 MI->getOpcode() == AMDGPU::S_MOV_B32;
2706 IsCopy ?
MI->getOperand(0).getReg()
2709 int64_t
Offset = FrameInfo.getObjectOffset(
Index);
2711 unsigned OpCode = IsSALU && !LiveSCC ? AMDGPU::S_LSHR_B32
2712 : AMDGPU::V_LSHRREV_B32_e64;
2714 if (IsSALU && LiveSCC) {
2716 AMDGPU::VGPR_32RegClass,
MI,
false, 0);
2720 if (OpCode == AMDGPU::V_LSHRREV_B32_e64)
2726 if (IsSALU && !LiveSCC)
2727 Shift.getInstr()->getOperand(3).setIsDead();
2728 if (IsSALU && LiveSCC) {
2736 ResultReg = NewDest;
2741 if ((MIB =
TII->getAddNoCarry(*
MBB,
MI,
DL, ResultReg, *RS)) !=
2751 const bool IsVOP2 = MIB->
getOpcode() == AMDGPU::V_ADD_U32_e32;
2762 "Need to reuse carry out register");
2767 ConstOffsetReg = getSubReg(MIB.
getReg(1), AMDGPU::sub0);
2769 ConstOffsetReg = MIB.
getReg(1);
2779 if (!MIB || IsSALU) {
2786 Register TmpScaledReg = IsCopy && IsSALU
2789 AMDGPU::SReg_32_XM0RegClass,
MI,
2792 TmpScaledReg.
isValid() ? TmpScaledReg : FrameReg;
2804 AMDGPU::VGPR_32RegClass,
MI,
false, 0,
true);
2807 if ((
Add =
TII->getAddNoCarry(*
MBB,
MI,
DL, TmpResultReg, *RS))) {
2812 if (
Add->getOpcode() == AMDGPU::V_ADD_CO_U32_e64) {
2824 "offset is unsafe for v_mad_u32_u24");
2835 if (!IsInlinableLiteral) {
2844 if (!IsInlinableLiteral) {
2857 Register NewDest = IsCopy ? ResultReg
2859 AMDGPU::SReg_32RegClass, *
Add,
2864 ResultReg = NewDest;
2870 ResultReg = TmpResultReg;
2872 if (!TmpScaledReg.
isValid()) {
2885 MI->eraseFromParent();
2894 assert(
static_cast<int>(FIOperandNum) ==
2896 AMDGPU::OpName::vaddr));
2898 auto &SOffset = *
TII->getNamedOperand(*
MI, AMDGPU::OpName::soffset);
2899 assert((SOffset.isImm() && SOffset.getImm() == 0));
2901 if (FrameReg != AMDGPU::NoRegister)
2902 SOffset.ChangeToRegister(FrameReg,
false);
2904 int64_t
Offset = FrameInfo.getObjectOffset(
Index);
2906 =
TII->getNamedOperand(*
MI, AMDGPU::OpName::offset)->getImm();
2907 int64_t NewOffset = OldImm +
Offset;
2909 if (
TII->isLegalMUBUFImmOffset(NewOffset) &&
2911 MI->eraseFromParent();
2920 if (!
TII->isImmOperandLegal(*
MI, FIOperandNum, FIOp)) {
2943 return &AMDGPU::VReg_64RegClass;
2945 return &AMDGPU::VReg_96RegClass;
2947 return &AMDGPU::VReg_128RegClass;
2949 return &AMDGPU::VReg_160RegClass;
2951 return &AMDGPU::VReg_192RegClass;
2953 return &AMDGPU::VReg_224RegClass;
2955 return &AMDGPU::VReg_256RegClass;
2957 return &AMDGPU::VReg_288RegClass;
2959 return &AMDGPU::VReg_320RegClass;
2961 return &AMDGPU::VReg_352RegClass;
2963 return &AMDGPU::VReg_384RegClass;
2965 return &AMDGPU::VReg_512RegClass;
2967 return &AMDGPU::VReg_1024RegClass;
2975 return &AMDGPU::VReg_64_Align2RegClass;
2977 return &AMDGPU::VReg_96_Align2RegClass;
2979 return &AMDGPU::VReg_128_Align2RegClass;
2981 return &AMDGPU::VReg_160_Align2RegClass;
2983 return &AMDGPU::VReg_192_Align2RegClass;
2985 return &AMDGPU::VReg_224_Align2RegClass;
2987 return &AMDGPU::VReg_256_Align2RegClass;
2989 return &AMDGPU::VReg_288_Align2RegClass;
2991 return &AMDGPU::VReg_320_Align2RegClass;
2993 return &AMDGPU::VReg_352_Align2RegClass;
2995 return &AMDGPU::VReg_384_Align2RegClass;
2997 return &AMDGPU::VReg_512_Align2RegClass;
2999 return &AMDGPU::VReg_1024_Align2RegClass;
3007 return &AMDGPU::VReg_1RegClass;
3009 return &AMDGPU::VGPR_16RegClass;
3011 return &AMDGPU::VGPR_32RegClass;
3019 return &AMDGPU::AReg_64RegClass;
3021 return &AMDGPU::AReg_96RegClass;
3023 return &AMDGPU::AReg_128RegClass;
3025 return &AMDGPU::AReg_160RegClass;
3027 return &AMDGPU::AReg_192RegClass;
3029 return &AMDGPU::AReg_224RegClass;
3031 return &AMDGPU::AReg_256RegClass;
3033 return &AMDGPU::AReg_288RegClass;
3035 return &AMDGPU::AReg_320RegClass;
3037 return &AMDGPU::AReg_352RegClass;
3039 return &AMDGPU::AReg_384RegClass;
3041 return &AMDGPU::AReg_512RegClass;
3043 return &AMDGPU::AReg_1024RegClass;
3051 return &AMDGPU::AReg_64_Align2RegClass;
3053 return &AMDGPU::AReg_96_Align2RegClass;
3055 return &AMDGPU::AReg_128_Align2RegClass;
3057 return &AMDGPU::AReg_160_Align2RegClass;
3059 return &AMDGPU::AReg_192_Align2RegClass;
3061 return &AMDGPU::AReg_224_Align2RegClass;
3063 return &AMDGPU::AReg_256_Align2RegClass;
3065 return &AMDGPU::AReg_288_Align2RegClass;
3067 return &AMDGPU::AReg_320_Align2RegClass;
3069 return &AMDGPU::AReg_352_Align2RegClass;
3071 return &AMDGPU::AReg_384_Align2RegClass;
3073 return &AMDGPU::AReg_512_Align2RegClass;
3075 return &AMDGPU::AReg_1024_Align2RegClass;
3083 return &AMDGPU::AGPR_LO16RegClass;
3085 return &AMDGPU::AGPR_32RegClass;
3093 return &AMDGPU::AV_64RegClass;
3095 return &AMDGPU::AV_96RegClass;
3097 return &AMDGPU::AV_128RegClass;
3099 return &AMDGPU::AV_160RegClass;
3101 return &AMDGPU::AV_192RegClass;
3103 return &AMDGPU::AV_224RegClass;
3105 return &AMDGPU::AV_256RegClass;
3107 return &AMDGPU::AV_288RegClass;
3109 return &AMDGPU::AV_320RegClass;
3111 return &AMDGPU::AV_352RegClass;
3113 return &AMDGPU::AV_384RegClass;
3115 return &AMDGPU::AV_512RegClass;
3117 return &AMDGPU::AV_1024RegClass;
3125 return &AMDGPU::AV_64_Align2RegClass;
3127 return &AMDGPU::AV_96_Align2RegClass;
3129 return &AMDGPU::AV_128_Align2RegClass;
3131 return &AMDGPU::AV_160_Align2RegClass;
3133 return &AMDGPU::AV_192_Align2RegClass;
3135 return &AMDGPU::AV_224_Align2RegClass;
3137 return &AMDGPU::AV_256_Align2RegClass;
3139 return &AMDGPU::AV_288_Align2RegClass;
3141 return &AMDGPU::AV_320_Align2RegClass;
3143 return &AMDGPU::AV_352_Align2RegClass;
3145 return &AMDGPU::AV_384_Align2RegClass;
3147 return &AMDGPU::AV_512_Align2RegClass;
3149 return &AMDGPU::AV_1024_Align2RegClass;
3157 return &AMDGPU::AV_32RegClass;
3166 return &AMDGPU::SGPR_LO16RegClass;
3168 return &AMDGPU::SReg_32RegClass;
3170 return &AMDGPU::SReg_64RegClass;
3172 return &AMDGPU::SGPR_96RegClass;
3174 return &AMDGPU::SGPR_128RegClass;
3176 return &AMDGPU::SGPR_160RegClass;
3178 return &AMDGPU::SGPR_192RegClass;
3180 return &AMDGPU::SGPR_224RegClass;
3182 return &AMDGPU::SGPR_256RegClass;
3184 return &AMDGPU::SGPR_288RegClass;
3186 return &AMDGPU::SGPR_320RegClass;
3188 return &AMDGPU::SGPR_352RegClass;
3190 return &AMDGPU::SGPR_384RegClass;
3192 return &AMDGPU::SGPR_512RegClass;
3194 return &AMDGPU::SGPR_1024RegClass;
3202 if (Reg.isVirtual())
3203 RC =
MRI.getRegClass(Reg);
3205 RC = getPhysRegBaseClass(Reg);
3211 unsigned Size = getRegSizeInBits(*SRC);
3213 assert(VRC &&
"Invalid register class size");
3219 unsigned Size = getRegSizeInBits(*SRC);
3221 assert(ARC &&
"Invalid register class size");
3227 unsigned Size = getRegSizeInBits(*VRC);
3229 return &AMDGPU::SGPR_32RegClass;
3231 assert(SRC &&
"Invalid register class size");
3238 unsigned SubIdx)
const {
3241 getMatchingSuperRegClass(SuperRC, SubRC, SubIdx);
3242 return MatchRC && MatchRC->
hasSubClassEq(SuperRC) ? MatchRC :
nullptr;
3258 unsigned SrcSubReg)
const {
3275 return getCommonSubClass(DefRC, SrcRC) !=
nullptr;
3291 if (ReserveHighestRegister) {
3293 if (
MRI.isAllocatable(Reg) && !
MRI.isPhysRegUsed(Reg))
3297 if (
MRI.isAllocatable(Reg) && !
MRI.isPhysRegUsed(Reg))
3314 unsigned EltSize)
const {
3316 assert(RegBitWidth >= 32 && RegBitWidth <= 1024);
3318 const unsigned RegDWORDs = RegBitWidth / 32;
3319 const unsigned EltDWORDs = EltSize / 4;
3320 assert(RegSplitParts.size() + 1 >= EltDWORDs);
3322 const std::vector<int16_t> &Parts = RegSplitParts[EltDWORDs - 1];
3323 const unsigned NumParts = RegDWORDs / EltDWORDs;
3325 return ArrayRef(Parts.data(), NumParts);
3331 return Reg.isVirtual() ?
MRI.getRegClass(Reg) : getPhysRegBaseClass(Reg);
3338 return getSubRegisterClass(SrcRC, MO.
getSubReg());
3363 unsigned SrcSize = getRegSizeInBits(*SrcRC);
3364 unsigned DstSize = getRegSizeInBits(*DstRC);
3365 unsigned NewSize = getRegSizeInBits(*NewRC);
3371 if (SrcSize <= 32 || DstSize <= 32)
3374 return NewSize <= DstSize || NewSize <= SrcSize;
3383 switch (RC->
getID()) {
3385 return AMDGPUGenRegisterInfo::getRegPressureLimit(RC, MF);
3386 case AMDGPU::VGPR_32RegClassID:
3388 case AMDGPU::SGPR_32RegClassID:
3389 case AMDGPU::SGPR_LO16RegClassID:
3395 unsigned Idx)
const {
3396 if (
Idx == AMDGPU::RegisterPressureSets::VGPR_32 ||
3397 Idx == AMDGPU::RegisterPressureSets::AGPR_32)
3401 if (
Idx == AMDGPU::RegisterPressureSets::SReg_32)
3409 static const int Empty[] = { -1 };
3411 if (RegPressureIgnoredUnits[RegUnit])
3414 return AMDGPUGenRegisterInfo::getRegUnitPressureSets(RegUnit);
3419 return AMDGPU::SGPR30_SGPR31;
3425 switch (RB.
getID()) {
3426 case AMDGPU::VGPRRegBankID:
3429 case AMDGPU::VCCRegBankID:
3431 return isWave32 ? &AMDGPU::SReg_32_XM0_XEXECRegClass
3432 : &AMDGPU::SReg_64_XEXECRegClass;
3433 case AMDGPU::SGPRRegBankID:
3435 case AMDGPU::AGPRRegBankID:
3450 return getAllocatableClass(RC);
3456 return isWave32 ? AMDGPU::VCC_LO : AMDGPU::VCC;
3460 return isWave32 ? AMDGPU::EXEC_LO : AMDGPU::EXEC;
3466 : &AMDGPU::VReg_64RegClass;
3471 switch ((
int)RCID) {
3472 case AMDGPU::SReg_1RegClassID:
3474 case AMDGPU::SReg_1_XEXECRegClassID:
3475 return isWave32 ? &AMDGPU::SReg_32_XM0_XEXECRegClass
3476 : &AMDGPU::SReg_64_XEXECRegClass;
3480 return AMDGPUGenRegisterInfo::getRegClass(RCID);
3493 if (Reg.isVirtual()) {
3498 :
MRI.getMaxLaneMaskForVReg(Reg);
3502 if ((S.LaneMask & SubLanes) == SubLanes) {
3503 V = S.getVNInfoAt(UseIdx);
3515 for (
MCRegUnit Unit : regunits(Reg.asMCReg())) {
3530 if (!Def || !MDT.dominates(Def, &
Use))
3533 assert(Def->modifiesRegister(Reg,
this));
3539 assert(getRegSizeInBits(*getPhysRegBaseClass(Reg)) <= 32);
3542 AMDGPU::SReg_32RegClass,
3543 AMDGPU::AGPR_32RegClass } ) {
3544 if (
MCPhysReg Super = getMatchingSuperReg(Reg, AMDGPU::lo16, &RC))
3547 if (
MCPhysReg Super = getMatchingSuperReg(Reg, AMDGPU::hi16,
3548 &AMDGPU::VGPR_32RegClass)) {
3552 return AMDGPU::NoRegister;
3575 unsigned Size = getRegSizeInBits(*RC);
3609 return std::min(128u, getSubRegIdxSize(
SubReg));
3613 return std::min(32u, getSubRegIdxSize(
SubReg));
unsigned const MachineRegisterInfo * MRI
Provides AMDGPU specific target descriptions.
This file declares the targeting of the RegisterBankInfo class for AMDGPU.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static const Function * getParent(const Value *V)
Analysis containing CSE Info
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
AMD GCN specific subclass of TargetSubtarget.
const HexagonInstrInfo * TII
static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
Return the first found DebugLoc that has a DILocation, given a range of instructions.
unsigned const TargetRegisterInfo * TRI
static unsigned getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo)
This file declares the machine register scavenger class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static int getOffenMUBUFStore(unsigned Opc)
static const TargetRegisterClass * getAnyAGPRClassForBitWidth(unsigned BitWidth)
static int getOffsetMUBUFLoad(unsigned Opc)
static const std::array< unsigned, 17 > SubRegFromChannelTableWidthMap
static const TargetRegisterClass * getAlignedAGPRClassForBitWidth(unsigned BitWidth)
static bool buildMUBUFOffsetLoadStore(const GCNSubtarget &ST, MachineFrameInfo &MFI, MachineBasicBlock::iterator MI, int Index, int64_t Offset)
static unsigned getFlatScratchSpillOpcode(const SIInstrInfo *TII, unsigned LoadStoreOp, unsigned EltSize)
static const TargetRegisterClass * getAlignedVGPRClassForBitWidth(unsigned BitWidth)
static int getOffsetMUBUFStore(unsigned Opc)
static const TargetRegisterClass * getAnyVGPRClassForBitWidth(unsigned BitWidth)
static cl::opt< bool > EnableSpillSGPRToVGPR("amdgpu-spill-sgpr-to-vgpr", cl::desc("Enable spilling SGPRs to VGPRs"), cl::ReallyHidden, cl::init(true))
static unsigned getNumSubRegsForSpillOp(unsigned Op)
static const TargetRegisterClass * getAlignedVectorSuperClassForBitWidth(unsigned BitWidth)
static const TargetRegisterClass * getAnyVectorSuperClassForBitWidth(unsigned BitWidth)
static MachineInstrBuilder spillVGPRtoAGPR(const GCNSubtarget &ST, MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, int Index, unsigned Lane, unsigned ValueReg, bool IsKill)
static bool isFIPlusImmOrVGPR(const SIRegisterInfo &TRI, const MachineInstr &MI)
static int getOffenMUBUFLoad(unsigned Opc)
Interface definition for SIRegisterInfo.
static const char * getRegisterName(MCRegister Reg)
uint32_t getLDSSize() const
bool isBottomOfStack() const
unsigned getOccupancyWithLocalMemSize(uint32_t Bytes, const Function &) const
Inverse of getMaxLocalMemWithWaveCount.
bool useRealTrue16Insts() const
Return true if real (non-fake) variants of True16 instructions using 16-bit registers should be code-...
unsigned getWavefrontSizeLog2() const
unsigned getWavefrontSize() const
bool hasInv2PiInlineImm() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
bool empty() const
empty - Check if the array is empty.
void resize(unsigned N, bool t=false)
resize - Grow or shrink the bitvector.
This class represents an Operation in the Expression.
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
bool hasGFX90AInsts() const
bool hasMFMAInlineLiteralBug() const
const SIInstrInfo * getInstrInfo() const override
unsigned getConstantBusLimit(unsigned Opcode) const
bool needsAlignedVGPRs() const
Return if operations acting on VGPR tuples require even alignment.
bool enableFlatScratch() const
unsigned getMaxNumVGPRs(unsigned WavesPerEU) const
const SIFrameLowering * getFrameLowering() const override
unsigned getMaxNumSGPRs(unsigned WavesPerEU, bool Addressable) const
bool hasVOP3Literal() const
bool hasFlatScratchSTMode() const
unsigned getMaxWaveScratchSize() const
LiveInterval - This class represents the liveness of a register, or stack slot.
bool hasSubRanges() const
Returns true if subregister liveness information is available.
iterator_range< subrange_iterator > subranges()
void removeAllRegUnitsForPhysReg(MCRegister Reg)
Remove associated live ranges for the register units associated with Reg.
bool hasInterval(Register Reg) const
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction associated with the given index.
MachineDominatorTree & getDomTree()
SlotIndex getInstructionIndex(const MachineInstr &Instr) const
Returns the base index of the given instruction.
LiveRange & getRegUnit(unsigned Unit)
Return the live range for register unit Unit.
LiveInterval & getInterval(Register Reg)
This class represents the liveness of a register, stack slot, etc.
VNInfo * getVNInfoAt(SlotIndex Idx) const
getVNInfoAt - Return the VNInfo that is live at Idx, or NULL.
A set of register units used to track register liveness.
bool available(MCPhysReg Reg) const
Returns true if no part of physical register Reg is live.
Describe properties that are true of each instruction in the target description file.
MCRegAliasIterator enumerates all registers aliasing Reg.
Wrapper class representing physical registers. Should be passed by value.
static MCRegister from(unsigned Val)
Check the provided unsigned value is a valid MCRegister.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
bool hasCalls() const
Return true if the current function has any function calls.
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
bool hasStackObjects() const
Return true if there are any stack objects in this function.
uint8_t getStackID(int ObjectIdx) const
unsigned getNumFixedObjects() const
Return the number of fixed objects.
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, LLT MemTy, Align base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
Register getReg(unsigned Idx) const
Get the register for the operand index.
const MachineInstrBuilder & setOperandDead(unsigned OpIdx) const
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & add(const MachineOperand &MO) const
const MachineInstrBuilder & addFrameIndex(int Idx) const
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & cloneMemRefs(const MachineInstr &OtherMI) const
MachineInstr * getInstr() const
If conversion operators fail, use this method to get the MachineInstr explicitly.
const MachineInstrBuilder & addDef(Register RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register definition operand.
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
void setAsmPrinterFlag(uint8_t Flag)
Set a flag for the AsmPrinter.
const MachineOperand & getOperand(unsigned i) const
A description of a memory reference used in the backend.
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
const MachinePointerInfo & getPointerInfo() const
Flags getFlags() const
Return the raw flags of the source value,.
MachineOperand class - Representation of each machine instruction operand.
unsigned getSubReg() const
void setImm(int64_t immVal)
void setIsRenamable(bool Val=true)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
void setIsDead(bool Val=true)
void setReg(Register Reg)
Change the register this operand corresponds to.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
void ChangeToImmediate(int64_t ImmVal, unsigned TargetFlags=0)
ChangeToImmediate - Replace this operand with a new immediate operand of the specified value.
void setIsKill(bool Val=true)
void ChangeToRegister(Register Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isDebug=false)
ChangeToRegister - Replace this operand with a new register operand of the specified value.
Register getReg() const
getReg - Returns the register number.
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
bool isReserved(MCRegister PhysReg) const
isReserved - Returns true when PhysReg is a reserved register.
T dyn_cast() const
Returns the current pointer if it is of the specified pointer type, otherwise returns null.
bool isRegUsed(Register Reg, bool includeReserved=true) const
Return if a specific register is currently used.
void setRegUsed(Register Reg, LaneBitmask LaneMask=LaneBitmask::getAll())
Tell the scavenger a register is used.
void assignRegToScavengingIndex(int FI, Register Reg, MachineInstr *Restore=nullptr)
Record that Reg is in use at scavenging index FI.
Register scavengeRegisterBackwards(const TargetRegisterClass &RC, MachineBasicBlock::iterator To, bool RestoreAfter, int SPAdj, bool AllowSpill=true)
Make a register of the specific register class available from the current position backwards to the p...
Holds all the information related to register banks.
virtual bool isDivergentRegBank(const RegisterBank *RB) const
Returns true if the register bank is considered divergent.
const RegisterBank & getRegBank(unsigned ID)
Get the register bank identified by ID.
This class implements the register bank concept.
unsigned getID() const
Get the identifier of this register bank.
Wrapper class representing virtual and physical registers.
constexpr bool isValid() const
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register.
static bool isFLATScratch(const MachineInstr &MI)
static bool isMUBUF(const MachineInstr &MI)
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
bool usesAGPRs(const MachineFunction &MF) const
ArrayRef< MCPhysReg > getAGPRSpillVGPRs() const
MCPhysReg getVGPRToAGPRSpill(int FrameIndex, unsigned Lane) const
Register getLongBranchReservedReg() const
Register getStackPtrOffsetReg() const
Register getScratchRSrcReg() const
Returns the physical register reserved for use as the resource descriptor for scratch accesses.
ArrayRef< MCPhysReg > getVGPRSpillAGPRs() const
int getScavengeFI(MachineFrameInfo &MFI, const SIRegisterInfo &TRI)
ArrayRef< SIRegisterInfo::SpilledReg > getSGPRSpillToVirtualVGPRLanes(int FrameIndex) const
Register getSGPRForEXECCopy() const
ArrayRef< SIRegisterInfo::SpilledReg > getSGPRSpillToPhysicalVGPRLanes(int FrameIndex) const
Register getVGPRForAGPRCopy() const
Register getFrameOffsetReg() const
void addToSpilledVGPRs(unsigned num)
const ReservedRegSet & getWWMReservedRegs() const
void addToSpilledSGPRs(unsigned num)
Register materializeFrameBaseRegister(MachineBasicBlock *MBB, int FrameIdx, int64_t Offset) const override
int64_t getScratchInstrOffset(const MachineInstr *MI) const
bool isFrameOffsetLegal(const MachineInstr *MI, Register BaseReg, int64_t Offset) const override
const TargetRegisterClass * getRegClass(unsigned RCID) const
const TargetRegisterClass * getCompatibleSubRegClass(const TargetRegisterClass *SuperRC, const TargetRegisterClass *SubRC, unsigned SubIdx) const
Returns a register class which is compatible with SuperRC, such that a subregister exists with class ...
ArrayRef< MCPhysReg > getAllSGPR64(const MachineFunction &MF) const
Return all SGPR64 which satisfy the waves per execution unit requirement of the subtarget.
MCRegister findUnusedRegister(const MachineRegisterInfo &MRI, const TargetRegisterClass *RC, const MachineFunction &MF, bool ReserveHighestVGPR=false) const
Returns a lowest register that is not used at any point in the function.
static unsigned getSubRegFromChannel(unsigned Channel, unsigned NumRegs=1)
MCPhysReg get32BitRegister(MCPhysReg Reg) const
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
bool requiresFrameIndexReplacementScavenging(const MachineFunction &MF) const override
const TargetRegisterClass * getProperlyAlignedRC(const TargetRegisterClass *RC) const
bool shouldRealignStack(const MachineFunction &MF) const override
bool restoreSGPR(MachineBasicBlock::iterator MI, int FI, RegScavenger *RS, SlotIndexes *Indexes=nullptr, LiveIntervals *LIS=nullptr, bool OnlyToVGPR=false, bool SpillToPhysVGPRLane=false) const
bool isProperlyAlignedRC(const TargetRegisterClass &RC) const
const TargetRegisterClass * getEquivalentVGPRClass(const TargetRegisterClass *SRC) const
Register getFrameRegister(const MachineFunction &MF) const override
LLVM_READONLY const TargetRegisterClass * getVectorSuperClassForBitWidth(unsigned BitWidth) const
bool spillEmergencySGPR(MachineBasicBlock::iterator MI, MachineBasicBlock &RestoreMBB, Register SGPR, RegScavenger *RS) const
SIRegisterInfo(const GCNSubtarget &ST)
const uint32_t * getAllVGPRRegMask() const
MCRegister getReturnAddressReg(const MachineFunction &MF) const
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
bool hasBasePointer(const MachineFunction &MF) const
const TargetRegisterClass * getCrossCopyRegClass(const TargetRegisterClass *RC) const override
Returns a legal register class to copy a register in the specified class to or from.
ArrayRef< int16_t > getRegSplitParts(const TargetRegisterClass *RC, unsigned EltSize) const
ArrayRef< MCPhysReg > getAllSGPR32(const MachineFunction &MF) const
Return all SGPR32 which satisfy the waves per execution unit requirement of the subtarget.
const TargetRegisterClass * getLargestLegalSuperClass(const TargetRegisterClass *RC, const MachineFunction &MF) const override
MCRegister reservedPrivateSegmentBufferReg(const MachineFunction &MF) const
Return the end register initially reserved for the scratch buffer in case spilling is needed.
bool eliminateSGPRToVGPRSpillFrameIndex(MachineBasicBlock::iterator MI, int FI, RegScavenger *RS, SlotIndexes *Indexes=nullptr, LiveIntervals *LIS=nullptr, bool SpillToPhysVGPRLane=false) const
Special case of eliminateFrameIndex.
bool isVGPR(const MachineRegisterInfo &MRI, Register Reg) const
void buildSpillLoadStore(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, unsigned LoadStoreOp, int Index, Register ValueReg, bool ValueIsKill, MCRegister ScratchOffsetReg, int64_t InstrOffset, MachineMemOperand *MMO, RegScavenger *RS, LiveRegUnits *LiveUnits=nullptr) const
bool isAsmClobberable(const MachineFunction &MF, MCRegister PhysReg) const override
LLVM_READONLY const TargetRegisterClass * getAGPRClassForBitWidth(unsigned BitWidth) const
static bool isChainScratchRegister(Register VGPR)
bool requiresRegisterScavenging(const MachineFunction &Fn) const override
bool opCanUseInlineConstant(unsigned OpType) const
const TargetRegisterClass * getRegClassForSizeOnBank(unsigned Size, const RegisterBank &Bank) const
const TargetRegisterClass * getConstrainedRegClassForOperand(const MachineOperand &MO, const MachineRegisterInfo &MRI) const override
bool isUniformReg(const MachineRegisterInfo &MRI, const RegisterBankInfo &RBI, Register Reg) const override
const uint32_t * getNoPreservedMask() const override
StringRef getRegAsmName(MCRegister Reg) const override
const uint32_t * getAllAllocatableSRegMask() const
MCRegister getAlignedHighSGPRForRC(const MachineFunction &MF, const unsigned Align, const TargetRegisterClass *RC) const
Return the largest available SGPR aligned to Align for the register class RC.
const TargetRegisterClass * getRegClassForReg(const MachineRegisterInfo &MRI, Register Reg) const
const MCPhysReg * getCalleeSavedRegsViaCopy(const MachineFunction *MF) const
const uint32_t * getAllVectorRegMask() const
const TargetRegisterClass * getEquivalentAGPRClass(const TargetRegisterClass *SRC) const
static LLVM_READONLY const TargetRegisterClass * getSGPRClassForBitWidth(unsigned BitWidth)
const TargetRegisterClass * getRegClassForTypeOnBank(LLT Ty, const RegisterBank &Bank) const
bool opCanUseLiteralConstant(unsigned OpType) const
Register getBaseRegister() const
LLVM_READONLY const TargetRegisterClass * getVGPRClassForBitWidth(unsigned BitWidth) const
bool requiresFrameIndexScavenging(const MachineFunction &MF) const override
bool shouldRewriteCopySrc(const TargetRegisterClass *DefRC, unsigned DefSubReg, const TargetRegisterClass *SrcRC, unsigned SrcSubReg) const override
static bool isVGPRClass(const TargetRegisterClass *RC)
unsigned getHWRegIndex(MCRegister Reg) const
MachineInstr * findReachingDef(Register Reg, unsigned SubReg, MachineInstr &Use, MachineRegisterInfo &MRI, LiveIntervals *LIS) const
bool isSGPRReg(const MachineRegisterInfo &MRI, Register Reg) const
const TargetRegisterClass * getEquivalentSGPRClass(const TargetRegisterClass *VRC) const
unsigned getRegPressureLimit(const TargetRegisterClass *RC, MachineFunction &MF) const override
ArrayRef< MCPhysReg > getAllSGPR128(const MachineFunction &MF) const
Return all SGPR128 which satisfy the waves per execution unit requirement of the subtarget.
unsigned getRegPressureSetLimit(const MachineFunction &MF, unsigned Idx) const override
BitVector getReservedRegs(const MachineFunction &MF) const override
bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const override
const TargetRegisterClass * getRegClassForOperandReg(const MachineRegisterInfo &MRI, const MachineOperand &MO) const
const uint32_t * getAllAGPRRegMask() const
bool shouldCoalesce(MachineInstr *MI, const TargetRegisterClass *SrcRC, unsigned SubReg, const TargetRegisterClass *DstRC, unsigned DstSubReg, const TargetRegisterClass *NewRC, LiveIntervals &LIS) const override
const TargetRegisterClass * getBoolRC() const
const TargetRegisterClass * getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const override
bool isAGPR(const MachineRegisterInfo &MRI, Register Reg) const
bool eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS) const override
bool spillSGPR(MachineBasicBlock::iterator MI, int FI, RegScavenger *RS, SlotIndexes *Indexes=nullptr, LiveIntervals *LIS=nullptr, bool OnlyToVGPR=false, bool SpillToPhysVGPRLane=false) const
If OnlyToVGPR is true, this will only succeed if this manages to find a free VGPR lane to spill.
MCRegister getExec() const
MCRegister getVCC() const
int64_t getFrameIndexInstrOffset(const MachineInstr *MI, int Idx) const override
bool isVectorSuperClass(const TargetRegisterClass *RC) const
const TargetRegisterClass * getWaveMaskRegClass() const
unsigned getSubRegAlignmentNumBits(const TargetRegisterClass *RC, unsigned SubReg) const
void resolveFrameIndex(MachineInstr &MI, Register BaseReg, int64_t Offset) const override
bool requiresVirtualBaseRegisters(const MachineFunction &Fn) const override
const TargetRegisterClass * getVGPR64Class() const
void buildVGPRSpillLoadStore(SGPRSpillBuilder &SB, int Index, int Offset, bool IsLoad, bool IsKill=true) const
static bool isSGPRClass(const TargetRegisterClass *RC)
static bool isAGPRClass(const TargetRegisterClass *RC)
const int * getRegUnitPressureSets(unsigned RegUnit) const override
SlotIndex - An opaque wrapper around machine indexes.
bool isValid() const
Returns true if this is a valid index.
SlotIndex insertMachineInstrInMaps(MachineInstr &MI, bool Late=false)
Insert the given machine instruction into the mapping.
SlotIndex replaceMachineInstrInMaps(MachineInstr &MI, MachineInstr &NewMI)
ReplaceMachineInstrInMaps - Replacing a machine instr with a new one in maps used by register allocat...
StringRef - Represent a constant reference to a string, i.e.
const uint8_t TSFlags
Configurable target specific flags.
unsigned getID() const
Return the register class ID number.
bool hasSubClassEq(const TargetRegisterClass *RC) const
Returns true if RC is a sub-class of or equal to this class.
bool hasSuperClassEq(const TargetRegisterClass *RC) const
Returns true if RC is a super-class of or equal to this class.
virtual const TargetRegisterClass * getLargestLegalSuperClass(const TargetRegisterClass *RC, const MachineFunction &) const
Returns the largest super class of RC that is legal to use in the current sub-target and has the same...
virtual bool shouldRealignStack(const MachineFunction &MF) const
True if storage within the function requires the stack pointer to be aligned more than the normal cal...
A Use represents the edge between a Value definition and its users.
VNInfo - Value Number Information.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ PRIVATE_ADDRESS
Address space for private memory.
bool isHi16Reg(MCRegister Reg, const MCRegisterInfo &MRI)
LLVM_READONLY int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx)
LLVM_READONLY int getFlatScratchInstSVfromSS(uint16_t Opcode)
LLVM_READONLY int getFlatScratchInstSTfromSS(uint16_t Opcode)
LLVM_READONLY int getFlatScratchInstSVfromSVS(uint16_t Opcode)
bool isInlinableLiteral32(int32_t Literal, bool HasInv2Pi)
LLVM_READONLY bool hasNamedOperand(uint64_t Opcode, uint64_t NamedIdx)
LLVM_READNONE bool isInlinableIntLiteral(int64_t Literal)
Is this literal inlinable, and not one of the values intended for floating point values.
@ OPERAND_REG_INLINE_AC_FIRST
@ OPERAND_REG_INLINE_AC_LAST
unsigned getRegBitWidth(const TargetRegisterClass &RC)
Get the size in bits of a register from the register class RC.
@ AMDGPU_Gfx
Used for AMD graphics targets.
@ AMDGPU_CS_ChainPreserve
Used on AMDGPUs to give the middle-end more control over argument placement.
@ AMDGPU_CS_Chain
Used on AMDGPUs to give the middle-end more control over argument placement.
@ Cold
Attempts to make code in the caller as efficient as possible under the assumption that the call is no...
@ Fast
Attempts to make calls as fast as possible (e.g.
@ C
The default llvm calling convention, compatible with C.
@ Implicit
Not emitted register (e.g. carry, or temporary result).
@ Renamable
Register that may be renamed.
@ Kill
The last use of a register.
@ Undef
Value of the register doesn't matter.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
constexpr T alignDown(U Value, V Align, W Skew=0)
Returns the largest unsigned integer less than or equal to Value and is Skew mod Align.
auto reverse(ContainerTy &&C)
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
constexpr T divideCeil(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
unsigned getDefRegState(bool B)
unsigned getKillRegState(bool B)
void call_once(once_flag &flag, Function &&F, Args &&... ArgList)
Execute the function specified as a parameter once.
constexpr unsigned BitWidth
static const MachineMemOperand::Flags MOLastUse
Mark the MMO of a load as the last use.
Align commonAlignment(Align A, uint64_t Offset)
Returns the alignment that satisfies both alignments.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Description of the encoding of one expression Op.
This class contains a discriminated union of information about pointers in memory operands,...
MachinePointerInfo getWithOffset(int64_t O) const
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
void setMI(MachineBasicBlock *NewMBB, MachineBasicBlock::iterator NewMI)
ArrayRef< int16_t > SplitParts
SIMachineFunctionInfo & MFI
SGPRSpillBuilder(const SIRegisterInfo &TRI, const SIInstrInfo &TII, bool IsWave32, MachineBasicBlock::iterator MI, int Index, RegScavenger *RS)
SGPRSpillBuilder(const SIRegisterInfo &TRI, const SIInstrInfo &TII, bool IsWave32, MachineBasicBlock::iterator MI, Register Reg, bool IsKill, int Index, RegScavenger *RS)
PerVGPRData getPerVGPRData()
MachineBasicBlock::iterator MI
void readWriteTmpVGPR(unsigned Offset, bool IsLoad)
const SIRegisterInfo & TRI
The llvm::once_flag structure.