66#define DEBUG_TYPE "hexagon-instrinfo"
68#define GET_INSTRINFO_CTOR_DTOR
69#define GET_INSTRMAP_INFO
71#include "HexagonGenDFAPacketizer.inc"
72#include "HexagonGenInstrInfo.inc"
76 "packetization boundary."));
83 cl::desc(
"Disable schedule adjustment for new value stores."));
87 cl::desc(
"Enable timing class latency"));
91 cl::desc(
"Enable vec alu forwarding"));
95 cl::desc(
"Enable vec acc forwarding"));
103 cl::desc(
"Use the DFA based hazard recognizer."));
118void HexagonInstrInfo::anchor() {}
123 RegInfo(ST.getHwMode()), Subtarget(ST) {}
132 return (
Reg >= Hexagon::R0 &&
Reg <= Hexagon::R7) ||
133 (
Reg >= Hexagon::R16 &&
Reg <= Hexagon::R23);
145 for (; MIB != MIE; ++MIB) {
146 if (!MIB->isDebugInstr())
157 if (!(
MI.getMF()->getFunction().hasOptSize()))
158 return MI.isAsCheapAsAMove();
160 if (
MI.getOpcode() == Hexagon::A2_tfrsi) {
161 auto Op =
MI.getOperand(1);
169 int64_t
Imm =
Op.getImm();
174 return MI.isAsCheapAsAMove();
189 if (
isFloat(
MI) &&
MI.hasRegisterImplicitUseOperand(Hexagon::USR))
203 if (EndLoopOp == Hexagon::ENDLOOP0) {
204 LOOPi = Hexagon::J2_loop0i;
205 LOOPr = Hexagon::J2_loop0r;
207 LOOPi = Hexagon::J2_loop1i;
208 LOOPr = Hexagon::J2_loop1r;
219 unsigned Opc =
I.getOpcode();
220 if (
Opc == LOOPi ||
Opc == LOOPr)
224 if (
Opc == EndLoopOp &&
I.getOperand(0).getMBB() != TargetBB)
251 Uses.push_back(MO.getReg());
290 int &FrameIndex)
const {
291 switch (
MI.getOpcode()) {
294 case Hexagon::L2_loadri_io:
295 case Hexagon::L2_loadrd_io:
296 case Hexagon::V6_vL32b_ai:
297 case Hexagon::V6_vL32b_nt_ai:
298 case Hexagon::V6_vL32Ub_ai:
299 case Hexagon::LDriw_pred:
300 case Hexagon::LDriw_ctr:
301 case Hexagon::PS_vloadrq_ai:
302 case Hexagon::PS_vloadrw_ai:
303 case Hexagon::PS_vloadrw_nt_ai:
304 case Hexagon::PS_loadrl:
305 case Hexagon::PS_loadrll: {
313 return MI.getOperand(0).getReg();
316 case Hexagon::L2_ploadrit_io:
317 case Hexagon::L2_ploadrif_io:
318 case Hexagon::L2_ploadrdt_io:
319 case Hexagon::L2_ploadrdf_io: {
327 return MI.getOperand(0).getReg();
340 int &FrameIndex)
const {
341 switch (
MI.getOpcode()) {
344 case Hexagon::S2_storerb_io:
345 case Hexagon::S2_storerh_io:
346 case Hexagon::S2_storeri_io:
347 case Hexagon::S2_storerd_io:
348 case Hexagon::V6_vS32b_ai:
349 case Hexagon::V6_vS32Ub_ai:
350 case Hexagon::STriw_pred:
351 case Hexagon::STriw_ctr:
352 case Hexagon::PS_vstorerq_ai:
353 case Hexagon::PS_vstorerw_ai:
354 case Hexagon::PS_storerl:
355 case Hexagon::PS_storerll: {
363 return MI.getOperand(2).getReg();
366 case Hexagon::S2_pstorerbt_io:
367 case Hexagon::S2_pstorerbf_io:
368 case Hexagon::S2_pstorerht_io:
369 case Hexagon::S2_pstorerhf_io:
370 case Hexagon::S2_pstorerit_io:
371 case Hexagon::S2_pstorerif_io:
372 case Hexagon::S2_pstorerdt_io:
373 case Hexagon::S2_pstorerdf_io: {
381 return MI.getOperand(3).getReg();
397 for (++MII; MII !=
MBB->instr_end() && MII->isInsideBundle(); ++MII)
415 for (++MII; MII !=
MBB->instr_end() && MII->isInsideBundle(); ++MII)
443 bool AllowModify)
const {
450 if (
I ==
MBB.instr_begin())
470 }
while (
I !=
MBB.instr_begin());
475 while (
I->isDebugInstr()) {
476 if (
I ==
MBB.instr_begin())
481 bool JumpToBlock =
I->getOpcode() == Hexagon::J2_jump &&
482 I->getOperand(0).isMBB();
484 if (AllowModify && JumpToBlock &&
485 MBB.isLayoutSuccessor(
I->getOperand(0).getMBB())) {
487 I->eraseFromParent();
489 if (
I ==
MBB.instr_begin())
493 if (!isUnpredicatedTerminator(*
I))
501 if (&*
I != LastInst && !
I->isBundle() && isUnpredicatedTerminator(*
I)) {
503 SecondLastInst = &*
I;
508 if (
I ==
MBB.instr_begin())
514 int SecLastOpcode = SecondLastInst ? SecondLastInst->
getOpcode() : 0;
517 if (LastOpcode == Hexagon::J2_jump && !LastInst->
getOperand(0).
isMBB())
519 if (SecLastOpcode == Hexagon::J2_jump &&
530 if (LastInst && !SecondLastInst) {
531 if (LastOpcode == Hexagon::J2_jump) {
541 if (LastOpcodeHasJMP_c) {
556 <<
" with one jump\n";);
563 if (SecLastOpcodeHasJMP_c && (LastOpcode == Hexagon::J2_jump)) {
574 if (SecLastOpcodeHasNVJump &&
576 (LastOpcode == Hexagon::J2_jump)) {
587 if (SecLastOpcode == Hexagon::J2_jump && LastOpcode == Hexagon::J2_jump) {
591 I->eraseFromParent();
596 if (
isEndLoopN(SecLastOpcode) && LastOpcode == Hexagon::J2_jump) {
604 <<
" with two jumps";);
610 int *BytesRemoved)
const {
611 assert(!BytesRemoved &&
"code size not handled");
616 while (
I !=
MBB.begin()) {
618 if (
I->isDebugInstr())
623 if (
Count && (
I->getOpcode() == Hexagon::J2_jump))
637 int *BytesAdded)
const {
638 unsigned BOpc = Hexagon::J2_jump;
639 unsigned BccOpc = Hexagon::J2_jumpt;
641 assert(
TBB &&
"insertBranch must not be told to insert a fallthrough");
642 assert(!BytesAdded &&
"code size not handled");
647 if (!
Cond.empty() &&
Cond[0].isImm())
648 BccOpc =
Cond[0].getImm();
658 auto Term =
MBB.getFirstTerminator();
668 int EndLoopOp =
Cond[0].getImm();
675 assert(
Loop !=
nullptr &&
"Inserting an ENDLOOP without a LOOP");
676 Loop->getOperand(0).setMBB(
TBB);
680 assert((
Cond.size() == 3) &&
"Only supporting rr/ri version of nvjump");
691 }
else if(
Cond[2].isImm()) {
697 assert((
Cond.size() == 2) &&
"Malformed cond vector");
705 "Cond. cannot be empty when multiple branchings are required");
707 "NV-jump cannot be inserted with another branch");
710 int EndLoopOp =
Cond[0].getImm();
717 assert(
Loop !=
nullptr &&
"Inserting an ENDLOOP without a LOOP");
718 Loop->getOperand(0).setMBB(
TBB);
747 TripCount =
Loop->getOpcode() == Hexagon::J2_loop0r
749 :
Loop->getOperand(1).getImm();
751 LoopCount =
Loop->getOperand(1).getReg();
754 bool shouldIgnoreForPipelining(
const MachineInstr *
MI)
const override {
756 return MI == EndLoop ||
TII->isHMXActivateInstr(*
MI) ||
757 TII->isHMXWeightInstr(*
MI);
760 std::optional<bool> createTripCountGreaterCondition(
761 int TC, MachineBasicBlock &
MBB,
762 SmallVectorImpl<MachineOperand> &
Cond)
override {
763 if (TripCount == -1) {
767 TII->get(Hexagon::C2_cmpgtui),
Done)
775 return TripCount > TC;
778 void setPreheader(MachineBasicBlock *NewPreheader)
override {
783 void adjustTripCount(
int TripCountAdjust)
override {
786 if (
Loop->getOpcode() == Hexagon::J2_loop0i ||
787 Loop->getOpcode() == Hexagon::J2_loop1i) {
788 int64_t TripCount =
Loop->getOperand(1).getImm() + TripCountAdjust;
789 assert(TripCount > 0 &&
"Can't create an empty or negative loop!");
790 Loop->getOperand(1).setImm(TripCount);
799 TII->get(Hexagon::A2_addi), NewLoopCount)
805 void disposed(LiveIntervals *LIS)
override {
808 Loop->eraseFromParent();
813std::unique_ptr<TargetInstrInfo::PipelinerLoopInfo>
821 LoopBB,
I->getOpcode(),
I->getOperand(0).getMBB(), VisitedBBs);
823 return std::make_unique<HexagonPipelinerLoopInfo>(LoopInst, &*
I);
829 unsigned NumCycles,
unsigned ExtraPredCycles,
843 return NumInstrs <= 4;
851 for (
auto I =
B.begin();
I !=
E; ++
I) {
861 for (
auto I =
B.rbegin();
I !=
E; ++
I)
870 bool RenamableSrc)
const {
874 if (Hexagon::IntRegsRegClass.
contains(SrcReg, DestReg)) {
876 .
addReg(SrcReg, KillFlag);
879 if (Hexagon::DoubleRegsRegClass.
contains(SrcReg, DestReg)) {
881 .
addReg(SrcReg, KillFlag);
884 if (Hexagon::PredRegsRegClass.
contains(SrcReg, DestReg)) {
890 if (Hexagon::CtrRegsRegClass.
contains(DestReg) &&
891 Hexagon::IntRegsRegClass.
contains(SrcReg)) {
893 .
addReg(SrcReg, KillFlag);
896 if (Hexagon::IntRegsRegClass.
contains(DestReg) &&
897 Hexagon::CtrRegsRegClass.
contains(SrcReg)) {
899 .
addReg(SrcReg, KillFlag);
902 if (Hexagon::ModRegsRegClass.
contains(DestReg) &&
903 Hexagon::IntRegsRegClass.
contains(SrcReg)) {
905 .
addReg(SrcReg, KillFlag);
908 if (Hexagon::PredRegsRegClass.
contains(SrcReg) &&
909 Hexagon::IntRegsRegClass.
contains(DestReg)) {
911 .
addReg(SrcReg, KillFlag);
914 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
915 Hexagon::PredRegsRegClass.
contains(DestReg)) {
917 .
addReg(SrcReg, KillFlag);
920 if (Hexagon::PredRegsRegClass.
contains(SrcReg) &&
921 Hexagon::IntRegsRegClass.
contains(DestReg)) {
923 .
addReg(SrcReg, KillFlag);
926 if (Hexagon::HvxVRRegClass.
contains(SrcReg, DestReg)) {
928 addReg(SrcReg, KillFlag);
931 if (Hexagon::HvxWRRegClass.
contains(SrcReg, DestReg)) {
934 Register SrcLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
935 Register SrcHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
939 .
addReg(SrcHi, KillFlag | UndefHi)
940 .
addReg(SrcLo, KillFlag | UndefLo);
943 if (Hexagon::HvxQRRegClass.
contains(SrcReg, DestReg)) {
946 .
addReg(SrcReg, KillFlag);
949 if (Hexagon::HvxQRRegClass.
contains(SrcReg) &&
950 Hexagon::HvxVRRegClass.
contains(DestReg)) {
954 if (Hexagon::HvxQRRegClass.
contains(DestReg) &&
955 Hexagon::HvxVRRegClass.
contains(SrcReg)) {
959 if (Hexagon::HlxLRRegClass.
contains(SrcReg, DestReg)) {
961 .
addReg(SrcReg, KillFlag);
964 if (Hexagon::HlxLLRRegClass.
contains(SrcReg, DestReg)) {
966 .
addReg(SrcReg, KillFlag);
980 Register SrcReg,
bool isKill,
int FI,
992 if (HMFI.isVTCMStackIndex(FI)) {
993 MFIIndex = HMFI.getMappedVTCMObjectIndex(FI);
994 MMFI = &HMFI.getVTCMFrameInfo();
1000 if (Hexagon::IntRegsRegClass.hasSubClassEq(RC)) {
1004 }
else if (Hexagon::DoubleRegsRegClass.hasSubClassEq(RC)) {
1008 }
else if (Hexagon::PredRegsRegClass.hasSubClassEq(RC)) {
1012 }
else if (Hexagon::ModRegsRegClass.hasSubClassEq(RC)) {
1016 }
else if (Hexagon::CircRegsRegClass.hasSubClassEq(RC)) {
1019 .
addReg(SrcReg, KillFlag)
1021 }
else if (Hexagon::HvxQRRegClass.hasSubClassEq(RC)) {
1025 }
else if (Hexagon::HvxVRRegClass.hasSubClassEq(RC)) {
1029 }
else if (Hexagon::HvxWRRegClass.hasSubClassEq(RC)) {
1033 }
else if (Hexagon::HlxLRRegClass.hasSubClassEq(RC)) {
1037 .
addReg(SrcReg, KillFlag)
1039 }
else if (Hexagon::HlxLLRRegClass.hasSubClassEq(RC)) {
1043 .
addReg(SrcReg, KillFlag)
1063 if (HMFI.isVTCMStackIndex(FI)) {
1064 MFIIndex = HMFI.getMappedVTCMObjectIndex(FI);
1065 MMFI = &HMFI.getVTCMFrameInfo();
1071 if (Hexagon::IntRegsRegClass.hasSubClassEq(RC)) {
1074 }
else if (Hexagon::DoubleRegsRegClass.hasSubClassEq(RC)) {
1077 }
else if (Hexagon::PredRegsRegClass.hasSubClassEq(RC)) {
1080 }
else if (Hexagon::ModRegsRegClass.hasSubClassEq(RC)) {
1083 }
else if (Hexagon::CircRegsRegClass.hasSubClassEq(RC)) {
1087 }
else if (Hexagon::HvxQRRegClass.hasSubClassEq(RC)) {
1090 }
else if (Hexagon::HvxVRRegClass.hasSubClassEq(RC)) {
1093 }
else if (Hexagon::HvxWRRegClass.hasSubClassEq(RC)) {
1096 }
else if (Hexagon::HlxLRRegClass.hasSubClassEq(RC)) {
1101 }
else if (Hexagon::HlxLLRRegClass.hasSubClassEq(RC)) {
1124 unsigned Opc =
MI.getOpcode();
1126 auto RealCirc = [&](
unsigned Opc,
bool HasImm,
unsigned MxOp) {
1127 Register M_CSx =
MI.getOperand(MxOp).getReg();
1128 Register Mx = HRI.getSubReg(M_CSx, Hexagon::isub_hi);
1129 unsigned CSOp = HasImm ? 5 : 4;
1131 for (
unsigned i = 0; i != CSOp; ++i)
1135 MIB.add(
MI.getOperand(i));
1136 Register CSx = (M_CSx == Hexagon::CS_M0 ? Hexagon::CS0 : Hexagon::CS1);
1143 if (
MI.memoperands().empty())
1146 return MMO->getAlign() >= NeedAlign;
1151 case Hexagon::PS_call_instrprof_custom: {
1152 auto Op0 =
MI.getOperand(0);
1154 "First operand must be a global containing handler name.");
1158 StringRef NameStr = Arr->isCString() ? Arr->getAsCString() : Arr->getAsString();
1184 MIB.addExternalSymbol(cstr);
1188 case TargetOpcode::COPY: {
1194 std::prev(
MBBI)->copyImplicitOps(*
MBB.getParent(),
MI);
1199 case Hexagon::PS_aligna:
1202 .
addImm(-
MI.getOperand(1).getImm());
1205 case Hexagon::V6_vassignp: {
1208 Register SrcLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
1209 Register SrcHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
1220 case Hexagon::V6_lo:
1221 case Hexagon::LX_lo: {
1224 Register SrcSubLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
1229 case Hexagon::V6_hi:
1230 case Hexagon::LX_hi: {
1233 Register SrcSubHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
1238 case Hexagon::PS_vloadrv_ai: {
1242 int Offset =
MI.getOperand(2).getImm();
1243 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1244 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vL32b_ai
1245 : Hexagon::V6_vL32Ub_ai;
1253 case Hexagon::PS_loadrl: {
1257 int Offset =
MI.getOperand(2).getImm();
1269 case Hexagon::PS_vloadrw_ai: {
1273 int Offset =
MI.getOperand(2).getImm();
1274 unsigned VecOffset = HRI.getSpillSize(Hexagon::HvxVRRegClass);
1275 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1276 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vL32b_ai
1277 : Hexagon::V6_vL32Ub_ai;
1279 HRI.getSubReg(DstReg, Hexagon::vsub_lo))
1284 HRI.getSubReg(DstReg, Hexagon::vsub_hi))
1291 case Hexagon::PS_vstorerv_ai: {
1296 int Offset =
MI.getOperand(1).getImm();
1297 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1298 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vS32b_ai
1299 : Hexagon::V6_vS32Ub_ai;
1308 case Hexagon::PS_storerl: {
1314 int Offset =
MI.getOperand(1).getImm();
1326 case Hexagon::PS_vstorerw_ai: {
1330 int Offset =
MI.getOperand(1).getImm();
1331 unsigned VecOffset = HRI.getSpillSize(Hexagon::HvxVRRegClass);
1332 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1333 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vS32b_ai
1334 : Hexagon::V6_vS32Ub_ai;
1338 .
addReg(HRI.getSubReg(SrcReg, Hexagon::vsub_lo))
1343 .
addReg(HRI.getSubReg(SrcReg, Hexagon::vsub_hi))
1348 case Hexagon::PS_true: {
1356 case Hexagon::PS_false: {
1364 case Hexagon::PS_qtrue: {
1371 case Hexagon::PS_qfalse: {
1378 case Hexagon::PS_vdd0: {
1386 case Hexagon::PS_vmulw: {
1389 Register Src1Reg =
MI.getOperand(1).getReg();
1390 Register Src2Reg =
MI.getOperand(2).getReg();
1391 Register Src1SubHi = HRI.getSubReg(Src1Reg, Hexagon::isub_hi);
1392 Register Src1SubLo = HRI.getSubReg(Src1Reg, Hexagon::isub_lo);
1393 Register Src2SubHi = HRI.getSubReg(Src2Reg, Hexagon::isub_hi);
1394 Register Src2SubLo = HRI.getSubReg(Src2Reg, Hexagon::isub_lo);
1396 HRI.getSubReg(DstReg, Hexagon::isub_hi))
1400 HRI.getSubReg(DstReg, Hexagon::isub_lo))
1406 case Hexagon::PS_vmulw_acc: {
1409 Register Src1Reg =
MI.getOperand(1).getReg();
1410 Register Src2Reg =
MI.getOperand(2).getReg();
1411 Register Src3Reg =
MI.getOperand(3).getReg();
1412 Register Src1SubHi = HRI.getSubReg(Src1Reg, Hexagon::isub_hi);
1413 Register Src1SubLo = HRI.getSubReg(Src1Reg, Hexagon::isub_lo);
1414 Register Src2SubHi = HRI.getSubReg(Src2Reg, Hexagon::isub_hi);
1415 Register Src2SubLo = HRI.getSubReg(Src2Reg, Hexagon::isub_lo);
1416 Register Src3SubHi = HRI.getSubReg(Src3Reg, Hexagon::isub_hi);
1417 Register Src3SubLo = HRI.getSubReg(Src3Reg, Hexagon::isub_lo);
1419 HRI.getSubReg(DstReg, Hexagon::isub_hi))
1424 HRI.getSubReg(DstReg, Hexagon::isub_lo))
1431 case Hexagon::PS_pselect: {
1455 case Hexagon::PS_vselect: {
1488 case Hexagon::PS_wselect: {
1528 case Hexagon::PS_crash: {
1544 void printCustom(
raw_ostream &OS)
const override {
1545 OS <<
"MisalignedCrash";
1549 static const CrashPseudoSourceValue CrashPSV(MF.
getTarget());
1561 case Hexagon::PS_tailcall_i:
1562 MI.setDesc(
get(Hexagon::J2_jump));
1564 case Hexagon::PS_tailcall_r:
1565 case Hexagon::PS_jmpret:
1566 MI.setDesc(
get(Hexagon::J2_jumpr));
1568 case Hexagon::PS_jmprett:
1569 MI.setDesc(
get(Hexagon::J2_jumprt));
1571 case Hexagon::PS_jmpretf:
1572 MI.setDesc(
get(Hexagon::J2_jumprf));
1574 case Hexagon::PS_jmprettnewpt:
1575 MI.setDesc(
get(Hexagon::J2_jumprtnewpt));
1577 case Hexagon::PS_jmpretfnewpt:
1578 MI.setDesc(
get(Hexagon::J2_jumprfnewpt));
1580 case Hexagon::PS_jmprettnew:
1581 MI.setDesc(
get(Hexagon::J2_jumprtnew));
1583 case Hexagon::PS_jmpretfnew:
1584 MI.setDesc(
get(Hexagon::J2_jumprfnew));
1587 case Hexagon::PS_loadrub_pci:
1588 return RealCirc(Hexagon::L2_loadrub_pci,
true, 4);
1589 case Hexagon::PS_loadrb_pci:
1590 return RealCirc(Hexagon::L2_loadrb_pci,
true, 4);
1591 case Hexagon::PS_loadruh_pci:
1592 return RealCirc(Hexagon::L2_loadruh_pci,
true, 4);
1593 case Hexagon::PS_loadrh_pci:
1594 return RealCirc(Hexagon::L2_loadrh_pci,
true, 4);
1595 case Hexagon::PS_loadri_pci:
1596 return RealCirc(Hexagon::L2_loadri_pci,
true, 4);
1597 case Hexagon::PS_loadrd_pci:
1598 return RealCirc(Hexagon::L2_loadrd_pci,
true, 4);
1599 case Hexagon::PS_loadrub_pcr:
1600 return RealCirc(Hexagon::L2_loadrub_pcr,
false, 3);
1601 case Hexagon::PS_loadrb_pcr:
1602 return RealCirc(Hexagon::L2_loadrb_pcr,
false, 3);
1603 case Hexagon::PS_loadruh_pcr:
1604 return RealCirc(Hexagon::L2_loadruh_pcr,
false, 3);
1605 case Hexagon::PS_loadrh_pcr:
1606 return RealCirc(Hexagon::L2_loadrh_pcr,
false, 3);
1607 case Hexagon::PS_loadri_pcr:
1608 return RealCirc(Hexagon::L2_loadri_pcr,
false, 3);
1609 case Hexagon::PS_loadrd_pcr:
1610 return RealCirc(Hexagon::L2_loadrd_pcr,
false, 3);
1611 case Hexagon::PS_storerb_pci:
1612 return RealCirc(Hexagon::S2_storerb_pci,
true, 3);
1613 case Hexagon::PS_storerh_pci:
1614 return RealCirc(Hexagon::S2_storerh_pci,
true, 3);
1615 case Hexagon::PS_storerf_pci:
1616 return RealCirc(Hexagon::S2_storerf_pci,
true, 3);
1617 case Hexagon::PS_storeri_pci:
1618 return RealCirc(Hexagon::S2_storeri_pci,
true, 3);
1619 case Hexagon::PS_storerd_pci:
1620 return RealCirc(Hexagon::S2_storerd_pci,
true, 3);
1621 case Hexagon::PS_storerb_pcr:
1622 return RealCirc(Hexagon::S2_storerb_pcr,
false, 2);
1623 case Hexagon::PS_storerh_pcr:
1624 return RealCirc(Hexagon::S2_storerh_pcr,
false, 2);
1625 case Hexagon::PS_storerf_pcr:
1626 return RealCirc(Hexagon::S2_storerf_pcr,
false, 2);
1627 case Hexagon::PS_storeri_pcr:
1628 return RealCirc(Hexagon::S2_storeri_pcr,
false, 2);
1629 case Hexagon::PS_storerd_pcr:
1630 return RealCirc(Hexagon::S2_storerd_pcr,
false, 2);
1640 unsigned Opc =
MI.getOpcode();
1644 case Hexagon::V6_vgather_vscatter_mh_pseudo:
1647 .
add(
MI.getOperand(2))
1648 .
add(
MI.getOperand(3))
1649 .
add(
MI.getOperand(4));
1651 .
add(
MI.getOperand(2))
1652 .
add(
MI.getOperand(3))
1653 .
add(
MI.getOperand(4))
1656 return First.getInstrIterator();
1657 case Hexagon::V6_vgathermh_pseudo:
1659 .
add(
MI.getOperand(2))
1660 .
add(
MI.getOperand(3))
1661 .
add(
MI.getOperand(4));
1663 .
add(
MI.getOperand(0))
1667 return First.getInstrIterator();
1669 case Hexagon::V6_vgathermw_pseudo:
1671 .
add(
MI.getOperand(2))
1672 .
add(
MI.getOperand(3))
1673 .
add(
MI.getOperand(4));
1675 .
add(
MI.getOperand(0))
1679 return First.getInstrIterator();
1681 case Hexagon::V6_vgathermhw_pseudo:
1683 .
add(
MI.getOperand(2))
1684 .
add(
MI.getOperand(3))
1685 .
add(
MI.getOperand(4));
1687 .
add(
MI.getOperand(0))
1691 return First.getInstrIterator();
1693 case Hexagon::V6_vgathermhq_pseudo:
1695 .
add(
MI.getOperand(2))
1696 .
add(
MI.getOperand(3))
1697 .
add(
MI.getOperand(4))
1698 .
add(
MI.getOperand(5));
1700 .
add(
MI.getOperand(0))
1704 return First.getInstrIterator();
1706 case Hexagon::V6_vgathermwq_pseudo:
1708 .
add(
MI.getOperand(2))
1709 .
add(
MI.getOperand(3))
1710 .
add(
MI.getOperand(4))
1711 .
add(
MI.getOperand(5));
1713 .
add(
MI.getOperand(0))
1717 return First.getInstrIterator();
1719 case Hexagon::V6_vgathermhwq_pseudo:
1721 .
add(
MI.getOperand(2))
1722 .
add(
MI.getOperand(3))
1723 .
add(
MI.getOperand(4))
1724 .
add(
MI.getOperand(5));
1726 .
add(
MI.getOperand(0))
1730 return First.getInstrIterator();
1733 return MI.getIterator();
1742 assert(
Cond[0].isImm() &&
"First entry in the cond vector not imm-val");
1743 unsigned opcode =
Cond[0].getImm();
1749 Cond[0].setImm(NewOpcode);
1764 unsigned BasePos, OffsetPos;
1779 const uint64_t
F =
MI.getDesc().TSFlags;
1790 int Opc =
MI.getOpcode();
1803 unsigned NOp = 0,
NumOps =
MI.getNumOperands();
1806 if (!
Op.isReg() || !
Op.isDef() ||
Op.isImplicit())
1813 unsigned PredRegPos;
1815 bool GotPredReg =
getPredReg(
Cond, PredReg, PredRegPos, PredRegFlags);
1818 T.addReg(PredReg, PredRegFlags);
1820 T.add(
MI.getOperand(NOp++));
1822 MI.setDesc(
get(PredOpc));
1823 while (
unsigned n =
MI.getNumOperands())
1824 MI.removeOperand(n-1);
1825 for (
unsigned i = 0, n =
T->getNumOperands(); i < n; ++i)
1826 MI.addOperand(
T->getOperand(i));
1832 MRI.clearKillFlags(PredReg);
1843 std::vector<MachineOperand> &Pred,
1844 bool SkipDead)
const {
1852 if (RC == &Hexagon::PredRegsRegClass) {
1857 }
else if (MO.isRegMask()) {
1858 for (
Register PR : Hexagon::PredRegsRegClass) {
1859 if (!
MI.modifiesRegister(PR, &HRI))
1870 if (!
MI.getDesc().isPredicable())
1874 if (!Subtarget.usePredicatedCalls())
1879 if (!Subtarget.hasV62Ops()) {
1880 switch (
MI.getOpcode()) {
1881 case Hexagon::V6_vL32b_ai:
1882 case Hexagon::V6_vL32b_pi:
1883 case Hexagon::V6_vL32b_ppu:
1884 case Hexagon::V6_vL32b_cur_ai:
1885 case Hexagon::V6_vL32b_cur_pi:
1886 case Hexagon::V6_vL32b_cur_ppu:
1887 case Hexagon::V6_vL32b_nt_ai:
1888 case Hexagon::V6_vL32b_nt_pi:
1889 case Hexagon::V6_vL32b_nt_ppu:
1890 case Hexagon::V6_vL32b_tmp_ai:
1891 case Hexagon::V6_vL32b_tmp_pi:
1892 case Hexagon::V6_vL32b_tmp_ppu:
1893 case Hexagon::V6_vL32b_nt_cur_ai:
1894 case Hexagon::V6_vL32b_nt_cur_pi:
1895 case Hexagon::V6_vL32b_nt_cur_ppu:
1896 case Hexagon::V6_vL32b_nt_tmp_ai:
1897 case Hexagon::V6_vL32b_nt_tmp_pi:
1898 case Hexagon::V6_vL32b_nt_tmp_ppu:
1906 bool Invert)
const {
1912 case Hexagon::F2_sfadd:
1928 if (
MI.isDebugInstr())
1938 for (
auto *
I :
MBB->successors())
1944 if (
MI.getDesc().isTerminator() ||
MI.isPosition())
1948 if (
MI.getOpcode() == TargetOpcode::INLINEASM_BR)
1972 bool atInsnStart =
true;
1975 for (; *Str; ++Str) {
1979 if (atInsnStart && !
isSpace(
static_cast<unsigned char>(*Str))) {
1981 atInsnStart =
false;
1985 atInsnStart =
false;
2008 int64_t &
Value)
const {
2009 unsigned Opc =
MI.getOpcode();
2013 case Hexagon::C2_cmpeq:
2014 case Hexagon::C2_cmpeqp:
2015 case Hexagon::C2_cmpgt:
2016 case Hexagon::C2_cmpgtp:
2017 case Hexagon::C2_cmpgtu:
2018 case Hexagon::C2_cmpgtup:
2019 case Hexagon::C4_cmpneq:
2020 case Hexagon::C4_cmplte:
2021 case Hexagon::C4_cmplteu:
2022 case Hexagon::C2_cmpeqi:
2023 case Hexagon::C2_cmpgti:
2024 case Hexagon::C2_cmpgtui:
2025 case Hexagon::C4_cmpneqi:
2026 case Hexagon::C4_cmplteui:
2027 case Hexagon::C4_cmpltei:
2028 SrcReg =
MI.getOperand(1).getReg();
2031 case Hexagon::A4_cmpbeq:
2032 case Hexagon::A4_cmpbgt:
2033 case Hexagon::A4_cmpbgtu:
2034 case Hexagon::A4_cmpbeqi:
2035 case Hexagon::A4_cmpbgti:
2036 case Hexagon::A4_cmpbgtui:
2037 SrcReg =
MI.getOperand(1).getReg();
2040 case Hexagon::A4_cmpheq:
2041 case Hexagon::A4_cmphgt:
2042 case Hexagon::A4_cmphgtu:
2043 case Hexagon::A4_cmpheqi:
2044 case Hexagon::A4_cmphgti:
2045 case Hexagon::A4_cmphgtui:
2046 SrcReg =
MI.getOperand(1).getReg();
2053 case Hexagon::C2_cmpeq:
2054 case Hexagon::C2_cmpeqp:
2055 case Hexagon::C2_cmpgt:
2056 case Hexagon::C2_cmpgtp:
2057 case Hexagon::C2_cmpgtu:
2058 case Hexagon::C2_cmpgtup:
2059 case Hexagon::A4_cmpbeq:
2060 case Hexagon::A4_cmpbgt:
2061 case Hexagon::A4_cmpbgtu:
2062 case Hexagon::A4_cmpheq:
2063 case Hexagon::A4_cmphgt:
2064 case Hexagon::A4_cmphgtu:
2065 case Hexagon::C4_cmpneq:
2066 case Hexagon::C4_cmplte:
2067 case Hexagon::C4_cmplteu:
2068 SrcReg2 =
MI.getOperand(2).getReg();
2072 case Hexagon::C2_cmpeqi:
2073 case Hexagon::C2_cmpgtui:
2074 case Hexagon::C2_cmpgti:
2075 case Hexagon::C4_cmpneqi:
2076 case Hexagon::C4_cmplteui:
2077 case Hexagon::C4_cmpltei:
2078 case Hexagon::A4_cmpbeqi:
2079 case Hexagon::A4_cmpbgti:
2080 case Hexagon::A4_cmpbgtui:
2081 case Hexagon::A4_cmpheqi:
2082 case Hexagon::A4_cmphgti:
2083 case Hexagon::A4_cmphgtui: {
2088 Value =
MI.getOperand(2).getImm();
2098 unsigned *PredCost)
const {
2124 unsigned BasePosA, OffsetPosA;
2132 unsigned BasePosB, OffsetPosB;
2139 if (BaseRegA != BaseRegB || BaseSubA != BaseSubB)
2157 if (OffsetA > OffsetB) {
2158 uint64_t OffDiff = (uint64_t)((int64_t)OffsetA - (int64_t)OffsetB);
2159 return SizeB <= OffDiff;
2161 if (OffsetA < OffsetB) {
2162 uint64_t OffDiff = (uint64_t)((int64_t)OffsetB - (int64_t)OffsetA);
2163 return SizeA <= OffDiff;
2173 unsigned BasePos = 0, OffsetPos = 0;
2181 }
else if (
MI.getOpcode() == Hexagon::A2_addi) {
2183 if (AddOp.isImm()) {
2184 Value = AddOp.getImm();
2192std::pair<unsigned, unsigned>
2202 static const std::pair<unsigned, const char*> Flags[] = {
2203 {MO_PCREL,
"hexagon-pcrel"},
2204 {MO_GOT,
"hexagon-got"},
2205 {MO_LO16,
"hexagon-lo16"},
2206 {MO_HI16,
"hexagon-hi16"},
2207 {MO_GPREL,
"hexagon-gprel"},
2208 {MO_GDGOT,
"hexagon-gdgot"},
2209 {MO_GDPLT,
"hexagon-gdplt"},
2210 {MO_IE,
"hexagon-ie"},
2211 {MO_IEGOT,
"hexagon-iegot"},
2212 {MO_TPREL,
"hexagon-tprel"}
2221 static const std::pair<unsigned, const char*> Flags[] = {
2222 {HMOTF_ConstExtended,
"hexagon-ext"}
2230 if (VT == MVT::i1) {
2231 TRC = &Hexagon::PredRegsRegClass;
2232 }
else if (VT == MVT::i32 || VT == MVT::f32) {
2233 TRC = &Hexagon::IntRegsRegClass;
2234 }
else if (VT == MVT::i64 || VT == MVT::f64) {
2235 TRC = &Hexagon::DoubleRegsRegClass;
2249 const uint64_t
F =
MI.getDesc().TSFlags;
2259 !
MI.getDesc().mayStore() &&
2260 MI.getDesc().getOpcode() != Hexagon::S2_allocframe &&
2261 MI.getDesc().getOpcode() != Hexagon::L2_deallocframe &&
2273 const uint64_t
F =
MI.getDesc().TSFlags;
2306 assert(MO.
isImm() &&
"Extendable operand must be Immediate type");
2310 int32_t SValue =
Value;
2313 return SValue < MinValue || SValue > MaxValue;
2318 return UValue < MinValue || UValue > MaxValue;
2322 switch (
MI.getOpcode()) {
2323 case Hexagon::L4_return:
2324 case Hexagon::L4_return_t:
2325 case Hexagon::L4_return_f:
2326 case Hexagon::L4_return_tnew_pnt:
2327 case Hexagon::L4_return_fnew_pnt:
2328 case Hexagon::L4_return_tnew_pt:
2329 case Hexagon::L4_return_fnew_pt:
2350 for (
auto &RegA : DefsA)
2351 for (
auto &RegB : UsesB) {
2368 switch (
MI.getOpcode()) {
2369 case Hexagon::V6_vL32b_cur_pi:
2370 case Hexagon::V6_vL32b_cur_ai:
2408 return (Opcode == Hexagon::ENDLOOP0 ||
2409 Opcode == Hexagon::ENDLOOP1);
2434 switch (
MI.getOpcode()) {
2436 case Hexagon::PS_fi:
2437 case Hexagon::PS_fia:
2450 const uint64_t
F =
MI.getDesc().TSFlags;
2462 unsigned Opcode =
MI.getOpcode();
2463 const uint64_t
F =
get(Opcode).TSFlags;
2472 if (!
I.mayLoad() && !
I.mayStore())
2478 switch (
MI.getOpcode()) {
2479 case Hexagon::J2_callr:
2480 case Hexagon::J2_callrf:
2481 case Hexagon::J2_callrt:
2482 case Hexagon::PS_call_nr:
2489 switch (
MI.getOpcode()) {
2490 case Hexagon::L4_return:
2491 case Hexagon::L4_return_t:
2492 case Hexagon::L4_return_f:
2493 case Hexagon::L4_return_fnew_pnt:
2494 case Hexagon::L4_return_fnew_pt:
2495 case Hexagon::L4_return_tnew_pnt:
2496 case Hexagon::L4_return_tnew_pt:
2503 switch (
MI.getOpcode()) {
2504 case Hexagon::J2_jumpr:
2505 case Hexagon::J2_jumprt:
2506 case Hexagon::J2_jumprf:
2507 case Hexagon::J2_jumprtnewpt:
2508 case Hexagon::J2_jumprfnewpt:
2509 case Hexagon::J2_jumprtnew:
2510 case Hexagon::J2_jumprfnew:
2521 unsigned offset)
const {
2527 switch (
MI.getOpcode()) {
2531 case Hexagon::J2_jump:
2532 case Hexagon::J2_call:
2533 case Hexagon::PS_call_nr:
2535 case Hexagon::J2_jumpt:
2536 case Hexagon::J2_jumpf:
2537 case Hexagon::J2_jumptnew:
2538 case Hexagon::J2_jumptnewpt:
2539 case Hexagon::J2_jumpfnew:
2540 case Hexagon::J2_jumpfnewpt:
2541 case Hexagon::J2_callt:
2542 case Hexagon::J2_callf:
2544 case Hexagon::J2_loop0i:
2545 case Hexagon::J2_loop0iext:
2546 case Hexagon::J2_loop0r:
2547 case Hexagon::J2_loop0rext:
2548 case Hexagon::J2_loop1i:
2549 case Hexagon::J2_loop1iext:
2550 case Hexagon::J2_loop1r:
2551 case Hexagon::J2_loop1rext:
2554 case Hexagon::J4_cmpeqi_tp0_jump_nt:
2555 case Hexagon::J4_cmpeqi_tp1_jump_nt:
2556 case Hexagon::J4_cmpeqn1_tp0_jump_nt:
2557 case Hexagon::J4_cmpeqn1_tp1_jump_nt:
2569 unsigned Opcode =
MI.getOpcode();
2570 return Opcode == Hexagon::J2_loop0i ||
2571 Opcode == Hexagon::J2_loop0r ||
2572 Opcode == Hexagon::J2_loop0iext ||
2573 Opcode == Hexagon::J2_loop0rext ||
2574 Opcode == Hexagon::J2_loop1i ||
2575 Opcode == Hexagon::J2_loop1r ||
2576 Opcode == Hexagon::J2_loop1iext ||
2577 Opcode == Hexagon::J2_loop1rext;
2581 switch (
MI.getOpcode()) {
2582 default:
return false;
2583 case Hexagon::L4_iadd_memopw_io:
2584 case Hexagon::L4_isub_memopw_io:
2585 case Hexagon::L4_add_memopw_io:
2586 case Hexagon::L4_sub_memopw_io:
2587 case Hexagon::L4_and_memopw_io:
2588 case Hexagon::L4_or_memopw_io:
2589 case Hexagon::L4_iadd_memoph_io:
2590 case Hexagon::L4_isub_memoph_io:
2591 case Hexagon::L4_add_memoph_io:
2592 case Hexagon::L4_sub_memoph_io:
2593 case Hexagon::L4_and_memoph_io:
2594 case Hexagon::L4_or_memoph_io:
2595 case Hexagon::L4_iadd_memopb_io:
2596 case Hexagon::L4_isub_memopb_io:
2597 case Hexagon::L4_add_memopb_io:
2598 case Hexagon::L4_sub_memopb_io:
2599 case Hexagon::L4_and_memopb_io:
2600 case Hexagon::L4_or_memopb_io:
2601 case Hexagon::L4_ior_memopb_io:
2602 case Hexagon::L4_ior_memoph_io:
2603 case Hexagon::L4_ior_memopw_io:
2604 case Hexagon::L4_iand_memopb_io:
2605 case Hexagon::L4_iand_memoph_io:
2606 case Hexagon::L4_iand_memopw_io:
2613 const uint64_t
F =
MI.getDesc().TSFlags;
2618 const uint64_t
F =
get(Opcode).TSFlags;
2635 const uint64_t
F =
MI.getDesc().TSFlags;
2640 const uint64_t
F =
get(Opcode).TSFlags;
2646 unsigned OperandNum)
const {
2647 const uint64_t
F =
MI.getDesc().TSFlags;
2653 const uint64_t
F =
MI.getDesc().TSFlags;
2659 const uint64_t
F =
get(Opcode).TSFlags;
2665 const uint64_t
F =
MI.getDesc().TSFlags;
2671 const uint64_t
F =
get(Opcode).TSFlags;
2679 const uint64_t
F =
get(Opcode).TSFlags;
2684 const uint64_t
F =
get(Opcode).TSFlags;
2689 const uint64_t
F =
get(Opcode).TSFlags;
2696 return MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4 ||
2697 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_EXT ||
2698 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_PIC ||
2699 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_EXT_PIC;
2703 switch (
MI.getOpcode()) {
2705 case Hexagon::L2_loadrb_io:
2706 case Hexagon::L4_loadrb_ur:
2707 case Hexagon::L4_loadrb_ap:
2708 case Hexagon::L2_loadrb_pr:
2709 case Hexagon::L2_loadrb_pbr:
2710 case Hexagon::L2_loadrb_pi:
2711 case Hexagon::L2_loadrb_pci:
2712 case Hexagon::L2_loadrb_pcr:
2713 case Hexagon::L2_loadbsw2_io:
2714 case Hexagon::L4_loadbsw2_ur:
2715 case Hexagon::L4_loadbsw2_ap:
2716 case Hexagon::L2_loadbsw2_pr:
2717 case Hexagon::L2_loadbsw2_pbr:
2718 case Hexagon::L2_loadbsw2_pi:
2719 case Hexagon::L2_loadbsw2_pci:
2720 case Hexagon::L2_loadbsw2_pcr:
2721 case Hexagon::L2_loadbsw4_io:
2722 case Hexagon::L4_loadbsw4_ur:
2723 case Hexagon::L4_loadbsw4_ap:
2724 case Hexagon::L2_loadbsw4_pr:
2725 case Hexagon::L2_loadbsw4_pbr:
2726 case Hexagon::L2_loadbsw4_pi:
2727 case Hexagon::L2_loadbsw4_pci:
2728 case Hexagon::L2_loadbsw4_pcr:
2729 case Hexagon::L4_loadrb_rr:
2730 case Hexagon::L2_ploadrbt_io:
2731 case Hexagon::L2_ploadrbt_pi:
2732 case Hexagon::L2_ploadrbf_io:
2733 case Hexagon::L2_ploadrbf_pi:
2734 case Hexagon::L2_ploadrbtnew_io:
2735 case Hexagon::L2_ploadrbfnew_io:
2736 case Hexagon::L4_ploadrbt_rr:
2737 case Hexagon::L4_ploadrbf_rr:
2738 case Hexagon::L4_ploadrbtnew_rr:
2739 case Hexagon::L4_ploadrbfnew_rr:
2740 case Hexagon::L2_ploadrbtnew_pi:
2741 case Hexagon::L2_ploadrbfnew_pi:
2742 case Hexagon::L4_ploadrbt_abs:
2743 case Hexagon::L4_ploadrbf_abs:
2744 case Hexagon::L4_ploadrbtnew_abs:
2745 case Hexagon::L4_ploadrbfnew_abs:
2746 case Hexagon::L2_loadrbgp:
2748 case Hexagon::L2_loadrh_io:
2749 case Hexagon::L4_loadrh_ur:
2750 case Hexagon::L4_loadrh_ap:
2751 case Hexagon::L2_loadrh_pr:
2752 case Hexagon::L2_loadrh_pbr:
2753 case Hexagon::L2_loadrh_pi:
2754 case Hexagon::L2_loadrh_pci:
2755 case Hexagon::L2_loadrh_pcr:
2756 case Hexagon::L4_loadrh_rr:
2757 case Hexagon::L2_ploadrht_io:
2758 case Hexagon::L2_ploadrht_pi:
2759 case Hexagon::L2_ploadrhf_io:
2760 case Hexagon::L2_ploadrhf_pi:
2761 case Hexagon::L2_ploadrhtnew_io:
2762 case Hexagon::L2_ploadrhfnew_io:
2763 case Hexagon::L4_ploadrht_rr:
2764 case Hexagon::L4_ploadrhf_rr:
2765 case Hexagon::L4_ploadrhtnew_rr:
2766 case Hexagon::L4_ploadrhfnew_rr:
2767 case Hexagon::L2_ploadrhtnew_pi:
2768 case Hexagon::L2_ploadrhfnew_pi:
2769 case Hexagon::L4_ploadrht_abs:
2770 case Hexagon::L4_ploadrhf_abs:
2771 case Hexagon::L4_ploadrhtnew_abs:
2772 case Hexagon::L4_ploadrhfnew_abs:
2773 case Hexagon::L2_loadrhgp:
2781 const uint64_t
F =
MI.getDesc().TSFlags;
2786 switch (
MI.getOpcode()) {
2787 case Hexagon::STriw_pred:
2788 case Hexagon::LDriw_pred:
2799 for (
auto &
Op :
MI.operands())
2800 if (
Op.isGlobal() ||
Op.isSymbol())
2807 unsigned SchedClass =
MI.getDesc().getSchedClass();
2808 return is_TC1(SchedClass);
2812 unsigned SchedClass =
MI.getDesc().getSchedClass();
2813 return is_TC2(SchedClass);
2817 unsigned SchedClass =
MI.getDesc().getSchedClass();
2822 unsigned SchedClass =
MI.getDesc().getSchedClass();
2833 for (
int I = 0;
I <
N;
I++)
2838 if (MI2.
getOpcode() == Hexagon::V6_vS32b_pi)
2893 bool Extend)
const {
2903 case Hexagon::PS_vstorerq_ai:
2904 case Hexagon::PS_vstorerv_ai:
2905 case Hexagon::PS_vstorerw_ai:
2906 case Hexagon::PS_vstorerw_nt_ai:
2907 case Hexagon::PS_vloadrq_ai:
2908 case Hexagon::PS_vloadrv_ai:
2909 case Hexagon::PS_vloadrw_ai:
2910 case Hexagon::PS_vloadrw_nt_ai:
2911 case Hexagon::V6_vL32b_ai:
2912 case Hexagon::V6_vS32b_ai:
2913 case Hexagon::V6_vS32b_pred_ai:
2914 case Hexagon::V6_vS32b_npred_ai:
2915 case Hexagon::V6_vS32b_qpred_ai:
2916 case Hexagon::V6_vS32b_nqpred_ai:
2917 case Hexagon::V6_vS32b_new_ai:
2918 case Hexagon::V6_vS32b_new_pred_ai:
2919 case Hexagon::V6_vS32b_new_npred_ai:
2920 case Hexagon::V6_vS32b_nt_pred_ai:
2921 case Hexagon::V6_vS32b_nt_npred_ai:
2922 case Hexagon::V6_vS32b_nt_new_ai:
2923 case Hexagon::V6_vS32b_nt_new_pred_ai:
2924 case Hexagon::V6_vS32b_nt_new_npred_ai:
2925 case Hexagon::V6_vS32b_nt_qpred_ai:
2926 case Hexagon::V6_vS32b_nt_nqpred_ai:
2927 case Hexagon::V6_vL32b_nt_ai:
2928 case Hexagon::V6_vS32b_nt_ai:
2929 case Hexagon::V6_vL32Ub_ai:
2930 case Hexagon::V6_vS32Ub_ai:
2931 case Hexagon::V6_vL32b_cur_ai:
2932 case Hexagon::V6_vL32b_tmp_ai:
2933 case Hexagon::V6_vL32b_pred_ai:
2934 case Hexagon::V6_vL32b_npred_ai:
2935 case Hexagon::V6_vL32b_cur_pred_ai:
2936 case Hexagon::V6_vL32b_cur_npred_ai:
2937 case Hexagon::V6_vL32b_tmp_pred_ai:
2938 case Hexagon::V6_vL32b_tmp_npred_ai:
2939 case Hexagon::V6_vL32b_nt_cur_ai:
2940 case Hexagon::V6_vL32b_nt_tmp_ai:
2941 case Hexagon::V6_vL32b_nt_pred_ai:
2942 case Hexagon::V6_vL32b_nt_npred_ai:
2943 case Hexagon::V6_vL32b_nt_cur_pred_ai:
2944 case Hexagon::V6_vL32b_nt_cur_npred_ai:
2945 case Hexagon::V6_vL32b_nt_tmp_pred_ai:
2946 case Hexagon::V6_vL32b_nt_tmp_npred_ai:
2947 case Hexagon::V6_vS32Ub_pred_ai:
2948 case Hexagon::V6_vS32Ub_npred_ai:
2949 case Hexagon::V6_vgathermh_pseudo:
2950 case Hexagon::V6_vgather_vscatter_mh_pseudo:
2951 case Hexagon::V6_vgathermw_pseudo:
2952 case Hexagon::V6_vgathermhw_pseudo:
2953 case Hexagon::V6_vgathermhq_pseudo:
2954 case Hexagon::V6_vgathermwq_pseudo:
2955 case Hexagon::V6_vgathermhwq_pseudo: {
2956 unsigned VectorSize = RegInfo.getSpillSize(Hexagon::HvxVRRegClass);
2958 if (
Offset & (VectorSize-1))
2963 case Hexagon::J2_loop0i:
2964 case Hexagon::J2_loop1i:
2967 case Hexagon::S4_storeirb_io:
2968 case Hexagon::S4_storeirbt_io:
2969 case Hexagon::S4_storeirbf_io:
2972 case Hexagon::S4_storeirh_io:
2973 case Hexagon::S4_storeirht_io:
2974 case Hexagon::S4_storeirhf_io:
2977 case Hexagon::S4_storeiri_io:
2978 case Hexagon::S4_storeirit_io:
2979 case Hexagon::S4_storeirif_io:
2982 case Hexagon::A4_cmpbeqi:
2984 case Hexagon::A4_cmpbgti:
2992 case Hexagon::L2_loadri_io:
2993 case Hexagon::S2_storeri_io:
2997 case Hexagon::L2_loadrd_io:
2998 case Hexagon::S2_storerd_io:
3002 case Hexagon::L2_loadrh_io:
3003 case Hexagon::L2_loadruh_io:
3004 case Hexagon::S2_storerh_io:
3005 case Hexagon::S2_storerf_io:
3009 case Hexagon::L2_loadrb_io:
3010 case Hexagon::L2_loadrub_io:
3011 case Hexagon::S2_storerb_io:
3015 case Hexagon::A2_addi:
3019 case Hexagon::L4_iadd_memopw_io:
3020 case Hexagon::L4_isub_memopw_io:
3021 case Hexagon::L4_add_memopw_io:
3022 case Hexagon::L4_sub_memopw_io:
3023 case Hexagon::L4_iand_memopw_io:
3024 case Hexagon::L4_ior_memopw_io:
3025 case Hexagon::L4_and_memopw_io:
3026 case Hexagon::L4_or_memopw_io:
3029 case Hexagon::L4_iadd_memoph_io:
3030 case Hexagon::L4_isub_memoph_io:
3031 case Hexagon::L4_add_memoph_io:
3032 case Hexagon::L4_sub_memoph_io:
3033 case Hexagon::L4_iand_memoph_io:
3034 case Hexagon::L4_ior_memoph_io:
3035 case Hexagon::L4_and_memoph_io:
3036 case Hexagon::L4_or_memoph_io:
3039 case Hexagon::L4_iadd_memopb_io:
3040 case Hexagon::L4_isub_memopb_io:
3041 case Hexagon::L4_add_memopb_io:
3042 case Hexagon::L4_sub_memopb_io:
3043 case Hexagon::L4_iand_memopb_io:
3044 case Hexagon::L4_ior_memopb_io:
3045 case Hexagon::L4_and_memopb_io:
3046 case Hexagon::L4_or_memopb_io:
3051 case Hexagon::STriw_pred:
3052 case Hexagon::LDriw_pred:
3053 case Hexagon::STriw_ctr:
3054 case Hexagon::LDriw_ctr:
3057 case Hexagon::PS_fi:
3058 case Hexagon::PS_fia:
3059 case Hexagon::INLINEASM:
3062 case Hexagon::L2_ploadrbt_io:
3063 case Hexagon::L2_ploadrbf_io:
3064 case Hexagon::L2_ploadrubt_io:
3065 case Hexagon::L2_ploadrubf_io:
3066 case Hexagon::S2_pstorerbt_io:
3067 case Hexagon::S2_pstorerbf_io:
3070 case Hexagon::L2_ploadrht_io:
3071 case Hexagon::L2_ploadrhf_io:
3072 case Hexagon::L2_ploadruht_io:
3073 case Hexagon::L2_ploadruhf_io:
3074 case Hexagon::S2_pstorerht_io:
3075 case Hexagon::S2_pstorerhf_io:
3076 case Hexagon::S2_pstorerft_io:
3077 case Hexagon::S2_pstorerff_io:
3080 case Hexagon::L2_ploadrit_io:
3081 case Hexagon::L2_ploadrif_io:
3082 case Hexagon::S2_pstorerit_io:
3083 case Hexagon::S2_pstorerif_io:
3086 case Hexagon::L2_ploadrdt_io:
3087 case Hexagon::L2_ploadrdf_io:
3088 case Hexagon::S2_pstorerdt_io:
3089 case Hexagon::S2_pstorerdf_io:
3092 case Hexagon::L2_loadbsw2_io:
3093 case Hexagon::L2_loadbzw2_io:
3096 case Hexagon::L2_loadbsw4_io:
3097 case Hexagon::L2_loadbzw4_io:
3101 dbgs() <<
"Failed Opcode is : " << Opcode <<
" (" <<
getName(Opcode)
3104 "Please define it in the above switch statement!");
3112 const uint64_t
F =
get(
MI.getOpcode()).TSFlags;
3134 switch (
MI.getOpcode()) {
3136 case Hexagon::L2_loadrub_io:
3137 case Hexagon::L4_loadrub_ur:
3138 case Hexagon::L4_loadrub_ap:
3139 case Hexagon::L2_loadrub_pr:
3140 case Hexagon::L2_loadrub_pbr:
3141 case Hexagon::L2_loadrub_pi:
3142 case Hexagon::L2_loadrub_pci:
3143 case Hexagon::L2_loadrub_pcr:
3144 case Hexagon::L2_loadbzw2_io:
3145 case Hexagon::L4_loadbzw2_ur:
3146 case Hexagon::L4_loadbzw2_ap:
3147 case Hexagon::L2_loadbzw2_pr:
3148 case Hexagon::L2_loadbzw2_pbr:
3149 case Hexagon::L2_loadbzw2_pi:
3150 case Hexagon::L2_loadbzw2_pci:
3151 case Hexagon::L2_loadbzw2_pcr:
3152 case Hexagon::L2_loadbzw4_io:
3153 case Hexagon::L4_loadbzw4_ur:
3154 case Hexagon::L4_loadbzw4_ap:
3155 case Hexagon::L2_loadbzw4_pr:
3156 case Hexagon::L2_loadbzw4_pbr:
3157 case Hexagon::L2_loadbzw4_pi:
3158 case Hexagon::L2_loadbzw4_pci:
3159 case Hexagon::L2_loadbzw4_pcr:
3160 case Hexagon::L4_loadrub_rr:
3161 case Hexagon::L2_ploadrubt_io:
3162 case Hexagon::L2_ploadrubt_pi:
3163 case Hexagon::L2_ploadrubf_io:
3164 case Hexagon::L2_ploadrubf_pi:
3165 case Hexagon::L2_ploadrubtnew_io:
3166 case Hexagon::L2_ploadrubfnew_io:
3167 case Hexagon::L4_ploadrubt_rr:
3168 case Hexagon::L4_ploadrubf_rr:
3169 case Hexagon::L4_ploadrubtnew_rr:
3170 case Hexagon::L4_ploadrubfnew_rr:
3171 case Hexagon::L2_ploadrubtnew_pi:
3172 case Hexagon::L2_ploadrubfnew_pi:
3173 case Hexagon::L4_ploadrubt_abs:
3174 case Hexagon::L4_ploadrubf_abs:
3175 case Hexagon::L4_ploadrubtnew_abs:
3176 case Hexagon::L4_ploadrubfnew_abs:
3177 case Hexagon::L2_loadrubgp:
3179 case Hexagon::L2_loadruh_io:
3180 case Hexagon::L4_loadruh_ur:
3181 case Hexagon::L4_loadruh_ap:
3182 case Hexagon::L2_loadruh_pr:
3183 case Hexagon::L2_loadruh_pbr:
3184 case Hexagon::L2_loadruh_pi:
3185 case Hexagon::L2_loadruh_pci:
3186 case Hexagon::L2_loadruh_pcr:
3187 case Hexagon::L4_loadruh_rr:
3188 case Hexagon::L2_ploadruht_io:
3189 case Hexagon::L2_ploadruht_pi:
3190 case Hexagon::L2_ploadruhf_io:
3191 case Hexagon::L2_ploadruhf_pi:
3192 case Hexagon::L2_ploadruhtnew_io:
3193 case Hexagon::L2_ploadruhfnew_io:
3194 case Hexagon::L4_ploadruht_rr:
3195 case Hexagon::L4_ploadruhf_rr:
3196 case Hexagon::L4_ploadruhtnew_rr:
3197 case Hexagon::L4_ploadruhfnew_rr:
3198 case Hexagon::L2_ploadruhtnew_pi:
3199 case Hexagon::L2_ploadruhfnew_pi:
3200 case Hexagon::L4_ploadruht_abs:
3201 case Hexagon::L4_ploadruhf_abs:
3202 case Hexagon::L4_ploadruhtnew_abs:
3203 case Hexagon::L4_ploadruhfnew_abs:
3204 case Hexagon::L2_loadruhgp:
3224 OffsetIsScalable =
false;
3226 if (!BaseOp || !BaseOp->
isReg())
3235 if (Second.
mayStore() &&
First.getOpcode() == Hexagon::S2_allocframe) {
3237 if (
Op.isReg() &&
Op.isUse() &&
Op.getReg() == Hexagon::R29)
3247 if (!Stored.
isReg())
3249 for (
unsigned i = 0, e =
First.getNumOperands(); i < e; ++i) {
3251 if (
Op.isReg() &&
Op.isDef() &&
Op.getReg() == Stored.
getReg())
3260 return Opc == Hexagon::PS_call_nr ||
Opc == Hexagon::PS_callr_nr;
3276 if (Hexagon::getRegForm(
MI.getOpcode()) >= 0)
3279 if (
MI.getDesc().mayLoad() ||
MI.getDesc().mayStore()) {
3286 NonExtOpcode = Hexagon::changeAddrMode_abs_io(
MI.getOpcode());
3292 NonExtOpcode = Hexagon::changeAddrMode_io_rr(
MI.getOpcode());
3295 NonExtOpcode = Hexagon::changeAddrMode_ur_rr(
MI.getOpcode());
3300 if (NonExtOpcode < 0)
3320 const uint64_t
F =
MI.getDesc().TSFlags;
3322 Subtarget.hasV60Ops();
3327 if (
MI.mayStore() && !Subtarget.useNewValueStores())
3330 const uint64_t
F =
MI.getDesc().TSFlags;
3335 return MI.getOpcode() == Hexagon::LX_L16b_pseudo;
3339 return MI.getOpcode() == Hexagon::LX_S16b_pseudo;
3369 if (!MII->isBundle())
3372 for (++MII; MII != MIE && MII->isInsideBundle(); ++MII) {
3384 if (MO.isRegMask() && MO.clobbersPhysReg(PredReg))
3386 if (MO.isReg() && MO.isDef() && MO.isImplicit() && (MO.getReg() == PredReg))
3392 switch (
MI.getOpcode()) {
3393 case Hexagon::A4_addp_c:
3394 case Hexagon::A4_subp_c:
3395 case Hexagon::A4_tlbmatch:
3396 case Hexagon::A5_ACS:
3397 case Hexagon::F2_sfinvsqrta:
3398 case Hexagon::F2_sfrecipa:
3399 case Hexagon::J2_endloop0:
3400 case Hexagon::J2_endloop01:
3401 case Hexagon::J2_ploop1si:
3402 case Hexagon::J2_ploop1sr:
3403 case Hexagon::J2_ploop2si:
3404 case Hexagon::J2_ploop2sr:
3405 case Hexagon::J2_ploop3si:
3406 case Hexagon::J2_ploop3sr:
3407 case Hexagon::S2_cabacdecbin:
3408 case Hexagon::S2_storew_locked:
3409 case Hexagon::S4_stored_locked:
3416 return Opcode == Hexagon::J2_jumpt ||
3417 Opcode == Hexagon::J2_jumptpt ||
3418 Opcode == Hexagon::J2_jumpf ||
3419 Opcode == Hexagon::J2_jumpfpt ||
3420 Opcode == Hexagon::J2_jumptnew ||
3421 Opcode == Hexagon::J2_jumpfnew ||
3422 Opcode == Hexagon::J2_jumptnewpt ||
3423 Opcode == Hexagon::J2_jumpfnewpt;
3433 const uint64_t
F =
MI.getDesc().TSFlags;
3452 unsigned BasePos = 0, OffsetPos = 0;
3475 unsigned &BasePos,
unsigned &OffsetPos)
const {
3483 }
else if (
MI.mayStore()) {
3486 }
else if (
MI.mayLoad()) {
3501 if (!
MI.getOperand(BasePos).isReg() || !
MI.getOperand(OffsetPos).isImm())
3516 if (
I ==
MBB.instr_begin())
3535 }
while (
I !=
MBB.instr_begin());
3537 I =
MBB.instr_end();
3540 while (
I->isDebugInstr()) {
3541 if (
I ==
MBB.instr_begin())
3545 if (!isUnpredicatedTerminator(*
I))
3554 if (&*
I != LastInst && !
I->isBundle() && isUnpredicatedTerminator(*
I)) {
3555 if (!SecondLastInst) {
3556 SecondLastInst = &*
I;
3561 if (
I ==
MBB.instr_begin())
3570 const uint64_t
F =
MI.getDesc().TSFlags;
3578 Register DstReg, SrcReg, Src1Reg, Src2Reg;
3580 switch (
MI.getOpcode()) {
3589 case Hexagon::C2_cmpeq:
3590 case Hexagon::C2_cmpgt:
3591 case Hexagon::C2_cmpgtu:
3592 DstReg =
MI.getOperand(0).getReg();
3593 Src1Reg =
MI.getOperand(1).getReg();
3594 Src2Reg =
MI.getOperand(2).getReg();
3595 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3596 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3600 case Hexagon::C2_cmpeqi:
3601 case Hexagon::C2_cmpgti:
3602 case Hexagon::C2_cmpgtui:
3604 DstReg =
MI.getOperand(0).getReg();
3605 SrcReg =
MI.getOperand(1).getReg();
3606 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3607 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3610 (
MI.getOperand(2).getImm() == -1)))
3613 case Hexagon::A2_tfr:
3615 DstReg =
MI.getOperand(0).getReg();
3616 SrcReg =
MI.getOperand(1).getReg();
3620 case Hexagon::A2_tfrsi:
3624 DstReg =
MI.getOperand(0).getReg();
3628 case Hexagon::S2_tstbit_i:
3629 DstReg =
MI.getOperand(0).getReg();
3630 Src1Reg =
MI.getOperand(1).getReg();
3631 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3632 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3633 MI.getOperand(2).isImm() &&
3641 case Hexagon::J2_jumptnew:
3642 case Hexagon::J2_jumpfnew:
3643 case Hexagon::J2_jumptnewpt:
3644 case Hexagon::J2_jumpfnewpt:
3645 Src1Reg =
MI.getOperand(0).getReg();
3646 if (Hexagon::PredRegsRegClass.
contains(Src1Reg) &&
3647 (Hexagon::P0 == Src1Reg || Hexagon::P1 == Src1Reg))
3654 case Hexagon::J2_jump:
3655 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4:
3656 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4_PIC:
3668 if ((GA.
getOpcode() != Hexagon::C2_cmpeqi) ||
3669 (GB.
getOpcode() != Hexagon::J2_jumptnew))
3674 if (DestReg != Hexagon::P0 && DestReg != Hexagon::P1)
3682 return DestReg == Hexagon::P0 ? Hexagon::J4_cmpeqn1_tp0_jump_nt
3683 : Hexagon::J4_cmpeqn1_tp1_jump_nt;
3686 return DestReg == Hexagon::P0 ? Hexagon::J4_cmpeqi_tp0_jump_nt
3687 : Hexagon::J4_cmpeqi_tp1_jump_nt;
3692 bool ForBigCore)
const {
3700 static const std::map<unsigned, unsigned> DupMap = {
3701 {Hexagon::A2_add, Hexagon::dup_A2_add},
3702 {Hexagon::A2_addi, Hexagon::dup_A2_addi},
3703 {Hexagon::A2_andir, Hexagon::dup_A2_andir},
3704 {Hexagon::A2_combineii, Hexagon::dup_A2_combineii},
3705 {Hexagon::A2_sxtb, Hexagon::dup_A2_sxtb},
3706 {Hexagon::A2_sxth, Hexagon::dup_A2_sxth},
3707 {Hexagon::A2_tfr, Hexagon::dup_A2_tfr},
3708 {Hexagon::A2_tfrsi, Hexagon::dup_A2_tfrsi},
3709 {Hexagon::A2_zxtb, Hexagon::dup_A2_zxtb},
3710 {Hexagon::A2_zxth, Hexagon::dup_A2_zxth},
3711 {Hexagon::A4_combineii, Hexagon::dup_A4_combineii},
3712 {Hexagon::A4_combineir, Hexagon::dup_A4_combineir},
3713 {Hexagon::A4_combineri, Hexagon::dup_A4_combineri},
3714 {Hexagon::C2_cmoveif, Hexagon::dup_C2_cmoveif},
3715 {Hexagon::C2_cmoveit, Hexagon::dup_C2_cmoveit},
3716 {Hexagon::C2_cmovenewif, Hexagon::dup_C2_cmovenewif},
3717 {Hexagon::C2_cmovenewit, Hexagon::dup_C2_cmovenewit},
3718 {Hexagon::C2_cmpeqi, Hexagon::dup_C2_cmpeqi},
3719 {Hexagon::L2_deallocframe, Hexagon::dup_L2_deallocframe},
3720 {Hexagon::L2_loadrb_io, Hexagon::dup_L2_loadrb_io},
3721 {Hexagon::L2_loadrd_io, Hexagon::dup_L2_loadrd_io},
3722 {Hexagon::L2_loadrh_io, Hexagon::dup_L2_loadrh_io},
3723 {Hexagon::L2_loadri_io, Hexagon::dup_L2_loadri_io},
3724 {Hexagon::L2_loadrub_io, Hexagon::dup_L2_loadrub_io},
3725 {Hexagon::L2_loadruh_io, Hexagon::dup_L2_loadruh_io},
3726 {Hexagon::S2_allocframe, Hexagon::dup_S2_allocframe},
3727 {Hexagon::S2_storerb_io, Hexagon::dup_S2_storerb_io},
3728 {Hexagon::S2_storerd_io, Hexagon::dup_S2_storerd_io},
3729 {Hexagon::S2_storerh_io, Hexagon::dup_S2_storerh_io},
3730 {Hexagon::S2_storeri_io, Hexagon::dup_S2_storeri_io},
3731 {Hexagon::S4_storeirb_io, Hexagon::dup_S4_storeirb_io},
3732 {Hexagon::S4_storeiri_io, Hexagon::dup_S4_storeiri_io},
3734 unsigned OpNum =
MI.getOpcode();
3737 auto Iter = DupMap.find(OpNum);
3738 if (Iter != DupMap.end())
3739 return Iter->second;
3741 for (
const auto &Iter : DupMap)
3742 if (Iter.second == OpNum)
3749 enum Hexagon::PredSense inPredSense;
3750 inPredSense = invertPredicate ? Hexagon::PredSense_false :
3751 Hexagon::PredSense_true;
3752 int CondOpcode = Hexagon::getPredOpcode(
Opc, inPredSense);
3753 if (CondOpcode >= 0)
3761 switch (
MI.getOpcode()) {
3763 case Hexagon::V6_vL32b_pi:
3764 return Hexagon::V6_vL32b_cur_pi;
3765 case Hexagon::V6_vL32b_ai:
3766 return Hexagon::V6_vL32b_cur_ai;
3767 case Hexagon::V6_vL32b_nt_pi:
3768 return Hexagon::V6_vL32b_nt_cur_pi;
3769 case Hexagon::V6_vL32b_nt_ai:
3770 return Hexagon::V6_vL32b_nt_cur_ai;
3771 case Hexagon::V6_vL32b_ppu:
3772 return Hexagon::V6_vL32b_cur_ppu;
3773 case Hexagon::V6_vL32b_nt_ppu:
3774 return Hexagon::V6_vL32b_nt_cur_ppu;
3781 switch (
MI.getOpcode()) {
3783 case Hexagon::V6_vL32b_cur_pi:
3784 return Hexagon::V6_vL32b_pi;
3785 case Hexagon::V6_vL32b_cur_ai:
3786 return Hexagon::V6_vL32b_ai;
3787 case Hexagon::V6_vL32b_nt_cur_pi:
3788 return Hexagon::V6_vL32b_nt_pi;
3789 case Hexagon::V6_vL32b_nt_cur_ai:
3790 return Hexagon::V6_vL32b_nt_ai;
3791 case Hexagon::V6_vL32b_cur_ppu:
3792 return Hexagon::V6_vL32b_ppu;
3793 case Hexagon::V6_vL32b_nt_cur_ppu:
3794 return Hexagon::V6_vL32b_nt_ppu;
3882 int NVOpcode = Hexagon::getNewValueOpcode(
MI.getOpcode());
3886 switch (
MI.getOpcode()) {
3889 std::to_string(
MI.getOpcode()));
3890 case Hexagon::S4_storerb_ur:
3891 return Hexagon::S4_storerbnew_ur;
3893 case Hexagon::S2_storerb_pci:
3894 return Hexagon::S2_storerb_pci;
3896 case Hexagon::S2_storeri_pci:
3897 return Hexagon::S2_storeri_pci;
3899 case Hexagon::S2_storerh_pci:
3900 return Hexagon::S2_storerh_pci;
3902 case Hexagon::S2_storerd_pci:
3903 return Hexagon::S2_storerd_pci;
3905 case Hexagon::S2_storerf_pci:
3906 return Hexagon::S2_storerf_pci;
3908 case Hexagon::V6_vS32b_ai:
3909 return Hexagon::V6_vS32b_new_ai;
3911 case Hexagon::V6_vS32b_pi:
3912 return Hexagon::V6_vS32b_new_pi;
3937 if (BrTarget.
isMBB()) {
3939 Taken = getEdgeProbability(Src, Dst) >= OneHalf;
3952 bool SawCond =
false, Bad =
false;
3956 if (
I.isConditionalBranch()) {
3963 if (
I.isUnconditionalBranch() && !SawCond) {
3971 if (NextIt ==
B.instr_end()) {
3974 if (!
B.isLayoutSuccessor(SB))
3976 Taken = getEdgeProbability(Src, SB) < OneHalf;
3980 assert(NextIt->isUnconditionalBranch());
3989 Taken =
BT && getEdgeProbability(Src,
BT) < OneHalf;
3996 switch (
MI.getOpcode()) {
3997 case Hexagon::J2_jumpt:
3998 return Taken ? Hexagon::J2_jumptnewpt : Hexagon::J2_jumptnew;
3999 case Hexagon::J2_jumpf:
4000 return Taken ? Hexagon::J2_jumpfnewpt : Hexagon::J2_jumpfnew;
4010 switch (
MI.getOpcode()) {
4012 case Hexagon::J2_jumpt:
4013 case Hexagon::J2_jumpf:
4017 int NewOpcode = Hexagon::getPredNewOpcode(
MI.getOpcode());
4024 int NewOp =
MI.getOpcode();
4026 NewOp = Hexagon::getPredOldOpcode(NewOp);
4030 if (!Subtarget.hasFeature(Hexagon::ArchV60)) {
4032 case Hexagon::J2_jumptpt:
4033 NewOp = Hexagon::J2_jumpt;
4035 case Hexagon::J2_jumpfpt:
4036 NewOp = Hexagon::J2_jumpf;
4038 case Hexagon::J2_jumprtpt:
4039 NewOp = Hexagon::J2_jumprt;
4041 case Hexagon::J2_jumprfpt:
4042 NewOp = Hexagon::J2_jumprf;
4047 "Couldn't change predicate new instruction to its old form.");
4051 NewOp = Hexagon::getNonNVStore(NewOp);
4052 assert(NewOp >= 0 &&
"Couldn't change new-value store to its old form.");
4055 if (Subtarget.hasV60Ops())
4060 case Hexagon::J2_jumpfpt:
4061 return Hexagon::J2_jumpf;
4062 case Hexagon::J2_jumptpt:
4063 return Hexagon::J2_jumpt;
4064 case Hexagon::J2_jumprfpt:
4065 return Hexagon::J2_jumprf;
4066 case Hexagon::J2_jumprtpt:
4067 return Hexagon::J2_jumprt;
4076 Register DstReg, SrcReg, Src1Reg, Src2Reg;
4079 switch (
MI.getOpcode()) {
4087 case Hexagon::L2_loadri_io:
4088 case Hexagon::dup_L2_loadri_io:
4089 DstReg =
MI.getOperand(0).getReg();
4090 SrcReg =
MI.getOperand(1).getReg();
4094 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4096 MI.getOperand(2).isImm() &&
4101 (
MI.getOperand(2).isImm() &&
4106 case Hexagon::L2_loadrub_io:
4107 case Hexagon::dup_L2_loadrub_io:
4109 DstReg =
MI.getOperand(0).getReg();
4110 SrcReg =
MI.getOperand(1).getReg();
4112 MI.getOperand(2).isImm() &&
isUInt<4>(
MI.getOperand(2).getImm()))
4125 case Hexagon::L2_loadrh_io:
4126 case Hexagon::L2_loadruh_io:
4127 case Hexagon::dup_L2_loadrh_io:
4128 case Hexagon::dup_L2_loadruh_io:
4130 DstReg =
MI.getOperand(0).getReg();
4131 SrcReg =
MI.getOperand(1).getReg();
4133 MI.getOperand(2).isImm() &&
4137 case Hexagon::L2_loadrb_io:
4138 case Hexagon::dup_L2_loadrb_io:
4140 DstReg =
MI.getOperand(0).getReg();
4141 SrcReg =
MI.getOperand(1).getReg();
4143 MI.getOperand(2).isImm() &&
4147 case Hexagon::L2_loadrd_io:
4148 case Hexagon::dup_L2_loadrd_io:
4150 DstReg =
MI.getOperand(0).getReg();
4151 SrcReg =
MI.getOperand(1).getReg();
4153 Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4155 MI.getOperand(2).isImm() &&
4161 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4:
4162 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4_PIC:
4163 case Hexagon::L4_return:
4164 case Hexagon::L2_deallocframe:
4165 case Hexagon::dup_L2_deallocframe:
4167 case Hexagon::EH_RETURN_JMPR:
4168 case Hexagon::PS_jmpret:
4169 case Hexagon::SL2_jumpr31:
4172 DstReg =
MI.getOperand(0).getReg();
4173 if (Hexagon::IntRegsRegClass.
contains(DstReg) && (Hexagon::R31 == DstReg))
4176 case Hexagon::PS_jmprett:
4177 case Hexagon::PS_jmpretf:
4178 case Hexagon::PS_jmprettnewpt:
4179 case Hexagon::PS_jmpretfnewpt:
4180 case Hexagon::PS_jmprettnew:
4181 case Hexagon::PS_jmpretfnew:
4182 case Hexagon::SL2_jumpr31_t:
4183 case Hexagon::SL2_jumpr31_f:
4184 case Hexagon::SL2_jumpr31_tnew:
4185 case Hexagon::SL2_jumpr31_fnew:
4186 DstReg =
MI.getOperand(1).getReg();
4187 SrcReg =
MI.getOperand(0).getReg();
4189 if ((Hexagon::PredRegsRegClass.
contains(SrcReg) &&
4190 (Hexagon::P0 == SrcReg)) &&
4191 (Hexagon::IntRegsRegClass.
contains(DstReg) && (Hexagon::R31 == DstReg)))
4194 case Hexagon::L4_return_t:
4195 case Hexagon::L4_return_f:
4196 case Hexagon::L4_return_tnew_pnt:
4197 case Hexagon::L4_return_fnew_pnt:
4198 case Hexagon::L4_return_tnew_pt:
4199 case Hexagon::L4_return_fnew_pt:
4201 SrcReg =
MI.getOperand(0).getReg();
4202 if (Hexagon::PredRegsRegClass.
contains(SrcReg) && (Hexagon::P0 == SrcReg))
4210 case Hexagon::S2_storeri_io:
4211 case Hexagon::dup_S2_storeri_io:
4214 Src1Reg =
MI.getOperand(0).getReg();
4215 Src2Reg =
MI.getOperand(2).getReg();
4216 if (Hexagon::IntRegsRegClass.
contains(Src1Reg) &&
4223 MI.getOperand(1).isImm() &&
4227 case Hexagon::S2_storerb_io:
4228 case Hexagon::dup_S2_storerb_io:
4230 Src1Reg =
MI.getOperand(0).getReg();
4231 Src2Reg =
MI.getOperand(2).getReg();
4233 MI.getOperand(1).isImm() &&
isUInt<4>(
MI.getOperand(1).getImm()))
4245 case Hexagon::S2_storerh_io:
4246 case Hexagon::dup_S2_storerh_io:
4248 Src1Reg =
MI.getOperand(0).getReg();
4249 Src2Reg =
MI.getOperand(2).getReg();
4251 MI.getOperand(1).isImm() &&
4255 case Hexagon::S2_storerd_io:
4256 case Hexagon::dup_S2_storerd_io:
4258 Src1Reg =
MI.getOperand(0).getReg();
4259 Src2Reg =
MI.getOperand(2).getReg();
4261 Hexagon::IntRegsRegClass.
contains(Src1Reg) &&
4266 case Hexagon::S4_storeiri_io:
4267 case Hexagon::dup_S4_storeiri_io:
4269 Src1Reg =
MI.getOperand(0).getReg();
4272 MI.getOperand(2).isImm() &&
isUInt<1>(
MI.getOperand(2).getImm()))
4275 case Hexagon::S4_storeirb_io:
4276 case Hexagon::dup_S4_storeirb_io:
4278 Src1Reg =
MI.getOperand(0).getReg();
4280 MI.getOperand(1).isImm() &&
isUInt<4>(
MI.getOperand(1).getImm()) &&
4281 MI.getOperand(2).isImm() &&
isUInt<1>(
MI.getOperand(2).getImm()))
4284 case Hexagon::S2_allocframe:
4285 case Hexagon::dup_S2_allocframe:
4286 if (
MI.getOperand(2).isImm() &&
4308 case Hexagon::A2_addi:
4309 case Hexagon::dup_A2_addi:
4310 DstReg =
MI.getOperand(0).getReg();
4311 SrcReg =
MI.getOperand(1).getReg();
4314 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4319 if ((DstReg == SrcReg) &&
MI.getOperand(2).isImm() &&
4325 ((
MI.getOperand(2).getImm() == 1) ||
4326 (
MI.getOperand(2).getImm() == -1)))
4330 case Hexagon::A2_add:
4331 case Hexagon::dup_A2_add:
4333 DstReg =
MI.getOperand(0).getReg();
4334 Src1Reg =
MI.getOperand(1).getReg();
4335 Src2Reg =
MI.getOperand(2).getReg();
4340 case Hexagon::A2_andir:
4341 case Hexagon::dup_A2_andir:
4345 DstReg =
MI.getOperand(0).getReg();
4346 SrcReg =
MI.getOperand(1).getReg();
4348 MI.getOperand(2).isImm() &&
4349 ((
MI.getOperand(2).getImm() == 1) ||
4350 (
MI.getOperand(2).getImm() == 255)))
4353 case Hexagon::A2_tfr:
4354 case Hexagon::dup_A2_tfr:
4356 DstReg =
MI.getOperand(0).getReg();
4357 SrcReg =
MI.getOperand(1).getReg();
4361 case Hexagon::A2_tfrsi:
4362 case Hexagon::dup_A2_tfrsi:
4367 DstReg =
MI.getOperand(0).getReg();
4371 case Hexagon::C2_cmoveit:
4372 case Hexagon::C2_cmovenewit:
4373 case Hexagon::C2_cmoveif:
4374 case Hexagon::C2_cmovenewif:
4375 case Hexagon::dup_C2_cmoveit:
4376 case Hexagon::dup_C2_cmovenewit:
4377 case Hexagon::dup_C2_cmoveif:
4378 case Hexagon::dup_C2_cmovenewif:
4382 DstReg =
MI.getOperand(0).getReg();
4383 SrcReg =
MI.getOperand(1).getReg();
4385 Hexagon::PredRegsRegClass.
contains(SrcReg) && Hexagon::P0 == SrcReg &&
4386 MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0)
4389 case Hexagon::C2_cmpeqi:
4390 case Hexagon::dup_C2_cmpeqi:
4392 DstReg =
MI.getOperand(0).getReg();
4393 SrcReg =
MI.getOperand(1).getReg();
4394 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
4396 MI.getOperand(2).isImm() &&
isUInt<2>(
MI.getOperand(2).getImm()))
4399 case Hexagon::A2_combineii:
4400 case Hexagon::A4_combineii:
4401 case Hexagon::dup_A2_combineii:
4402 case Hexagon::dup_A4_combineii:
4404 DstReg =
MI.getOperand(0).getReg();
4406 ((
MI.getOperand(1).isImm() &&
isUInt<2>(
MI.getOperand(1).getImm())) ||
4407 (
MI.getOperand(1).isGlobal() &&
4409 ((
MI.getOperand(2).isImm() &&
isUInt<2>(
MI.getOperand(2).getImm())) ||
4410 (
MI.getOperand(2).isGlobal() &&
4414 case Hexagon::A4_combineri:
4415 case Hexagon::dup_A4_combineri:
4418 DstReg =
MI.getOperand(0).getReg();
4419 SrcReg =
MI.getOperand(1).getReg();
4421 ((
MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0) ||
4422 (
MI.getOperand(2).isGlobal() &&
MI.getOperand(2).getOffset() == 0)))
4425 case Hexagon::A4_combineir:
4426 case Hexagon::dup_A4_combineir:
4428 DstReg =
MI.getOperand(0).getReg();
4429 SrcReg =
MI.getOperand(2).getReg();
4431 ((
MI.getOperand(1).isImm() &&
MI.getOperand(1).getImm() == 0) ||
4432 (
MI.getOperand(1).isGlobal() &&
MI.getOperand(1).getOffset() == 0)))
4435 case Hexagon::A2_sxtb:
4436 case Hexagon::A2_sxth:
4437 case Hexagon::A2_zxtb:
4438 case Hexagon::A2_zxth:
4439 case Hexagon::dup_A2_sxtb:
4440 case Hexagon::dup_A2_sxth:
4441 case Hexagon::dup_A2_zxtb:
4442 case Hexagon::dup_A2_zxth:
4444 DstReg =
MI.getOperand(0).getReg();
4445 SrcReg =
MI.getOperand(1).getReg();
4461 if (
MI.isTransient())
4485 int Idx =
DefMI.findRegisterDefOperandIdx(SR, &HRI,
false,
false);
4496 int Idx =
UseMI.findRegisterUseOperandIdx(SR, &HRI,
false);
4530 : Hexagon::getTruePredOpcode(
Opc);
4531 if (InvPredOpcode >= 0)
4532 return InvPredOpcode;
4539 const uint64_t
F =
MI.getDesc().TSFlags;
4546 return ~(-1U << (bits - 1));
4548 return ~(-1U << bits);
4553 switch (
MI.getOpcode()) {
4554 case Hexagon::L2_loadrbgp:
4555 case Hexagon::L2_loadrdgp:
4556 case Hexagon::L2_loadrhgp:
4557 case Hexagon::L2_loadrigp:
4558 case Hexagon::L2_loadrubgp:
4559 case Hexagon::L2_loadruhgp:
4560 case Hexagon::S2_storerbgp:
4561 case Hexagon::S2_storerbnewgp:
4562 case Hexagon::S2_storerhgp:
4563 case Hexagon::S2_storerhnewgp:
4564 case Hexagon::S2_storerigp:
4565 case Hexagon::S2_storerinewgp:
4566 case Hexagon::S2_storerdgp:
4567 case Hexagon::S2_storerfgp:
4570 const uint64_t
F =
MI.getDesc().TSFlags;
4585 if (
MI.getOpcode() == Hexagon::A4_ext)
4593 const uint64_t
F =
MI.getDesc().TSFlags;
4599 bool ToBigInstrs)
const {
4611 MII->setDesc(
get(Opcode));
4617 bool ToBigInstrs)
const {
4620 End = MB.instr_end();
4621 Instr !=
End; ++Instr)
4629 while ((MII !=
MBB->instr_end()) && MII->isInsideBundle()) {
4638 const uint64_t
F =
MI.getDesc().TSFlags;
4639 unsigned S = (
F >> MemAccessSizePos) & MemAccesSizeMask;
4640 unsigned Size = getMemAccessSizeInBytes(MemAccessSize(S));
4644 if (
MI.getOpcode() == Hexagon::Y2_dcfetchbo)
4651 return HRI.getSpillSize(Hexagon::HvxVRRegClass);
4653 return HRI.getSpillSize(Hexagon::HlxLRRegClass);
4661 const uint64_t
F =
MI.getDesc().TSFlags;
4668 return -1U << (bits - 1);
4677 short NonExtOpcode = Hexagon::getRegForm(
MI.getOpcode());
4678 if (NonExtOpcode >= 0)
4679 return NonExtOpcode;
4681 if (
MI.getDesc().mayLoad() ||
MI.getDesc().mayStore()) {
4685 return Hexagon::changeAddrMode_abs_io(
MI.getOpcode());
4687 return Hexagon::changeAddrMode_io_rr(
MI.getOpcode());
4689 return Hexagon::changeAddrMode_ur_rr(
MI.getOpcode());
4699 Register &PredReg,
unsigned &PredRegPos,
4708 PredReg =
Cond[1].getReg();
4712 if (
Cond[1].isImplicit())
4720 return Hexagon::getRegForm(
MI.getOpcode());
4728 if (
MI.isDebugInstr() ||
MI.isPosition())
4731 unsigned Size =
MI.getDesc().getSize();
4747 unsigned NumDefs = 0;
4748 for (;
MI.getOperand(NumDefs).
isReg() &&
MI.getOperand(NumDefs).isDef();
4750 assert(NumDefs !=
MI.getNumOperands()-2 &&
"No asm string?");
4752 assert(
MI.getOperand(NumDefs).isSymbol() &&
"No asm string?");
4754 const char *AsmStr =
MI.getOperand(NumDefs).getSymbolName();
4762 const uint64_t
F =
MI.getDesc().TSFlags;
4768 const InstrStage &IS = *
II.beginStage(
MI.getDesc().getSchedClass());
4770 return IS.getUnits();
4780 assert(BundleHead->isBundle() &&
"Not a bundle header");
4790 "Instruction must be extendable");
4796 "Branch with unknown extendable field type");
4808 int TargetPos =
MI.getNumOperands() - 1;
4811 while ((TargetPos > -1) && !
MI.getOperand(TargetPos).isMBB())
4813 assert((TargetPos >= 0) &&
MI.getOperand(TargetPos).isMBB());
4814 MI.getOperand(TargetPos).setMBB(NewTarget);
4818 MI.setDesc(
get(NewOpcode));
4830 for (
unsigned insn = TargetOpcode::GENERIC_OP_END+1;
4831 insn < Hexagon::INSTRUCTION_LIST_END; ++insn) {
4852 int PredRevOpcode = -1;
4854 PredRevOpcode = Hexagon::notTakenBranchPrediction(Opcode);
4856 PredRevOpcode = Hexagon::takenBranchPrediction(Opcode);
4857 assert(PredRevOpcode > 0);
4858 return PredRevOpcode;
4864 return Cond.empty() || (
Cond[0].isImm() && (
Cond.size() != 1));
4871 if (Operand.
isImm())
4872 Operand.
setImm(Operand.
getImm() | memShufDisabledMask);
4880 return (Operand.
isImm() && (Operand.
getImm() & memShufDisabledMask) != 0);
4884 return (
MI->getOpcode() == Hexagon::V6_vmpy_qf16_hf ||
4885 MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
4886 MI->getOpcode() == Hexagon::V6_vmpy_qf32_hf ||
4887 MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
4888 MI->getOpcode() == Hexagon::V6_vmpy_qf32_sf ||
4889 MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
4890 MI->getOpcode() == Hexagon::V6_vmpy_qf16 ||
4891 MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
4892 MI->getOpcode() == Hexagon::V6_vmpy_qf32_qf16 ||
4893 MI->getOpcode() == Hexagon::V6_vmpy_qf32);
4914 case Hexagon::V6_vabs_qf16_hf:
4916 case Hexagon::V6_vabs_qf16_qf16:
4918 case Hexagon::V6_vabs_qf32_qf32:
4920 case Hexagon::V6_vabs_qf32_sf:
4922 case Hexagon::V6_vadd_hf:
4924 case Hexagon::V6_vadd_qf16:
4926 case Hexagon::V6_vadd_qf16_mix:
4928 case Hexagon::V6_vadd_qf32:
4930 case Hexagon::V6_vadd_qf32_mix:
4932 case Hexagon::V6_vadd_sf:
4934 case Hexagon::V6_vconv_bf_qf32:
4936 case Hexagon::V6_vconv_f8_qf16:
4938 case Hexagon::V6_vconv_hf_qf16:
4940 case Hexagon::V6_vconv_hf_qf32:
4942 case Hexagon::V6_vconv_qf16_f8:
4944 case Hexagon::V6_vconv_qf16_hf:
4946 case Hexagon::V6_vconv_qf16_qf16:
4948 case Hexagon::V6_vconv_qf32_qf32:
4950 case Hexagon::V6_vconv_qf32_sf:
4952 case Hexagon::V6_vconv_sf_qf32:
4954 case Hexagon::V6_vilog2_qf16:
4956 case Hexagon::V6_vilog2_qf32:
4958 case Hexagon::V6_vmpy_qf16:
4960 case Hexagon::V6_vmpy_qf16_hf:
4962 case Hexagon::V6_vmpy_qf16_mix_hf:
4964 case Hexagon::V6_vmpy_qf32:
4966 case Hexagon::V6_vmpy_qf32_hf:
4968 case Hexagon::V6_vmpy_qf32_mix_hf:
4970 case Hexagon::V6_vmpy_qf32_qf16:
4972 case Hexagon::V6_vmpy_qf32_sf:
4974 case Hexagon::V6_vmpy_rt_hf:
4976 case Hexagon::V6_vmpy_rt_qf16:
4978 case Hexagon::V6_vmpy_rt_sf:
4980 case Hexagon::V6_vneg_qf16_hf:
4982 case Hexagon::V6_vneg_qf16_qf16:
4984 case Hexagon::V6_vneg_qf32_qf32:
4986 case Hexagon::V6_vneg_qf32_sf:
4988 case Hexagon::V6_vsub_hf:
4990 case Hexagon::V6_vsub_qf16:
4992 case Hexagon::V6_vsub_qf16_mix:
4994 case Hexagon::V6_vsub_qf32:
4996 case Hexagon::V6_vsub_qf32_mix:
4998 case Hexagon::V6_vsub_sf:
5000 case Hexagon::V6_vsub_sf_mix:
5002 case Hexagon::V6_vsub_hf_mix:
5075 if (!
A || !
B ||
A->getParent() !=
B->getParent())
5094 if (MO.isReg() && MO.getReg().isValid() &&
5095 (Between.isCall() || Between.modifiesRegister(MO.getReg(),
TRI)))
5112 if (
MI.isDebugValue() && !
MI.isDebugEntryValue() &&
5113 MI.readsRegister(DefReg,
TRI) &&
5130 MBB.insert(FinalPos, MF.CloneMachineInstr(
MI));
5132 if (!
MI->isDebugEntryValue() &&
MI->readsRegister(DefReg,
TRI))
5133 MI->setDebugValueUndef();
5138 return Opc >= 0 ? Hexagon::changeAddrMode_abs_io(
Opc) :
Opc;
5142 return Opc >= 0 ? Hexagon::changeAddrMode_io_abs(
Opc) :
Opc;
5146 return Opc >= 0 ? Hexagon::changeAddrMode_io_pi(
Opc) :
Opc;
5150 return Opc >= 0 ? Hexagon::changeAddrMode_io_rr(
Opc) :
Opc;
5154 return Opc >= 0 ? Hexagon::changeAddrMode_pi_io(
Opc) :
Opc;
5158 return Opc >= 0 ? Hexagon::changeAddrMode_rr_io(
Opc) :
Opc;
5162 return Opc >= 0 ? Hexagon::changeAddrMode_rr_ur(
Opc) :
Opc;
5166 return Opc >= 0 ? Hexagon::changeAddrMode_ur_rr(
Opc) :
Opc;
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< 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 void parseOperands(MachineInstr *MI, SmallVector< unsigned, 4 > &Defs, SmallVector< unsigned, 8 > &Uses)
Gather register def/uses from 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"))
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.
const size_t AbstractManglingParser< Derived, Alloc >::NumOps
This file implements the LivePhysRegs utility for tracking liveness of physical registers.
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)
SmallVector< MachineOperand, 4 > Cond
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.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
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 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...
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 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.
bool isAddrModeWithOffset(const MachineInstr &MI) 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.
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.
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 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
unsigned getInlineAsmLength(const char *Str, const MCAsmInfo &MAI, const TargetSubtargetInfo *STI=nullptr) const override
Measure the specified inline asm to determine an approximation of its length.
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
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
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
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 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
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)
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...
virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI=nullptr) 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.
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 bool hasUnmodeledSideEffects() const
Return true if this instruction has side effects that are not modeled by mayLoad / mayStore,...
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.
@ MOVolatile
The memory access is volatile.
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
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 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,...
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,...
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.
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.
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.