67#define DEBUG_TYPE "hexagon-instrinfo"
69#define GET_INSTRINFO_CTOR_DTOR
70#define GET_INSTRMAP_INFO
72#include "HexagonGenDFAPacketizer.inc"
73#include "HexagonGenInstrInfo.inc"
77 "packetization boundary."));
84 cl::desc(
"Disable schedule adjustment for new value stores."));
88 cl::desc(
"Enable timing class latency"));
92 cl::desc(
"Enable vec alu forwarding"));
96 cl::desc(
"Enable vec acc forwarding"));
104 cl::desc(
"Use the DFA based hazard recognizer."));
119void HexagonInstrInfo::anchor() {}
124 RegInfo(ST.getHwMode()), Subtarget(ST) {}
133 return (
Reg >= Hexagon::R0 &&
Reg <= Hexagon::R7) ||
134 (
Reg >= Hexagon::R16 &&
Reg <= Hexagon::R23);
146 for (; MIB != MIE; ++MIB) {
147 if (!MIB->isDebugInstr())
158 if (!(
MI.getMF()->getFunction().hasOptSize()))
159 return MI.isAsCheapAsAMove();
161 if (
MI.getOpcode() == Hexagon::A2_tfrsi) {
162 auto Op =
MI.getOperand(1);
170 int64_t
Imm =
Op.getImm();
175 return MI.isAsCheapAsAMove();
190 if (
isFloat(
MI) &&
MI.hasRegisterImplicitUseOperand(Hexagon::USR))
204 if (EndLoopOp == Hexagon::ENDLOOP0) {
205 LOOPi = Hexagon::J2_loop0i;
206 LOOPr = Hexagon::J2_loop0r;
208 LOOPi = Hexagon::J2_loop1i;
209 LOOPr = Hexagon::J2_loop1r;
220 unsigned Opc =
I.getOpcode();
221 if (
Opc == LOOPi ||
Opc == LOOPr)
225 if (
Opc == EndLoopOp &&
I.getOperand(0).getMBB() != TargetBB)
252 Uses.push_back(MO.getReg());
291 int &FrameIndex)
const {
292 switch (
MI.getOpcode()) {
295 case Hexagon::L2_loadri_io:
296 case Hexagon::L2_loadrd_io:
297 case Hexagon::V6_vL32b_ai:
298 case Hexagon::V6_vL32b_nt_ai:
299 case Hexagon::V6_vL32Ub_ai:
300 case Hexagon::LDriw_pred:
301 case Hexagon::LDriw_ctr:
302 case Hexagon::PS_vloadrq_ai:
303 case Hexagon::PS_vloadrw_ai:
304 case Hexagon::PS_vloadrw_nt_ai:
305 case Hexagon::PS_loadrl:
306 case Hexagon::PS_loadrll: {
314 return MI.getOperand(0).getReg();
317 case Hexagon::L2_ploadrit_io:
318 case Hexagon::L2_ploadrif_io:
319 case Hexagon::L2_ploadrdt_io:
320 case Hexagon::L2_ploadrdf_io: {
328 return MI.getOperand(0).getReg();
341 int &FrameIndex)
const {
342 switch (
MI.getOpcode()) {
345 case Hexagon::S2_storerb_io:
346 case Hexagon::S2_storerh_io:
347 case Hexagon::S2_storeri_io:
348 case Hexagon::S2_storerd_io:
349 case Hexagon::V6_vS32b_ai:
350 case Hexagon::V6_vS32Ub_ai:
351 case Hexagon::STriw_pred:
352 case Hexagon::STriw_ctr:
353 case Hexagon::PS_vstorerq_ai:
354 case Hexagon::PS_vstorerw_ai:
355 case Hexagon::PS_storerl:
356 case Hexagon::PS_storerll: {
364 return MI.getOperand(2).getReg();
367 case Hexagon::S2_pstorerbt_io:
368 case Hexagon::S2_pstorerbf_io:
369 case Hexagon::S2_pstorerht_io:
370 case Hexagon::S2_pstorerhf_io:
371 case Hexagon::S2_pstorerit_io:
372 case Hexagon::S2_pstorerif_io:
373 case Hexagon::S2_pstorerdt_io:
374 case Hexagon::S2_pstorerdf_io: {
382 return MI.getOperand(3).getReg();
398 for (++MII; MII !=
MBB->instr_end() && MII->isInsideBundle(); ++MII)
416 for (++MII; MII !=
MBB->instr_end() && MII->isInsideBundle(); ++MII)
444 bool AllowModify)
const {
451 if (
I ==
MBB.instr_begin())
471 }
while (
I !=
MBB.instr_begin());
476 while (
I->isDebugInstr()) {
477 if (
I ==
MBB.instr_begin())
482 bool JumpToBlock =
I->getOpcode() == Hexagon::J2_jump &&
483 I->getOperand(0).isMBB();
485 if (AllowModify && JumpToBlock &&
486 MBB.isLayoutSuccessor(
I->getOperand(0).getMBB())) {
488 I->eraseFromParent();
490 if (
I ==
MBB.instr_begin())
494 if (!isUnpredicatedTerminator(*
I))
502 if (&*
I != LastInst && !
I->isBundle() && isUnpredicatedTerminator(*
I)) {
504 SecondLastInst = &*
I;
509 if (
I ==
MBB.instr_begin())
515 int SecLastOpcode = SecondLastInst ? SecondLastInst->
getOpcode() : 0;
518 if (LastOpcode == Hexagon::J2_jump && !LastInst->
getOperand(0).
isMBB())
520 if (SecLastOpcode == Hexagon::J2_jump &&
531 if (LastInst && !SecondLastInst) {
532 if (LastOpcode == Hexagon::J2_jump) {
542 if (LastOpcodeHasJMP_c) {
557 <<
" with one jump\n";);
564 if (SecLastOpcodeHasJMP_c && (LastOpcode == Hexagon::J2_jump)) {
575 if (SecLastOpcodeHasNVJump &&
577 (LastOpcode == Hexagon::J2_jump)) {
588 if (SecLastOpcode == Hexagon::J2_jump && LastOpcode == Hexagon::J2_jump) {
592 I->eraseFromParent();
597 if (
isEndLoopN(SecLastOpcode) && LastOpcode == Hexagon::J2_jump) {
605 <<
" with two jumps";);
611 int *BytesRemoved)
const {
612 assert(!BytesRemoved &&
"code size not handled");
617 while (
I !=
MBB.begin()) {
619 if (
I->isDebugInstr())
624 if (
Count && (
I->getOpcode() == Hexagon::J2_jump))
638 int *BytesAdded)
const {
639 unsigned BOpc = Hexagon::J2_jump;
640 unsigned BccOpc = Hexagon::J2_jumpt;
642 assert(
TBB &&
"insertBranch must not be told to insert a fallthrough");
643 assert(!BytesAdded &&
"code size not handled");
648 if (!
Cond.empty() &&
Cond[0].isImm())
649 BccOpc =
Cond[0].getImm();
659 auto Term =
MBB.getFirstTerminator();
669 int EndLoopOp =
Cond[0].getImm();
676 assert(
Loop !=
nullptr &&
"Inserting an ENDLOOP without a LOOP");
677 Loop->getOperand(0).setMBB(
TBB);
681 assert((
Cond.size() == 3) &&
"Only supporting rr/ri version of nvjump");
692 }
else if(
Cond[2].isImm()) {
698 assert((
Cond.size() == 2) &&
"Malformed cond vector");
706 "Cond. cannot be empty when multiple branchings are required");
708 "NV-jump cannot be inserted with another branch");
711 int EndLoopOp =
Cond[0].getImm();
718 assert(
Loop !=
nullptr &&
"Inserting an ENDLOOP without a LOOP");
719 Loop->getOperand(0).setMBB(
TBB);
748 TripCount =
Loop->getOpcode() == Hexagon::J2_loop0r
750 :
Loop->getOperand(1).getImm();
752 LoopCount =
Loop->getOperand(1).getReg();
755 bool shouldIgnoreForPipelining(
const MachineInstr *
MI)
const override {
757 return MI == EndLoop ||
TII->isHMXActivateInstr(*
MI) ||
758 TII->isHMXWeightInstr(*
MI);
761 std::optional<bool> createTripCountGreaterCondition(
762 int TC, MachineBasicBlock &
MBB,
763 SmallVectorImpl<MachineOperand> &
Cond)
override {
764 if (TripCount == -1) {
768 TII->get(Hexagon::C2_cmpgtui),
Done)
776 return TripCount > TC;
779 void setPreheader(MachineBasicBlock *NewPreheader)
override {
784 void adjustTripCount(
int TripCountAdjust)
override {
787 if (
Loop->getOpcode() == Hexagon::J2_loop0i ||
788 Loop->getOpcode() == Hexagon::J2_loop1i) {
789 int64_t TripCount =
Loop->getOperand(1).getImm() + TripCountAdjust;
790 assert(TripCount > 0 &&
"Can't create an empty or negative loop!");
791 Loop->getOperand(1).setImm(TripCount);
800 TII->get(Hexagon::A2_addi), NewLoopCount)
806 void disposed(LiveIntervals *LIS)
override {
809 Loop->eraseFromParent();
814std::unique_ptr<TargetInstrInfo::PipelinerLoopInfo>
822 LoopBB,
I->getOpcode(),
I->getOperand(0).getMBB(), VisitedBBs);
824 return std::make_unique<HexagonPipelinerLoopInfo>(LoopInst, &*
I);
830 unsigned NumCycles,
unsigned ExtraPredCycles,
844 return NumInstrs <= 4;
852 for (
auto I =
B.begin();
I !=
E; ++
I) {
862 for (
auto I =
B.rbegin();
I !=
E; ++
I)
871 bool RenamableSrc)
const {
875 if (Hexagon::IntRegsRegClass.
contains(SrcReg, DestReg)) {
877 .
addReg(SrcReg, KillFlag);
880 if (Hexagon::DoubleRegsRegClass.
contains(SrcReg, DestReg)) {
882 .
addReg(SrcReg, KillFlag);
885 if (Hexagon::PredRegsRegClass.
contains(SrcReg, DestReg)) {
891 if (Hexagon::CtrRegsRegClass.
contains(DestReg) &&
892 Hexagon::IntRegsRegClass.
contains(SrcReg)) {
894 .
addReg(SrcReg, KillFlag);
897 if (Hexagon::IntRegsRegClass.
contains(DestReg) &&
898 Hexagon::CtrRegsRegClass.
contains(SrcReg)) {
900 .
addReg(SrcReg, KillFlag);
903 if (Hexagon::ModRegsRegClass.
contains(DestReg) &&
904 Hexagon::IntRegsRegClass.
contains(SrcReg)) {
906 .
addReg(SrcReg, KillFlag);
909 if (Hexagon::PredRegsRegClass.
contains(SrcReg) &&
910 Hexagon::IntRegsRegClass.
contains(DestReg)) {
912 .
addReg(SrcReg, KillFlag);
915 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
916 Hexagon::PredRegsRegClass.
contains(DestReg)) {
918 .
addReg(SrcReg, KillFlag);
921 if (Hexagon::PredRegsRegClass.
contains(SrcReg) &&
922 Hexagon::IntRegsRegClass.
contains(DestReg)) {
924 .
addReg(SrcReg, KillFlag);
927 if (Hexagon::HvxVRRegClass.
contains(SrcReg, DestReg)) {
929 addReg(SrcReg, KillFlag);
932 if (Hexagon::HvxWRRegClass.
contains(SrcReg, DestReg)) {
935 Register SrcLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
936 Register SrcHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
940 .
addReg(SrcHi, KillFlag | UndefHi)
941 .
addReg(SrcLo, KillFlag | UndefLo);
944 if (Hexagon::HvxQRRegClass.
contains(SrcReg, DestReg)) {
947 .
addReg(SrcReg, KillFlag);
950 if (Hexagon::HvxQRRegClass.
contains(SrcReg) &&
951 Hexagon::HvxVRRegClass.
contains(DestReg)) {
955 if (Hexagon::HvxQRRegClass.
contains(DestReg) &&
956 Hexagon::HvxVRRegClass.
contains(SrcReg)) {
960 if (Hexagon::HlxLRRegClass.
contains(SrcReg, DestReg)) {
962 .
addReg(SrcReg, KillFlag);
965 if (Hexagon::HlxLLRRegClass.
contains(SrcReg, DestReg)) {
967 .
addReg(SrcReg, KillFlag);
981 Register SrcReg,
bool isKill,
int FI,
993 if (HMFI.isVTCMStackIndex(FI)) {
994 MFIIndex = HMFI.getMappedVTCMObjectIndex(FI);
995 MMFI = &HMFI.getVTCMFrameInfo();
1001 if (Hexagon::IntRegsRegClass.hasSubClassEq(RC)) {
1005 }
else if (Hexagon::DoubleRegsRegClass.hasSubClassEq(RC)) {
1009 }
else if (Hexagon::PredRegsRegClass.hasSubClassEq(RC)) {
1013 }
else if (Hexagon::ModRegsRegClass.hasSubClassEq(RC)) {
1017 }
else if (Hexagon::CircRegsRegClass.hasSubClassEq(RC)) {
1020 .
addReg(SrcReg, KillFlag)
1022 }
else if (Hexagon::HvxQRRegClass.hasSubClassEq(RC)) {
1026 }
else if (Hexagon::HvxVRRegClass.hasSubClassEq(RC)) {
1030 }
else if (Hexagon::HvxWRRegClass.hasSubClassEq(RC)) {
1034 }
else if (Hexagon::HlxLRRegClass.hasSubClassEq(RC)) {
1038 .
addReg(SrcReg, KillFlag)
1040 }
else if (Hexagon::HlxLLRRegClass.hasSubClassEq(RC)) {
1044 .
addReg(SrcReg, KillFlag)
1064 if (HMFI.isVTCMStackIndex(FI)) {
1065 MFIIndex = HMFI.getMappedVTCMObjectIndex(FI);
1066 MMFI = &HMFI.getVTCMFrameInfo();
1072 if (Hexagon::IntRegsRegClass.hasSubClassEq(RC)) {
1075 }
else if (Hexagon::DoubleRegsRegClass.hasSubClassEq(RC)) {
1078 }
else if (Hexagon::PredRegsRegClass.hasSubClassEq(RC)) {
1081 }
else if (Hexagon::ModRegsRegClass.hasSubClassEq(RC)) {
1084 }
else if (Hexagon::CircRegsRegClass.hasSubClassEq(RC)) {
1088 }
else if (Hexagon::HvxQRRegClass.hasSubClassEq(RC)) {
1091 }
else if (Hexagon::HvxVRRegClass.hasSubClassEq(RC)) {
1094 }
else if (Hexagon::HvxWRRegClass.hasSubClassEq(RC)) {
1097 }
else if (Hexagon::HlxLRRegClass.hasSubClassEq(RC)) {
1102 }
else if (Hexagon::HlxLLRRegClass.hasSubClassEq(RC)) {
1125 unsigned Opc =
MI.getOpcode();
1127 auto RealCirc = [&](
unsigned Opc,
bool HasImm,
unsigned MxOp) {
1128 Register M_CSx =
MI.getOperand(MxOp).getReg();
1129 Register Mx = HRI.getSubReg(M_CSx, Hexagon::isub_hi);
1130 unsigned CSOp = HasImm ? 5 : 4;
1132 for (
unsigned i = 0; i != CSOp; ++i)
1136 MIB.add(
MI.getOperand(i));
1137 Register CSx = (M_CSx == Hexagon::CS_M0 ? Hexagon::CS0 : Hexagon::CS1);
1144 if (
MI.memoperands().empty())
1147 return MMO->getAlign() >= NeedAlign;
1152 case Hexagon::PS_call_instrprof_custom: {
1153 auto Op0 =
MI.getOperand(0);
1155 "First operand must be a global containing handler name.");
1159 StringRef NameStr = Arr->isCString() ? Arr->getAsCString() : Arr->getAsString();
1185 MIB.addExternalSymbol(cstr);
1189 case TargetOpcode::COPY: {
1195 std::prev(
MBBI)->copyImplicitOps(*
MBB.getParent(),
MI);
1200 case Hexagon::PS_aligna:
1203 .
addImm(-
MI.getOperand(1).getImm());
1206 case Hexagon::V6_vassignp: {
1209 Register SrcLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
1210 Register SrcHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
1221 case Hexagon::V6_lo:
1222 case Hexagon::LX_lo: {
1225 Register SrcSubLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
1230 case Hexagon::V6_hi:
1231 case Hexagon::LX_hi: {
1234 Register SrcSubHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
1239 case Hexagon::PS_vloadrv_ai: {
1243 int Offset =
MI.getOperand(2).getImm();
1244 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1245 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vL32b_ai
1246 : Hexagon::V6_vL32Ub_ai;
1254 case Hexagon::PS_loadrl: {
1258 int Offset =
MI.getOperand(2).getImm();
1270 case Hexagon::PS_vloadrw_ai: {
1274 int Offset =
MI.getOperand(2).getImm();
1275 unsigned VecOffset = HRI.getSpillSize(Hexagon::HvxVRRegClass);
1276 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1277 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vL32b_ai
1278 : Hexagon::V6_vL32Ub_ai;
1280 HRI.getSubReg(DstReg, Hexagon::vsub_lo))
1285 HRI.getSubReg(DstReg, Hexagon::vsub_hi))
1292 case Hexagon::PS_vstorerv_ai: {
1297 int Offset =
MI.getOperand(1).getImm();
1298 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1299 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vS32b_ai
1300 : Hexagon::V6_vS32Ub_ai;
1309 case Hexagon::PS_storerl: {
1315 int Offset =
MI.getOperand(1).getImm();
1327 case Hexagon::PS_vstorerw_ai: {
1331 int Offset =
MI.getOperand(1).getImm();
1332 unsigned VecOffset = HRI.getSpillSize(Hexagon::HvxVRRegClass);
1333 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1334 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vS32b_ai
1335 : Hexagon::V6_vS32Ub_ai;
1339 .
addReg(HRI.getSubReg(SrcReg, Hexagon::vsub_lo))
1344 .
addReg(HRI.getSubReg(SrcReg, Hexagon::vsub_hi))
1349 case Hexagon::PS_true: {
1357 case Hexagon::PS_false: {
1365 case Hexagon::PS_qtrue: {
1372 case Hexagon::PS_qfalse: {
1379 case Hexagon::PS_vdd0: {
1387 case Hexagon::PS_vmulw: {
1390 Register Src1Reg =
MI.getOperand(1).getReg();
1391 Register Src2Reg =
MI.getOperand(2).getReg();
1392 Register Src1SubHi = HRI.getSubReg(Src1Reg, Hexagon::isub_hi);
1393 Register Src1SubLo = HRI.getSubReg(Src1Reg, Hexagon::isub_lo);
1394 Register Src2SubHi = HRI.getSubReg(Src2Reg, Hexagon::isub_hi);
1395 Register Src2SubLo = HRI.getSubReg(Src2Reg, Hexagon::isub_lo);
1397 HRI.getSubReg(DstReg, Hexagon::isub_hi))
1401 HRI.getSubReg(DstReg, Hexagon::isub_lo))
1407 case Hexagon::PS_vmulw_acc: {
1410 Register Src1Reg =
MI.getOperand(1).getReg();
1411 Register Src2Reg =
MI.getOperand(2).getReg();
1412 Register Src3Reg =
MI.getOperand(3).getReg();
1413 Register Src1SubHi = HRI.getSubReg(Src1Reg, Hexagon::isub_hi);
1414 Register Src1SubLo = HRI.getSubReg(Src1Reg, Hexagon::isub_lo);
1415 Register Src2SubHi = HRI.getSubReg(Src2Reg, Hexagon::isub_hi);
1416 Register Src2SubLo = HRI.getSubReg(Src2Reg, Hexagon::isub_lo);
1417 Register Src3SubHi = HRI.getSubReg(Src3Reg, Hexagon::isub_hi);
1418 Register Src3SubLo = HRI.getSubReg(Src3Reg, Hexagon::isub_lo);
1420 HRI.getSubReg(DstReg, Hexagon::isub_hi))
1425 HRI.getSubReg(DstReg, Hexagon::isub_lo))
1432 case Hexagon::PS_pselect: {
1456 case Hexagon::PS_vselect: {
1489 case Hexagon::PS_wselect: {
1529 case Hexagon::PS_crash: {
1545 void printCustom(
raw_ostream &OS)
const override {
1546 OS <<
"MisalignedCrash";
1550 static const CrashPseudoSourceValue CrashPSV(MF.
getTarget());
1562 case Hexagon::PS_tailcall_i:
1563 MI.setDesc(
get(Hexagon::J2_jump));
1565 case Hexagon::PS_tailcall_r:
1566 case Hexagon::PS_jmpret:
1567 MI.setDesc(
get(Hexagon::J2_jumpr));
1569 case Hexagon::PS_jmprett:
1570 MI.setDesc(
get(Hexagon::J2_jumprt));
1572 case Hexagon::PS_jmpretf:
1573 MI.setDesc(
get(Hexagon::J2_jumprf));
1575 case Hexagon::PS_jmprettnewpt:
1576 MI.setDesc(
get(Hexagon::J2_jumprtnewpt));
1578 case Hexagon::PS_jmpretfnewpt:
1579 MI.setDesc(
get(Hexagon::J2_jumprfnewpt));
1581 case Hexagon::PS_jmprettnew:
1582 MI.setDesc(
get(Hexagon::J2_jumprtnew));
1584 case Hexagon::PS_jmpretfnew:
1585 MI.setDesc(
get(Hexagon::J2_jumprfnew));
1588 case Hexagon::PS_loadrub_pci:
1589 return RealCirc(Hexagon::L2_loadrub_pci,
true, 4);
1590 case Hexagon::PS_loadrb_pci:
1591 return RealCirc(Hexagon::L2_loadrb_pci,
true, 4);
1592 case Hexagon::PS_loadruh_pci:
1593 return RealCirc(Hexagon::L2_loadruh_pci,
true, 4);
1594 case Hexagon::PS_loadrh_pci:
1595 return RealCirc(Hexagon::L2_loadrh_pci,
true, 4);
1596 case Hexagon::PS_loadri_pci:
1597 return RealCirc(Hexagon::L2_loadri_pci,
true, 4);
1598 case Hexagon::PS_loadrd_pci:
1599 return RealCirc(Hexagon::L2_loadrd_pci,
true, 4);
1600 case Hexagon::PS_loadrub_pcr:
1601 return RealCirc(Hexagon::L2_loadrub_pcr,
false, 3);
1602 case Hexagon::PS_loadrb_pcr:
1603 return RealCirc(Hexagon::L2_loadrb_pcr,
false, 3);
1604 case Hexagon::PS_loadruh_pcr:
1605 return RealCirc(Hexagon::L2_loadruh_pcr,
false, 3);
1606 case Hexagon::PS_loadrh_pcr:
1607 return RealCirc(Hexagon::L2_loadrh_pcr,
false, 3);
1608 case Hexagon::PS_loadri_pcr:
1609 return RealCirc(Hexagon::L2_loadri_pcr,
false, 3);
1610 case Hexagon::PS_loadrd_pcr:
1611 return RealCirc(Hexagon::L2_loadrd_pcr,
false, 3);
1612 case Hexagon::PS_storerb_pci:
1613 return RealCirc(Hexagon::S2_storerb_pci,
true, 3);
1614 case Hexagon::PS_storerh_pci:
1615 return RealCirc(Hexagon::S2_storerh_pci,
true, 3);
1616 case Hexagon::PS_storerf_pci:
1617 return RealCirc(Hexagon::S2_storerf_pci,
true, 3);
1618 case Hexagon::PS_storeri_pci:
1619 return RealCirc(Hexagon::S2_storeri_pci,
true, 3);
1620 case Hexagon::PS_storerd_pci:
1621 return RealCirc(Hexagon::S2_storerd_pci,
true, 3);
1622 case Hexagon::PS_storerb_pcr:
1623 return RealCirc(Hexagon::S2_storerb_pcr,
false, 2);
1624 case Hexagon::PS_storerh_pcr:
1625 return RealCirc(Hexagon::S2_storerh_pcr,
false, 2);
1626 case Hexagon::PS_storerf_pcr:
1627 return RealCirc(Hexagon::S2_storerf_pcr,
false, 2);
1628 case Hexagon::PS_storeri_pcr:
1629 return RealCirc(Hexagon::S2_storeri_pcr,
false, 2);
1630 case Hexagon::PS_storerd_pcr:
1631 return RealCirc(Hexagon::S2_storerd_pcr,
false, 2);
1641 unsigned Opc =
MI.getOpcode();
1645 case Hexagon::V6_vgather_vscatter_mh_pseudo:
1648 .
add(
MI.getOperand(2))
1649 .
add(
MI.getOperand(3))
1650 .
add(
MI.getOperand(4));
1652 .
add(
MI.getOperand(2))
1653 .
add(
MI.getOperand(3))
1654 .
add(
MI.getOperand(4))
1657 return First.getInstrIterator();
1658 case Hexagon::V6_vgathermh_pseudo:
1660 .
add(
MI.getOperand(2))
1661 .
add(
MI.getOperand(3))
1662 .
add(
MI.getOperand(4));
1664 .
add(
MI.getOperand(0))
1668 return First.getInstrIterator();
1670 case Hexagon::V6_vgathermw_pseudo:
1672 .
add(
MI.getOperand(2))
1673 .
add(
MI.getOperand(3))
1674 .
add(
MI.getOperand(4));
1676 .
add(
MI.getOperand(0))
1680 return First.getInstrIterator();
1682 case Hexagon::V6_vgathermhw_pseudo:
1684 .
add(
MI.getOperand(2))
1685 .
add(
MI.getOperand(3))
1686 .
add(
MI.getOperand(4));
1688 .
add(
MI.getOperand(0))
1692 return First.getInstrIterator();
1694 case Hexagon::V6_vgathermhq_pseudo:
1696 .
add(
MI.getOperand(2))
1697 .
add(
MI.getOperand(3))
1698 .
add(
MI.getOperand(4))
1699 .
add(
MI.getOperand(5));
1701 .
add(
MI.getOperand(0))
1705 return First.getInstrIterator();
1707 case Hexagon::V6_vgathermwq_pseudo:
1709 .
add(
MI.getOperand(2))
1710 .
add(
MI.getOperand(3))
1711 .
add(
MI.getOperand(4))
1712 .
add(
MI.getOperand(5));
1714 .
add(
MI.getOperand(0))
1718 return First.getInstrIterator();
1720 case Hexagon::V6_vgathermhwq_pseudo:
1722 .
add(
MI.getOperand(2))
1723 .
add(
MI.getOperand(3))
1724 .
add(
MI.getOperand(4))
1725 .
add(
MI.getOperand(5));
1727 .
add(
MI.getOperand(0))
1731 return First.getInstrIterator();
1734 return MI.getIterator();
1743 assert(
Cond[0].isImm() &&
"First entry in the cond vector not imm-val");
1744 unsigned opcode =
Cond[0].getImm();
1750 Cond[0].setImm(NewOpcode);
1765 unsigned BasePos, OffsetPos;
1780 const uint64_t
F =
MI.getDesc().TSFlags;
1791 int Opc =
MI.getOpcode();
1804 unsigned NOp = 0,
NumOps =
MI.getNumOperands();
1807 if (!
Op.isReg() || !
Op.isDef() ||
Op.isImplicit())
1814 unsigned PredRegPos;
1816 bool GotPredReg =
getPredReg(
Cond, PredReg, PredRegPos, PredRegFlags);
1821 for (
auto I = std::next(BundleStart), E =
MI.getIterator();
I != E; ++
I)
1827 T.addReg(PredReg, PredRegFlags);
1829 T.add(
MI.getOperand(NOp++));
1831 MI.setDesc(
get(PredOpc));
1832 while (
unsigned n =
MI.getNumOperands())
1833 MI.removeOperand(n-1);
1834 for (
unsigned i = 0, n =
T->getNumOperands(); i < n; ++i)
1835 MI.addOperand(
T->getOperand(i));
1841 MRI.clearKillFlags(PredReg);
1852 std::vector<MachineOperand> &Pred,
1853 bool SkipDead)
const {
1861 if (RC == &Hexagon::PredRegsRegClass) {
1866 }
else if (MO.isRegMask()) {
1867 for (
Register PR : Hexagon::PredRegsRegClass) {
1868 if (!
MI.modifiesRegister(PR, &HRI))
1879 if (!
MI.getDesc().isPredicable())
1883 if (!Subtarget.usePredicatedCalls())
1888 if (!Subtarget.hasV62Ops()) {
1889 switch (
MI.getOpcode()) {
1890 case Hexagon::V6_vL32b_ai:
1891 case Hexagon::V6_vL32b_pi:
1892 case Hexagon::V6_vL32b_ppu:
1893 case Hexagon::V6_vL32b_cur_ai:
1894 case Hexagon::V6_vL32b_cur_pi:
1895 case Hexagon::V6_vL32b_cur_ppu:
1896 case Hexagon::V6_vL32b_nt_ai:
1897 case Hexagon::V6_vL32b_nt_pi:
1898 case Hexagon::V6_vL32b_nt_ppu:
1899 case Hexagon::V6_vL32b_tmp_ai:
1900 case Hexagon::V6_vL32b_tmp_pi:
1901 case Hexagon::V6_vL32b_tmp_ppu:
1902 case Hexagon::V6_vL32b_nt_cur_ai:
1903 case Hexagon::V6_vL32b_nt_cur_pi:
1904 case Hexagon::V6_vL32b_nt_cur_ppu:
1905 case Hexagon::V6_vL32b_nt_tmp_ai:
1906 case Hexagon::V6_vL32b_nt_tmp_pi:
1907 case Hexagon::V6_vL32b_nt_tmp_ppu:
1915 bool Invert)
const {
1921 case Hexagon::F2_sfadd:
1937 if (
MI.isDebugInstr())
1947 for (
auto *
I :
MBB->successors())
1953 if (
MI.getDesc().isTerminator() ||
MI.isPosition())
1957 if (
MI.getOpcode() == TargetOpcode::INLINEASM_BR)
1978 unsigned MaxInstLength)
const {
1981 bool atInsnStart =
true;
1983 if (MaxInstLength == 0)
1985 for (; *Str; ++Str) {
1989 if (atInsnStart && !
isSpace(
static_cast<unsigned char>(*Str))) {
1991 atInsnStart =
false;
1995 atInsnStart =
false;
2018 int64_t &
Value)
const {
2019 unsigned Opc =
MI.getOpcode();
2023 case Hexagon::C2_cmpeq:
2024 case Hexagon::C2_cmpeqp:
2025 case Hexagon::C2_cmpgt:
2026 case Hexagon::C2_cmpgtp:
2027 case Hexagon::C2_cmpgtu:
2028 case Hexagon::C2_cmpgtup:
2029 case Hexagon::C4_cmpneq:
2030 case Hexagon::C4_cmplte:
2031 case Hexagon::C4_cmplteu:
2032 case Hexagon::C2_cmpeqi:
2033 case Hexagon::C2_cmpgti:
2034 case Hexagon::C2_cmpgtui:
2035 case Hexagon::C4_cmpneqi:
2036 case Hexagon::C4_cmplteui:
2037 case Hexagon::C4_cmpltei:
2038 SrcReg =
MI.getOperand(1).getReg();
2041 case Hexagon::A4_cmpbeq:
2042 case Hexagon::A4_cmpbgt:
2043 case Hexagon::A4_cmpbgtu:
2044 case Hexagon::A4_cmpbeqi:
2045 case Hexagon::A4_cmpbgti:
2046 case Hexagon::A4_cmpbgtui:
2047 SrcReg =
MI.getOperand(1).getReg();
2050 case Hexagon::A4_cmpheq:
2051 case Hexagon::A4_cmphgt:
2052 case Hexagon::A4_cmphgtu:
2053 case Hexagon::A4_cmpheqi:
2054 case Hexagon::A4_cmphgti:
2055 case Hexagon::A4_cmphgtui:
2056 SrcReg =
MI.getOperand(1).getReg();
2063 case Hexagon::C2_cmpeq:
2064 case Hexagon::C2_cmpeqp:
2065 case Hexagon::C2_cmpgt:
2066 case Hexagon::C2_cmpgtp:
2067 case Hexagon::C2_cmpgtu:
2068 case Hexagon::C2_cmpgtup:
2069 case Hexagon::A4_cmpbeq:
2070 case Hexagon::A4_cmpbgt:
2071 case Hexagon::A4_cmpbgtu:
2072 case Hexagon::A4_cmpheq:
2073 case Hexagon::A4_cmphgt:
2074 case Hexagon::A4_cmphgtu:
2075 case Hexagon::C4_cmpneq:
2076 case Hexagon::C4_cmplte:
2077 case Hexagon::C4_cmplteu:
2078 SrcReg2 =
MI.getOperand(2).getReg();
2082 case Hexagon::C2_cmpeqi:
2083 case Hexagon::C2_cmpgtui:
2084 case Hexagon::C2_cmpgti:
2085 case Hexagon::C4_cmpneqi:
2086 case Hexagon::C4_cmplteui:
2087 case Hexagon::C4_cmpltei:
2088 case Hexagon::A4_cmpbeqi:
2089 case Hexagon::A4_cmpbgti:
2090 case Hexagon::A4_cmpbgtui:
2091 case Hexagon::A4_cmpheqi:
2092 case Hexagon::A4_cmphgti:
2093 case Hexagon::A4_cmphgtui: {
2098 Value =
MI.getOperand(2).getImm();
2108 unsigned *PredCost)
const {
2134 unsigned BasePosA, OffsetPosA;
2142 unsigned BasePosB, OffsetPosB;
2149 if (BaseRegA != BaseRegB || BaseSubA != BaseSubB)
2167 if (OffsetA > OffsetB) {
2168 uint64_t OffDiff = (uint64_t)((int64_t)OffsetA - (int64_t)OffsetB);
2169 return SizeB <= OffDiff;
2171 if (OffsetA < OffsetB) {
2172 uint64_t OffDiff = (uint64_t)((int64_t)OffsetB - (int64_t)OffsetA);
2173 return SizeA <= OffDiff;
2182 if (!
MI ||
MI->memoperands_empty())
2185 if ((*
MI->memoperands_begin())->isVolatile() ||
MI->hasUnmodeledSideEffects())
2188 if (!(*
MI->memoperands_begin())->getValue())
2228 assert((MMOa->
getOffset() >= 0) &&
"Negative MachineMemOperand offset");
2229 assert((MMOb->
getOffset() >= 0) &&
"Negative MachineMemOperand offset");
2231 "Size 0 memory access");
2263 unsigned BasePos = 0, OffsetPos = 0;
2271 }
else if (
MI.getOpcode() == Hexagon::A2_addi) {
2273 if (AddOp.isImm()) {
2274 Value = AddOp.getImm();
2282std::pair<unsigned, unsigned>
2292 static const std::pair<unsigned, const char*> Flags[] = {
2293 {MO_PCREL,
"hexagon-pcrel"},
2294 {MO_GOT,
"hexagon-got"},
2295 {MO_LO16,
"hexagon-lo16"},
2296 {MO_HI16,
"hexagon-hi16"},
2297 {MO_GPREL,
"hexagon-gprel"},
2298 {MO_GDGOT,
"hexagon-gdgot"},
2299 {MO_GDPLT,
"hexagon-gdplt"},
2300 {MO_IE,
"hexagon-ie"},
2301 {MO_IEGOT,
"hexagon-iegot"},
2302 {MO_TPREL,
"hexagon-tprel"}
2311 static const std::pair<unsigned, const char*> Flags[] = {
2312 {HMOTF_ConstExtended,
"hexagon-ext"}
2320 if (VT == MVT::i1) {
2321 TRC = &Hexagon::PredRegsRegClass;
2322 }
else if (VT == MVT::i32 || VT == MVT::f32) {
2323 TRC = &Hexagon::IntRegsRegClass;
2324 }
else if (VT == MVT::i64 || VT == MVT::f64) {
2325 TRC = &Hexagon::DoubleRegsRegClass;
2339 const uint64_t
F =
MI.getDesc().TSFlags;
2349 !
MI.getDesc().mayStore() &&
2350 MI.getDesc().getOpcode() != Hexagon::S2_allocframe &&
2351 MI.getDesc().getOpcode() != Hexagon::L2_deallocframe &&
2363 const uint64_t
F =
MI.getDesc().TSFlags;
2396 assert(MO.
isImm() &&
"Extendable operand must be Immediate type");
2400 int32_t SValue =
Value;
2403 return SValue < MinValue || SValue > MaxValue;
2408 return UValue < MinValue || UValue > MaxValue;
2412 switch (
MI.getOpcode()) {
2413 case Hexagon::L4_return:
2414 case Hexagon::L4_return_t:
2415 case Hexagon::L4_return_f:
2416 case Hexagon::L4_return_tnew_pnt:
2417 case Hexagon::L4_return_fnew_pnt:
2418 case Hexagon::L4_return_tnew_pt:
2419 case Hexagon::L4_return_fnew_pt:
2440 for (
auto &RegA : DefsA)
2441 for (
auto &RegB : UsesB) {
2460 switch (
MI.getOpcode()) {
2468 case Hexagon::V6_vL32b_cur_pi:
2469 case Hexagon::V6_vL32b_nt_cur_pi:
2470 case Hexagon::V6_vL32b_cur_pred_pi:
2471 case Hexagon::V6_vL32b_nt_cur_pred_pi:
2472 case Hexagon::V6_vL32b_cur_npred_pi:
2473 case Hexagon::V6_vL32b_nt_cur_npred_pi:
2474 case Hexagon::V6_vL32b_cur_ai:
2475 case Hexagon::V6_vL32b_nt_cur_ai:
2476 case Hexagon::V6_vL32b_cur_pred_ai:
2477 case Hexagon::V6_vL32b_nt_cur_pred_ai:
2478 case Hexagon::V6_vL32b_cur_npred_ai:
2479 case Hexagon::V6_vL32b_nt_cur_npred_ai:
2480 case Hexagon::V6_vL32b_cur_ppu:
2481 case Hexagon::V6_vL32b_nt_cur_ppu:
2482 case Hexagon::V6_vL32b_cur_pred_ppu:
2483 case Hexagon::V6_vL32b_nt_cur_pred_ppu:
2484 case Hexagon::V6_vL32b_cur_npred_ppu:
2485 case Hexagon::V6_vL32b_nt_cur_npred_ppu:
2495 unsigned OpIndex)
const {
2513 return (RC == &Hexagon::PredRegsRegClass);
2555 unsigned OpIndex)
const {
2576 unsigned OpIndex)
const {
2593 unsigned UseOpIdx,
bool IsPullDown,
2594 bool DefViaRegMask)
const {
2599 if (!DefViaRegMask) {
2603 if (!
DefMI.getOperand(DefOpIdx).isReg())
2612 if (
UseMI.isTerminator())
2649 return (Opcode == Hexagon::ENDLOOP0 ||
2650 Opcode == Hexagon::ENDLOOP1);
2675 switch (
MI.getOpcode()) {
2677 case Hexagon::PS_fi:
2678 case Hexagon::PS_fia:
2691 const uint64_t
F =
MI.getDesc().TSFlags;
2703 unsigned Opcode =
MI.getOpcode();
2704 const uint64_t
F =
get(Opcode).TSFlags;
2713 if (!
I.mayLoad() && !
I.mayStore())
2719 switch (
MI.getOpcode()) {
2720 case Hexagon::J2_callr:
2721 case Hexagon::J2_callrf:
2722 case Hexagon::J2_callrt:
2723 case Hexagon::PS_call_nr:
2730 switch (
MI.getOpcode()) {
2731 case Hexagon::L4_return:
2732 case Hexagon::L4_return_t:
2733 case Hexagon::L4_return_f:
2734 case Hexagon::L4_return_fnew_pnt:
2735 case Hexagon::L4_return_fnew_pt:
2736 case Hexagon::L4_return_tnew_pnt:
2737 case Hexagon::L4_return_tnew_pt:
2744 switch (
MI.getOpcode()) {
2745 case Hexagon::J2_jumpr:
2746 case Hexagon::J2_jumprt:
2747 case Hexagon::J2_jumprf:
2748 case Hexagon::J2_jumprtnewpt:
2749 case Hexagon::J2_jumprfnewpt:
2750 case Hexagon::J2_jumprtnew:
2751 case Hexagon::J2_jumprfnew:
2762 unsigned offset)
const {
2768 switch (
MI.getOpcode()) {
2772 case Hexagon::J2_jump:
2773 case Hexagon::J2_call:
2774 case Hexagon::PS_call_nr:
2776 case Hexagon::J2_jumpt:
2777 case Hexagon::J2_jumpf:
2778 case Hexagon::J2_jumptnew:
2779 case Hexagon::J2_jumptnewpt:
2780 case Hexagon::J2_jumpfnew:
2781 case Hexagon::J2_jumpfnewpt:
2782 case Hexagon::J2_callt:
2783 case Hexagon::J2_callf:
2785 case Hexagon::J2_loop0i:
2786 case Hexagon::J2_loop0iext:
2787 case Hexagon::J2_loop0r:
2788 case Hexagon::J2_loop0rext:
2789 case Hexagon::J2_loop1i:
2790 case Hexagon::J2_loop1iext:
2791 case Hexagon::J2_loop1r:
2792 case Hexagon::J2_loop1rext:
2795 case Hexagon::J4_cmpeqi_tp0_jump_nt:
2796 case Hexagon::J4_cmpeqi_tp1_jump_nt:
2797 case Hexagon::J4_cmpeqn1_tp0_jump_nt:
2798 case Hexagon::J4_cmpeqn1_tp1_jump_nt:
2810 unsigned Opcode =
MI.getOpcode();
2811 return Opcode == Hexagon::J2_loop0i ||
2812 Opcode == Hexagon::J2_loop0r ||
2813 Opcode == Hexagon::J2_loop0iext ||
2814 Opcode == Hexagon::J2_loop0rext ||
2815 Opcode == Hexagon::J2_loop1i ||
2816 Opcode == Hexagon::J2_loop1r ||
2817 Opcode == Hexagon::J2_loop1iext ||
2818 Opcode == Hexagon::J2_loop1rext;
2822 switch (
MI.getOpcode()) {
2823 default:
return false;
2824 case Hexagon::L4_iadd_memopw_io:
2825 case Hexagon::L4_isub_memopw_io:
2826 case Hexagon::L4_add_memopw_io:
2827 case Hexagon::L4_sub_memopw_io:
2828 case Hexagon::L4_and_memopw_io:
2829 case Hexagon::L4_or_memopw_io:
2830 case Hexagon::L4_iadd_memoph_io:
2831 case Hexagon::L4_isub_memoph_io:
2832 case Hexagon::L4_add_memoph_io:
2833 case Hexagon::L4_sub_memoph_io:
2834 case Hexagon::L4_and_memoph_io:
2835 case Hexagon::L4_or_memoph_io:
2836 case Hexagon::L4_iadd_memopb_io:
2837 case Hexagon::L4_isub_memopb_io:
2838 case Hexagon::L4_add_memopb_io:
2839 case Hexagon::L4_sub_memopb_io:
2840 case Hexagon::L4_and_memopb_io:
2841 case Hexagon::L4_or_memopb_io:
2842 case Hexagon::L4_ior_memopb_io:
2843 case Hexagon::L4_ior_memoph_io:
2844 case Hexagon::L4_ior_memopw_io:
2845 case Hexagon::L4_iand_memopb_io:
2846 case Hexagon::L4_iand_memoph_io:
2847 case Hexagon::L4_iand_memopw_io:
2854 const uint64_t
F =
MI.getDesc().TSFlags;
2859 const uint64_t
F =
get(Opcode).TSFlags;
2876 const uint64_t
F =
MI.getDesc().TSFlags;
2881 const uint64_t
F =
get(Opcode).TSFlags;
2887 unsigned OperandNum)
const {
2888 const uint64_t
F =
MI.getDesc().TSFlags;
2894 const uint64_t
F =
MI.getDesc().TSFlags;
2900 const uint64_t
F =
get(Opcode).TSFlags;
2906 const uint64_t
F =
MI.getDesc().TSFlags;
2912 const uint64_t
F =
get(Opcode).TSFlags;
2920 const uint64_t
F =
get(Opcode).TSFlags;
2925 const uint64_t
F =
get(Opcode).TSFlags;
2930 const uint64_t
F =
get(Opcode).TSFlags;
2937 return MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4 ||
2938 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_EXT ||
2939 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_PIC ||
2940 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_EXT_PIC;
2944 switch (
MI.getOpcode()) {
2946 case Hexagon::L2_loadrb_io:
2947 case Hexagon::L4_loadrb_ur:
2948 case Hexagon::L4_loadrb_ap:
2949 case Hexagon::L2_loadrb_pr:
2950 case Hexagon::L2_loadrb_pbr:
2951 case Hexagon::L2_loadrb_pi:
2952 case Hexagon::L2_loadrb_pci:
2953 case Hexagon::L2_loadrb_pcr:
2954 case Hexagon::L2_loadbsw2_io:
2955 case Hexagon::L4_loadbsw2_ur:
2956 case Hexagon::L4_loadbsw2_ap:
2957 case Hexagon::L2_loadbsw2_pr:
2958 case Hexagon::L2_loadbsw2_pbr:
2959 case Hexagon::L2_loadbsw2_pi:
2960 case Hexagon::L2_loadbsw2_pci:
2961 case Hexagon::L2_loadbsw2_pcr:
2962 case Hexagon::L2_loadbsw4_io:
2963 case Hexagon::L4_loadbsw4_ur:
2964 case Hexagon::L4_loadbsw4_ap:
2965 case Hexagon::L2_loadbsw4_pr:
2966 case Hexagon::L2_loadbsw4_pbr:
2967 case Hexagon::L2_loadbsw4_pi:
2968 case Hexagon::L2_loadbsw4_pci:
2969 case Hexagon::L2_loadbsw4_pcr:
2970 case Hexagon::L4_loadrb_rr:
2971 case Hexagon::L2_ploadrbt_io:
2972 case Hexagon::L2_ploadrbt_pi:
2973 case Hexagon::L2_ploadrbf_io:
2974 case Hexagon::L2_ploadrbf_pi:
2975 case Hexagon::L2_ploadrbtnew_io:
2976 case Hexagon::L2_ploadrbfnew_io:
2977 case Hexagon::L4_ploadrbt_rr:
2978 case Hexagon::L4_ploadrbf_rr:
2979 case Hexagon::L4_ploadrbtnew_rr:
2980 case Hexagon::L4_ploadrbfnew_rr:
2981 case Hexagon::L2_ploadrbtnew_pi:
2982 case Hexagon::L2_ploadrbfnew_pi:
2983 case Hexagon::L4_ploadrbt_abs:
2984 case Hexagon::L4_ploadrbf_abs:
2985 case Hexagon::L4_ploadrbtnew_abs:
2986 case Hexagon::L4_ploadrbfnew_abs:
2987 case Hexagon::L2_loadrbgp:
2989 case Hexagon::L2_loadrh_io:
2990 case Hexagon::L4_loadrh_ur:
2991 case Hexagon::L4_loadrh_ap:
2992 case Hexagon::L2_loadrh_pr:
2993 case Hexagon::L2_loadrh_pbr:
2994 case Hexagon::L2_loadrh_pi:
2995 case Hexagon::L2_loadrh_pci:
2996 case Hexagon::L2_loadrh_pcr:
2997 case Hexagon::L4_loadrh_rr:
2998 case Hexagon::L2_ploadrht_io:
2999 case Hexagon::L2_ploadrht_pi:
3000 case Hexagon::L2_ploadrhf_io:
3001 case Hexagon::L2_ploadrhf_pi:
3002 case Hexagon::L2_ploadrhtnew_io:
3003 case Hexagon::L2_ploadrhfnew_io:
3004 case Hexagon::L4_ploadrht_rr:
3005 case Hexagon::L4_ploadrhf_rr:
3006 case Hexagon::L4_ploadrhtnew_rr:
3007 case Hexagon::L4_ploadrhfnew_rr:
3008 case Hexagon::L2_ploadrhtnew_pi:
3009 case Hexagon::L2_ploadrhfnew_pi:
3010 case Hexagon::L4_ploadrht_abs:
3011 case Hexagon::L4_ploadrhf_abs:
3012 case Hexagon::L4_ploadrhtnew_abs:
3013 case Hexagon::L4_ploadrhfnew_abs:
3014 case Hexagon::L2_loadrhgp:
3022 const uint64_t
F =
MI.getDesc().TSFlags;
3027 switch (
MI.getOpcode()) {
3028 case Hexagon::STriw_pred:
3029 case Hexagon::LDriw_pred:
3040 for (
auto &
Op :
MI.operands())
3041 if (
Op.isGlobal() ||
Op.isSymbol())
3048 unsigned SchedClass =
MI.getDesc().getSchedClass();
3049 return is_TC1(SchedClass);
3053 unsigned SchedClass =
MI.getDesc().getSchedClass();
3054 return is_TC2(SchedClass);
3058 unsigned SchedClass =
MI.getDesc().getSchedClass();
3063 unsigned SchedClass =
MI.getDesc().getSchedClass();
3074 for (
int I = 0;
I <
N;
I++)
3079 if (MI2.
getOpcode() == Hexagon::V6_vS32b_pi)
3134 bool Extend)
const {
3144 case Hexagon::PS_vstorerq_ai:
3145 case Hexagon::PS_vstorerv_ai:
3146 case Hexagon::PS_vstorerw_ai:
3147 case Hexagon::PS_vstorerw_nt_ai:
3148 case Hexagon::PS_vloadrq_ai:
3149 case Hexagon::PS_vloadrv_ai:
3150 case Hexagon::PS_vloadrw_ai:
3151 case Hexagon::PS_vloadrw_nt_ai:
3152 case Hexagon::V6_vL32b_ai:
3153 case Hexagon::V6_vS32b_ai:
3154 case Hexagon::V6_vS32b_pred_ai:
3155 case Hexagon::V6_vS32b_npred_ai:
3156 case Hexagon::V6_vS32b_qpred_ai:
3157 case Hexagon::V6_vS32b_nqpred_ai:
3158 case Hexagon::V6_vS32b_new_ai:
3159 case Hexagon::V6_vS32b_new_pred_ai:
3160 case Hexagon::V6_vS32b_new_npred_ai:
3161 case Hexagon::V6_vS32b_nt_pred_ai:
3162 case Hexagon::V6_vS32b_nt_npred_ai:
3163 case Hexagon::V6_vS32b_nt_new_ai:
3164 case Hexagon::V6_vS32b_nt_new_pred_ai:
3165 case Hexagon::V6_vS32b_nt_new_npred_ai:
3166 case Hexagon::V6_vS32b_nt_qpred_ai:
3167 case Hexagon::V6_vS32b_nt_nqpred_ai:
3168 case Hexagon::V6_vL32b_nt_ai:
3169 case Hexagon::V6_vS32b_nt_ai:
3170 case Hexagon::V6_vL32Ub_ai:
3171 case Hexagon::V6_vS32Ub_ai:
3172 case Hexagon::V6_vL32b_cur_ai:
3173 case Hexagon::V6_vL32b_tmp_ai:
3174 case Hexagon::V6_vL32b_pred_ai:
3175 case Hexagon::V6_vL32b_npred_ai:
3176 case Hexagon::V6_vL32b_cur_pred_ai:
3177 case Hexagon::V6_vL32b_cur_npred_ai:
3178 case Hexagon::V6_vL32b_tmp_pred_ai:
3179 case Hexagon::V6_vL32b_tmp_npred_ai:
3180 case Hexagon::V6_vL32b_nt_cur_ai:
3181 case Hexagon::V6_vL32b_nt_tmp_ai:
3182 case Hexagon::V6_vL32b_nt_pred_ai:
3183 case Hexagon::V6_vL32b_nt_npred_ai:
3184 case Hexagon::V6_vL32b_nt_cur_pred_ai:
3185 case Hexagon::V6_vL32b_nt_cur_npred_ai:
3186 case Hexagon::V6_vL32b_nt_tmp_pred_ai:
3187 case Hexagon::V6_vL32b_nt_tmp_npred_ai:
3188 case Hexagon::V6_vS32Ub_pred_ai:
3189 case Hexagon::V6_vS32Ub_npred_ai:
3190 case Hexagon::V6_vgathermh_pseudo:
3191 case Hexagon::V6_vgather_vscatter_mh_pseudo:
3192 case Hexagon::V6_vgathermw_pseudo:
3193 case Hexagon::V6_vgathermhw_pseudo:
3194 case Hexagon::V6_vgathermhq_pseudo:
3195 case Hexagon::V6_vgathermwq_pseudo:
3196 case Hexagon::V6_vgathermhwq_pseudo: {
3197 unsigned VectorSize = RegInfo.getSpillSize(Hexagon::HvxVRRegClass);
3199 if (
Offset & (VectorSize-1))
3204 case Hexagon::J2_loop0i:
3205 case Hexagon::J2_loop1i:
3208 case Hexagon::S4_storeirb_io:
3209 case Hexagon::S4_storeirbt_io:
3210 case Hexagon::S4_storeirbf_io:
3213 case Hexagon::S4_storeirh_io:
3214 case Hexagon::S4_storeirht_io:
3215 case Hexagon::S4_storeirhf_io:
3218 case Hexagon::S4_storeiri_io:
3219 case Hexagon::S4_storeirit_io:
3220 case Hexagon::S4_storeirif_io:
3223 case Hexagon::A4_cmpbeqi:
3225 case Hexagon::A4_cmpbgti:
3233 case Hexagon::L2_loadri_io:
3234 case Hexagon::S2_storeri_io:
3238 case Hexagon::L2_loadrd_io:
3239 case Hexagon::S2_storerd_io:
3243 case Hexagon::L2_loadrh_io:
3244 case Hexagon::L2_loadruh_io:
3245 case Hexagon::S2_storerh_io:
3246 case Hexagon::S2_storerf_io:
3250 case Hexagon::L2_loadrb_io:
3251 case Hexagon::L2_loadrub_io:
3252 case Hexagon::S2_storerb_io:
3256 case Hexagon::A2_addi:
3260 case Hexagon::L4_iadd_memopw_io:
3261 case Hexagon::L4_isub_memopw_io:
3262 case Hexagon::L4_add_memopw_io:
3263 case Hexagon::L4_sub_memopw_io:
3264 case Hexagon::L4_iand_memopw_io:
3265 case Hexagon::L4_ior_memopw_io:
3266 case Hexagon::L4_and_memopw_io:
3267 case Hexagon::L4_or_memopw_io:
3270 case Hexagon::L4_iadd_memoph_io:
3271 case Hexagon::L4_isub_memoph_io:
3272 case Hexagon::L4_add_memoph_io:
3273 case Hexagon::L4_sub_memoph_io:
3274 case Hexagon::L4_iand_memoph_io:
3275 case Hexagon::L4_ior_memoph_io:
3276 case Hexagon::L4_and_memoph_io:
3277 case Hexagon::L4_or_memoph_io:
3280 case Hexagon::L4_iadd_memopb_io:
3281 case Hexagon::L4_isub_memopb_io:
3282 case Hexagon::L4_add_memopb_io:
3283 case Hexagon::L4_sub_memopb_io:
3284 case Hexagon::L4_iand_memopb_io:
3285 case Hexagon::L4_ior_memopb_io:
3286 case Hexagon::L4_and_memopb_io:
3287 case Hexagon::L4_or_memopb_io:
3292 case Hexagon::STriw_pred:
3293 case Hexagon::LDriw_pred:
3294 case Hexagon::STriw_ctr:
3295 case Hexagon::LDriw_ctr:
3298 case Hexagon::PS_fi:
3299 case Hexagon::PS_fia:
3300 case Hexagon::INLINEASM:
3303 case Hexagon::L2_ploadrbt_io:
3304 case Hexagon::L2_ploadrbf_io:
3305 case Hexagon::L2_ploadrubt_io:
3306 case Hexagon::L2_ploadrubf_io:
3307 case Hexagon::S2_pstorerbt_io:
3308 case Hexagon::S2_pstorerbf_io:
3311 case Hexagon::L2_ploadrht_io:
3312 case Hexagon::L2_ploadrhf_io:
3313 case Hexagon::L2_ploadruht_io:
3314 case Hexagon::L2_ploadruhf_io:
3315 case Hexagon::S2_pstorerht_io:
3316 case Hexagon::S2_pstorerhf_io:
3317 case Hexagon::S2_pstorerft_io:
3318 case Hexagon::S2_pstorerff_io:
3321 case Hexagon::L2_ploadrit_io:
3322 case Hexagon::L2_ploadrif_io:
3323 case Hexagon::S2_pstorerit_io:
3324 case Hexagon::S2_pstorerif_io:
3327 case Hexagon::L2_ploadrdt_io:
3328 case Hexagon::L2_ploadrdf_io:
3329 case Hexagon::S2_pstorerdt_io:
3330 case Hexagon::S2_pstorerdf_io:
3333 case Hexagon::L2_loadbsw2_io:
3334 case Hexagon::L2_loadbzw2_io:
3337 case Hexagon::L2_loadbsw4_io:
3338 case Hexagon::L2_loadbzw4_io:
3342 dbgs() <<
"Failed Opcode is : " << Opcode <<
" (" <<
getName(Opcode)
3345 "Please define it in the above switch statement!");
3353 const uint64_t
F =
get(
MI.getOpcode()).TSFlags;
3375 switch (
MI.getOpcode()) {
3377 case Hexagon::L2_loadrub_io:
3378 case Hexagon::L4_loadrub_ur:
3379 case Hexagon::L4_loadrub_ap:
3380 case Hexagon::L2_loadrub_pr:
3381 case Hexagon::L2_loadrub_pbr:
3382 case Hexagon::L2_loadrub_pi:
3383 case Hexagon::L2_loadrub_pci:
3384 case Hexagon::L2_loadrub_pcr:
3385 case Hexagon::L2_loadbzw2_io:
3386 case Hexagon::L4_loadbzw2_ur:
3387 case Hexagon::L4_loadbzw2_ap:
3388 case Hexagon::L2_loadbzw2_pr:
3389 case Hexagon::L2_loadbzw2_pbr:
3390 case Hexagon::L2_loadbzw2_pi:
3391 case Hexagon::L2_loadbzw2_pci:
3392 case Hexagon::L2_loadbzw2_pcr:
3393 case Hexagon::L2_loadbzw4_io:
3394 case Hexagon::L4_loadbzw4_ur:
3395 case Hexagon::L4_loadbzw4_ap:
3396 case Hexagon::L2_loadbzw4_pr:
3397 case Hexagon::L2_loadbzw4_pbr:
3398 case Hexagon::L2_loadbzw4_pi:
3399 case Hexagon::L2_loadbzw4_pci:
3400 case Hexagon::L2_loadbzw4_pcr:
3401 case Hexagon::L4_loadrub_rr:
3402 case Hexagon::L2_ploadrubt_io:
3403 case Hexagon::L2_ploadrubt_pi:
3404 case Hexagon::L2_ploadrubf_io:
3405 case Hexagon::L2_ploadrubf_pi:
3406 case Hexagon::L2_ploadrubtnew_io:
3407 case Hexagon::L2_ploadrubfnew_io:
3408 case Hexagon::L4_ploadrubt_rr:
3409 case Hexagon::L4_ploadrubf_rr:
3410 case Hexagon::L4_ploadrubtnew_rr:
3411 case Hexagon::L4_ploadrubfnew_rr:
3412 case Hexagon::L2_ploadrubtnew_pi:
3413 case Hexagon::L2_ploadrubfnew_pi:
3414 case Hexagon::L4_ploadrubt_abs:
3415 case Hexagon::L4_ploadrubf_abs:
3416 case Hexagon::L4_ploadrubtnew_abs:
3417 case Hexagon::L4_ploadrubfnew_abs:
3418 case Hexagon::L2_loadrubgp:
3420 case Hexagon::L2_loadruh_io:
3421 case Hexagon::L4_loadruh_ur:
3422 case Hexagon::L4_loadruh_ap:
3423 case Hexagon::L2_loadruh_pr:
3424 case Hexagon::L2_loadruh_pbr:
3425 case Hexagon::L2_loadruh_pi:
3426 case Hexagon::L2_loadruh_pci:
3427 case Hexagon::L2_loadruh_pcr:
3428 case Hexagon::L4_loadruh_rr:
3429 case Hexagon::L2_ploadruht_io:
3430 case Hexagon::L2_ploadruht_pi:
3431 case Hexagon::L2_ploadruhf_io:
3432 case Hexagon::L2_ploadruhf_pi:
3433 case Hexagon::L2_ploadruhtnew_io:
3434 case Hexagon::L2_ploadruhfnew_io:
3435 case Hexagon::L4_ploadruht_rr:
3436 case Hexagon::L4_ploadruhf_rr:
3437 case Hexagon::L4_ploadruhtnew_rr:
3438 case Hexagon::L4_ploadruhfnew_rr:
3439 case Hexagon::L2_ploadruhtnew_pi:
3440 case Hexagon::L2_ploadruhfnew_pi:
3441 case Hexagon::L4_ploadruht_abs:
3442 case Hexagon::L4_ploadruhf_abs:
3443 case Hexagon::L4_ploadruhtnew_abs:
3444 case Hexagon::L4_ploadruhfnew_abs:
3445 case Hexagon::L2_loadruhgp:
3465 OffsetIsScalable =
false;
3467 if (!BaseOp || !BaseOp->
isReg())
3476 if (Second.
mayStore() &&
First.getOpcode() == Hexagon::S2_allocframe) {
3478 if (
Op.isReg() &&
Op.isUse() &&
Op.getReg() == Hexagon::R29)
3488 if (!Stored.
isReg())
3490 for (
unsigned i = 0, e =
First.getNumOperands(); i < e; ++i) {
3492 if (
Op.isReg() &&
Op.isDef() &&
Op.getReg() == Stored.
getReg())
3501 return Opc == Hexagon::PS_call_nr ||
Opc == Hexagon::PS_callr_nr;
3517 if (Hexagon::getRegForm(
MI.getOpcode()) >= 0)
3520 if (
MI.getDesc().mayLoad() ||
MI.getDesc().mayStore()) {
3527 NonExtOpcode = Hexagon::changeAddrMode_abs_io(
MI.getOpcode());
3533 NonExtOpcode = Hexagon::changeAddrMode_io_rr(
MI.getOpcode());
3536 NonExtOpcode = Hexagon::changeAddrMode_ur_rr(
MI.getOpcode());
3541 if (NonExtOpcode < 0)
3561 const uint64_t
F =
MI.getDesc().TSFlags;
3563 Subtarget.hasV60Ops();
3568 if (
MI.mayStore() && !Subtarget.useNewValueStores())
3571 const uint64_t
F =
MI.getDesc().TSFlags;
3576 return MI.getOpcode() == Hexagon::LX_L16b_pseudo;
3580 return MI.getOpcode() == Hexagon::LX_S16b_pseudo;
3610 if (!MII->isBundle())
3613 for (++MII; MII != MIE && MII->isInsideBundle(); ++MII) {
3625 if (MO.isRegMask() && MO.clobbersPhysReg(PredReg))
3627 if (MO.isReg() && MO.isDef() && MO.isImplicit() && (MO.getReg() == PredReg))
3633 switch (
MI.getOpcode()) {
3634 case Hexagon::A4_addp_c:
3635 case Hexagon::A4_subp_c:
3636 case Hexagon::A4_tlbmatch:
3637 case Hexagon::A5_ACS:
3638 case Hexagon::F2_sfinvsqrta:
3639 case Hexagon::F2_sfrecipa:
3640 case Hexagon::J2_endloop0:
3641 case Hexagon::J2_endloop01:
3642 case Hexagon::J2_ploop1si:
3643 case Hexagon::J2_ploop1sr:
3644 case Hexagon::J2_ploop2si:
3645 case Hexagon::J2_ploop2sr:
3646 case Hexagon::J2_ploop3si:
3647 case Hexagon::J2_ploop3sr:
3648 case Hexagon::S2_cabacdecbin:
3649 case Hexagon::S2_storew_locked:
3650 case Hexagon::S4_stored_locked:
3657 return Opcode == Hexagon::J2_jumpt ||
3658 Opcode == Hexagon::J2_jumptpt ||
3659 Opcode == Hexagon::J2_jumpf ||
3660 Opcode == Hexagon::J2_jumpfpt ||
3661 Opcode == Hexagon::J2_jumptnew ||
3662 Opcode == Hexagon::J2_jumpfnew ||
3663 Opcode == Hexagon::J2_jumptnewpt ||
3664 Opcode == Hexagon::J2_jumpfnewpt;
3674 const uint64_t
F =
MI.getDesc().TSFlags;
3693 unsigned BasePos = 0, OffsetPos = 0;
3716 unsigned &BasePos,
unsigned &OffsetPos)
const {
3724 }
else if (
MI.mayStore()) {
3727 }
else if (
MI.mayLoad()) {
3742 if (!
MI.getOperand(BasePos).isReg() || !
MI.getOperand(OffsetPos).isImm())
3757 if (
I ==
MBB.instr_begin())
3776 }
while (
I !=
MBB.instr_begin());
3778 I =
MBB.instr_end();
3781 while (
I->isDebugInstr()) {
3782 if (
I ==
MBB.instr_begin())
3786 if (!isUnpredicatedTerminator(*
I))
3795 if (&*
I != LastInst && !
I->isBundle() && isUnpredicatedTerminator(*
I)) {
3796 if (!SecondLastInst) {
3797 SecondLastInst = &*
I;
3802 if (
I ==
MBB.instr_begin())
3811 const uint64_t
F =
MI.getDesc().TSFlags;
3819 Register DstReg, SrcReg, Src1Reg, Src2Reg;
3821 switch (
MI.getOpcode()) {
3830 case Hexagon::C2_cmpeq:
3831 case Hexagon::C2_cmpgt:
3832 case Hexagon::C2_cmpgtu:
3833 DstReg =
MI.getOperand(0).getReg();
3834 Src1Reg =
MI.getOperand(1).getReg();
3835 Src2Reg =
MI.getOperand(2).getReg();
3836 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3837 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3841 case Hexagon::C2_cmpeqi:
3842 case Hexagon::C2_cmpgti:
3843 case Hexagon::C2_cmpgtui:
3845 DstReg =
MI.getOperand(0).getReg();
3846 SrcReg =
MI.getOperand(1).getReg();
3847 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3848 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3851 (
MI.getOperand(2).getImm() == -1)))
3854 case Hexagon::A2_tfr:
3856 DstReg =
MI.getOperand(0).getReg();
3857 SrcReg =
MI.getOperand(1).getReg();
3861 case Hexagon::A2_tfrsi:
3865 DstReg =
MI.getOperand(0).getReg();
3869 case Hexagon::S2_tstbit_i:
3870 DstReg =
MI.getOperand(0).getReg();
3871 Src1Reg =
MI.getOperand(1).getReg();
3872 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3873 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3874 MI.getOperand(2).isImm() &&
3882 case Hexagon::J2_jumptnew:
3883 case Hexagon::J2_jumpfnew:
3884 case Hexagon::J2_jumptnewpt:
3885 case Hexagon::J2_jumpfnewpt:
3886 Src1Reg =
MI.getOperand(0).getReg();
3887 if (Hexagon::PredRegsRegClass.
contains(Src1Reg) &&
3888 (Hexagon::P0 == Src1Reg || Hexagon::P1 == Src1Reg))
3895 case Hexagon::J2_jump:
3896 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4:
3897 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4_PIC:
3909 if ((GA.
getOpcode() != Hexagon::C2_cmpeqi) ||
3910 (GB.
getOpcode() != Hexagon::J2_jumptnew))
3915 if (DestReg != Hexagon::P0 && DestReg != Hexagon::P1)
3923 return DestReg == Hexagon::P0 ? Hexagon::J4_cmpeqn1_tp0_jump_nt
3924 : Hexagon::J4_cmpeqn1_tp1_jump_nt;
3927 return DestReg == Hexagon::P0 ? Hexagon::J4_cmpeqi_tp0_jump_nt
3928 : Hexagon::J4_cmpeqi_tp1_jump_nt;
3933 bool ForBigCore)
const {
3941 static const std::map<unsigned, unsigned> DupMap = {
3942 {Hexagon::A2_add, Hexagon::dup_A2_add},
3943 {Hexagon::A2_addi, Hexagon::dup_A2_addi},
3944 {Hexagon::A2_andir, Hexagon::dup_A2_andir},
3945 {Hexagon::A2_combineii, Hexagon::dup_A2_combineii},
3946 {Hexagon::A2_sxtb, Hexagon::dup_A2_sxtb},
3947 {Hexagon::A2_sxth, Hexagon::dup_A2_sxth},
3948 {Hexagon::A2_tfr, Hexagon::dup_A2_tfr},
3949 {Hexagon::A2_tfrsi, Hexagon::dup_A2_tfrsi},
3950 {Hexagon::A2_zxtb, Hexagon::dup_A2_zxtb},
3951 {Hexagon::A2_zxth, Hexagon::dup_A2_zxth},
3952 {Hexagon::A4_combineii, Hexagon::dup_A4_combineii},
3953 {Hexagon::A4_combineir, Hexagon::dup_A4_combineir},
3954 {Hexagon::A4_combineri, Hexagon::dup_A4_combineri},
3955 {Hexagon::C2_cmoveif, Hexagon::dup_C2_cmoveif},
3956 {Hexagon::C2_cmoveit, Hexagon::dup_C2_cmoveit},
3957 {Hexagon::C2_cmovenewif, Hexagon::dup_C2_cmovenewif},
3958 {Hexagon::C2_cmovenewit, Hexagon::dup_C2_cmovenewit},
3959 {Hexagon::C2_cmpeqi, Hexagon::dup_C2_cmpeqi},
3960 {Hexagon::L2_deallocframe, Hexagon::dup_L2_deallocframe},
3961 {Hexagon::L2_loadrb_io, Hexagon::dup_L2_loadrb_io},
3962 {Hexagon::L2_loadrd_io, Hexagon::dup_L2_loadrd_io},
3963 {Hexagon::L2_loadrh_io, Hexagon::dup_L2_loadrh_io},
3964 {Hexagon::L2_loadri_io, Hexagon::dup_L2_loadri_io},
3965 {Hexagon::L2_loadrub_io, Hexagon::dup_L2_loadrub_io},
3966 {Hexagon::L2_loadruh_io, Hexagon::dup_L2_loadruh_io},
3967 {Hexagon::S2_allocframe, Hexagon::dup_S2_allocframe},
3968 {Hexagon::S2_storerb_io, Hexagon::dup_S2_storerb_io},
3969 {Hexagon::S2_storerd_io, Hexagon::dup_S2_storerd_io},
3970 {Hexagon::S2_storerh_io, Hexagon::dup_S2_storerh_io},
3971 {Hexagon::S2_storeri_io, Hexagon::dup_S2_storeri_io},
3972 {Hexagon::S4_storeirb_io, Hexagon::dup_S4_storeirb_io},
3973 {Hexagon::S4_storeiri_io, Hexagon::dup_S4_storeiri_io},
3975 unsigned OpNum =
MI.getOpcode();
3978 auto Iter = DupMap.find(OpNum);
3979 if (Iter != DupMap.end())
3980 return Iter->second;
3982 for (
const auto &Iter : DupMap)
3983 if (Iter.second == OpNum)
3990 enum Hexagon::PredSense inPredSense;
3991 inPredSense = invertPredicate ? Hexagon::PredSense_false :
3992 Hexagon::PredSense_true;
3993 int CondOpcode = Hexagon::getPredOpcode(
Opc, inPredSense);
3994 if (CondOpcode >= 0)
4002 switch (
MI.getOpcode()) {
4004 case Hexagon::V6_vL32b_pi:
4005 return Hexagon::V6_vL32b_cur_pi;
4006 case Hexagon::V6_vL32b_ai:
4007 return Hexagon::V6_vL32b_cur_ai;
4008 case Hexagon::V6_vL32b_nt_pi:
4009 return Hexagon::V6_vL32b_nt_cur_pi;
4010 case Hexagon::V6_vL32b_nt_ai:
4011 return Hexagon::V6_vL32b_nt_cur_ai;
4012 case Hexagon::V6_vL32b_ppu:
4013 return Hexagon::V6_vL32b_cur_ppu;
4014 case Hexagon::V6_vL32b_nt_ppu:
4015 return Hexagon::V6_vL32b_nt_cur_ppu;
4022 switch (
MI.getOpcode()) {
4024 case Hexagon::V6_vL32b_cur_pi:
4025 return Hexagon::V6_vL32b_pi;
4026 case Hexagon::V6_vL32b_cur_ai:
4027 return Hexagon::V6_vL32b_ai;
4028 case Hexagon::V6_vL32b_nt_cur_pi:
4029 return Hexagon::V6_vL32b_nt_pi;
4030 case Hexagon::V6_vL32b_nt_cur_ai:
4031 return Hexagon::V6_vL32b_nt_ai;
4032 case Hexagon::V6_vL32b_cur_ppu:
4033 return Hexagon::V6_vL32b_ppu;
4034 case Hexagon::V6_vL32b_nt_cur_ppu:
4035 return Hexagon::V6_vL32b_nt_ppu;
4123 int NVOpcode = Hexagon::getNewValueOpcode(
MI.getOpcode());
4127 switch (
MI.getOpcode()) {
4130 std::to_string(
MI.getOpcode()));
4131 case Hexagon::S4_storerb_ur:
4132 return Hexagon::S4_storerbnew_ur;
4134 case Hexagon::S2_storerb_pci:
4135 return Hexagon::S2_storerb_pci;
4137 case Hexagon::S2_storeri_pci:
4138 return Hexagon::S2_storeri_pci;
4140 case Hexagon::S2_storerh_pci:
4141 return Hexagon::S2_storerh_pci;
4143 case Hexagon::S2_storerd_pci:
4144 return Hexagon::S2_storerd_pci;
4146 case Hexagon::S2_storerf_pci:
4147 return Hexagon::S2_storerf_pci;
4149 case Hexagon::V6_vS32b_ai:
4150 return Hexagon::V6_vS32b_new_ai;
4152 case Hexagon::V6_vS32b_pi:
4153 return Hexagon::V6_vS32b_new_pi;
4178 if (BrTarget.
isMBB()) {
4180 Taken = getEdgeProbability(Src, Dst) >= OneHalf;
4193 bool SawCond =
false, Bad =
false;
4197 if (
I.isConditionalBranch()) {
4204 if (
I.isUnconditionalBranch() && !SawCond) {
4212 if (NextIt ==
B.instr_end()) {
4215 if (!
B.isLayoutSuccessor(SB))
4217 Taken = getEdgeProbability(Src, SB) < OneHalf;
4221 assert(NextIt->isUnconditionalBranch());
4230 Taken =
BT && getEdgeProbability(Src,
BT) < OneHalf;
4237 switch (
MI.getOpcode()) {
4238 case Hexagon::J2_jumpt:
4239 return Taken ? Hexagon::J2_jumptnewpt : Hexagon::J2_jumptnew;
4240 case Hexagon::J2_jumpf:
4241 return Taken ? Hexagon::J2_jumpfnewpt : Hexagon::J2_jumpfnew;
4251 switch (
MI.getOpcode()) {
4253 case Hexagon::J2_jumpt:
4254 case Hexagon::J2_jumpf:
4258 int NewOpcode = Hexagon::getPredNewOpcode(
MI.getOpcode());
4265 int NewOp =
MI.getOpcode();
4267 NewOp = Hexagon::getPredOldOpcode(NewOp);
4271 if (!Subtarget.hasFeature(Hexagon::ArchV60)) {
4273 case Hexagon::J2_jumptpt:
4274 NewOp = Hexagon::J2_jumpt;
4276 case Hexagon::J2_jumpfpt:
4277 NewOp = Hexagon::J2_jumpf;
4279 case Hexagon::J2_jumprtpt:
4280 NewOp = Hexagon::J2_jumprt;
4282 case Hexagon::J2_jumprfpt:
4283 NewOp = Hexagon::J2_jumprf;
4288 "Couldn't change predicate new instruction to its old form.");
4292 NewOp = Hexagon::getNonNVStore(NewOp);
4293 assert(NewOp >= 0 &&
"Couldn't change new-value store to its old form.");
4296 if (Subtarget.hasV60Ops())
4301 case Hexagon::J2_jumpfpt:
4302 return Hexagon::J2_jumpf;
4303 case Hexagon::J2_jumptpt:
4304 return Hexagon::J2_jumpt;
4305 case Hexagon::J2_jumprfpt:
4306 return Hexagon::J2_jumprf;
4307 case Hexagon::J2_jumprtpt:
4308 return Hexagon::J2_jumprt;
4317 Register DstReg, SrcReg, Src1Reg, Src2Reg;
4320 switch (
MI.getOpcode()) {
4328 case Hexagon::L2_loadri_io:
4329 case Hexagon::dup_L2_loadri_io:
4330 DstReg =
MI.getOperand(0).getReg();
4331 SrcReg =
MI.getOperand(1).getReg();
4335 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4337 MI.getOperand(2).isImm() &&
4342 (
MI.getOperand(2).isImm() &&
4347 case Hexagon::L2_loadrub_io:
4348 case Hexagon::dup_L2_loadrub_io:
4350 DstReg =
MI.getOperand(0).getReg();
4351 SrcReg =
MI.getOperand(1).getReg();
4353 MI.getOperand(2).isImm() &&
isUInt<4>(
MI.getOperand(2).getImm()))
4366 case Hexagon::L2_loadrh_io:
4367 case Hexagon::L2_loadruh_io:
4368 case Hexagon::dup_L2_loadrh_io:
4369 case Hexagon::dup_L2_loadruh_io:
4371 DstReg =
MI.getOperand(0).getReg();
4372 SrcReg =
MI.getOperand(1).getReg();
4374 MI.getOperand(2).isImm() &&
4378 case Hexagon::L2_loadrb_io:
4379 case Hexagon::dup_L2_loadrb_io:
4381 DstReg =
MI.getOperand(0).getReg();
4382 SrcReg =
MI.getOperand(1).getReg();
4384 MI.getOperand(2).isImm() &&
4388 case Hexagon::L2_loadrd_io:
4389 case Hexagon::dup_L2_loadrd_io:
4391 DstReg =
MI.getOperand(0).getReg();
4392 SrcReg =
MI.getOperand(1).getReg();
4394 Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4396 MI.getOperand(2).isImm() &&
4402 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4:
4403 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4_PIC:
4404 case Hexagon::L4_return:
4405 case Hexagon::L2_deallocframe:
4406 case Hexagon::dup_L2_deallocframe:
4408 case Hexagon::EH_RETURN_JMPR:
4409 case Hexagon::PS_jmpret:
4410 case Hexagon::SL2_jumpr31:
4413 DstReg =
MI.getOperand(0).getReg();
4414 if (Hexagon::IntRegsRegClass.
contains(DstReg) && (Hexagon::R31 == DstReg))
4417 case Hexagon::PS_jmprett:
4418 case Hexagon::PS_jmpretf:
4419 case Hexagon::PS_jmprettnewpt:
4420 case Hexagon::PS_jmpretfnewpt:
4421 case Hexagon::PS_jmprettnew:
4422 case Hexagon::PS_jmpretfnew:
4423 case Hexagon::SL2_jumpr31_t:
4424 case Hexagon::SL2_jumpr31_f:
4425 case Hexagon::SL2_jumpr31_tnew:
4426 case Hexagon::SL2_jumpr31_fnew:
4427 DstReg =
MI.getOperand(1).getReg();
4428 SrcReg =
MI.getOperand(0).getReg();
4430 if ((Hexagon::PredRegsRegClass.
contains(SrcReg) &&
4431 (Hexagon::P0 == SrcReg)) &&
4432 (Hexagon::IntRegsRegClass.
contains(DstReg) && (Hexagon::R31 == DstReg)))
4435 case Hexagon::L4_return_t:
4436 case Hexagon::L4_return_f:
4437 case Hexagon::L4_return_tnew_pnt:
4438 case Hexagon::L4_return_fnew_pnt:
4439 case Hexagon::L4_return_tnew_pt:
4440 case Hexagon::L4_return_fnew_pt:
4442 SrcReg =
MI.getOperand(0).getReg();
4443 if (Hexagon::PredRegsRegClass.
contains(SrcReg) && (Hexagon::P0 == SrcReg))
4451 case Hexagon::S2_storeri_io:
4452 case Hexagon::dup_S2_storeri_io:
4455 Src1Reg =
MI.getOperand(0).getReg();
4456 Src2Reg =
MI.getOperand(2).getReg();
4457 if (Hexagon::IntRegsRegClass.
contains(Src1Reg) &&
4464 MI.getOperand(1).isImm() &&
4468 case Hexagon::S2_storerb_io:
4469 case Hexagon::dup_S2_storerb_io:
4471 Src1Reg =
MI.getOperand(0).getReg();
4472 Src2Reg =
MI.getOperand(2).getReg();
4474 MI.getOperand(1).isImm() &&
isUInt<4>(
MI.getOperand(1).getImm()))
4486 case Hexagon::S2_storerh_io:
4487 case Hexagon::dup_S2_storerh_io:
4489 Src1Reg =
MI.getOperand(0).getReg();
4490 Src2Reg =
MI.getOperand(2).getReg();
4492 MI.getOperand(1).isImm() &&
4496 case Hexagon::S2_storerd_io:
4497 case Hexagon::dup_S2_storerd_io:
4499 Src1Reg =
MI.getOperand(0).getReg();
4500 Src2Reg =
MI.getOperand(2).getReg();
4502 Hexagon::IntRegsRegClass.
contains(Src1Reg) &&
4507 case Hexagon::S4_storeiri_io:
4508 case Hexagon::dup_S4_storeiri_io:
4510 Src1Reg =
MI.getOperand(0).getReg();
4513 MI.getOperand(2).isImm() &&
isUInt<1>(
MI.getOperand(2).getImm()))
4516 case Hexagon::S4_storeirb_io:
4517 case Hexagon::dup_S4_storeirb_io:
4519 Src1Reg =
MI.getOperand(0).getReg();
4521 MI.getOperand(1).isImm() &&
isUInt<4>(
MI.getOperand(1).getImm()) &&
4522 MI.getOperand(2).isImm() &&
isUInt<1>(
MI.getOperand(2).getImm()))
4525 case Hexagon::S2_allocframe:
4526 case Hexagon::dup_S2_allocframe:
4527 if (
MI.getOperand(2).isImm() &&
4549 case Hexagon::A2_addi:
4550 case Hexagon::dup_A2_addi:
4551 DstReg =
MI.getOperand(0).getReg();
4552 SrcReg =
MI.getOperand(1).getReg();
4555 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4560 if ((DstReg == SrcReg) &&
MI.getOperand(2).isImm() &&
4566 ((
MI.getOperand(2).getImm() == 1) ||
4567 (
MI.getOperand(2).getImm() == -1)))
4571 case Hexagon::A2_add:
4572 case Hexagon::dup_A2_add:
4574 DstReg =
MI.getOperand(0).getReg();
4575 Src1Reg =
MI.getOperand(1).getReg();
4576 Src2Reg =
MI.getOperand(2).getReg();
4581 case Hexagon::A2_andir:
4582 case Hexagon::dup_A2_andir:
4586 DstReg =
MI.getOperand(0).getReg();
4587 SrcReg =
MI.getOperand(1).getReg();
4589 MI.getOperand(2).isImm() &&
4590 ((
MI.getOperand(2).getImm() == 1) ||
4591 (
MI.getOperand(2).getImm() == 255)))
4594 case Hexagon::A2_tfr:
4595 case Hexagon::dup_A2_tfr:
4597 DstReg =
MI.getOperand(0).getReg();
4598 SrcReg =
MI.getOperand(1).getReg();
4602 case Hexagon::A2_tfrsi:
4603 case Hexagon::dup_A2_tfrsi:
4608 DstReg =
MI.getOperand(0).getReg();
4612 case Hexagon::C2_cmoveit:
4613 case Hexagon::C2_cmovenewit:
4614 case Hexagon::C2_cmoveif:
4615 case Hexagon::C2_cmovenewif:
4616 case Hexagon::dup_C2_cmoveit:
4617 case Hexagon::dup_C2_cmovenewit:
4618 case Hexagon::dup_C2_cmoveif:
4619 case Hexagon::dup_C2_cmovenewif:
4623 DstReg =
MI.getOperand(0).getReg();
4624 SrcReg =
MI.getOperand(1).getReg();
4626 Hexagon::PredRegsRegClass.
contains(SrcReg) && Hexagon::P0 == SrcReg &&
4627 MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0)
4630 case Hexagon::C2_cmpeqi:
4631 case Hexagon::dup_C2_cmpeqi:
4633 DstReg =
MI.getOperand(0).getReg();
4634 SrcReg =
MI.getOperand(1).getReg();
4635 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
4637 MI.getOperand(2).isImm() &&
isUInt<2>(
MI.getOperand(2).getImm()))
4640 case Hexagon::A2_combineii:
4641 case Hexagon::A4_combineii:
4642 case Hexagon::dup_A2_combineii:
4643 case Hexagon::dup_A4_combineii:
4645 DstReg =
MI.getOperand(0).getReg();
4647 ((
MI.getOperand(1).isImm() &&
isUInt<2>(
MI.getOperand(1).getImm())) ||
4648 (
MI.getOperand(1).isGlobal() &&
4650 ((
MI.getOperand(2).isImm() &&
isUInt<2>(
MI.getOperand(2).getImm())) ||
4651 (
MI.getOperand(2).isGlobal() &&
4655 case Hexagon::A4_combineri:
4656 case Hexagon::dup_A4_combineri:
4659 DstReg =
MI.getOperand(0).getReg();
4660 SrcReg =
MI.getOperand(1).getReg();
4662 ((
MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0) ||
4663 (
MI.getOperand(2).isGlobal() &&
MI.getOperand(2).getOffset() == 0)))
4666 case Hexagon::A4_combineir:
4667 case Hexagon::dup_A4_combineir:
4669 DstReg =
MI.getOperand(0).getReg();
4670 SrcReg =
MI.getOperand(2).getReg();
4672 ((
MI.getOperand(1).isImm() &&
MI.getOperand(1).getImm() == 0) ||
4673 (
MI.getOperand(1).isGlobal() &&
MI.getOperand(1).getOffset() == 0)))
4676 case Hexagon::A2_sxtb:
4677 case Hexagon::A2_sxth:
4678 case Hexagon::A2_zxtb:
4679 case Hexagon::A2_zxth:
4680 case Hexagon::dup_A2_sxtb:
4681 case Hexagon::dup_A2_sxth:
4682 case Hexagon::dup_A2_zxtb:
4683 case Hexagon::dup_A2_zxth:
4685 DstReg =
MI.getOperand(0).getReg();
4686 SrcReg =
MI.getOperand(1).getReg();
4702 if (
MI.isTransient())
4726 int Idx =
DefMI.findRegisterDefOperandIdx(SR, &HRI,
false,
false);
4737 int Idx =
UseMI.findRegisterUseOperandIdx(SR, &HRI,
false);
4771 : Hexagon::getTruePredOpcode(
Opc);
4772 if (InvPredOpcode >= 0)
4773 return InvPredOpcode;
4780 const uint64_t
F =
MI.getDesc().TSFlags;
4787 return ~(-1U << (bits - 1));
4789 return ~(-1U << bits);
4794 switch (
MI.getOpcode()) {
4795 case Hexagon::L2_loadrbgp:
4796 case Hexagon::L2_loadrdgp:
4797 case Hexagon::L2_loadrhgp:
4798 case Hexagon::L2_loadrigp:
4799 case Hexagon::L2_loadrubgp:
4800 case Hexagon::L2_loadruhgp:
4801 case Hexagon::S2_storerbgp:
4802 case Hexagon::S2_storerbnewgp:
4803 case Hexagon::S2_storerhgp:
4804 case Hexagon::S2_storerhnewgp:
4805 case Hexagon::S2_storerigp:
4806 case Hexagon::S2_storerinewgp:
4807 case Hexagon::S2_storerdgp:
4808 case Hexagon::S2_storerfgp:
4811 const uint64_t
F =
MI.getDesc().TSFlags;
4826 if (
MI.getOpcode() == Hexagon::A4_ext)
4834 const uint64_t
F =
MI.getDesc().TSFlags;
4840 bool ToBigInstrs)
const {
4852 MII->setDesc(
get(Opcode));
4858 bool ToBigInstrs)
const {
4861 End = MB.instr_end();
4862 Instr !=
End; ++Instr)
4870 while ((MII !=
MBB->instr_end()) && MII->isInsideBundle()) {
4879 const uint64_t
F =
MI.getDesc().TSFlags;
4880 unsigned S = (
F >> MemAccessSizePos) & MemAccesSizeMask;
4881 unsigned Size = getMemAccessSizeInBytes(MemAccessSize(S));
4885 if (
MI.getOpcode() == Hexagon::Y2_dcfetchbo)
4892 return HRI.getSpillSize(Hexagon::HvxVRRegClass);
4894 return HRI.getSpillSize(Hexagon::HlxLRRegClass);
4902 const uint64_t
F =
MI.getDesc().TSFlags;
4909 return -1U << (bits - 1);
4918 short NonExtOpcode = Hexagon::getRegForm(
MI.getOpcode());
4919 if (NonExtOpcode >= 0)
4920 return NonExtOpcode;
4922 if (
MI.getDesc().mayLoad() ||
MI.getDesc().mayStore()) {
4926 return Hexagon::changeAddrMode_abs_io(
MI.getOpcode());
4928 return Hexagon::changeAddrMode_io_rr(
MI.getOpcode());
4930 return Hexagon::changeAddrMode_ur_rr(
MI.getOpcode());
4940 Register &PredReg,
unsigned &PredRegPos,
4949 PredReg =
Cond[1].getReg();
4953 if (
Cond[1].isImplicit())
4961 return Hexagon::getRegForm(
MI.getOpcode());
4969 if (
MI.isDebugInstr() ||
MI.isPosition())
4972 unsigned Size =
MI.getDesc().getSize();
4988 unsigned NumDefs = 0;
4989 for (;
MI.getOperand(NumDefs).
isReg() &&
MI.getOperand(NumDefs).isDef();
4991 assert(NumDefs !=
MI.getNumOperands()-2 &&
"No asm string?");
4993 assert(
MI.getOperand(NumDefs).isSymbol() &&
"No asm string?");
4995 const char *AsmStr =
MI.getOperand(NumDefs).getSymbolName();
5003 const uint64_t
F =
MI.getDesc().TSFlags;
5009 const InstrStage &IS = *
II.beginStage(
MI.getDesc().getSchedClass());
5011 return IS.getUnits();
5021 assert(BundleHead->isBundle() &&
"Not a bundle header");
5031 "Instruction must be extendable");
5037 "Branch with unknown extendable field type");
5049 int TargetPos =
MI.getNumOperands() - 1;
5052 while ((TargetPos > -1) && !
MI.getOperand(TargetPos).isMBB())
5054 assert((TargetPos >= 0) &&
MI.getOperand(TargetPos).isMBB());
5055 MI.getOperand(TargetPos).setMBB(NewTarget);
5059 MI.setDesc(
get(NewOpcode));
5071 for (
unsigned insn = TargetOpcode::GENERIC_OP_END+1;
5072 insn < Hexagon::INSTRUCTION_LIST_END; ++insn) {
5093 int PredRevOpcode = -1;
5095 PredRevOpcode = Hexagon::notTakenBranchPrediction(Opcode);
5097 PredRevOpcode = Hexagon::takenBranchPrediction(Opcode);
5098 assert(PredRevOpcode > 0);
5099 return PredRevOpcode;
5105 return Cond.empty() || (
Cond[0].isImm() && (
Cond.size() != 1));
5112 if (Operand.
isImm())
5113 Operand.
setImm(Operand.
getImm() | memShufDisabledMask);
5121 return (Operand.
isImm() && (Operand.
getImm() & memShufDisabledMask) != 0);
5125 return (
MI->getOpcode() == Hexagon::V6_vmpy_qf16_hf ||
5126 MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
5127 MI->getOpcode() == Hexagon::V6_vmpy_qf32_hf ||
5128 MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
5129 MI->getOpcode() == Hexagon::V6_vmpy_qf32_sf ||
5130 MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
5131 MI->getOpcode() == Hexagon::V6_vmpy_qf16 ||
5132 MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
5133 MI->getOpcode() == Hexagon::V6_vmpy_qf32_qf16 ||
5134 MI->getOpcode() == Hexagon::V6_vmpy_qf32);
5155 case Hexagon::V6_vabs_qf16_hf:
5157 case Hexagon::V6_vabs_qf16_qf16:
5159 case Hexagon::V6_vabs_qf32_qf32:
5161 case Hexagon::V6_vabs_qf32_sf:
5163 case Hexagon::V6_vadd_hf:
5165 case Hexagon::V6_vadd_qf16:
5167 case Hexagon::V6_vadd_qf16_mix:
5169 case Hexagon::V6_vadd_qf32:
5171 case Hexagon::V6_vadd_qf32_mix:
5173 case Hexagon::V6_vadd_sf:
5175 case Hexagon::V6_vconv_bf_qf32:
5177 case Hexagon::V6_vconv_f8_qf16:
5179 case Hexagon::V6_vconv_hf_qf16:
5181 case Hexagon::V6_vconv_hf_qf32:
5183 case Hexagon::V6_vconv_qf16_f8:
5185 case Hexagon::V6_vconv_qf16_hf:
5187 case Hexagon::V6_vconv_qf16_qf16:
5189 case Hexagon::V6_vconv_qf32_qf32:
5191 case Hexagon::V6_vconv_qf32_sf:
5193 case Hexagon::V6_vconv_sf_qf32:
5195 case Hexagon::V6_vilog2_qf16:
5197 case Hexagon::V6_vilog2_qf32:
5199 case Hexagon::V6_vmpy_qf16:
5201 case Hexagon::V6_vmpy_qf16_hf:
5203 case Hexagon::V6_vmpy_qf16_mix_hf:
5205 case Hexagon::V6_vmpy_qf32:
5207 case Hexagon::V6_vmpy_qf32_hf:
5209 case Hexagon::V6_vmpy_qf32_mix_hf:
5211 case Hexagon::V6_vmpy_qf32_qf16:
5213 case Hexagon::V6_vmpy_qf32_sf:
5215 case Hexagon::V6_vmpy_rt_hf:
5217 case Hexagon::V6_vmpy_rt_qf16:
5219 case Hexagon::V6_vmpy_rt_sf:
5221 case Hexagon::V6_vneg_qf16_hf:
5223 case Hexagon::V6_vneg_qf16_qf16:
5225 case Hexagon::V6_vneg_qf32_qf32:
5227 case Hexagon::V6_vneg_qf32_sf:
5229 case Hexagon::V6_vsub_hf:
5231 case Hexagon::V6_vsub_qf16:
5233 case Hexagon::V6_vsub_qf16_mix:
5235 case Hexagon::V6_vsub_qf32:
5237 case Hexagon::V6_vsub_qf32_mix:
5239 case Hexagon::V6_vsub_sf:
5241 case Hexagon::V6_vsub_sf_mix:
5243 case Hexagon::V6_vsub_hf_mix:
5316 if (!
A || !
B ||
A->getParent() !=
B->getParent())
5335 if (MO.isReg() && MO.getReg().isValid() &&
5336 (Between.isCall() || Between.modifiesRegister(MO.getReg(),
TRI)))
5353 if (
MI.isDebugValue() && !
MI.isDebugEntryValue() &&
5354 MI.readsRegister(DefReg,
TRI) &&
5371 MBB.insert(FinalPos, MF.CloneMachineInstr(
MI));
5373 if (!
MI->isDebugEntryValue() &&
MI->readsRegister(DefReg,
TRI))
5374 MI->setDebugValueUndef();
5379 return Opc >= 0 ? Hexagon::changeAddrMode_abs_io(
Opc) :
Opc;
5383 return Opc >= 0 ? Hexagon::changeAddrMode_io_abs(
Opc) :
Opc;
5387 return Opc >= 0 ? Hexagon::changeAddrMode_io_pi(
Opc) :
Opc;
5391 return Opc >= 0 ? Hexagon::changeAddrMode_io_rr(
Opc) :
Opc;
5395 return Opc >= 0 ? Hexagon::changeAddrMode_pi_io(
Opc) :
Opc;
5399 return Opc >= 0 ? Hexagon::changeAddrMode_rr_io(
Opc) :
Opc;
5403 return Opc >= 0 ? Hexagon::changeAddrMode_rr_ur(
Opc) :
Opc;
5407 return Opc >= 0 ? Hexagon::changeAddrMode_ur_rr(
Opc) :
Opc;
5421 if (MO.isReg() && MO.isInternalRead())
5432 bool IsPullDown)
const {
5445 bool IsDuplexCandidate =
false;
5448 IsDuplexCandidate =
true;
5453 BitVector Defs = MIUseDef->second.second;
5457 if (!DepSet && Defs.
count() > 1)
5466 for (
auto &RMIDef : RMII->all_defs()) {
5467 if (!RMIDef.isReg())
5472 for (
auto &RMIUse : RMII->all_uses()) {
5473 if (!RMIUse.isReg())
5492 for (
auto MII = SrcBeg; MII != SrcEnd; ++MII) {
5498 if (MIUseDefP == MIUseDefs.
end()) {
5499 assert(
MI->isBundle() ||
MI->isDebugInstr());
5506 for (
auto &SrcDef :
MI->all_defs()) {
5507 if (!SrcDef.isReg() || !
Uses[SrcDef.getReg()])
5509 int DefIdx = SrcDef.getOperandNo();
5510 int UseIdx = RMII->findRegisterUseOperandIdx(SrcDef.getReg(),
TRI);
5512 if (DepSet && DepSet->
insert(
MI).second)
5513 Dep |=
srcDependence(SrcBeg, SrcEnd, MII, MIUseDefs, DepSet,
5518 if (DepSet && DepSet->
insert(
MI).second)
5519 Dep |=
srcDependence(SrcBeg, SrcEnd, MII, MIUseDefs, DepSet,
5522 }
else if (DepSet && IsPullDown) {
5525 Dep |=
srcDependence(SrcBeg, SrcEnd, MII, MIUseDefs, DepSet,
5534 for (
auto &SrcUse :
MI->all_uses()) {
5535 if (!SrcUse.isReg() || !Defs[SrcUse.getReg()])
5537 int DefIdx = RMII->findRegisterDefOperandIdx(SrcUse.getReg(),
TRI);
5539 if (DepSet && DepSet->
insert(
MI).second)
5540 Dep |=
srcDependence(SrcBeg, SrcEnd, MII, MIUseDefs, DepSet,
5545 if (DepSet && DepSet->
insert(
MI).second)
5546 Dep |=
srcDependence(SrcBeg, SrcEnd, MII, MIUseDefs, DepSet,
5549 }
else if (DepSet) {
5553 Dep |=
srcDependence(SrcBeg, SrcEnd, MII, MIUseDefs, DepSet,
5570 if (MO.isReg() && MO.isDef() && MO.getReg().isPhysical())
5571 if (Hexagon::PredRegsRegClass.
contains(MO.getReg()))
5577std::optional<unsigned>
5582 case Hexagon::C2_cmpeqi:
5583 return Hexagon::C4_cmpneqi;
5584 case Hexagon::C4_cmpneqi:
5585 return Hexagon::C2_cmpeqi;
5586 case Hexagon::C2_cmpgti:
5587 return Hexagon::C4_cmpltei;
5588 case Hexagon::C4_cmpltei:
5589 return Hexagon::C2_cmpgti;
5590 case Hexagon::C2_cmpgtui:
5591 return Hexagon::C4_cmplteui;
5592 case Hexagon::C4_cmplteui:
5593 return Hexagon::C2_cmpgtui;
5594 case Hexagon::C2_cmpeq:
5595 return Hexagon::C4_cmpneq;
5596 case Hexagon::C4_cmpneq:
5597 return Hexagon::C2_cmpeq;
5598 case Hexagon::C2_cmpgt:
5599 return Hexagon::C4_cmplte;
5600 case Hexagon::C4_cmplte:
5601 return Hexagon::C2_cmpgt;
5602 case Hexagon::C2_cmpgtu:
5603 return Hexagon::C4_cmplteu;
5604 case Hexagon::C4_cmplteu:
5605 return Hexagon::C2_cmpgtu;
5607 case Hexagon::C2_bitsclri:
5608 return Hexagon::C4_nbitsclri;
5609 case Hexagon::C4_nbitsclri:
5610 return Hexagon::C2_bitsclri;
5611 case Hexagon::C2_bitsclr:
5612 return Hexagon::C4_nbitsclr;
5613 case Hexagon::C4_nbitsclr:
5614 return Hexagon::C2_bitsclr;
5615 case Hexagon::C2_bitsset:
5616 return Hexagon::C4_nbitsset;
5617 case Hexagon::C4_nbitsset:
5618 return Hexagon::C2_bitsset;
5620 case Hexagon::S2_tstbit_i:
5621 return Hexagon::S4_ntstbit_i;
5622 case Hexagon::S4_ntstbit_i:
5623 return Hexagon::S2_tstbit_i;
5624 case Hexagon::S2_tstbit_r:
5625 return Hexagon::S4_ntstbit_r;
5626 case Hexagon::S4_ntstbit_r:
5627 return Hexagon::S2_tstbit_r;
5630 return std::nullopt;
5636 auto OpC =
MI.getOpcode();
5637 return OpC == Hexagon::J2_ploop1sr || OpC == Hexagon::J2_ploop2sr ||
5638 OpC == Hexagon::J2_ploop3sr || OpC == Hexagon::J2_ploop1si ||
5639 OpC == Hexagon::J2_ploop2si || OpC == Hexagon::J2_ploop3si;
5651 for (
auto I = MIBegin;
I != MIEnd; ++
I) {
5653 if (
MI.isBundle() ||
MI.isDebugInstr())
5657 if (
MI.readsRegister(Reg, &
TRI))
5670 LLVM_DEBUG(
dbgs() <<
"\nPredication in NV-jump different from other ins.");
5676 for (
unsigned oper = 0; oper <
MI->getNumOperands(); ++oper) {
5679 if (HRI.isFakeReg(MO.
getReg()))
5682 if ((RC == &Hexagon::PredRegsRegClass) &&
5683 !
MI->definesRegister(MO.
getReg(), &HRI)) {
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
static bool mayAlias(MachineInstr &MIa, SmallVectorImpl< MachineInstr * > &MemInsns, AliasAnalysis *AA)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool isConstant(const MachineInstr &MI)
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
static const Function * getParent(const Value *V)
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
DXIL Forward Handle Accesses
static bool isSigned(unsigned Opcode)
const HexagonInstrInfo * TII
static cl::opt< bool > PreventDuplexSep("prevent-duplex-sep-v2", cl::Hidden, cl::init(true), cl::desc("Prevent separation of duplex while pullup in global scheduler V2"))
static void parseOperands(MachineInstr *MI, SmallVector< unsigned, 4 > &Defs, SmallVector< unsigned, 8 > &Uses)
Gather register def/uses from MI.
static bool usesInternalDefs(const MachineInstr &MI)
static cl::opt< bool > DisableNVSchedule("disable-hexagon-nv-schedule", cl::Hidden, cl::desc("Disable schedule adjustment for new value stores."))
const int Hexagon_MEMH_OFFSET_MAX
const int Hexagon_MEMB_OFFSET_MAX
const int Hexagon_MEMH_OFFSET_MIN
const int Hexagon_MEMD_OFFSET_MAX
static cl::opt< bool > EnableTimingClassLatency("enable-timing-class-latency", cl::Hidden, cl::init(false), cl::desc("Enable timing class latency"))
static bool isUnsafeMemoryObject(const MachineInstr *MI)
const int Hexagon_MEMD_OFFSET_MIN
const int Hexagon_ADDI_OFFSET_MAX
static cl::opt< bool > EnableACCForwarding("enable-acc-forwarding", cl::Hidden, cl::init(true), cl::desc("Enable vec acc forwarding"))
static void getLiveInRegsAt(LivePhysRegs &Regs, const MachineInstr &MI)
const int Hexagon_MEMW_OFFSET_MAX
Constants for Hexagon instructions.
const int Hexagon_MEMW_OFFSET_MIN
cl::opt< bool > ScheduleInlineAsm("hexagon-sched-inline-asm", cl::Hidden, cl::init(false), cl::desc("Do not consider inline-asm a scheduling/" "packetization boundary."))
const int Hexagon_ADDI_OFFSET_MIN
static cl::opt< bool > BranchRelaxAsmLarge("branch-relax-asm-large", cl::init(true), cl::Hidden, cl::desc("branch relax asm"))
static cl::opt< bool > EnableALUForwarding("enable-alu-forwarding", cl::Hidden, cl::init(true), cl::desc("Enable vec alu forwarding"))
const int Hexagon_MEMB_OFFSET_MIN
static unsigned nonDbgMICount(MachineBasicBlock::const_instr_iterator MIB, MachineBasicBlock::const_instr_iterator MIE)
Calculate number of instructions excluding the debug instructions.
static cl::opt< bool > EnableBranchPrediction("hexagon-enable-branch-prediction", cl::Hidden, cl::init(true), cl::desc("Enable branch prediction"))
static bool isDblRegForSubInst(Register Reg, const HexagonRegisterInfo &HRI)
static void getLiveOutRegsAt(LivePhysRegs &Regs, const MachineInstr &MI)
static bool canMoveDebugValue(MachineInstr &MI, MachineInstr &Second, const TargetRegisterInfo *TRI)
static cl::opt< bool > UseDFAHazardRec("dfa-hazard-rec", cl::init(true), cl::Hidden, cl::desc("Use the DFA based hazard recognizer."))
static bool isIntRegForSubInst(Register Reg)
static bool isDuplexPairMatch(unsigned Ga, unsigned Gb)
#define HEXAGON_INSTR_SIZE
std::pair< Instruction::BinaryOps, Value * > OffsetOp
Find all possible pairs (BinOp, RHS) that BinOp V, RHS can be simplified.
static constexpr Value * getValue(Ty &ValueOrUse)
const size_t AbstractManglingParser< Derived, Alloc >::NumOps
This file implements the LivePhysRegs utility for tracking liveness of physical registers.
SmallVector< MachineOperand, 4 > Cond
static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
Return the first DebugLoc that has line number information, given a range of instructions.
static bool isUndef(const MachineInstr &MI)
Register const TargetRegisterInfo * TRI
Promote Memory to Register
static MCRegister getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo)
static bool isReg(const MCInst &MI, unsigned OpNo)
uint64_t IntrinsicInst * II
PassBuilder PB(Mod->getContext(), Machine, PassOpts->PTO, std::nullopt, &PIC)
static StringRef getName(Value *V)
static bool isBranch(unsigned Opcode)
MachineRegisterInfo & MRI
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
Remove Loads Into Fake Uses
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
The possible results of an alias query.
@ NoAlias
The two locations do not alias at all.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_type count() const
Returns the number of bits which are set.
BitVector & set()
Set all bits in the bitvector.
iterator find(const_arg_type_t< KeyT > Val)
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT, true > const_iterator
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
bool isTmpLoadPseudo(const MachineInstr &MI) const
int getDuplexOpcode(const MachineInstr &MI, bool ForBigCore=true) const
bool isHLXVec(const MachineInstr &MI) const
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
Remove the branching code at the end of the specific MBB.
bool isPredicated(const MachineInstr &MI) const override
Returns true if the instruction is already predicated.
bool isHVXMemWithAIndirect(const MachineInstr &I, const MachineInstr &J) const
short changeAddrMode_abs_io(short Opc) const
bool isRestrictNoSlot1Store(const MachineInstr &MI) const
short getRegForm(const MachineInstr &MI) const
bool isVecALU(const MachineInstr &MI) const
bool definesPredicateReg(const MachineInstr &MI) const
bool isCompoundBranchInstr(const MachineInstr &MI) const
bool isDuplexPair(const MachineInstr &MIa, const MachineInstr &MIb) const
Symmetrical. See if these two instructions are fit for duplex pair.
bool isJumpR(const MachineInstr &MI) const
ScheduleHazardRecognizer * CreateTargetPostRAHazardRecognizer(const InstrItineraryData *II, const ScheduleDAG *DAG) const override
Allocate and return a hazard recognizer to use for this target when scheduling the machine instructio...
std::pair< unsigned, unsigned > decomposeMachineOperandsTargetFlags(unsigned TF) const override
Decompose the machine operand's target flags into two values - the direct target flag value and any o...
unsigned getInlineAsmLength(const char *Str, const MCAsmInfo &MAI, unsigned MaxInstLength=0) const override
Measure the specified inline asm to determine an approximation of its length.
bool getMemOperandsWithOffsetWidth(const MachineInstr &LdSt, SmallVectorImpl< const MachineOperand * > &BaseOps, int64_t &Offset, bool &OffsetIsScalable, LocationSize &Width) const override
Get the base register and byte offset of a load/store instr.
bool producesStall(const MachineInstr &ProdMI, const MachineInstr &ConsMI) const
bool invertAndChangeJumpTarget(MachineInstr &MI, MachineBasicBlock *NewTarget) const
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
Store the specified register of the given register class to the specified stack frame index.
bool isDotTmpInst(const MachineInstr &MI) const
bool isSoftwarePipelineLoopInstr(const MachineInstr &MI) const
bool isPredictedTaken(unsigned Opcode) const
bool isSaveCalleeSavedRegsCall(const MachineInstr &MI) const
bool hasQFPInstrs(const MachineFunction &MF) const
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
TargetInstrInfo overrides.
unsigned nonDbgBundleSize(MachineBasicBlock::const_iterator BundleHead) const
int getDotNewPredOp(const MachineInstr &MI, const MachineBranchProbabilityInfo *MBPI) const
bool isQFP32Instr(MachineInstr *MI) const
bool ClobbersPredicate(MachineInstr &MI, std::vector< MachineOperand > &Pred, bool SkipDead) const override
If the specified instruction defines any predicate or condition code register(s) used for predication...
unsigned getInvertedPredicatedOpcode(const int Opc) const
bool isPureSlot0(const MachineInstr &MI) const
bool doesNotReturn(const MachineInstr &CallMI) const
HexagonII::SubInstructionGroup getDuplexCandidateGroup(const MachineInstr &MI) const
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
Analyze the branching code at the end of MBB, returning true if it cannot be understood (e....
bool usesQF16Operand(MachineInstr *MI, unsigned Index=0) const
bool isPredicatedNew(const MachineInstr &MI) const
bool isSignExtendingLoad(const MachineInstr &MI) const
bool isVecAcc(const MachineInstr &MI) const
bool reversePredSense(MachineInstr &MI) const
bool isPostIncWithImmOffset(const MachineInstr &MI) const
bool isQFPMul(const MachineInstr *MF) const
unsigned getAddrMode(const MachineInstr &MI) const
MCInst getNop() const override
bool isJumpWithinBranchRange(const MachineInstr &MI, unsigned offset) const
bool mayBeNewStore(const MachineInstr &MI) const
bool isOperandExtended(const MachineInstr &MI, unsigned OperandNum) const
bool canExecuteInBundle(const MachineInstr &First, const MachineInstr &Second) const
Can these instructions execute at the same time in a bundle.
bool isQFP16Instr(MachineInstr *MI) const
std::optional< unsigned > getOperandLatency(const InstrItineraryData *ItinData, const MachineInstr &DefMI, unsigned DefIdx, const MachineInstr &UseMI, unsigned UseIdx) const override
getOperandLatency - Compute and return the use operand latency of a given pair of def and use.
int srcDependence(MachineBasicBlock::instr_iterator SrcBeg, MachineBasicBlock::instr_iterator SrcEnd, MachineBasicBlock::instr_iterator RMII, const MIUseDefMap &MIUseDefs, SmallPtrSetImpl< MachineInstr * > *DepSet=nullptr, bool PreventDuplexSep=true, bool IsPullDown=false) const
Compute the intra-packet dependence of RMII against the rest of the bundle [SrcBeg,...
bool isAddrModeWithOffset(const MachineInstr &MI) const
bool hasCallUseInBundle(MachineBasicBlock::const_instr_iterator MIBegin, MachineBasicBlock::const_instr_iterator MIEnd, unsigned Reg, const TargetRegisterInfo &TRI) const
bool isBaseImmOffset(const MachineInstr &MI) const
bool isAbsoluteSet(const MachineInstr &MI) const
short changeAddrMode_io_pi(short Opc) const
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register DestReg, Register SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
Emit instructions to copy a pair of physical registers.
void findInstrPredicate(MachineInstr *MI, SmallVectorImpl< MachineOperand > &Cond) const
findInstrPredicate - Set the predicate of the instruction in the specified predicate vector First ent...
const HexagonRegisterInfo & getRegisterInfo() const
short changeAddrMode_pi_io(short Opc) const
bool analyzeCompare(const MachineInstr &MI, Register &SrcReg, Register &SrcReg2, int64_t &Mask, int64_t &Value) const override
For a comparison instruction, return the source registers in SrcReg and SrcReg2 if having two registe...
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
Reverses the branch condition of the specified condition list, returning false on success and true if...
std::unique_ptr< PipelinerLoopInfo > analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const override
Analyze loop L, which must be a single-basic-block loop, and if the conditions can be understood enou...
bool isLoopN(const MachineInstr &MI) const
bool isSpillPredRegOp(const MachineInstr &MI) const
bool hasStoreToStackSlot(const MachineInstr &MI, SmallVectorImpl< const MachineMemOperand * > &Accesses) const override
Check if the instruction or the bundle of instructions has store to stack slots.
bool isFloatCompare(const MachineInstr &MI) const
ArrayRef< std::pair< unsigned, const char * > > getSerializableDirectMachineOperandTargetFlags() const override
Return an array that contains the direct target flag values and their names.
bool isIndirectCall(const MachineInstr &MI) const
short changeAddrMode_ur_rr(short Opc) const
bool isValidAutoIncImm(const EVT VT, const int Offset) const
bool hasNonExtEquivalent(const MachineInstr &MI) const
bool isConstExtended(const MachineInstr &MI) const
bool getIncrementValue(const MachineInstr &MI, int &Value) const override
If the instruction is an increment of a constant value, return the amount.
int getCondOpcode(int Opc, bool sense) const
void moveDependentDebugValues(MachineInstr &First, MachineInstr &Second) const
Copies the debug values of the variables that read the register First and Second define to just after...
MachineInstr * findLoopInstr(MachineBasicBlock *BB, unsigned EndLoopOp, MachineBasicBlock *TargetBB, SmallPtrSet< MachineBasicBlock *, 8 > &Visited) const
Find the hardware loop instruction used to set-up the specified loop.
unsigned getInstrTimingClassLatency(const InstrItineraryData *ItinData, const MachineInstr &MI) const
bool usesQF32Operand(MachineInstr *MI, unsigned Index=0) const
bool isAccumulator(const MachineInstr &MI) const
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
Insert branch code into the end of the specified MachineBasicBlock.
unsigned getInstrLatency(const InstrItineraryData *ItinData, const MachineInstr &MI, unsigned *PredCost=nullptr) const override
Compute the instruction latency of a given instruction.
bool PredOpcodeHasJMP_c(unsigned Opcode) const
bool isNewValue(const MachineInstr &MI) const
Register createVR(MachineFunction *MF, MVT VT) const
HexagonInstrInfo specifics.
bool isDotCurInst(const MachineInstr &MI) const
bool validateBranchCond(const ArrayRef< MachineOperand > &Cond) const
bool areMemAccessesDependent(AAResults *AA, const MachineInstr *MIa, const MachineInstr *MIb) const
Return true if the memory accesses of MIa and MIb may depend on each other.
bool isExtended(const MachineInstr &MI) const
bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, unsigned ExtraPredCycles, BranchProbability Probability) const override
Return true if it's profitable to predicate instructions with accumulated instruction latency of "Num...
bool isAsCheapAsAMove(const MachineInstr &MI) const override
int getMaxValue(const MachineInstr &MI) const
bool isPredicateLate(unsigned Opcode) const
short changeAddrMode_rr_ur(short Opc) const
bool isNewValueInst(const MachineInstr &MI) const
bool isHMXWeightInstr(const MachineInstr &MI) const
bool areMemAccessesTriviallyDisjoint(const MachineInstr &MIa, const MachineInstr &MIb) const override
int getNonDotCurOp(const MachineInstr &MI) const
bool isIndirectL4Return(const MachineInstr &MI) const
unsigned reversePrediction(unsigned Opcode) const
ArrayRef< std::pair< unsigned, const char * > > getSerializableBitmaskMachineOperandTargetFlags() const override
Return an array that contains the bitmask target flag values and their names.
bool isAssociativeAndCommutative(const MachineInstr &Inst, bool Invert) const override
InstrStage::FuncUnits getUnits(const MachineInstr &MI) const
unsigned getMemAccessSize(const MachineInstr &MI) const
bool predOpcodeHasNot(ArrayRef< MachineOperand > Cond) const
bool isComplex(const MachineInstr &MI) const
bool isPostIncrement(const MachineInstr &MI) const override
Return true for post-incremented instructions.
void setBundleNoShuf(MachineBasicBlock::instr_iterator MIB) const
MachineBasicBlock::instr_iterator expandVGatherPseudo(MachineInstr &MI) const
bool isDotCurOperand(const MachineInstr &MI, unsigned OpIndex) const
Returns true if the specified operand is a .cur (current) operand.
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register DestReg, int FrameIndex, const TargetRegisterClass *RC, Register VReg, unsigned SubReg=0, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
Load the specified register of the given register class from the specified stack frame index.
int getDotNewOp(const MachineInstr &MI) const
void changeDuplexOpcode(MachineBasicBlock::instr_iterator MII, bool ToBigInstrs) const
bool isMemOp(const MachineInstr &MI) const
int getDotOldOp(const MachineInstr &MI) const
bool hasUncondBranch(const MachineBasicBlock *B) const
short getNonExtOpcode(const MachineInstr &MI) const
bool isNewStorePseudo(const MachineInstr &MI) const
bool isTailCall(const MachineInstr &MI) const override
void insertNoop(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override
Insert a noop into the instruction stream at the specified point.
bool isDeallocRet(const MachineInstr &MI) const
HexagonInstrInfo(const HexagonSubtarget &ST)
unsigned getCExtOpNum(const MachineInstr &MI) const
bool isSolo(const MachineInstr &MI) const
DFAPacketizer * CreateTargetScheduleState(const TargetSubtargetInfo &STI) const override
Create machine specific model for scheduling.
bool isLateSourceInstr(const MachineInstr &MI) const
bool isDotNewInst(const MachineInstr &MI) const
void translateInstrsForDup(MachineFunction &MF, bool ToBigInstrs=true) const
bool isTC1(const MachineInstr &MI) const
bool isSchedulingBoundary(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const override
Test if the given instruction should be considered a scheduling boundary.
bool predCanBeUsedAsDotNew(const MachineInstr &MI, Register PredReg) const
unsigned getSize(const MachineInstr &MI) const
std::optional< unsigned > getInvertedCompare(const int OpC) const
bool isDotNewOperand(const MachineInstr &MI, unsigned OpIndex) const
Should be able to tell if the operand in question is .new.
bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, BranchProbability Probability) const override
Return true if it's profitable for if-converter to duplicate instructions of specified accumulated in...
short changeAddrMode_io_abs(short Opc) const
int getDotCurOp(const MachineInstr &MI) const
bool expandPostRAPseudo(MachineInstr &MI) const override
This function is called for all pseudo instructions that remain after register allocation.
bool isMIBefore(const MachineInstr *A, const MachineInstr *B) const
bool isExpr(unsigned OpType) const
bool isSafeInBundleWAR(const MachineInstr &DefMI, unsigned DefOpIdx, const MachineInstr &UseMI, unsigned UseOpIdx, bool IsPullDown=false, bool DefViaRegMask=false) const
A use (UseMI) can share a bundle with an instruction that redefines the same register (DefMI),...
DenseMap< const MachineInstr *, UseDefBitVectors > MIUseDefMap
void genAllInsnTimingClasses(MachineFunction &MF) const
bool isTC2Early(const MachineInstr &MI) const
bool hasEHLabel(const MachineBasicBlock *B) const
bool shouldSink(const MachineInstr &MI) const override
bool isZeroExtendingLoad(const MachineInstr &MI) const
short changeAddrMode_rr_io(short Opc) const
bool isHVXVec(const MachineInstr &MI) const
bool isDotTmpOperand(const MachineInstr &MI, unsigned OpIndex) const
Returns true if the specified operand is a .tmp (temporary) operand.
bool isDependent(const MachineInstr &ProdMI, const MachineInstr &ConsMI) const
short changeAddrMode_io_rr(short Opc) const
bool SubsumesPredicate(ArrayRef< MachineOperand > Pred1, ArrayRef< MachineOperand > Pred2) const override
Returns true if the first specified predicate subsumes the second, e.g.
bool mayBeCurLoad(const MachineInstr &MI) const
bool getBundleNoShuf(const MachineInstr &MIB) const
bool isNewValueJump(const MachineInstr &MI) const
bool isTC4x(const MachineInstr &MI) const
bool PredicateInstruction(MachineInstr &MI, ArrayRef< MachineOperand > Cond) const override
Convert the instruction into a predicated instruction.
bool getPredReg(ArrayRef< MachineOperand > Cond, Register &PredReg, unsigned &PredRegPos, RegState &PredRegFlags) const
bool isFloat(const MachineInstr &MI) const
bool isQFPInstr(MachineInstr *MI) const
bool isToBeScheduledASAP(const MachineInstr &MI1, const MachineInstr &MI2) const
MachineOperand * getBaseAndOffset(const MachineInstr &MI, int64_t &Offset, LocationSize &AccessSize) const
bool getInvertedPredSense(SmallVectorImpl< MachineOperand > &Cond) const
unsigned nonDbgBBSize(const MachineBasicBlock *BB) const
getInstrTimingClassLatency - Compute the instruction latency of a given instruction using Timing Clas...
uint64_t getType(const MachineInstr &MI) const
bool isEndLoopN(unsigned Opcode) const
bool getBaseAndOffsetPosition(const MachineInstr &MI, unsigned &BasePos, unsigned &OffsetPos) const override
For instructions with a base and offset, return the position of the base register and offset operands...
bool isPredicable(const MachineInstr &MI) const override
Return true if the specified instruction can be predicated.
bool isHMXActivateInstr(const MachineInstr &MI) const
bool isExtendable(const MachineInstr &MI) const
void immediateExtend(MachineInstr &MI) const
immediateExtend - Changes the instruction in place to one using an immediate extender.
bool isValidOffset(unsigned Opcode, int Offset, bool Extend=true) const
bool isActivateWeightPair(const MachineInstr &MIa, const MachineInstr &MIb) const
HexagonII::CompoundGroup getCompoundCandidateGroup(const MachineInstr &MI) const
bool hasLoadFromStackSlot(const MachineInstr &MI, SmallVectorImpl< const MachineMemOperand * > &Accesses) const override
Check if the instruction or the bundle of instructions has load from stack slots.
SmallVector< MachineInstr *, 2 > getBranchingInstrs(MachineBasicBlock &MBB) const
bool isPredicatedTrue(const MachineInstr &MI) const
bool isNewValueStore(const MachineInstr &MI) const
int getMinValue(const MachineInstr &MI) const
bool isVecUsableNextPacket(const MachineInstr &ProdMI, const MachineInstr &ConsMI) const
unsigned getCompoundOpcode(const MachineInstr &GA, const MachineInstr &GB) const
bool addLatencyToSchedule(const MachineInstr &MI1, const MachineInstr &MI2) const
Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
If the specified machine instruction is a direct store to a stack slot, return the virtual or physica...
int getDotNewPredJumpOp(const MachineInstr &MI, const MachineBranchProbabilityInfo *MBPI) const
bool usesQFOperand(MachineInstr *MI, unsigned Index=0) const
bool isTC2(const MachineInstr &MI) const
Hexagon target-specific information for each MachineFunction.
Register getStackRegister() const
Register getFrameRegister(const MachineFunction &MF) const override
bool isFakeReg(MCPhysReg Reg) const
Returns true if the given reserved physical register Reg is live across function calls/returns.
Itinerary data supplied by a subtarget to be used by a target.
unsigned getStageLatency(unsigned ItinClassIndx) const
Return the total stage latency of the given class.
void RemoveMachineInstrFromMaps(MachineInstr &MI)
A set of physical registers with utility functions to track liveness when walking backward/forward th...
LLVM_ABI void stepForward(const MachineInstr &MI, SmallVectorImpl< std::pair< MCPhysReg, const MachineOperand * > > &Clobbers)
Simulates liveness when stepping forward over an instruction(bundle).
LLVM_ABI void stepBackward(const MachineInstr &MI)
Simulates liveness when stepping backwards over an instruction(bundle).
LLVM_ABI void addLiveIns(const MachineBasicBlock &MBB)
Adds all live-in registers of basic block MBB.
LLVM_ABI bool available(const MachineRegisterInfo &MRI, MCRegister Reg) const
Returns true if register Reg and no aliasing register is in the set.
LLVM_ABI void addLiveOuts(const MachineBasicBlock &MBB)
Adds all live-out registers of basic block MBB.
bool contains(MCRegister Reg) const
Returns true if register Reg is contained in the set.
static LocationSize precise(uint64_t Value)
TypeSize getValue() const
Represents a single loop in the control flow graph.
This class is intended to be used as a base class for asm properties and features specific to the tar...
unsigned getMaxInstLength() const
Returns the maximum possible encoded instruction size in bytes.
StringRef getCommentString() const
const char * getSeparatorString() const
MCInstBuilder & addInst(const MCInst *Val)
Add a new MCInst operand.
MCInstBuilder & addImm(int64_t Val)
Add a new integer immediate operand.
Instances of this class represent a single low-level machine instruction.
Describe properties that are true of each instruction in the target description file.
unsigned getSchedClass() const
Return the scheduling class for this instruction.
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
MCRegAliasIterator enumerates all registers aliasing Reg.
instr_iterator instr_begin()
MachineInstrBundleIterator< const MachineInstr > const_iterator
LLVM_ABI iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
Instructions::iterator instr_iterator
instr_iterator instr_end()
Instructions::const_iterator const_instr_iterator
iterator_range< pred_iterator > predecessors()
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
MachineInstrBundleIterator< MachineInstr > iterator
LLVM_ABI BranchProbability getEdgeProbability(const MachineBasicBlock *Src, const MachineBasicBlock *Dst) const
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const char * createExternalSymbolName(StringRef Name)
Allocate a string and populate it with the given external symbol name.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
BasicBlockListType::iterator iterator
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags F, LLT MemTy, Align BaseAlignment, const MMOMetadata &Metadata=MMOMetadata(), SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
const MachineInstrBuilder & addUse(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a virtual register use operand.
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
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 & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
const MachineInstrBuilder & addDef(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a virtual register definition operand.
const MachineInstrBuilder & cloneMemRefs(const MachineInstr &OtherMI) const
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
reverse_iterator getReverse() const
Get a reverse iterator to the same node.
instr_iterator getInstrIterator() const
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool isTerminator(QueryType Type=AnyInBundle) const
Returns true if this instruction part of the terminator for a basic block.
const MachineBasicBlock * getParent() const
bool readsRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr reads the specified register.
bool getFlag(MIFlag Flag) const
Return whether an MI flag is set.
unsigned getNumOperands() const
Retuns the total number of operands.
LLVM_ABI unsigned getNumExplicitOperands() const
Returns the number of non-implicit operands.
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
LLVM_ABI unsigned getBundleSize() const
Return the number of instructions inside the MI bundle, excluding the bundle header.
LLVM_ABI bool hasUnmodeledSideEffects() const
Return true if this instruction has side effects that are not modeled by mayLoad / mayStore,...
bool hasOneMemOperand() const
Return true if this instruction has exactly one MachineMemOperand.
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
LLVM_ABI bool hasOrderedMemoryRef() const
Return true if this instruction may have an ordered or volatile memory reference, or if the informati...
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
const MachineOperand & getOperand(unsigned i) const
LLVM_ABI MachineInstrBundleIterator< MachineInstr > eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
bool isIndirectBranch(QueryType Type=AnyInBundle) const
Return true if this is an indirect branch, such as a branch through a register.
A description of a memory reference used in the backend.
LocationSize getSize() const
Return the size in bytes of the memory reference.
@ MOVolatile
The memory access is volatile.
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
AAMDNodes getAAInfo() const
Return the AA tags for the memory reference.
const Value * getValue() const
Return the base address of the memory access.
int64_t getOffset() const
For normal values, this is a byte offset added to the base address.
MachineOperand class - Representation of each machine instruction operand.
unsigned getSubReg() const
void setImm(int64_t immVal)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
MachineBasicBlock * getMBB() const
bool isCPI() const
isCPI - Tests if this is a MO_ConstantPoolIndex operand.
LLVM_ABI void setReg(Register Reg)
Change the register this operand corresponds to.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
bool isSymbol() const
isSymbol - Tests if this is a MO_ExternalSymbol operand.
bool isJTI() const
isJTI - Tests if this is a MO_JumpTableIndex operand.
unsigned getTargetFlags() const
static MachineOperand CreateImm(int64_t Val)
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
bool isBlockAddress() const
isBlockAddress - Tests if this is a MO_BlockAddress operand.
Register getReg() const
getReg - Returns the register number.
void addTargetFlag(unsigned F)
bool isInternalRead() const
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
@ MO_ConstantPoolIndex
Address of indexed Constant in Constant Pool.
@ MO_GlobalAddress
Address of a global value.
@ MO_BlockAddress
Address of a basic block.
@ MO_MachineBasicBlock
MachineBasicBlock reference.
@ MO_ExternalSymbol
Name of external global symbol.
@ MO_JumpTableIndex
Address of indexed Jump Table for switch.
bool isFPImm() const
isFPImm - Tests if this is a MO_FPImmediate operand.
bool isMBB() const
isMBB - Tests if this is a MO_MachineBasicBlock operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Representation for a specific memory location.
Special value supplied for machine level alias analysis.
Wrapper class representing virtual and physical registers.
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
HazardRecognizer - This determines whether or not an instruction can be issued this cycle,...
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
constexpr size_t size() const
Get the string size.
constexpr const char * data() const
Get a pointer to the start of the string (which may not be null terminated).
size_t count(char C) const
Return the number of occurrences of C in the string.
Object returned by analyzeLoopForPipelining.
virtual ScheduleHazardRecognizer * CreateTargetPostRAHazardRecognizer(const InstrItineraryData *, const ScheduleDAG *DAG) const
Allocate and return a hazard recognizer to use for this target when scheduling the machine instructio...
virtual bool hasStoreToStackSlot(const MachineInstr &MI, SmallVectorImpl< const MachineMemOperand * > &Accesses) const
If the specified machine instruction has a store to a stack slot, return true along with the FrameInd...
virtual std::optional< unsigned > getOperandLatency(const InstrItineraryData *ItinData, SDNode *DefNode, unsigned DefIdx, SDNode *UseNode, unsigned UseIdx) const
virtual bool hasLoadFromStackSlot(const MachineInstr &MI, SmallVectorImpl< const MachineMemOperand * > &Accesses) const
If the specified machine instruction has a load from a stack slot, return true along with the FrameIn...
Primary interface to the complete machine description for the target machine.
const MCAsmInfo & getMCAsmInfo() const
Return target specific asm information.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
TargetSubtargetInfo - Generic base class for all target subtargets.
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
virtual const InstrItineraryData * getInstrItineraryData() const
getInstrItineraryData - Returns instruction itinerary data for the target or specific subtarget.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
self_iterator getIterator()
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Abstract Attribute helper functions.
bool isSlot0Only(unsigned units)
HexagonII - This namespace holds all of the target specific flags that instruction info tracks.
unsigned const TypeCVI_LAST
static constexpr RegTypeInfo make(RegType Out, RegType In1=RegType::Unknown, RegType In2=RegType::Unknown, RegType In3=RegType::Unknown)
@ RestrictNoSlot1StoreMask
@ RestrictNoSlot1StorePos
unsigned const TypeCVI_FIRST
RegType getOpRegType(unsigned Opcode)
RegTypeInfo getRegTypeInfo(unsigned Opcode)
bool getTSFlag(const MCInstrDesc &MID, HexagonTSFlagsVal Pos)
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
MachineBasicBlock::instr_iterator getBundleStart(MachineBasicBlock::instr_iterator I)
Returns an iterator to the first instruction in the bundle containing I.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
RegState
Flags to represent properties of register accesses.
@ Implicit
Not emitted register (e.g. carry, or temporary result).
@ Kill
The last use of a register.
@ InternalRead
Register reads a value that is defined inside the same instruction or bundle.
@ Undef
Value of the register doesn't matter.
@ NoFlags
No Specific Flags.
constexpr RegState getKillRegState(bool B)
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool is_TC1(unsigned SchedClass)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
auto reverse(ContainerTy &&C)
MachineInstr * getImm(const MachineOperand &MO, const MachineRegisterInfo *MRI)
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
MachineBasicBlock::instr_iterator getBundleEnd(MachineBasicBlock::instr_iterator I)
Returns an iterator pointing beyond the bundle containing I.
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.
RegState getRegState(const MachineOperand &RegOp)
Get all register state flags from machine operand RegOp.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
bool is_TC2(unsigned SchedClass)
bool is_TC2early(unsigned SchedClass)
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
constexpr bool isShiftedInt(int64_t x)
Checks if a signed integer is an N bit number shifted left by S.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
bool isSpace(char C)
Checks whether character C is whitespace in the "C" locale.
@ End
Run the machine verifier once, at the end of the pipeline.
constexpr RegState getUndefRegState(bool B)
LLVM_ABI Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
constexpr bool isShiftedUInt(uint64_t x)
Checks if a unsigned integer is an N bit number shifted left by S.
LLVM_ABI Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
bool is_TC4x(unsigned SchedClass)
MCRegisterClass TargetRegisterClass
This struct is a compact representation of a valid (non-zero power of two) alignment.
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
These values represent a non-pipelined step in the execution of an instruction.
uint64_t FuncUnits
Bitmask representing a set of functional units.
This class contains a discriminated union of information about pointers in memory operands,...
static LLVM_ABI MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.