67#define DEBUG_TYPE "hexagon-instrinfo"
69#define GET_INSTRINFO_CTOR_DTOR
70#define GET_INSTRMAP_INFO
72#include "HexagonGenDFAPacketizer.inc"
73#include "HexagonGenInstrInfo.inc"
77 "packetization boundary."));
84 cl::desc(
"Disable schedule adjustment for new value stores."));
88 cl::desc(
"Enable timing class latency"));
92 cl::desc(
"Enable vec alu forwarding"));
96 cl::desc(
"Enable vec acc forwarding"));
104 cl::desc(
"Use the DFA based hazard recognizer."));
119void HexagonInstrInfo::anchor() {}
124 RegInfo(ST.getHwMode()), Subtarget(ST) {}
133 return (
Reg >= Hexagon::R0 &&
Reg <= Hexagon::R7) ||
134 (
Reg >= Hexagon::R16 &&
Reg <= Hexagon::R23);
146 for (; MIB != MIE; ++MIB) {
147 if (!MIB->isDebugInstr())
158 if (!(
MI.getMF()->getFunction().hasOptSize()))
159 return MI.isAsCheapAsAMove();
161 if (
MI.getOpcode() == Hexagon::A2_tfrsi) {
162 auto Op =
MI.getOperand(1);
170 int64_t
Imm =
Op.getImm();
175 return MI.isAsCheapAsAMove();
190 if (
isFloat(
MI) &&
MI.hasRegisterImplicitUseOperand(Hexagon::USR))
204 if (EndLoopOp == Hexagon::ENDLOOP0) {
205 LOOPi = Hexagon::J2_loop0i;
206 LOOPr = Hexagon::J2_loop0r;
208 LOOPi = Hexagon::J2_loop1i;
209 LOOPr = Hexagon::J2_loop1r;
220 unsigned Opc =
I.getOpcode();
221 if (
Opc == LOOPi ||
Opc == LOOPr)
225 if (
Opc == EndLoopOp &&
I.getOperand(0).getMBB() != TargetBB)
252 Uses.push_back(MO.getReg());
291 int &FrameIndex)
const {
292 switch (
MI.getOpcode()) {
295 case Hexagon::L2_loadri_io:
296 case Hexagon::L2_loadrd_io:
297 case Hexagon::V6_vL32b_ai:
298 case Hexagon::V6_vL32b_nt_ai:
299 case Hexagon::V6_vL32Ub_ai:
300 case Hexagon::LDriw_pred:
301 case Hexagon::LDriw_ctr:
302 case Hexagon::PS_vloadrq_ai:
303 case Hexagon::PS_vloadrw_ai:
304 case Hexagon::PS_vloadrw_nt_ai:
305 case Hexagon::PS_loadrl:
306 case Hexagon::PS_loadrll: {
314 return MI.getOperand(0).getReg();
317 case Hexagon::L2_ploadrit_io:
318 case Hexagon::L2_ploadrif_io:
319 case Hexagon::L2_ploadrdt_io:
320 case Hexagon::L2_ploadrdf_io: {
328 return MI.getOperand(0).getReg();
341 int &FrameIndex)
const {
342 switch (
MI.getOpcode()) {
345 case Hexagon::S2_storerb_io:
346 case Hexagon::S2_storerh_io:
347 case Hexagon::S2_storeri_io:
348 case Hexagon::S2_storerd_io:
349 case Hexagon::V6_vS32b_ai:
350 case Hexagon::V6_vS32Ub_ai:
351 case Hexagon::STriw_pred:
352 case Hexagon::STriw_ctr:
353 case Hexagon::PS_vstorerq_ai:
354 case Hexagon::PS_vstorerw_ai:
355 case Hexagon::PS_storerl:
356 case Hexagon::PS_storerll: {
364 return MI.getOperand(2).getReg();
367 case Hexagon::S2_pstorerbt_io:
368 case Hexagon::S2_pstorerbf_io:
369 case Hexagon::S2_pstorerht_io:
370 case Hexagon::S2_pstorerhf_io:
371 case Hexagon::S2_pstorerit_io:
372 case Hexagon::S2_pstorerif_io:
373 case Hexagon::S2_pstorerdt_io:
374 case Hexagon::S2_pstorerdf_io: {
382 return MI.getOperand(3).getReg();
398 for (++MII; MII !=
MBB->instr_end() && MII->isInsideBundle(); ++MII)
416 for (++MII; MII !=
MBB->instr_end() && MII->isInsideBundle(); ++MII)
444 bool AllowModify)
const {
451 if (
I ==
MBB.instr_begin())
471 }
while (
I !=
MBB.instr_begin());
476 while (
I->isDebugInstr()) {
477 if (
I ==
MBB.instr_begin())
482 bool JumpToBlock =
I->getOpcode() == Hexagon::J2_jump &&
483 I->getOperand(0).isMBB();
485 if (AllowModify && JumpToBlock &&
486 MBB.isLayoutSuccessor(
I->getOperand(0).getMBB())) {
488 I->eraseFromParent();
490 if (
I ==
MBB.instr_begin())
494 if (!isUnpredicatedTerminator(*
I))
502 if (&*
I != LastInst && !
I->isBundle() && isUnpredicatedTerminator(*
I)) {
504 SecondLastInst = &*
I;
509 if (
I ==
MBB.instr_begin())
515 int SecLastOpcode = SecondLastInst ? SecondLastInst->
getOpcode() : 0;
518 if (LastOpcode == Hexagon::J2_jump && !LastInst->
getOperand(0).
isMBB())
520 if (SecLastOpcode == Hexagon::J2_jump &&
531 if (LastInst && !SecondLastInst) {
532 if (LastOpcode == Hexagon::J2_jump) {
542 if (LastOpcodeHasJMP_c) {
557 <<
" with one jump\n";);
564 if (SecLastOpcodeHasJMP_c && (LastOpcode == Hexagon::J2_jump)) {
575 if (SecLastOpcodeHasNVJump &&
577 (LastOpcode == Hexagon::J2_jump)) {
588 if (SecLastOpcode == Hexagon::J2_jump && LastOpcode == Hexagon::J2_jump) {
592 I->eraseFromParent();
597 if (
isEndLoopN(SecLastOpcode) && LastOpcode == Hexagon::J2_jump) {
605 <<
" with two jumps";);
611 int *BytesRemoved)
const {
612 assert(!BytesRemoved &&
"code size not handled");
617 while (
I !=
MBB.begin()) {
619 if (
I->isDebugInstr())
624 if (
Count && (
I->getOpcode() == Hexagon::J2_jump))
638 int *BytesAdded)
const {
639 unsigned BOpc = Hexagon::J2_jump;
640 unsigned BccOpc = Hexagon::J2_jumpt;
642 assert(
TBB &&
"insertBranch must not be told to insert a fallthrough");
643 assert(!BytesAdded &&
"code size not handled");
648 if (!
Cond.empty() &&
Cond[0].isImm())
649 BccOpc =
Cond[0].getImm();
659 auto Term =
MBB.getFirstTerminator();
669 int EndLoopOp =
Cond[0].getImm();
676 assert(
Loop !=
nullptr &&
"Inserting an ENDLOOP without a LOOP");
677 Loop->getOperand(0).setMBB(
TBB);
681 assert((
Cond.size() == 3) &&
"Only supporting rr/ri version of nvjump");
692 }
else if(
Cond[2].isImm()) {
698 assert((
Cond.size() == 2) &&
"Malformed cond vector");
706 "Cond. cannot be empty when multiple branchings are required");
708 "NV-jump cannot be inserted with another branch");
711 int EndLoopOp =
Cond[0].getImm();
718 assert(
Loop !=
nullptr &&
"Inserting an ENDLOOP without a LOOP");
719 Loop->getOperand(0).setMBB(
TBB);
748 TripCount =
Loop->getOpcode() == Hexagon::J2_loop0r
750 :
Loop->getOperand(1).getImm();
752 LoopCount =
Loop->getOperand(1).getReg();
755 bool shouldIgnoreForPipelining(
const MachineInstr *
MI)
const override {
757 return MI == EndLoop ||
TII->isHMXActivateInstr(*
MI) ||
758 TII->isHMXWeightInstr(*
MI);
761 std::optional<bool> createTripCountGreaterCondition(
762 int TC, MachineBasicBlock &
MBB,
763 SmallVectorImpl<MachineOperand> &
Cond)
override {
764 if (TripCount == -1) {
768 TII->get(Hexagon::C2_cmpgtui),
Done)
776 return TripCount > TC;
779 void setPreheader(MachineBasicBlock *NewPreheader)
override {
784 void adjustTripCount(
int TripCountAdjust)
override {
787 if (
Loop->getOpcode() == Hexagon::J2_loop0i ||
788 Loop->getOpcode() == Hexagon::J2_loop1i) {
789 int64_t TripCount =
Loop->getOperand(1).getImm() + TripCountAdjust;
790 assert(TripCount > 0 &&
"Can't create an empty or negative loop!");
791 Loop->getOperand(1).setImm(TripCount);
800 TII->get(Hexagon::A2_addi), NewLoopCount)
806 void disposed(LiveIntervals *LIS)
override {
809 Loop->eraseFromParent();
814std::unique_ptr<TargetInstrInfo::PipelinerLoopInfo>
822 LoopBB,
I->getOpcode(),
I->getOperand(0).getMBB(), VisitedBBs);
824 return std::make_unique<HexagonPipelinerLoopInfo>(LoopInst, &*
I);
830 unsigned NumCycles,
unsigned ExtraPredCycles,
844 return NumInstrs <= 4;
852 for (
auto I =
B.begin();
I !=
E; ++
I) {
862 for (
auto I =
B.rbegin();
I !=
E; ++
I)
871 bool RenamableSrc)
const {
875 if (Hexagon::IntRegsRegClass.
contains(SrcReg, DestReg)) {
877 .
addReg(SrcReg, KillFlag);
880 if (Hexagon::DoubleRegsRegClass.
contains(SrcReg, DestReg)) {
882 .
addReg(SrcReg, KillFlag);
885 if (Hexagon::PredRegsRegClass.
contains(SrcReg, DestReg)) {
891 if (Hexagon::CtrRegsRegClass.
contains(DestReg) &&
892 Hexagon::IntRegsRegClass.
contains(SrcReg)) {
894 .
addReg(SrcReg, KillFlag);
897 if (Hexagon::IntRegsRegClass.
contains(DestReg) &&
898 Hexagon::CtrRegsRegClass.
contains(SrcReg)) {
900 .
addReg(SrcReg, KillFlag);
903 if (Hexagon::ModRegsRegClass.
contains(DestReg) &&
904 Hexagon::IntRegsRegClass.
contains(SrcReg)) {
906 .
addReg(SrcReg, KillFlag);
909 if (Hexagon::PredRegsRegClass.
contains(SrcReg) &&
910 Hexagon::IntRegsRegClass.
contains(DestReg)) {
912 .
addReg(SrcReg, KillFlag);
915 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
916 Hexagon::PredRegsRegClass.
contains(DestReg)) {
918 .
addReg(SrcReg, KillFlag);
921 if (Hexagon::PredRegsRegClass.
contains(SrcReg) &&
922 Hexagon::IntRegsRegClass.
contains(DestReg)) {
924 .
addReg(SrcReg, KillFlag);
927 if (Hexagon::HvxVRRegClass.
contains(SrcReg, DestReg)) {
929 addReg(SrcReg, KillFlag);
932 if (Hexagon::HvxWRRegClass.
contains(SrcReg, DestReg)) {
935 Register SrcLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
936 Register SrcHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
940 .
addReg(SrcHi, KillFlag | UndefHi)
941 .
addReg(SrcLo, KillFlag | UndefLo);
944 if (Hexagon::HvxQRRegClass.
contains(SrcReg, DestReg)) {
947 .
addReg(SrcReg, KillFlag);
950 if (Hexagon::HvxQRRegClass.
contains(SrcReg) &&
951 Hexagon::HvxVRRegClass.
contains(DestReg)) {
955 if (Hexagon::HvxQRRegClass.
contains(DestReg) &&
956 Hexagon::HvxVRRegClass.
contains(SrcReg)) {
960 if (Hexagon::HlxLRRegClass.
contains(SrcReg, DestReg)) {
962 .
addReg(SrcReg, KillFlag);
965 if (Hexagon::HlxLLRRegClass.
contains(SrcReg, DestReg)) {
967 .
addReg(SrcReg, KillFlag);
981 Register SrcReg,
bool isKill,
int FI,
993 if (HMFI.isVTCMStackIndex(FI)) {
994 MFIIndex = HMFI.getMappedVTCMObjectIndex(FI);
995 MMFI = &HMFI.getVTCMFrameInfo();
1001 if (Hexagon::IntRegsRegClass.hasSubClassEq(RC)) {
1005 }
else if (Hexagon::DoubleRegsRegClass.hasSubClassEq(RC)) {
1009 }
else if (Hexagon::PredRegsRegClass.hasSubClassEq(RC)) {
1013 }
else if (Hexagon::ModRegsRegClass.hasSubClassEq(RC)) {
1017 }
else if (Hexagon::CircRegsRegClass.hasSubClassEq(RC)) {
1020 .
addReg(SrcReg, KillFlag)
1022 }
else if (Hexagon::HvxQRRegClass.hasSubClassEq(RC)) {
1026 }
else if (Hexagon::HvxVRRegClass.hasSubClassEq(RC)) {
1030 }
else if (Hexagon::HvxWRRegClass.hasSubClassEq(RC)) {
1034 }
else if (Hexagon::HlxLRRegClass.hasSubClassEq(RC)) {
1038 .
addReg(SrcReg, KillFlag)
1040 }
else if (Hexagon::HlxLLRRegClass.hasSubClassEq(RC)) {
1044 .
addReg(SrcReg, KillFlag)
1064 if (HMFI.isVTCMStackIndex(FI)) {
1065 MFIIndex = HMFI.getMappedVTCMObjectIndex(FI);
1066 MMFI = &HMFI.getVTCMFrameInfo();
1072 if (Hexagon::IntRegsRegClass.hasSubClassEq(RC)) {
1075 }
else if (Hexagon::DoubleRegsRegClass.hasSubClassEq(RC)) {
1078 }
else if (Hexagon::PredRegsRegClass.hasSubClassEq(RC)) {
1081 }
else if (Hexagon::ModRegsRegClass.hasSubClassEq(RC)) {
1084 }
else if (Hexagon::CircRegsRegClass.hasSubClassEq(RC)) {
1088 }
else if (Hexagon::HvxQRRegClass.hasSubClassEq(RC)) {
1091 }
else if (Hexagon::HvxVRRegClass.hasSubClassEq(RC)) {
1094 }
else if (Hexagon::HvxWRRegClass.hasSubClassEq(RC)) {
1097 }
else if (Hexagon::HlxLRRegClass.hasSubClassEq(RC)) {
1102 }
else if (Hexagon::HlxLLRRegClass.hasSubClassEq(RC)) {
1125 unsigned Opc =
MI.getOpcode();
1127 auto RealCirc = [&](
unsigned Opc,
bool HasImm,
unsigned MxOp) {
1128 Register M_CSx =
MI.getOperand(MxOp).getReg();
1129 Register Mx = HRI.getSubReg(M_CSx, Hexagon::isub_hi);
1130 unsigned CSOp = HasImm ? 5 : 4;
1132 for (
unsigned i = 0; i != CSOp; ++i)
1136 MIB.add(
MI.getOperand(i));
1137 Register CSx = (M_CSx == Hexagon::CS_M0 ? Hexagon::CS0 : Hexagon::CS1);
1144 if (
MI.memoperands().empty())
1147 return MMO->getAlign() >= NeedAlign;
1152 case Hexagon::PS_call_instrprof_custom: {
1153 auto Op0 =
MI.getOperand(0);
1155 "First operand must be a global containing handler name.");
1159 StringRef NameStr = Arr->isCString() ? Arr->getAsCString() : Arr->getAsString();
1185 MIB.addExternalSymbol(cstr);
1189 case TargetOpcode::COPY: {
1195 std::prev(
MBBI)->copyImplicitOps(*
MBB.getParent(),
MI);
1200 case Hexagon::PS_aligna:
1203 .
addImm(-
MI.getOperand(1).getImm());
1206 case Hexagon::V6_vassignp: {
1209 Register SrcLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
1210 Register SrcHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
1221 case Hexagon::V6_lo:
1222 case Hexagon::LX_lo: {
1225 Register SrcSubLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
1230 case Hexagon::V6_hi:
1231 case Hexagon::LX_hi: {
1234 Register SrcSubHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
1239 case Hexagon::PS_vloadrv_ai: {
1243 int Offset =
MI.getOperand(2).getImm();
1244 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1245 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vL32b_ai
1246 : Hexagon::V6_vL32Ub_ai;
1254 case Hexagon::PS_loadrl: {
1258 int Offset =
MI.getOperand(2).getImm();
1270 case Hexagon::PS_vloadrw_ai: {
1274 int Offset =
MI.getOperand(2).getImm();
1275 unsigned VecOffset = HRI.getSpillSize(Hexagon::HvxVRRegClass);
1276 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1277 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vL32b_ai
1278 : Hexagon::V6_vL32Ub_ai;
1280 HRI.getSubReg(DstReg, Hexagon::vsub_lo))
1285 HRI.getSubReg(DstReg, Hexagon::vsub_hi))
1292 case Hexagon::PS_vstorerv_ai: {
1297 int Offset =
MI.getOperand(1).getImm();
1298 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1299 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vS32b_ai
1300 : Hexagon::V6_vS32Ub_ai;
1309 case Hexagon::PS_storerl: {
1315 int Offset =
MI.getOperand(1).getImm();
1327 case Hexagon::PS_vstorerw_ai: {
1331 int Offset =
MI.getOperand(1).getImm();
1332 unsigned VecOffset = HRI.getSpillSize(Hexagon::HvxVRRegClass);
1333 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1334 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vS32b_ai
1335 : Hexagon::V6_vS32Ub_ai;
1339 .
addReg(HRI.getSubReg(SrcReg, Hexagon::vsub_lo))
1344 .
addReg(HRI.getSubReg(SrcReg, Hexagon::vsub_hi))
1349 case Hexagon::PS_true: {
1357 case Hexagon::PS_false: {
1365 case Hexagon::PS_qtrue: {
1372 case Hexagon::PS_qfalse: {
1379 case Hexagon::PS_vdd0: {
1387 case Hexagon::PS_vmulw: {
1390 Register Src1Reg =
MI.getOperand(1).getReg();
1391 Register Src2Reg =
MI.getOperand(2).getReg();
1392 Register Src1SubHi = HRI.getSubReg(Src1Reg, Hexagon::isub_hi);
1393 Register Src1SubLo = HRI.getSubReg(Src1Reg, Hexagon::isub_lo);
1394 Register Src2SubHi = HRI.getSubReg(Src2Reg, Hexagon::isub_hi);
1395 Register Src2SubLo = HRI.getSubReg(Src2Reg, Hexagon::isub_lo);
1397 HRI.getSubReg(DstReg, Hexagon::isub_hi))
1401 HRI.getSubReg(DstReg, Hexagon::isub_lo))
1407 case Hexagon::PS_vmulw_acc: {
1410 Register Src1Reg =
MI.getOperand(1).getReg();
1411 Register Src2Reg =
MI.getOperand(2).getReg();
1412 Register Src3Reg =
MI.getOperand(3).getReg();
1413 Register Src1SubHi = HRI.getSubReg(Src1Reg, Hexagon::isub_hi);
1414 Register Src1SubLo = HRI.getSubReg(Src1Reg, Hexagon::isub_lo);
1415 Register Src2SubHi = HRI.getSubReg(Src2Reg, Hexagon::isub_hi);
1416 Register Src2SubLo = HRI.getSubReg(Src2Reg, Hexagon::isub_lo);
1417 Register Src3SubHi = HRI.getSubReg(Src3Reg, Hexagon::isub_hi);
1418 Register Src3SubLo = HRI.getSubReg(Src3Reg, Hexagon::isub_lo);
1420 HRI.getSubReg(DstReg, Hexagon::isub_hi))
1425 HRI.getSubReg(DstReg, Hexagon::isub_lo))
1432 case Hexagon::PS_pselect: {
1456 case Hexagon::PS_vselect: {
1489 case Hexagon::PS_wselect: {
1529 case Hexagon::PS_crash: {
1545 void printCustom(
raw_ostream &OS)
const override {
1546 OS <<
"MisalignedCrash";
1550 static const CrashPseudoSourceValue CrashPSV(MF.
getTarget());
1562 case Hexagon::PS_tailcall_i:
1563 MI.setDesc(
get(Hexagon::J2_jump));
1565 case Hexagon::PS_tailcall_r:
1566 case Hexagon::PS_jmpret:
1567 MI.setDesc(
get(Hexagon::J2_jumpr));
1569 case Hexagon::PS_jmprett:
1570 MI.setDesc(
get(Hexagon::J2_jumprt));
1572 case Hexagon::PS_jmpretf:
1573 MI.setDesc(
get(Hexagon::J2_jumprf));
1575 case Hexagon::PS_jmprettnewpt:
1576 MI.setDesc(
get(Hexagon::J2_jumprtnewpt));
1578 case Hexagon::PS_jmpretfnewpt:
1579 MI.setDesc(
get(Hexagon::J2_jumprfnewpt));
1581 case Hexagon::PS_jmprettnew:
1582 MI.setDesc(
get(Hexagon::J2_jumprtnew));
1584 case Hexagon::PS_jmpretfnew:
1585 MI.setDesc(
get(Hexagon::J2_jumprfnew));
1588 case Hexagon::PS_loadrub_pci:
1589 return RealCirc(Hexagon::L2_loadrub_pci,
true, 4);
1590 case Hexagon::PS_loadrb_pci:
1591 return RealCirc(Hexagon::L2_loadrb_pci,
true, 4);
1592 case Hexagon::PS_loadruh_pci:
1593 return RealCirc(Hexagon::L2_loadruh_pci,
true, 4);
1594 case Hexagon::PS_loadrh_pci:
1595 return RealCirc(Hexagon::L2_loadrh_pci,
true, 4);
1596 case Hexagon::PS_loadri_pci:
1597 return RealCirc(Hexagon::L2_loadri_pci,
true, 4);
1598 case Hexagon::PS_loadrd_pci:
1599 return RealCirc(Hexagon::L2_loadrd_pci,
true, 4);
1600 case Hexagon::PS_loadrub_pcr:
1601 return RealCirc(Hexagon::L2_loadrub_pcr,
false, 3);
1602 case Hexagon::PS_loadrb_pcr:
1603 return RealCirc(Hexagon::L2_loadrb_pcr,
false, 3);
1604 case Hexagon::PS_loadruh_pcr:
1605 return RealCirc(Hexagon::L2_loadruh_pcr,
false, 3);
1606 case Hexagon::PS_loadrh_pcr:
1607 return RealCirc(Hexagon::L2_loadrh_pcr,
false, 3);
1608 case Hexagon::PS_loadri_pcr:
1609 return RealCirc(Hexagon::L2_loadri_pcr,
false, 3);
1610 case Hexagon::PS_loadrd_pcr:
1611 return RealCirc(Hexagon::L2_loadrd_pcr,
false, 3);
1612 case Hexagon::PS_storerb_pci:
1613 return RealCirc(Hexagon::S2_storerb_pci,
true, 3);
1614 case Hexagon::PS_storerh_pci:
1615 return RealCirc(Hexagon::S2_storerh_pci,
true, 3);
1616 case Hexagon::PS_storerf_pci:
1617 return RealCirc(Hexagon::S2_storerf_pci,
true, 3);
1618 case Hexagon::PS_storeri_pci:
1619 return RealCirc(Hexagon::S2_storeri_pci,
true, 3);
1620 case Hexagon::PS_storerd_pci:
1621 return RealCirc(Hexagon::S2_storerd_pci,
true, 3);
1622 case Hexagon::PS_storerb_pcr:
1623 return RealCirc(Hexagon::S2_storerb_pcr,
false, 2);
1624 case Hexagon::PS_storerh_pcr:
1625 return RealCirc(Hexagon::S2_storerh_pcr,
false, 2);
1626 case Hexagon::PS_storerf_pcr:
1627 return RealCirc(Hexagon::S2_storerf_pcr,
false, 2);
1628 case Hexagon::PS_storeri_pcr:
1629 return RealCirc(Hexagon::S2_storeri_pcr,
false, 2);
1630 case Hexagon::PS_storerd_pcr:
1631 return RealCirc(Hexagon::S2_storerd_pcr,
false, 2);
1641 unsigned Opc =
MI.getOpcode();
1645 case Hexagon::V6_vgather_vscatter_mh_pseudo:
1648 .
add(
MI.getOperand(2))
1649 .
add(
MI.getOperand(3))
1650 .
add(
MI.getOperand(4));
1652 .
add(
MI.getOperand(2))
1653 .
add(
MI.getOperand(3))
1654 .
add(
MI.getOperand(4))
1657 return First.getInstrIterator();
1658 case Hexagon::V6_vgathermh_pseudo:
1660 .
add(
MI.getOperand(2))
1661 .
add(
MI.getOperand(3))
1662 .
add(
MI.getOperand(4));
1664 .
add(
MI.getOperand(0))
1668 return First.getInstrIterator();
1670 case Hexagon::V6_vgathermw_pseudo:
1672 .
add(
MI.getOperand(2))
1673 .
add(
MI.getOperand(3))
1674 .
add(
MI.getOperand(4));
1676 .
add(
MI.getOperand(0))
1680 return First.getInstrIterator();
1682 case Hexagon::V6_vgathermhw_pseudo:
1684 .
add(
MI.getOperand(2))
1685 .
add(
MI.getOperand(3))
1686 .
add(
MI.getOperand(4));
1688 .
add(
MI.getOperand(0))
1692 return First.getInstrIterator();
1694 case Hexagon::V6_vgathermhq_pseudo:
1696 .
add(
MI.getOperand(2))
1697 .
add(
MI.getOperand(3))
1698 .
add(
MI.getOperand(4))
1699 .
add(
MI.getOperand(5));
1701 .
add(
MI.getOperand(0))
1705 return First.getInstrIterator();
1707 case Hexagon::V6_vgathermwq_pseudo:
1709 .
add(
MI.getOperand(2))
1710 .
add(
MI.getOperand(3))
1711 .
add(
MI.getOperand(4))
1712 .
add(
MI.getOperand(5));
1714 .
add(
MI.getOperand(0))
1718 return First.getInstrIterator();
1720 case Hexagon::V6_vgathermhwq_pseudo:
1722 .
add(
MI.getOperand(2))
1723 .
add(
MI.getOperand(3))
1724 .
add(
MI.getOperand(4))
1725 .
add(
MI.getOperand(5));
1727 .
add(
MI.getOperand(0))
1731 return First.getInstrIterator();
1734 return MI.getIterator();
1743 assert(
Cond[0].isImm() &&
"First entry in the cond vector not imm-val");
1744 unsigned opcode =
Cond[0].getImm();
1750 Cond[0].setImm(NewOpcode);
1765 unsigned BasePos, OffsetPos;
1780 const uint64_t
F =
MI.getDesc().TSFlags;
1791 int Opc =
MI.getOpcode();
1804 unsigned NOp = 0,
NumOps =
MI.getNumOperands();
1807 if (!
Op.isReg() || !
Op.isDef() ||
Op.isImplicit())
1814 unsigned PredRegPos;
1816 bool GotPredReg =
getPredReg(
Cond, PredReg, PredRegPos, PredRegFlags);
1819 T.addReg(PredReg, PredRegFlags);
1821 T.add(
MI.getOperand(NOp++));
1823 MI.setDesc(
get(PredOpc));
1824 while (
unsigned n =
MI.getNumOperands())
1825 MI.removeOperand(n-1);
1826 for (
unsigned i = 0, n =
T->getNumOperands(); i < n; ++i)
1827 MI.addOperand(
T->getOperand(i));
1833 MRI.clearKillFlags(PredReg);
1844 std::vector<MachineOperand> &Pred,
1845 bool SkipDead)
const {
1853 if (RC == &Hexagon::PredRegsRegClass) {
1858 }
else if (MO.isRegMask()) {
1859 for (
Register PR : Hexagon::PredRegsRegClass) {
1860 if (!
MI.modifiesRegister(PR, &HRI))
1871 if (!
MI.getDesc().isPredicable())
1875 if (!Subtarget.usePredicatedCalls())
1880 if (!Subtarget.hasV62Ops()) {
1881 switch (
MI.getOpcode()) {
1882 case Hexagon::V6_vL32b_ai:
1883 case Hexagon::V6_vL32b_pi:
1884 case Hexagon::V6_vL32b_ppu:
1885 case Hexagon::V6_vL32b_cur_ai:
1886 case Hexagon::V6_vL32b_cur_pi:
1887 case Hexagon::V6_vL32b_cur_ppu:
1888 case Hexagon::V6_vL32b_nt_ai:
1889 case Hexagon::V6_vL32b_nt_pi:
1890 case Hexagon::V6_vL32b_nt_ppu:
1891 case Hexagon::V6_vL32b_tmp_ai:
1892 case Hexagon::V6_vL32b_tmp_pi:
1893 case Hexagon::V6_vL32b_tmp_ppu:
1894 case Hexagon::V6_vL32b_nt_cur_ai:
1895 case Hexagon::V6_vL32b_nt_cur_pi:
1896 case Hexagon::V6_vL32b_nt_cur_ppu:
1897 case Hexagon::V6_vL32b_nt_tmp_ai:
1898 case Hexagon::V6_vL32b_nt_tmp_pi:
1899 case Hexagon::V6_vL32b_nt_tmp_ppu:
1907 bool Invert)
const {
1913 case Hexagon::F2_sfadd:
1929 if (
MI.isDebugInstr())
1939 for (
auto *
I :
MBB->successors())
1945 if (
MI.getDesc().isTerminator() ||
MI.isPosition())
1949 if (
MI.getOpcode() == TargetOpcode::INLINEASM_BR)
1973 bool atInsnStart =
true;
1976 for (; *Str; ++Str) {
1980 if (atInsnStart && !
isSpace(
static_cast<unsigned char>(*Str))) {
1982 atInsnStart =
false;
1986 atInsnStart =
false;
2009 int64_t &
Value)
const {
2010 unsigned Opc =
MI.getOpcode();
2014 case Hexagon::C2_cmpeq:
2015 case Hexagon::C2_cmpeqp:
2016 case Hexagon::C2_cmpgt:
2017 case Hexagon::C2_cmpgtp:
2018 case Hexagon::C2_cmpgtu:
2019 case Hexagon::C2_cmpgtup:
2020 case Hexagon::C4_cmpneq:
2021 case Hexagon::C4_cmplte:
2022 case Hexagon::C4_cmplteu:
2023 case Hexagon::C2_cmpeqi:
2024 case Hexagon::C2_cmpgti:
2025 case Hexagon::C2_cmpgtui:
2026 case Hexagon::C4_cmpneqi:
2027 case Hexagon::C4_cmplteui:
2028 case Hexagon::C4_cmpltei:
2029 SrcReg =
MI.getOperand(1).getReg();
2032 case Hexagon::A4_cmpbeq:
2033 case Hexagon::A4_cmpbgt:
2034 case Hexagon::A4_cmpbgtu:
2035 case Hexagon::A4_cmpbeqi:
2036 case Hexagon::A4_cmpbgti:
2037 case Hexagon::A4_cmpbgtui:
2038 SrcReg =
MI.getOperand(1).getReg();
2041 case Hexagon::A4_cmpheq:
2042 case Hexagon::A4_cmphgt:
2043 case Hexagon::A4_cmphgtu:
2044 case Hexagon::A4_cmpheqi:
2045 case Hexagon::A4_cmphgti:
2046 case Hexagon::A4_cmphgtui:
2047 SrcReg =
MI.getOperand(1).getReg();
2054 case Hexagon::C2_cmpeq:
2055 case Hexagon::C2_cmpeqp:
2056 case Hexagon::C2_cmpgt:
2057 case Hexagon::C2_cmpgtp:
2058 case Hexagon::C2_cmpgtu:
2059 case Hexagon::C2_cmpgtup:
2060 case Hexagon::A4_cmpbeq:
2061 case Hexagon::A4_cmpbgt:
2062 case Hexagon::A4_cmpbgtu:
2063 case Hexagon::A4_cmpheq:
2064 case Hexagon::A4_cmphgt:
2065 case Hexagon::A4_cmphgtu:
2066 case Hexagon::C4_cmpneq:
2067 case Hexagon::C4_cmplte:
2068 case Hexagon::C4_cmplteu:
2069 SrcReg2 =
MI.getOperand(2).getReg();
2073 case Hexagon::C2_cmpeqi:
2074 case Hexagon::C2_cmpgtui:
2075 case Hexagon::C2_cmpgti:
2076 case Hexagon::C4_cmpneqi:
2077 case Hexagon::C4_cmplteui:
2078 case Hexagon::C4_cmpltei:
2079 case Hexagon::A4_cmpbeqi:
2080 case Hexagon::A4_cmpbgti:
2081 case Hexagon::A4_cmpbgtui:
2082 case Hexagon::A4_cmpheqi:
2083 case Hexagon::A4_cmphgti:
2084 case Hexagon::A4_cmphgtui: {
2089 Value =
MI.getOperand(2).getImm();
2099 unsigned *PredCost)
const {
2125 unsigned BasePosA, OffsetPosA;
2133 unsigned BasePosB, OffsetPosB;
2140 if (BaseRegA != BaseRegB || BaseSubA != BaseSubB)
2158 if (OffsetA > OffsetB) {
2159 uint64_t OffDiff = (uint64_t)((int64_t)OffsetA - (int64_t)OffsetB);
2160 return SizeB <= OffDiff;
2162 if (OffsetA < OffsetB) {
2163 uint64_t OffDiff = (uint64_t)((int64_t)OffsetB - (int64_t)OffsetA);
2164 return SizeA <= OffDiff;
2173 if (!
MI ||
MI->memoperands_empty())
2176 if ((*
MI->memoperands_begin())->isVolatile() ||
MI->hasUnmodeledSideEffects())
2179 if (!(*
MI->memoperands_begin())->getValue())
2219 assert((MMOa->
getOffset() >= 0) &&
"Negative MachineMemOperand offset");
2220 assert((MMOb->
getOffset() >= 0) &&
"Negative MachineMemOperand offset");
2222 "Size 0 memory access");
2254 unsigned BasePos = 0, OffsetPos = 0;
2262 }
else if (
MI.getOpcode() == Hexagon::A2_addi) {
2264 if (AddOp.isImm()) {
2265 Value = AddOp.getImm();
2273std::pair<unsigned, unsigned>
2283 static const std::pair<unsigned, const char*> Flags[] = {
2284 {MO_PCREL,
"hexagon-pcrel"},
2285 {MO_GOT,
"hexagon-got"},
2286 {MO_LO16,
"hexagon-lo16"},
2287 {MO_HI16,
"hexagon-hi16"},
2288 {MO_GPREL,
"hexagon-gprel"},
2289 {MO_GDGOT,
"hexagon-gdgot"},
2290 {MO_GDPLT,
"hexagon-gdplt"},
2291 {MO_IE,
"hexagon-ie"},
2292 {MO_IEGOT,
"hexagon-iegot"},
2293 {MO_TPREL,
"hexagon-tprel"}
2302 static const std::pair<unsigned, const char*> Flags[] = {
2303 {HMOTF_ConstExtended,
"hexagon-ext"}
2311 if (VT == MVT::i1) {
2312 TRC = &Hexagon::PredRegsRegClass;
2313 }
else if (VT == MVT::i32 || VT == MVT::f32) {
2314 TRC = &Hexagon::IntRegsRegClass;
2315 }
else if (VT == MVT::i64 || VT == MVT::f64) {
2316 TRC = &Hexagon::DoubleRegsRegClass;
2330 const uint64_t
F =
MI.getDesc().TSFlags;
2340 !
MI.getDesc().mayStore() &&
2341 MI.getDesc().getOpcode() != Hexagon::S2_allocframe &&
2342 MI.getDesc().getOpcode() != Hexagon::L2_deallocframe &&
2354 const uint64_t
F =
MI.getDesc().TSFlags;
2387 assert(MO.
isImm() &&
"Extendable operand must be Immediate type");
2391 int32_t SValue =
Value;
2394 return SValue < MinValue || SValue > MaxValue;
2399 return UValue < MinValue || UValue > MaxValue;
2403 switch (
MI.getOpcode()) {
2404 case Hexagon::L4_return:
2405 case Hexagon::L4_return_t:
2406 case Hexagon::L4_return_f:
2407 case Hexagon::L4_return_tnew_pnt:
2408 case Hexagon::L4_return_fnew_pnt:
2409 case Hexagon::L4_return_tnew_pt:
2410 case Hexagon::L4_return_fnew_pt:
2431 for (
auto &RegA : DefsA)
2432 for (
auto &RegB : UsesB) {
2449 switch (
MI.getOpcode()) {
2450 case Hexagon::V6_vL32b_cur_pi:
2451 case Hexagon::V6_vL32b_cur_ai:
2489 return (Opcode == Hexagon::ENDLOOP0 ||
2490 Opcode == Hexagon::ENDLOOP1);
2515 switch (
MI.getOpcode()) {
2517 case Hexagon::PS_fi:
2518 case Hexagon::PS_fia:
2531 const uint64_t
F =
MI.getDesc().TSFlags;
2543 unsigned Opcode =
MI.getOpcode();
2544 const uint64_t
F =
get(Opcode).TSFlags;
2553 if (!
I.mayLoad() && !
I.mayStore())
2559 switch (
MI.getOpcode()) {
2560 case Hexagon::J2_callr:
2561 case Hexagon::J2_callrf:
2562 case Hexagon::J2_callrt:
2563 case Hexagon::PS_call_nr:
2570 switch (
MI.getOpcode()) {
2571 case Hexagon::L4_return:
2572 case Hexagon::L4_return_t:
2573 case Hexagon::L4_return_f:
2574 case Hexagon::L4_return_fnew_pnt:
2575 case Hexagon::L4_return_fnew_pt:
2576 case Hexagon::L4_return_tnew_pnt:
2577 case Hexagon::L4_return_tnew_pt:
2584 switch (
MI.getOpcode()) {
2585 case Hexagon::J2_jumpr:
2586 case Hexagon::J2_jumprt:
2587 case Hexagon::J2_jumprf:
2588 case Hexagon::J2_jumprtnewpt:
2589 case Hexagon::J2_jumprfnewpt:
2590 case Hexagon::J2_jumprtnew:
2591 case Hexagon::J2_jumprfnew:
2602 unsigned offset)
const {
2608 switch (
MI.getOpcode()) {
2612 case Hexagon::J2_jump:
2613 case Hexagon::J2_call:
2614 case Hexagon::PS_call_nr:
2616 case Hexagon::J2_jumpt:
2617 case Hexagon::J2_jumpf:
2618 case Hexagon::J2_jumptnew:
2619 case Hexagon::J2_jumptnewpt:
2620 case Hexagon::J2_jumpfnew:
2621 case Hexagon::J2_jumpfnewpt:
2622 case Hexagon::J2_callt:
2623 case Hexagon::J2_callf:
2625 case Hexagon::J2_loop0i:
2626 case Hexagon::J2_loop0iext:
2627 case Hexagon::J2_loop0r:
2628 case Hexagon::J2_loop0rext:
2629 case Hexagon::J2_loop1i:
2630 case Hexagon::J2_loop1iext:
2631 case Hexagon::J2_loop1r:
2632 case Hexagon::J2_loop1rext:
2635 case Hexagon::J4_cmpeqi_tp0_jump_nt:
2636 case Hexagon::J4_cmpeqi_tp1_jump_nt:
2637 case Hexagon::J4_cmpeqn1_tp0_jump_nt:
2638 case Hexagon::J4_cmpeqn1_tp1_jump_nt:
2650 unsigned Opcode =
MI.getOpcode();
2651 return Opcode == Hexagon::J2_loop0i ||
2652 Opcode == Hexagon::J2_loop0r ||
2653 Opcode == Hexagon::J2_loop0iext ||
2654 Opcode == Hexagon::J2_loop0rext ||
2655 Opcode == Hexagon::J2_loop1i ||
2656 Opcode == Hexagon::J2_loop1r ||
2657 Opcode == Hexagon::J2_loop1iext ||
2658 Opcode == Hexagon::J2_loop1rext;
2662 switch (
MI.getOpcode()) {
2663 default:
return false;
2664 case Hexagon::L4_iadd_memopw_io:
2665 case Hexagon::L4_isub_memopw_io:
2666 case Hexagon::L4_add_memopw_io:
2667 case Hexagon::L4_sub_memopw_io:
2668 case Hexagon::L4_and_memopw_io:
2669 case Hexagon::L4_or_memopw_io:
2670 case Hexagon::L4_iadd_memoph_io:
2671 case Hexagon::L4_isub_memoph_io:
2672 case Hexagon::L4_add_memoph_io:
2673 case Hexagon::L4_sub_memoph_io:
2674 case Hexagon::L4_and_memoph_io:
2675 case Hexagon::L4_or_memoph_io:
2676 case Hexagon::L4_iadd_memopb_io:
2677 case Hexagon::L4_isub_memopb_io:
2678 case Hexagon::L4_add_memopb_io:
2679 case Hexagon::L4_sub_memopb_io:
2680 case Hexagon::L4_and_memopb_io:
2681 case Hexagon::L4_or_memopb_io:
2682 case Hexagon::L4_ior_memopb_io:
2683 case Hexagon::L4_ior_memoph_io:
2684 case Hexagon::L4_ior_memopw_io:
2685 case Hexagon::L4_iand_memopb_io:
2686 case Hexagon::L4_iand_memoph_io:
2687 case Hexagon::L4_iand_memopw_io:
2694 const uint64_t
F =
MI.getDesc().TSFlags;
2699 const uint64_t
F =
get(Opcode).TSFlags;
2716 const uint64_t
F =
MI.getDesc().TSFlags;
2721 const uint64_t
F =
get(Opcode).TSFlags;
2727 unsigned OperandNum)
const {
2728 const uint64_t
F =
MI.getDesc().TSFlags;
2734 const uint64_t
F =
MI.getDesc().TSFlags;
2740 const uint64_t
F =
get(Opcode).TSFlags;
2746 const uint64_t
F =
MI.getDesc().TSFlags;
2752 const uint64_t
F =
get(Opcode).TSFlags;
2760 const uint64_t
F =
get(Opcode).TSFlags;
2765 const uint64_t
F =
get(Opcode).TSFlags;
2770 const uint64_t
F =
get(Opcode).TSFlags;
2777 return MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4 ||
2778 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_EXT ||
2779 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_PIC ||
2780 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_EXT_PIC;
2784 switch (
MI.getOpcode()) {
2786 case Hexagon::L2_loadrb_io:
2787 case Hexagon::L4_loadrb_ur:
2788 case Hexagon::L4_loadrb_ap:
2789 case Hexagon::L2_loadrb_pr:
2790 case Hexagon::L2_loadrb_pbr:
2791 case Hexagon::L2_loadrb_pi:
2792 case Hexagon::L2_loadrb_pci:
2793 case Hexagon::L2_loadrb_pcr:
2794 case Hexagon::L2_loadbsw2_io:
2795 case Hexagon::L4_loadbsw2_ur:
2796 case Hexagon::L4_loadbsw2_ap:
2797 case Hexagon::L2_loadbsw2_pr:
2798 case Hexagon::L2_loadbsw2_pbr:
2799 case Hexagon::L2_loadbsw2_pi:
2800 case Hexagon::L2_loadbsw2_pci:
2801 case Hexagon::L2_loadbsw2_pcr:
2802 case Hexagon::L2_loadbsw4_io:
2803 case Hexagon::L4_loadbsw4_ur:
2804 case Hexagon::L4_loadbsw4_ap:
2805 case Hexagon::L2_loadbsw4_pr:
2806 case Hexagon::L2_loadbsw4_pbr:
2807 case Hexagon::L2_loadbsw4_pi:
2808 case Hexagon::L2_loadbsw4_pci:
2809 case Hexagon::L2_loadbsw4_pcr:
2810 case Hexagon::L4_loadrb_rr:
2811 case Hexagon::L2_ploadrbt_io:
2812 case Hexagon::L2_ploadrbt_pi:
2813 case Hexagon::L2_ploadrbf_io:
2814 case Hexagon::L2_ploadrbf_pi:
2815 case Hexagon::L2_ploadrbtnew_io:
2816 case Hexagon::L2_ploadrbfnew_io:
2817 case Hexagon::L4_ploadrbt_rr:
2818 case Hexagon::L4_ploadrbf_rr:
2819 case Hexagon::L4_ploadrbtnew_rr:
2820 case Hexagon::L4_ploadrbfnew_rr:
2821 case Hexagon::L2_ploadrbtnew_pi:
2822 case Hexagon::L2_ploadrbfnew_pi:
2823 case Hexagon::L4_ploadrbt_abs:
2824 case Hexagon::L4_ploadrbf_abs:
2825 case Hexagon::L4_ploadrbtnew_abs:
2826 case Hexagon::L4_ploadrbfnew_abs:
2827 case Hexagon::L2_loadrbgp:
2829 case Hexagon::L2_loadrh_io:
2830 case Hexagon::L4_loadrh_ur:
2831 case Hexagon::L4_loadrh_ap:
2832 case Hexagon::L2_loadrh_pr:
2833 case Hexagon::L2_loadrh_pbr:
2834 case Hexagon::L2_loadrh_pi:
2835 case Hexagon::L2_loadrh_pci:
2836 case Hexagon::L2_loadrh_pcr:
2837 case Hexagon::L4_loadrh_rr:
2838 case Hexagon::L2_ploadrht_io:
2839 case Hexagon::L2_ploadrht_pi:
2840 case Hexagon::L2_ploadrhf_io:
2841 case Hexagon::L2_ploadrhf_pi:
2842 case Hexagon::L2_ploadrhtnew_io:
2843 case Hexagon::L2_ploadrhfnew_io:
2844 case Hexagon::L4_ploadrht_rr:
2845 case Hexagon::L4_ploadrhf_rr:
2846 case Hexagon::L4_ploadrhtnew_rr:
2847 case Hexagon::L4_ploadrhfnew_rr:
2848 case Hexagon::L2_ploadrhtnew_pi:
2849 case Hexagon::L2_ploadrhfnew_pi:
2850 case Hexagon::L4_ploadrht_abs:
2851 case Hexagon::L4_ploadrhf_abs:
2852 case Hexagon::L4_ploadrhtnew_abs:
2853 case Hexagon::L4_ploadrhfnew_abs:
2854 case Hexagon::L2_loadrhgp:
2862 const uint64_t
F =
MI.getDesc().TSFlags;
2867 switch (
MI.getOpcode()) {
2868 case Hexagon::STriw_pred:
2869 case Hexagon::LDriw_pred:
2880 for (
auto &
Op :
MI.operands())
2881 if (
Op.isGlobal() ||
Op.isSymbol())
2888 unsigned SchedClass =
MI.getDesc().getSchedClass();
2889 return is_TC1(SchedClass);
2893 unsigned SchedClass =
MI.getDesc().getSchedClass();
2894 return is_TC2(SchedClass);
2898 unsigned SchedClass =
MI.getDesc().getSchedClass();
2903 unsigned SchedClass =
MI.getDesc().getSchedClass();
2914 for (
int I = 0;
I <
N;
I++)
2919 if (MI2.
getOpcode() == Hexagon::V6_vS32b_pi)
2974 bool Extend)
const {
2984 case Hexagon::PS_vstorerq_ai:
2985 case Hexagon::PS_vstorerv_ai:
2986 case Hexagon::PS_vstorerw_ai:
2987 case Hexagon::PS_vstorerw_nt_ai:
2988 case Hexagon::PS_vloadrq_ai:
2989 case Hexagon::PS_vloadrv_ai:
2990 case Hexagon::PS_vloadrw_ai:
2991 case Hexagon::PS_vloadrw_nt_ai:
2992 case Hexagon::V6_vL32b_ai:
2993 case Hexagon::V6_vS32b_ai:
2994 case Hexagon::V6_vS32b_pred_ai:
2995 case Hexagon::V6_vS32b_npred_ai:
2996 case Hexagon::V6_vS32b_qpred_ai:
2997 case Hexagon::V6_vS32b_nqpred_ai:
2998 case Hexagon::V6_vS32b_new_ai:
2999 case Hexagon::V6_vS32b_new_pred_ai:
3000 case Hexagon::V6_vS32b_new_npred_ai:
3001 case Hexagon::V6_vS32b_nt_pred_ai:
3002 case Hexagon::V6_vS32b_nt_npred_ai:
3003 case Hexagon::V6_vS32b_nt_new_ai:
3004 case Hexagon::V6_vS32b_nt_new_pred_ai:
3005 case Hexagon::V6_vS32b_nt_new_npred_ai:
3006 case Hexagon::V6_vS32b_nt_qpred_ai:
3007 case Hexagon::V6_vS32b_nt_nqpred_ai:
3008 case Hexagon::V6_vL32b_nt_ai:
3009 case Hexagon::V6_vS32b_nt_ai:
3010 case Hexagon::V6_vL32Ub_ai:
3011 case Hexagon::V6_vS32Ub_ai:
3012 case Hexagon::V6_vL32b_cur_ai:
3013 case Hexagon::V6_vL32b_tmp_ai:
3014 case Hexagon::V6_vL32b_pred_ai:
3015 case Hexagon::V6_vL32b_npred_ai:
3016 case Hexagon::V6_vL32b_cur_pred_ai:
3017 case Hexagon::V6_vL32b_cur_npred_ai:
3018 case Hexagon::V6_vL32b_tmp_pred_ai:
3019 case Hexagon::V6_vL32b_tmp_npred_ai:
3020 case Hexagon::V6_vL32b_nt_cur_ai:
3021 case Hexagon::V6_vL32b_nt_tmp_ai:
3022 case Hexagon::V6_vL32b_nt_pred_ai:
3023 case Hexagon::V6_vL32b_nt_npred_ai:
3024 case Hexagon::V6_vL32b_nt_cur_pred_ai:
3025 case Hexagon::V6_vL32b_nt_cur_npred_ai:
3026 case Hexagon::V6_vL32b_nt_tmp_pred_ai:
3027 case Hexagon::V6_vL32b_nt_tmp_npred_ai:
3028 case Hexagon::V6_vS32Ub_pred_ai:
3029 case Hexagon::V6_vS32Ub_npred_ai:
3030 case Hexagon::V6_vgathermh_pseudo:
3031 case Hexagon::V6_vgather_vscatter_mh_pseudo:
3032 case Hexagon::V6_vgathermw_pseudo:
3033 case Hexagon::V6_vgathermhw_pseudo:
3034 case Hexagon::V6_vgathermhq_pseudo:
3035 case Hexagon::V6_vgathermwq_pseudo:
3036 case Hexagon::V6_vgathermhwq_pseudo: {
3037 unsigned VectorSize = RegInfo.getSpillSize(Hexagon::HvxVRRegClass);
3039 if (
Offset & (VectorSize-1))
3044 case Hexagon::J2_loop0i:
3045 case Hexagon::J2_loop1i:
3048 case Hexagon::S4_storeirb_io:
3049 case Hexagon::S4_storeirbt_io:
3050 case Hexagon::S4_storeirbf_io:
3053 case Hexagon::S4_storeirh_io:
3054 case Hexagon::S4_storeirht_io:
3055 case Hexagon::S4_storeirhf_io:
3058 case Hexagon::S4_storeiri_io:
3059 case Hexagon::S4_storeirit_io:
3060 case Hexagon::S4_storeirif_io:
3063 case Hexagon::A4_cmpbeqi:
3065 case Hexagon::A4_cmpbgti:
3073 case Hexagon::L2_loadri_io:
3074 case Hexagon::S2_storeri_io:
3078 case Hexagon::L2_loadrd_io:
3079 case Hexagon::S2_storerd_io:
3083 case Hexagon::L2_loadrh_io:
3084 case Hexagon::L2_loadruh_io:
3085 case Hexagon::S2_storerh_io:
3086 case Hexagon::S2_storerf_io:
3090 case Hexagon::L2_loadrb_io:
3091 case Hexagon::L2_loadrub_io:
3092 case Hexagon::S2_storerb_io:
3096 case Hexagon::A2_addi:
3100 case Hexagon::L4_iadd_memopw_io:
3101 case Hexagon::L4_isub_memopw_io:
3102 case Hexagon::L4_add_memopw_io:
3103 case Hexagon::L4_sub_memopw_io:
3104 case Hexagon::L4_iand_memopw_io:
3105 case Hexagon::L4_ior_memopw_io:
3106 case Hexagon::L4_and_memopw_io:
3107 case Hexagon::L4_or_memopw_io:
3110 case Hexagon::L4_iadd_memoph_io:
3111 case Hexagon::L4_isub_memoph_io:
3112 case Hexagon::L4_add_memoph_io:
3113 case Hexagon::L4_sub_memoph_io:
3114 case Hexagon::L4_iand_memoph_io:
3115 case Hexagon::L4_ior_memoph_io:
3116 case Hexagon::L4_and_memoph_io:
3117 case Hexagon::L4_or_memoph_io:
3120 case Hexagon::L4_iadd_memopb_io:
3121 case Hexagon::L4_isub_memopb_io:
3122 case Hexagon::L4_add_memopb_io:
3123 case Hexagon::L4_sub_memopb_io:
3124 case Hexagon::L4_iand_memopb_io:
3125 case Hexagon::L4_ior_memopb_io:
3126 case Hexagon::L4_and_memopb_io:
3127 case Hexagon::L4_or_memopb_io:
3132 case Hexagon::STriw_pred:
3133 case Hexagon::LDriw_pred:
3134 case Hexagon::STriw_ctr:
3135 case Hexagon::LDriw_ctr:
3138 case Hexagon::PS_fi:
3139 case Hexagon::PS_fia:
3140 case Hexagon::INLINEASM:
3143 case Hexagon::L2_ploadrbt_io:
3144 case Hexagon::L2_ploadrbf_io:
3145 case Hexagon::L2_ploadrubt_io:
3146 case Hexagon::L2_ploadrubf_io:
3147 case Hexagon::S2_pstorerbt_io:
3148 case Hexagon::S2_pstorerbf_io:
3151 case Hexagon::L2_ploadrht_io:
3152 case Hexagon::L2_ploadrhf_io:
3153 case Hexagon::L2_ploadruht_io:
3154 case Hexagon::L2_ploadruhf_io:
3155 case Hexagon::S2_pstorerht_io:
3156 case Hexagon::S2_pstorerhf_io:
3157 case Hexagon::S2_pstorerft_io:
3158 case Hexagon::S2_pstorerff_io:
3161 case Hexagon::L2_ploadrit_io:
3162 case Hexagon::L2_ploadrif_io:
3163 case Hexagon::S2_pstorerit_io:
3164 case Hexagon::S2_pstorerif_io:
3167 case Hexagon::L2_ploadrdt_io:
3168 case Hexagon::L2_ploadrdf_io:
3169 case Hexagon::S2_pstorerdt_io:
3170 case Hexagon::S2_pstorerdf_io:
3173 case Hexagon::L2_loadbsw2_io:
3174 case Hexagon::L2_loadbzw2_io:
3177 case Hexagon::L2_loadbsw4_io:
3178 case Hexagon::L2_loadbzw4_io:
3182 dbgs() <<
"Failed Opcode is : " << Opcode <<
" (" <<
getName(Opcode)
3185 "Please define it in the above switch statement!");
3193 const uint64_t
F =
get(
MI.getOpcode()).TSFlags;
3215 switch (
MI.getOpcode()) {
3217 case Hexagon::L2_loadrub_io:
3218 case Hexagon::L4_loadrub_ur:
3219 case Hexagon::L4_loadrub_ap:
3220 case Hexagon::L2_loadrub_pr:
3221 case Hexagon::L2_loadrub_pbr:
3222 case Hexagon::L2_loadrub_pi:
3223 case Hexagon::L2_loadrub_pci:
3224 case Hexagon::L2_loadrub_pcr:
3225 case Hexagon::L2_loadbzw2_io:
3226 case Hexagon::L4_loadbzw2_ur:
3227 case Hexagon::L4_loadbzw2_ap:
3228 case Hexagon::L2_loadbzw2_pr:
3229 case Hexagon::L2_loadbzw2_pbr:
3230 case Hexagon::L2_loadbzw2_pi:
3231 case Hexagon::L2_loadbzw2_pci:
3232 case Hexagon::L2_loadbzw2_pcr:
3233 case Hexagon::L2_loadbzw4_io:
3234 case Hexagon::L4_loadbzw4_ur:
3235 case Hexagon::L4_loadbzw4_ap:
3236 case Hexagon::L2_loadbzw4_pr:
3237 case Hexagon::L2_loadbzw4_pbr:
3238 case Hexagon::L2_loadbzw4_pi:
3239 case Hexagon::L2_loadbzw4_pci:
3240 case Hexagon::L2_loadbzw4_pcr:
3241 case Hexagon::L4_loadrub_rr:
3242 case Hexagon::L2_ploadrubt_io:
3243 case Hexagon::L2_ploadrubt_pi:
3244 case Hexagon::L2_ploadrubf_io:
3245 case Hexagon::L2_ploadrubf_pi:
3246 case Hexagon::L2_ploadrubtnew_io:
3247 case Hexagon::L2_ploadrubfnew_io:
3248 case Hexagon::L4_ploadrubt_rr:
3249 case Hexagon::L4_ploadrubf_rr:
3250 case Hexagon::L4_ploadrubtnew_rr:
3251 case Hexagon::L4_ploadrubfnew_rr:
3252 case Hexagon::L2_ploadrubtnew_pi:
3253 case Hexagon::L2_ploadrubfnew_pi:
3254 case Hexagon::L4_ploadrubt_abs:
3255 case Hexagon::L4_ploadrubf_abs:
3256 case Hexagon::L4_ploadrubtnew_abs:
3257 case Hexagon::L4_ploadrubfnew_abs:
3258 case Hexagon::L2_loadrubgp:
3260 case Hexagon::L2_loadruh_io:
3261 case Hexagon::L4_loadruh_ur:
3262 case Hexagon::L4_loadruh_ap:
3263 case Hexagon::L2_loadruh_pr:
3264 case Hexagon::L2_loadruh_pbr:
3265 case Hexagon::L2_loadruh_pi:
3266 case Hexagon::L2_loadruh_pci:
3267 case Hexagon::L2_loadruh_pcr:
3268 case Hexagon::L4_loadruh_rr:
3269 case Hexagon::L2_ploadruht_io:
3270 case Hexagon::L2_ploadruht_pi:
3271 case Hexagon::L2_ploadruhf_io:
3272 case Hexagon::L2_ploadruhf_pi:
3273 case Hexagon::L2_ploadruhtnew_io:
3274 case Hexagon::L2_ploadruhfnew_io:
3275 case Hexagon::L4_ploadruht_rr:
3276 case Hexagon::L4_ploadruhf_rr:
3277 case Hexagon::L4_ploadruhtnew_rr:
3278 case Hexagon::L4_ploadruhfnew_rr:
3279 case Hexagon::L2_ploadruhtnew_pi:
3280 case Hexagon::L2_ploadruhfnew_pi:
3281 case Hexagon::L4_ploadruht_abs:
3282 case Hexagon::L4_ploadruhf_abs:
3283 case Hexagon::L4_ploadruhtnew_abs:
3284 case Hexagon::L4_ploadruhfnew_abs:
3285 case Hexagon::L2_loadruhgp:
3305 OffsetIsScalable =
false;
3307 if (!BaseOp || !BaseOp->
isReg())
3316 if (Second.
mayStore() &&
First.getOpcode() == Hexagon::S2_allocframe) {
3318 if (
Op.isReg() &&
Op.isUse() &&
Op.getReg() == Hexagon::R29)
3328 if (!Stored.
isReg())
3330 for (
unsigned i = 0, e =
First.getNumOperands(); i < e; ++i) {
3332 if (
Op.isReg() &&
Op.isDef() &&
Op.getReg() == Stored.
getReg())
3341 return Opc == Hexagon::PS_call_nr ||
Opc == Hexagon::PS_callr_nr;
3357 if (Hexagon::getRegForm(
MI.getOpcode()) >= 0)
3360 if (
MI.getDesc().mayLoad() ||
MI.getDesc().mayStore()) {
3367 NonExtOpcode = Hexagon::changeAddrMode_abs_io(
MI.getOpcode());
3373 NonExtOpcode = Hexagon::changeAddrMode_io_rr(
MI.getOpcode());
3376 NonExtOpcode = Hexagon::changeAddrMode_ur_rr(
MI.getOpcode());
3381 if (NonExtOpcode < 0)
3401 const uint64_t
F =
MI.getDesc().TSFlags;
3403 Subtarget.hasV60Ops();
3408 if (
MI.mayStore() && !Subtarget.useNewValueStores())
3411 const uint64_t
F =
MI.getDesc().TSFlags;
3416 return MI.getOpcode() == Hexagon::LX_L16b_pseudo;
3420 return MI.getOpcode() == Hexagon::LX_S16b_pseudo;
3450 if (!MII->isBundle())
3453 for (++MII; MII != MIE && MII->isInsideBundle(); ++MII) {
3465 if (MO.isRegMask() && MO.clobbersPhysReg(PredReg))
3467 if (MO.isReg() && MO.isDef() && MO.isImplicit() && (MO.getReg() == PredReg))
3473 switch (
MI.getOpcode()) {
3474 case Hexagon::A4_addp_c:
3475 case Hexagon::A4_subp_c:
3476 case Hexagon::A4_tlbmatch:
3477 case Hexagon::A5_ACS:
3478 case Hexagon::F2_sfinvsqrta:
3479 case Hexagon::F2_sfrecipa:
3480 case Hexagon::J2_endloop0:
3481 case Hexagon::J2_endloop01:
3482 case Hexagon::J2_ploop1si:
3483 case Hexagon::J2_ploop1sr:
3484 case Hexagon::J2_ploop2si:
3485 case Hexagon::J2_ploop2sr:
3486 case Hexagon::J2_ploop3si:
3487 case Hexagon::J2_ploop3sr:
3488 case Hexagon::S2_cabacdecbin:
3489 case Hexagon::S2_storew_locked:
3490 case Hexagon::S4_stored_locked:
3497 return Opcode == Hexagon::J2_jumpt ||
3498 Opcode == Hexagon::J2_jumptpt ||
3499 Opcode == Hexagon::J2_jumpf ||
3500 Opcode == Hexagon::J2_jumpfpt ||
3501 Opcode == Hexagon::J2_jumptnew ||
3502 Opcode == Hexagon::J2_jumpfnew ||
3503 Opcode == Hexagon::J2_jumptnewpt ||
3504 Opcode == Hexagon::J2_jumpfnewpt;
3514 const uint64_t
F =
MI.getDesc().TSFlags;
3533 unsigned BasePos = 0, OffsetPos = 0;
3556 unsigned &BasePos,
unsigned &OffsetPos)
const {
3564 }
else if (
MI.mayStore()) {
3567 }
else if (
MI.mayLoad()) {
3582 if (!
MI.getOperand(BasePos).isReg() || !
MI.getOperand(OffsetPos).isImm())
3597 if (
I ==
MBB.instr_begin())
3616 }
while (
I !=
MBB.instr_begin());
3618 I =
MBB.instr_end();
3621 while (
I->isDebugInstr()) {
3622 if (
I ==
MBB.instr_begin())
3626 if (!isUnpredicatedTerminator(*
I))
3635 if (&*
I != LastInst && !
I->isBundle() && isUnpredicatedTerminator(*
I)) {
3636 if (!SecondLastInst) {
3637 SecondLastInst = &*
I;
3642 if (
I ==
MBB.instr_begin())
3651 const uint64_t
F =
MI.getDesc().TSFlags;
3659 Register DstReg, SrcReg, Src1Reg, Src2Reg;
3661 switch (
MI.getOpcode()) {
3670 case Hexagon::C2_cmpeq:
3671 case Hexagon::C2_cmpgt:
3672 case Hexagon::C2_cmpgtu:
3673 DstReg =
MI.getOperand(0).getReg();
3674 Src1Reg =
MI.getOperand(1).getReg();
3675 Src2Reg =
MI.getOperand(2).getReg();
3676 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3677 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3681 case Hexagon::C2_cmpeqi:
3682 case Hexagon::C2_cmpgti:
3683 case Hexagon::C2_cmpgtui:
3685 DstReg =
MI.getOperand(0).getReg();
3686 SrcReg =
MI.getOperand(1).getReg();
3687 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3688 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3691 (
MI.getOperand(2).getImm() == -1)))
3694 case Hexagon::A2_tfr:
3696 DstReg =
MI.getOperand(0).getReg();
3697 SrcReg =
MI.getOperand(1).getReg();
3701 case Hexagon::A2_tfrsi:
3705 DstReg =
MI.getOperand(0).getReg();
3709 case Hexagon::S2_tstbit_i:
3710 DstReg =
MI.getOperand(0).getReg();
3711 Src1Reg =
MI.getOperand(1).getReg();
3712 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3713 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3714 MI.getOperand(2).isImm() &&
3722 case Hexagon::J2_jumptnew:
3723 case Hexagon::J2_jumpfnew:
3724 case Hexagon::J2_jumptnewpt:
3725 case Hexagon::J2_jumpfnewpt:
3726 Src1Reg =
MI.getOperand(0).getReg();
3727 if (Hexagon::PredRegsRegClass.
contains(Src1Reg) &&
3728 (Hexagon::P0 == Src1Reg || Hexagon::P1 == Src1Reg))
3735 case Hexagon::J2_jump:
3736 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4:
3737 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4_PIC:
3749 if ((GA.
getOpcode() != Hexagon::C2_cmpeqi) ||
3750 (GB.
getOpcode() != Hexagon::J2_jumptnew))
3755 if (DestReg != Hexagon::P0 && DestReg != Hexagon::P1)
3763 return DestReg == Hexagon::P0 ? Hexagon::J4_cmpeqn1_tp0_jump_nt
3764 : Hexagon::J4_cmpeqn1_tp1_jump_nt;
3767 return DestReg == Hexagon::P0 ? Hexagon::J4_cmpeqi_tp0_jump_nt
3768 : Hexagon::J4_cmpeqi_tp1_jump_nt;
3773 bool ForBigCore)
const {
3781 static const std::map<unsigned, unsigned> DupMap = {
3782 {Hexagon::A2_add, Hexagon::dup_A2_add},
3783 {Hexagon::A2_addi, Hexagon::dup_A2_addi},
3784 {Hexagon::A2_andir, Hexagon::dup_A2_andir},
3785 {Hexagon::A2_combineii, Hexagon::dup_A2_combineii},
3786 {Hexagon::A2_sxtb, Hexagon::dup_A2_sxtb},
3787 {Hexagon::A2_sxth, Hexagon::dup_A2_sxth},
3788 {Hexagon::A2_tfr, Hexagon::dup_A2_tfr},
3789 {Hexagon::A2_tfrsi, Hexagon::dup_A2_tfrsi},
3790 {Hexagon::A2_zxtb, Hexagon::dup_A2_zxtb},
3791 {Hexagon::A2_zxth, Hexagon::dup_A2_zxth},
3792 {Hexagon::A4_combineii, Hexagon::dup_A4_combineii},
3793 {Hexagon::A4_combineir, Hexagon::dup_A4_combineir},
3794 {Hexagon::A4_combineri, Hexagon::dup_A4_combineri},
3795 {Hexagon::C2_cmoveif, Hexagon::dup_C2_cmoveif},
3796 {Hexagon::C2_cmoveit, Hexagon::dup_C2_cmoveit},
3797 {Hexagon::C2_cmovenewif, Hexagon::dup_C2_cmovenewif},
3798 {Hexagon::C2_cmovenewit, Hexagon::dup_C2_cmovenewit},
3799 {Hexagon::C2_cmpeqi, Hexagon::dup_C2_cmpeqi},
3800 {Hexagon::L2_deallocframe, Hexagon::dup_L2_deallocframe},
3801 {Hexagon::L2_loadrb_io, Hexagon::dup_L2_loadrb_io},
3802 {Hexagon::L2_loadrd_io, Hexagon::dup_L2_loadrd_io},
3803 {Hexagon::L2_loadrh_io, Hexagon::dup_L2_loadrh_io},
3804 {Hexagon::L2_loadri_io, Hexagon::dup_L2_loadri_io},
3805 {Hexagon::L2_loadrub_io, Hexagon::dup_L2_loadrub_io},
3806 {Hexagon::L2_loadruh_io, Hexagon::dup_L2_loadruh_io},
3807 {Hexagon::S2_allocframe, Hexagon::dup_S2_allocframe},
3808 {Hexagon::S2_storerb_io, Hexagon::dup_S2_storerb_io},
3809 {Hexagon::S2_storerd_io, Hexagon::dup_S2_storerd_io},
3810 {Hexagon::S2_storerh_io, Hexagon::dup_S2_storerh_io},
3811 {Hexagon::S2_storeri_io, Hexagon::dup_S2_storeri_io},
3812 {Hexagon::S4_storeirb_io, Hexagon::dup_S4_storeirb_io},
3813 {Hexagon::S4_storeiri_io, Hexagon::dup_S4_storeiri_io},
3815 unsigned OpNum =
MI.getOpcode();
3818 auto Iter = DupMap.find(OpNum);
3819 if (Iter != DupMap.end())
3820 return Iter->second;
3822 for (
const auto &Iter : DupMap)
3823 if (Iter.second == OpNum)
3830 enum Hexagon::PredSense inPredSense;
3831 inPredSense = invertPredicate ? Hexagon::PredSense_false :
3832 Hexagon::PredSense_true;
3833 int CondOpcode = Hexagon::getPredOpcode(
Opc, inPredSense);
3834 if (CondOpcode >= 0)
3842 switch (
MI.getOpcode()) {
3844 case Hexagon::V6_vL32b_pi:
3845 return Hexagon::V6_vL32b_cur_pi;
3846 case Hexagon::V6_vL32b_ai:
3847 return Hexagon::V6_vL32b_cur_ai;
3848 case Hexagon::V6_vL32b_nt_pi:
3849 return Hexagon::V6_vL32b_nt_cur_pi;
3850 case Hexagon::V6_vL32b_nt_ai:
3851 return Hexagon::V6_vL32b_nt_cur_ai;
3852 case Hexagon::V6_vL32b_ppu:
3853 return Hexagon::V6_vL32b_cur_ppu;
3854 case Hexagon::V6_vL32b_nt_ppu:
3855 return Hexagon::V6_vL32b_nt_cur_ppu;
3862 switch (
MI.getOpcode()) {
3864 case Hexagon::V6_vL32b_cur_pi:
3865 return Hexagon::V6_vL32b_pi;
3866 case Hexagon::V6_vL32b_cur_ai:
3867 return Hexagon::V6_vL32b_ai;
3868 case Hexagon::V6_vL32b_nt_cur_pi:
3869 return Hexagon::V6_vL32b_nt_pi;
3870 case Hexagon::V6_vL32b_nt_cur_ai:
3871 return Hexagon::V6_vL32b_nt_ai;
3872 case Hexagon::V6_vL32b_cur_ppu:
3873 return Hexagon::V6_vL32b_ppu;
3874 case Hexagon::V6_vL32b_nt_cur_ppu:
3875 return Hexagon::V6_vL32b_nt_ppu;
3963 int NVOpcode = Hexagon::getNewValueOpcode(
MI.getOpcode());
3967 switch (
MI.getOpcode()) {
3970 std::to_string(
MI.getOpcode()));
3971 case Hexagon::S4_storerb_ur:
3972 return Hexagon::S4_storerbnew_ur;
3974 case Hexagon::S2_storerb_pci:
3975 return Hexagon::S2_storerb_pci;
3977 case Hexagon::S2_storeri_pci:
3978 return Hexagon::S2_storeri_pci;
3980 case Hexagon::S2_storerh_pci:
3981 return Hexagon::S2_storerh_pci;
3983 case Hexagon::S2_storerd_pci:
3984 return Hexagon::S2_storerd_pci;
3986 case Hexagon::S2_storerf_pci:
3987 return Hexagon::S2_storerf_pci;
3989 case Hexagon::V6_vS32b_ai:
3990 return Hexagon::V6_vS32b_new_ai;
3992 case Hexagon::V6_vS32b_pi:
3993 return Hexagon::V6_vS32b_new_pi;
4018 if (BrTarget.
isMBB()) {
4020 Taken = getEdgeProbability(Src, Dst) >= OneHalf;
4033 bool SawCond =
false, Bad =
false;
4037 if (
I.isConditionalBranch()) {
4044 if (
I.isUnconditionalBranch() && !SawCond) {
4052 if (NextIt ==
B.instr_end()) {
4055 if (!
B.isLayoutSuccessor(SB))
4057 Taken = getEdgeProbability(Src, SB) < OneHalf;
4061 assert(NextIt->isUnconditionalBranch());
4070 Taken =
BT && getEdgeProbability(Src,
BT) < OneHalf;
4077 switch (
MI.getOpcode()) {
4078 case Hexagon::J2_jumpt:
4079 return Taken ? Hexagon::J2_jumptnewpt : Hexagon::J2_jumptnew;
4080 case Hexagon::J2_jumpf:
4081 return Taken ? Hexagon::J2_jumpfnewpt : Hexagon::J2_jumpfnew;
4091 switch (
MI.getOpcode()) {
4093 case Hexagon::J2_jumpt:
4094 case Hexagon::J2_jumpf:
4098 int NewOpcode = Hexagon::getPredNewOpcode(
MI.getOpcode());
4105 int NewOp =
MI.getOpcode();
4107 NewOp = Hexagon::getPredOldOpcode(NewOp);
4111 if (!Subtarget.hasFeature(Hexagon::ArchV60)) {
4113 case Hexagon::J2_jumptpt:
4114 NewOp = Hexagon::J2_jumpt;
4116 case Hexagon::J2_jumpfpt:
4117 NewOp = Hexagon::J2_jumpf;
4119 case Hexagon::J2_jumprtpt:
4120 NewOp = Hexagon::J2_jumprt;
4122 case Hexagon::J2_jumprfpt:
4123 NewOp = Hexagon::J2_jumprf;
4128 "Couldn't change predicate new instruction to its old form.");
4132 NewOp = Hexagon::getNonNVStore(NewOp);
4133 assert(NewOp >= 0 &&
"Couldn't change new-value store to its old form.");
4136 if (Subtarget.hasV60Ops())
4141 case Hexagon::J2_jumpfpt:
4142 return Hexagon::J2_jumpf;
4143 case Hexagon::J2_jumptpt:
4144 return Hexagon::J2_jumpt;
4145 case Hexagon::J2_jumprfpt:
4146 return Hexagon::J2_jumprf;
4147 case Hexagon::J2_jumprtpt:
4148 return Hexagon::J2_jumprt;
4157 Register DstReg, SrcReg, Src1Reg, Src2Reg;
4160 switch (
MI.getOpcode()) {
4168 case Hexagon::L2_loadri_io:
4169 case Hexagon::dup_L2_loadri_io:
4170 DstReg =
MI.getOperand(0).getReg();
4171 SrcReg =
MI.getOperand(1).getReg();
4175 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4177 MI.getOperand(2).isImm() &&
4182 (
MI.getOperand(2).isImm() &&
4187 case Hexagon::L2_loadrub_io:
4188 case Hexagon::dup_L2_loadrub_io:
4190 DstReg =
MI.getOperand(0).getReg();
4191 SrcReg =
MI.getOperand(1).getReg();
4193 MI.getOperand(2).isImm() &&
isUInt<4>(
MI.getOperand(2).getImm()))
4206 case Hexagon::L2_loadrh_io:
4207 case Hexagon::L2_loadruh_io:
4208 case Hexagon::dup_L2_loadrh_io:
4209 case Hexagon::dup_L2_loadruh_io:
4211 DstReg =
MI.getOperand(0).getReg();
4212 SrcReg =
MI.getOperand(1).getReg();
4214 MI.getOperand(2).isImm() &&
4218 case Hexagon::L2_loadrb_io:
4219 case Hexagon::dup_L2_loadrb_io:
4221 DstReg =
MI.getOperand(0).getReg();
4222 SrcReg =
MI.getOperand(1).getReg();
4224 MI.getOperand(2).isImm() &&
4228 case Hexagon::L2_loadrd_io:
4229 case Hexagon::dup_L2_loadrd_io:
4231 DstReg =
MI.getOperand(0).getReg();
4232 SrcReg =
MI.getOperand(1).getReg();
4234 Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4236 MI.getOperand(2).isImm() &&
4242 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4:
4243 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4_PIC:
4244 case Hexagon::L4_return:
4245 case Hexagon::L2_deallocframe:
4246 case Hexagon::dup_L2_deallocframe:
4248 case Hexagon::EH_RETURN_JMPR:
4249 case Hexagon::PS_jmpret:
4250 case Hexagon::SL2_jumpr31:
4253 DstReg =
MI.getOperand(0).getReg();
4254 if (Hexagon::IntRegsRegClass.
contains(DstReg) && (Hexagon::R31 == DstReg))
4257 case Hexagon::PS_jmprett:
4258 case Hexagon::PS_jmpretf:
4259 case Hexagon::PS_jmprettnewpt:
4260 case Hexagon::PS_jmpretfnewpt:
4261 case Hexagon::PS_jmprettnew:
4262 case Hexagon::PS_jmpretfnew:
4263 case Hexagon::SL2_jumpr31_t:
4264 case Hexagon::SL2_jumpr31_f:
4265 case Hexagon::SL2_jumpr31_tnew:
4266 case Hexagon::SL2_jumpr31_fnew:
4267 DstReg =
MI.getOperand(1).getReg();
4268 SrcReg =
MI.getOperand(0).getReg();
4270 if ((Hexagon::PredRegsRegClass.
contains(SrcReg) &&
4271 (Hexagon::P0 == SrcReg)) &&
4272 (Hexagon::IntRegsRegClass.
contains(DstReg) && (Hexagon::R31 == DstReg)))
4275 case Hexagon::L4_return_t:
4276 case Hexagon::L4_return_f:
4277 case Hexagon::L4_return_tnew_pnt:
4278 case Hexagon::L4_return_fnew_pnt:
4279 case Hexagon::L4_return_tnew_pt:
4280 case Hexagon::L4_return_fnew_pt:
4282 SrcReg =
MI.getOperand(0).getReg();
4283 if (Hexagon::PredRegsRegClass.
contains(SrcReg) && (Hexagon::P0 == SrcReg))
4291 case Hexagon::S2_storeri_io:
4292 case Hexagon::dup_S2_storeri_io:
4295 Src1Reg =
MI.getOperand(0).getReg();
4296 Src2Reg =
MI.getOperand(2).getReg();
4297 if (Hexagon::IntRegsRegClass.
contains(Src1Reg) &&
4304 MI.getOperand(1).isImm() &&
4308 case Hexagon::S2_storerb_io:
4309 case Hexagon::dup_S2_storerb_io:
4311 Src1Reg =
MI.getOperand(0).getReg();
4312 Src2Reg =
MI.getOperand(2).getReg();
4314 MI.getOperand(1).isImm() &&
isUInt<4>(
MI.getOperand(1).getImm()))
4326 case Hexagon::S2_storerh_io:
4327 case Hexagon::dup_S2_storerh_io:
4329 Src1Reg =
MI.getOperand(0).getReg();
4330 Src2Reg =
MI.getOperand(2).getReg();
4332 MI.getOperand(1).isImm() &&
4336 case Hexagon::S2_storerd_io:
4337 case Hexagon::dup_S2_storerd_io:
4339 Src1Reg =
MI.getOperand(0).getReg();
4340 Src2Reg =
MI.getOperand(2).getReg();
4342 Hexagon::IntRegsRegClass.
contains(Src1Reg) &&
4347 case Hexagon::S4_storeiri_io:
4348 case Hexagon::dup_S4_storeiri_io:
4350 Src1Reg =
MI.getOperand(0).getReg();
4353 MI.getOperand(2).isImm() &&
isUInt<1>(
MI.getOperand(2).getImm()))
4356 case Hexagon::S4_storeirb_io:
4357 case Hexagon::dup_S4_storeirb_io:
4359 Src1Reg =
MI.getOperand(0).getReg();
4361 MI.getOperand(1).isImm() &&
isUInt<4>(
MI.getOperand(1).getImm()) &&
4362 MI.getOperand(2).isImm() &&
isUInt<1>(
MI.getOperand(2).getImm()))
4365 case Hexagon::S2_allocframe:
4366 case Hexagon::dup_S2_allocframe:
4367 if (
MI.getOperand(2).isImm() &&
4389 case Hexagon::A2_addi:
4390 case Hexagon::dup_A2_addi:
4391 DstReg =
MI.getOperand(0).getReg();
4392 SrcReg =
MI.getOperand(1).getReg();
4395 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4400 if ((DstReg == SrcReg) &&
MI.getOperand(2).isImm() &&
4406 ((
MI.getOperand(2).getImm() == 1) ||
4407 (
MI.getOperand(2).getImm() == -1)))
4411 case Hexagon::A2_add:
4412 case Hexagon::dup_A2_add:
4414 DstReg =
MI.getOperand(0).getReg();
4415 Src1Reg =
MI.getOperand(1).getReg();
4416 Src2Reg =
MI.getOperand(2).getReg();
4421 case Hexagon::A2_andir:
4422 case Hexagon::dup_A2_andir:
4426 DstReg =
MI.getOperand(0).getReg();
4427 SrcReg =
MI.getOperand(1).getReg();
4429 MI.getOperand(2).isImm() &&
4430 ((
MI.getOperand(2).getImm() == 1) ||
4431 (
MI.getOperand(2).getImm() == 255)))
4434 case Hexagon::A2_tfr:
4435 case Hexagon::dup_A2_tfr:
4437 DstReg =
MI.getOperand(0).getReg();
4438 SrcReg =
MI.getOperand(1).getReg();
4442 case Hexagon::A2_tfrsi:
4443 case Hexagon::dup_A2_tfrsi:
4448 DstReg =
MI.getOperand(0).getReg();
4452 case Hexagon::C2_cmoveit:
4453 case Hexagon::C2_cmovenewit:
4454 case Hexagon::C2_cmoveif:
4455 case Hexagon::C2_cmovenewif:
4456 case Hexagon::dup_C2_cmoveit:
4457 case Hexagon::dup_C2_cmovenewit:
4458 case Hexagon::dup_C2_cmoveif:
4459 case Hexagon::dup_C2_cmovenewif:
4463 DstReg =
MI.getOperand(0).getReg();
4464 SrcReg =
MI.getOperand(1).getReg();
4466 Hexagon::PredRegsRegClass.
contains(SrcReg) && Hexagon::P0 == SrcReg &&
4467 MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0)
4470 case Hexagon::C2_cmpeqi:
4471 case Hexagon::dup_C2_cmpeqi:
4473 DstReg =
MI.getOperand(0).getReg();
4474 SrcReg =
MI.getOperand(1).getReg();
4475 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
4477 MI.getOperand(2).isImm() &&
isUInt<2>(
MI.getOperand(2).getImm()))
4480 case Hexagon::A2_combineii:
4481 case Hexagon::A4_combineii:
4482 case Hexagon::dup_A2_combineii:
4483 case Hexagon::dup_A4_combineii:
4485 DstReg =
MI.getOperand(0).getReg();
4487 ((
MI.getOperand(1).isImm() &&
isUInt<2>(
MI.getOperand(1).getImm())) ||
4488 (
MI.getOperand(1).isGlobal() &&
4490 ((
MI.getOperand(2).isImm() &&
isUInt<2>(
MI.getOperand(2).getImm())) ||
4491 (
MI.getOperand(2).isGlobal() &&
4495 case Hexagon::A4_combineri:
4496 case Hexagon::dup_A4_combineri:
4499 DstReg =
MI.getOperand(0).getReg();
4500 SrcReg =
MI.getOperand(1).getReg();
4502 ((
MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0) ||
4503 (
MI.getOperand(2).isGlobal() &&
MI.getOperand(2).getOffset() == 0)))
4506 case Hexagon::A4_combineir:
4507 case Hexagon::dup_A4_combineir:
4509 DstReg =
MI.getOperand(0).getReg();
4510 SrcReg =
MI.getOperand(2).getReg();
4512 ((
MI.getOperand(1).isImm() &&
MI.getOperand(1).getImm() == 0) ||
4513 (
MI.getOperand(1).isGlobal() &&
MI.getOperand(1).getOffset() == 0)))
4516 case Hexagon::A2_sxtb:
4517 case Hexagon::A2_sxth:
4518 case Hexagon::A2_zxtb:
4519 case Hexagon::A2_zxth:
4520 case Hexagon::dup_A2_sxtb:
4521 case Hexagon::dup_A2_sxth:
4522 case Hexagon::dup_A2_zxtb:
4523 case Hexagon::dup_A2_zxth:
4525 DstReg =
MI.getOperand(0).getReg();
4526 SrcReg =
MI.getOperand(1).getReg();
4542 if (
MI.isTransient())
4566 int Idx =
DefMI.findRegisterDefOperandIdx(SR, &HRI,
false,
false);
4577 int Idx =
UseMI.findRegisterUseOperandIdx(SR, &HRI,
false);
4611 : Hexagon::getTruePredOpcode(
Opc);
4612 if (InvPredOpcode >= 0)
4613 return InvPredOpcode;
4620 const uint64_t
F =
MI.getDesc().TSFlags;
4627 return ~(-1U << (bits - 1));
4629 return ~(-1U << bits);
4634 switch (
MI.getOpcode()) {
4635 case Hexagon::L2_loadrbgp:
4636 case Hexagon::L2_loadrdgp:
4637 case Hexagon::L2_loadrhgp:
4638 case Hexagon::L2_loadrigp:
4639 case Hexagon::L2_loadrubgp:
4640 case Hexagon::L2_loadruhgp:
4641 case Hexagon::S2_storerbgp:
4642 case Hexagon::S2_storerbnewgp:
4643 case Hexagon::S2_storerhgp:
4644 case Hexagon::S2_storerhnewgp:
4645 case Hexagon::S2_storerigp:
4646 case Hexagon::S2_storerinewgp:
4647 case Hexagon::S2_storerdgp:
4648 case Hexagon::S2_storerfgp:
4651 const uint64_t
F =
MI.getDesc().TSFlags;
4666 if (
MI.getOpcode() == Hexagon::A4_ext)
4674 const uint64_t
F =
MI.getDesc().TSFlags;
4680 bool ToBigInstrs)
const {
4692 MII->setDesc(
get(Opcode));
4698 bool ToBigInstrs)
const {
4701 End = MB.instr_end();
4702 Instr !=
End; ++Instr)
4710 while ((MII !=
MBB->instr_end()) && MII->isInsideBundle()) {
4719 const uint64_t
F =
MI.getDesc().TSFlags;
4720 unsigned S = (
F >> MemAccessSizePos) & MemAccesSizeMask;
4721 unsigned Size = getMemAccessSizeInBytes(MemAccessSize(S));
4725 if (
MI.getOpcode() == Hexagon::Y2_dcfetchbo)
4732 return HRI.getSpillSize(Hexagon::HvxVRRegClass);
4734 return HRI.getSpillSize(Hexagon::HlxLRRegClass);
4742 const uint64_t
F =
MI.getDesc().TSFlags;
4749 return -1U << (bits - 1);
4758 short NonExtOpcode = Hexagon::getRegForm(
MI.getOpcode());
4759 if (NonExtOpcode >= 0)
4760 return NonExtOpcode;
4762 if (
MI.getDesc().mayLoad() ||
MI.getDesc().mayStore()) {
4766 return Hexagon::changeAddrMode_abs_io(
MI.getOpcode());
4768 return Hexagon::changeAddrMode_io_rr(
MI.getOpcode());
4770 return Hexagon::changeAddrMode_ur_rr(
MI.getOpcode());
4780 Register &PredReg,
unsigned &PredRegPos,
4789 PredReg =
Cond[1].getReg();
4793 if (
Cond[1].isImplicit())
4801 return Hexagon::getRegForm(
MI.getOpcode());
4809 if (
MI.isDebugInstr() ||
MI.isPosition())
4812 unsigned Size =
MI.getDesc().getSize();
4828 unsigned NumDefs = 0;
4829 for (;
MI.getOperand(NumDefs).
isReg() &&
MI.getOperand(NumDefs).isDef();
4831 assert(NumDefs !=
MI.getNumOperands()-2 &&
"No asm string?");
4833 assert(
MI.getOperand(NumDefs).isSymbol() &&
"No asm string?");
4835 const char *AsmStr =
MI.getOperand(NumDefs).getSymbolName();
4843 const uint64_t
F =
MI.getDesc().TSFlags;
4849 const InstrStage &IS = *
II.beginStage(
MI.getDesc().getSchedClass());
4851 return IS.getUnits();
4861 assert(BundleHead->isBundle() &&
"Not a bundle header");
4871 "Instruction must be extendable");
4877 "Branch with unknown extendable field type");
4889 int TargetPos =
MI.getNumOperands() - 1;
4892 while ((TargetPos > -1) && !
MI.getOperand(TargetPos).isMBB())
4894 assert((TargetPos >= 0) &&
MI.getOperand(TargetPos).isMBB());
4895 MI.getOperand(TargetPos).setMBB(NewTarget);
4899 MI.setDesc(
get(NewOpcode));
4911 for (
unsigned insn = TargetOpcode::GENERIC_OP_END+1;
4912 insn < Hexagon::INSTRUCTION_LIST_END; ++insn) {
4933 int PredRevOpcode = -1;
4935 PredRevOpcode = Hexagon::notTakenBranchPrediction(Opcode);
4937 PredRevOpcode = Hexagon::takenBranchPrediction(Opcode);
4938 assert(PredRevOpcode > 0);
4939 return PredRevOpcode;
4945 return Cond.empty() || (
Cond[0].isImm() && (
Cond.size() != 1));
4952 if (Operand.
isImm())
4953 Operand.
setImm(Operand.
getImm() | memShufDisabledMask);
4961 return (Operand.
isImm() && (Operand.
getImm() & memShufDisabledMask) != 0);
4965 return (
MI->getOpcode() == Hexagon::V6_vmpy_qf16_hf ||
4966 MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
4967 MI->getOpcode() == Hexagon::V6_vmpy_qf32_hf ||
4968 MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
4969 MI->getOpcode() == Hexagon::V6_vmpy_qf32_sf ||
4970 MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
4971 MI->getOpcode() == Hexagon::V6_vmpy_qf16 ||
4972 MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
4973 MI->getOpcode() == Hexagon::V6_vmpy_qf32_qf16 ||
4974 MI->getOpcode() == Hexagon::V6_vmpy_qf32);
4995 case Hexagon::V6_vabs_qf16_hf:
4997 case Hexagon::V6_vabs_qf16_qf16:
4999 case Hexagon::V6_vabs_qf32_qf32:
5001 case Hexagon::V6_vabs_qf32_sf:
5003 case Hexagon::V6_vadd_hf:
5005 case Hexagon::V6_vadd_qf16:
5007 case Hexagon::V6_vadd_qf16_mix:
5009 case Hexagon::V6_vadd_qf32:
5011 case Hexagon::V6_vadd_qf32_mix:
5013 case Hexagon::V6_vadd_sf:
5015 case Hexagon::V6_vconv_bf_qf32:
5017 case Hexagon::V6_vconv_f8_qf16:
5019 case Hexagon::V6_vconv_hf_qf16:
5021 case Hexagon::V6_vconv_hf_qf32:
5023 case Hexagon::V6_vconv_qf16_f8:
5025 case Hexagon::V6_vconv_qf16_hf:
5027 case Hexagon::V6_vconv_qf16_qf16:
5029 case Hexagon::V6_vconv_qf32_qf32:
5031 case Hexagon::V6_vconv_qf32_sf:
5033 case Hexagon::V6_vconv_sf_qf32:
5035 case Hexagon::V6_vilog2_qf16:
5037 case Hexagon::V6_vilog2_qf32:
5039 case Hexagon::V6_vmpy_qf16:
5041 case Hexagon::V6_vmpy_qf16_hf:
5043 case Hexagon::V6_vmpy_qf16_mix_hf:
5045 case Hexagon::V6_vmpy_qf32:
5047 case Hexagon::V6_vmpy_qf32_hf:
5049 case Hexagon::V6_vmpy_qf32_mix_hf:
5051 case Hexagon::V6_vmpy_qf32_qf16:
5053 case Hexagon::V6_vmpy_qf32_sf:
5055 case Hexagon::V6_vmpy_rt_hf:
5057 case Hexagon::V6_vmpy_rt_qf16:
5059 case Hexagon::V6_vmpy_rt_sf:
5061 case Hexagon::V6_vneg_qf16_hf:
5063 case Hexagon::V6_vneg_qf16_qf16:
5065 case Hexagon::V6_vneg_qf32_qf32:
5067 case Hexagon::V6_vneg_qf32_sf:
5069 case Hexagon::V6_vsub_hf:
5071 case Hexagon::V6_vsub_qf16:
5073 case Hexagon::V6_vsub_qf16_mix:
5075 case Hexagon::V6_vsub_qf32:
5077 case Hexagon::V6_vsub_qf32_mix:
5079 case Hexagon::V6_vsub_sf:
5081 case Hexagon::V6_vsub_sf_mix:
5083 case Hexagon::V6_vsub_hf_mix:
5156 if (!
A || !
B ||
A->getParent() !=
B->getParent())
5175 if (MO.isReg() && MO.getReg().isValid() &&
5176 (Between.isCall() || Between.modifiesRegister(MO.getReg(),
TRI)))
5193 if (
MI.isDebugValue() && !
MI.isDebugEntryValue() &&
5194 MI.readsRegister(DefReg,
TRI) &&
5211 MBB.insert(FinalPos, MF.CloneMachineInstr(
MI));
5213 if (!
MI->isDebugEntryValue() &&
MI->readsRegister(DefReg,
TRI))
5214 MI->setDebugValueUndef();
5219 return Opc >= 0 ? Hexagon::changeAddrMode_abs_io(
Opc) :
Opc;
5223 return Opc >= 0 ? Hexagon::changeAddrMode_io_abs(
Opc) :
Opc;
5227 return Opc >= 0 ? Hexagon::changeAddrMode_io_pi(
Opc) :
Opc;
5231 return Opc >= 0 ? Hexagon::changeAddrMode_io_rr(
Opc) :
Opc;
5235 return Opc >= 0 ? Hexagon::changeAddrMode_pi_io(
Opc) :
Opc;
5239 return Opc >= 0 ? Hexagon::changeAddrMode_rr_io(
Opc) :
Opc;
5243 return Opc >= 0 ? Hexagon::changeAddrMode_rr_ur(
Opc) :
Opc;
5247 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"))
static bool isUnsafeMemoryObject(const MachineInstr *MI)
const int Hexagon_MEMD_OFFSET_MIN
const int Hexagon_ADDI_OFFSET_MAX
static cl::opt< bool > EnableACCForwarding("enable-acc-forwarding", cl::Hidden, cl::init(true), cl::desc("Enable vec acc forwarding"))
static void getLiveInRegsAt(LivePhysRegs &Regs, const MachineInstr &MI)
const int Hexagon_MEMW_OFFSET_MAX
Constants for Hexagon instructions.
const int Hexagon_MEMW_OFFSET_MIN
cl::opt< bool > ScheduleInlineAsm("hexagon-sched-inline-asm", cl::Hidden, cl::init(false), cl::desc("Do not consider inline-asm a scheduling/" "packetization boundary."))
const int Hexagon_ADDI_OFFSET_MIN
static cl::opt< bool > BranchRelaxAsmLarge("branch-relax-asm-large", cl::init(true), cl::Hidden, cl::desc("branch relax asm"))
static cl::opt< bool > EnableALUForwarding("enable-alu-forwarding", cl::Hidden, cl::init(true), cl::desc("Enable vec alu forwarding"))
const int Hexagon_MEMB_OFFSET_MIN
static unsigned nonDbgMICount(MachineBasicBlock::const_instr_iterator MIB, MachineBasicBlock::const_instr_iterator MIE)
Calculate number of instructions excluding the debug instructions.
static cl::opt< bool > EnableBranchPrediction("hexagon-enable-branch-prediction", cl::Hidden, cl::init(true), cl::desc("Enable branch prediction"))
static bool isDblRegForSubInst(Register Reg, const HexagonRegisterInfo &HRI)
static void getLiveOutRegsAt(LivePhysRegs &Regs, const MachineInstr &MI)
static bool canMoveDebugValue(MachineInstr &MI, MachineInstr &Second, const TargetRegisterInfo *TRI)
static cl::opt< bool > UseDFAHazardRec("dfa-hazard-rec", cl::init(true), cl::Hidden, cl::desc("Use the DFA based hazard recognizer."))
static bool isIntRegForSubInst(Register Reg)
static bool isDuplexPairMatch(unsigned Ga, unsigned Gb)
#define HEXAGON_INSTR_SIZE
std::pair< Instruction::BinaryOps, Value * > OffsetOp
Find all possible pairs (BinOp, RHS) that BinOp V, RHS can be simplified.
static constexpr Value * getValue(Ty &ValueOrUse)
const size_t AbstractManglingParser< Derived, Alloc >::NumOps
This file implements the LivePhysRegs utility for tracking liveness of physical registers.
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.
The possible results of an alias query.
@ NoAlias
The two locations do not alias at all.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
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 areMemAccessesDependent(AAResults *AA, const MachineInstr *MIa, const MachineInstr *MIb) const
Return true if the memory accesses of MIa and MIb may depend on each other.
bool isExtended(const MachineInstr &MI) const
bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, unsigned ExtraPredCycles, BranchProbability Probability) const override
Return true if it's profitable to predicate instructions with accumulated instruction latency of "Num...
bool isAsCheapAsAMove(const MachineInstr &MI) const override
int getMaxValue(const MachineInstr &MI) const
bool isPredicateLate(unsigned Opcode) const
short changeAddrMode_rr_ur(short Opc) const
bool isNewValueInst(const MachineInstr &MI) const
bool isHMXWeightInstr(const MachineInstr &MI) const
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)
TypeSize getValue() const
Represents a single loop in the control flow graph.
This class is intended to be used as a base class for asm properties and features specific to the tar...
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,...
bool hasOneMemOperand() const
Return true if this instruction has exactly one MachineMemOperand.
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
LLVM_ABI bool hasOrderedMemoryRef() const
Return true if this instruction may have an ordered or volatile memory reference, or if the informati...
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
const MachineOperand & getOperand(unsigned i) const
LLVM_ABI MachineInstrBundleIterator< MachineInstr > eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
bool isIndirectBranch(QueryType Type=AnyInBundle) const
Return true if this is an indirect branch, such as a branch through a register.
A description of a memory reference used in the backend.
LocationSize getSize() const
Return the size in bytes of the memory reference.
@ MOVolatile
The memory access is volatile.
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
AAMDNodes getAAInfo() const
Return the AA tags for the memory reference.
const Value * getValue() const
Return the base address of the memory access.
int64_t getOffset() const
For normal values, this is a byte offset added to the base address.
MachineOperand class - Representation of each machine instruction operand.
unsigned getSubReg() const
void setImm(int64_t immVal)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
MachineBasicBlock * getMBB() const
bool isCPI() const
isCPI - Tests if this is a MO_ConstantPoolIndex operand.
LLVM_ABI void setReg(Register Reg)
Change the register this operand corresponds to.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
bool isSymbol() const
isSymbol - Tests if this is a MO_ExternalSymbol operand.
bool isJTI() const
isJTI - Tests if this is a MO_JumpTableIndex operand.
unsigned getTargetFlags() const
static MachineOperand CreateImm(int64_t Val)
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
bool isBlockAddress() const
isBlockAddress - Tests if this is a MO_BlockAddress operand.
Register getReg() const
getReg - Returns the register number.
void addTargetFlag(unsigned F)
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
@ MO_ConstantPoolIndex
Address of indexed Constant in Constant Pool.
@ MO_GlobalAddress
Address of a global value.
@ MO_BlockAddress
Address of a basic block.
@ MO_MachineBasicBlock
MachineBasicBlock reference.
@ MO_ExternalSymbol
Name of external global symbol.
@ MO_JumpTableIndex
Address of indexed Jump Table for switch.
bool isFPImm() const
isFPImm - Tests if this is a MO_FPImmediate operand.
bool isMBB() const
isMBB - Tests if this is a MO_MachineBasicBlock operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Representation for a specific memory location.
Special value supplied for machine level alias analysis.
Wrapper class representing virtual and physical registers.
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
HazardRecognizer - This determines whether or not an instruction can be issued this cycle,...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
constexpr size_t size() const
Get the string size.
constexpr const char * data() const
Get a pointer to the start of the string (which may not be null terminated).
size_t count(char C) const
Return the number of occurrences of C in the string.
Object returned by analyzeLoopForPipelining.
virtual ScheduleHazardRecognizer * CreateTargetPostRAHazardRecognizer(const InstrItineraryData *, const ScheduleDAG *DAG) const
Allocate and return a hazard recognizer to use for this target when scheduling the machine instructio...
virtual bool hasStoreToStackSlot(const MachineInstr &MI, SmallVectorImpl< const MachineMemOperand * > &Accesses) const
If the specified machine instruction has a store to a stack slot, return true along with the FrameInd...
virtual std::optional< unsigned > getOperandLatency(const InstrItineraryData *ItinData, SDNode *DefNode, unsigned DefIdx, SDNode *UseNode, unsigned UseIdx) const
virtual bool hasLoadFromStackSlot(const MachineInstr &MI, SmallVectorImpl< const MachineMemOperand * > &Accesses) const
If the specified machine instruction has a load from a stack slot, return true along with the FrameIn...
Primary interface to the complete machine description for the target machine.
const MCAsmInfo & getMCAsmInfo() const
Return target specific asm information.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
TargetSubtargetInfo - Generic base class for all target subtargets.
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
virtual const InstrItineraryData * getInstrItineraryData() const
getInstrItineraryData - Returns instruction itinerary data for the target or specific subtarget.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
self_iterator getIterator()
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Abstract Attribute helper functions.
bool isSlot0Only(unsigned units)
HexagonII - This namespace holds all of the target specific flags that instruction info tracks.
unsigned const TypeCVI_LAST
static constexpr RegTypeInfo make(RegType Out, RegType In1=RegType::Unknown, RegType In2=RegType::Unknown, RegType In3=RegType::Unknown)
@ RestrictNoSlot1StoreMask
@ RestrictNoSlot1StorePos
unsigned const TypeCVI_FIRST
RegType getOpRegType(unsigned Opcode)
RegTypeInfo getRegTypeInfo(unsigned Opcode)
bool getTSFlag(const MCInstrDesc &MID, HexagonTSFlagsVal Pos)
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
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.
@ 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.