65#define DEBUG_TYPE "hexagon-instrinfo"
67#define GET_INSTRINFO_CTOR_DTOR
68#define GET_INSTRMAP_INFO
70#include "HexagonGenDFAPacketizer.inc"
71#include "HexagonGenInstrInfo.inc"
75 "packetization boundary."));
82 cl::desc(
"Disable schedule adjustment for new value stores."));
86 cl::desc(
"Enable timing class latency"));
90 cl::desc(
"Enable vec alu forwarding"));
94 cl::desc(
"Enable vec acc forwarding"));
102 cl::desc(
"Use the DFA based hazard recognizer."));
117void HexagonInstrInfo::anchor() {}
122 RegInfo(ST.getHwMode()), Subtarget(ST) {}
131 return (
Reg >= Hexagon::R0 &&
Reg <= Hexagon::R7) ||
132 (
Reg >= Hexagon::R16 &&
Reg <= Hexagon::R23);
144 for (; MIB != MIE; ++MIB) {
145 if (!MIB->isDebugInstr())
156 if (!(
MI.getMF()->getFunction().hasOptSize()))
157 return MI.isAsCheapAsAMove();
159 if (
MI.getOpcode() == Hexagon::A2_tfrsi) {
160 auto Op =
MI.getOperand(1);
168 int64_t
Imm =
Op.getImm();
173 return MI.isAsCheapAsAMove();
188 if (
isFloat(
MI) &&
MI.hasRegisterImplicitUseOperand(Hexagon::USR))
202 if (EndLoopOp == Hexagon::ENDLOOP0) {
203 LOOPi = Hexagon::J2_loop0i;
204 LOOPr = Hexagon::J2_loop0r;
206 LOOPi = Hexagon::J2_loop1i;
207 LOOPr = Hexagon::J2_loop1r;
218 unsigned Opc =
I.getOpcode();
219 if (
Opc == LOOPi ||
Opc == LOOPr)
223 if (
Opc == EndLoopOp &&
I.getOperand(0).getMBB() != TargetBB)
250 Uses.push_back(MO.getReg());
289 int &FrameIndex)
const {
290 switch (
MI.getOpcode()) {
293 case Hexagon::L2_loadri_io:
294 case Hexagon::L2_loadrd_io:
295 case Hexagon::V6_vL32b_ai:
296 case Hexagon::V6_vL32b_nt_ai:
297 case Hexagon::V6_vL32Ub_ai:
298 case Hexagon::LDriw_pred:
299 case Hexagon::LDriw_ctr:
300 case Hexagon::PS_vloadrq_ai:
301 case Hexagon::PS_vloadrw_ai:
302 case Hexagon::PS_vloadrw_nt_ai: {
310 return MI.getOperand(0).getReg();
313 case Hexagon::L2_ploadrit_io:
314 case Hexagon::L2_ploadrif_io:
315 case Hexagon::L2_ploadrdt_io:
316 case Hexagon::L2_ploadrdf_io: {
324 return MI.getOperand(0).getReg();
337 int &FrameIndex)
const {
338 switch (
MI.getOpcode()) {
341 case Hexagon::S2_storerb_io:
342 case Hexagon::S2_storerh_io:
343 case Hexagon::S2_storeri_io:
344 case Hexagon::S2_storerd_io:
345 case Hexagon::V6_vS32b_ai:
346 case Hexagon::V6_vS32Ub_ai:
347 case Hexagon::STriw_pred:
348 case Hexagon::STriw_ctr:
349 case Hexagon::PS_vstorerq_ai:
350 case Hexagon::PS_vstorerw_ai: {
358 return MI.getOperand(2).getReg();
361 case Hexagon::S2_pstorerbt_io:
362 case Hexagon::S2_pstorerbf_io:
363 case Hexagon::S2_pstorerht_io:
364 case Hexagon::S2_pstorerhf_io:
365 case Hexagon::S2_pstorerit_io:
366 case Hexagon::S2_pstorerif_io:
367 case Hexagon::S2_pstorerdt_io:
368 case Hexagon::S2_pstorerdf_io: {
376 return MI.getOperand(3).getReg();
392 for (++MII; MII !=
MBB->instr_end() && MII->isInsideBundle(); ++MII)
410 for (++MII; MII !=
MBB->instr_end() && MII->isInsideBundle(); ++MII)
438 bool AllowModify)
const {
445 if (
I ==
MBB.instr_begin())
465 }
while (
I !=
MBB.instr_begin());
470 while (
I->isDebugInstr()) {
471 if (
I ==
MBB.instr_begin())
476 bool JumpToBlock =
I->getOpcode() == Hexagon::J2_jump &&
477 I->getOperand(0).isMBB();
479 if (AllowModify && JumpToBlock &&
480 MBB.isLayoutSuccessor(
I->getOperand(0).getMBB())) {
482 I->eraseFromParent();
484 if (
I ==
MBB.instr_begin())
488 if (!isUnpredicatedTerminator(*
I))
496 if (&*
I != LastInst && !
I->isBundle() && isUnpredicatedTerminator(*
I)) {
498 SecondLastInst = &*
I;
503 if (
I ==
MBB.instr_begin())
509 int SecLastOpcode = SecondLastInst ? SecondLastInst->
getOpcode() : 0;
512 if (LastOpcode == Hexagon::J2_jump && !LastInst->
getOperand(0).
isMBB())
514 if (SecLastOpcode == Hexagon::J2_jump &&
525 if (LastInst && !SecondLastInst) {
526 if (LastOpcode == Hexagon::J2_jump) {
536 if (LastOpcodeHasJMP_c) {
551 <<
" with one jump\n";);
558 if (SecLastOpcodeHasJMP_c && (LastOpcode == Hexagon::J2_jump)) {
569 if (SecLastOpcodeHasNVJump &&
571 (LastOpcode == Hexagon::J2_jump)) {
582 if (SecLastOpcode == Hexagon::J2_jump && LastOpcode == Hexagon::J2_jump) {
586 I->eraseFromParent();
591 if (
isEndLoopN(SecLastOpcode) && LastOpcode == Hexagon::J2_jump) {
599 <<
" with two jumps";);
605 int *BytesRemoved)
const {
606 assert(!BytesRemoved &&
"code size not handled");
611 while (
I !=
MBB.begin()) {
613 if (
I->isDebugInstr())
618 if (
Count && (
I->getOpcode() == Hexagon::J2_jump))
632 int *BytesAdded)
const {
633 unsigned BOpc = Hexagon::J2_jump;
634 unsigned BccOpc = Hexagon::J2_jumpt;
636 assert(
TBB &&
"insertBranch must not be told to insert a fallthrough");
637 assert(!BytesAdded &&
"code size not handled");
642 if (!
Cond.empty() &&
Cond[0].isImm())
643 BccOpc =
Cond[0].getImm();
653 auto Term =
MBB.getFirstTerminator();
663 int EndLoopOp =
Cond[0].getImm();
670 assert(
Loop !=
nullptr &&
"Inserting an ENDLOOP without a LOOP");
671 Loop->getOperand(0).setMBB(
TBB);
675 assert((
Cond.size() == 3) &&
"Only supporting rr/ri version of nvjump");
686 }
else if(
Cond[2].isImm()) {
692 assert((
Cond.size() == 2) &&
"Malformed cond vector");
700 "Cond. cannot be empty when multiple branchings are required");
702 "NV-jump cannot be inserted with another branch");
705 int EndLoopOp =
Cond[0].getImm();
712 assert(
Loop !=
nullptr &&
"Inserting an ENDLOOP without a LOOP");
713 Loop->getOperand(0).setMBB(
TBB);
742 TripCount =
Loop->getOpcode() == Hexagon::J2_loop0r
744 :
Loop->getOperand(1).getImm();
746 LoopCount =
Loop->getOperand(1).getReg();
749 bool shouldIgnoreForPipelining(
const MachineInstr *
MI)
const override {
751 return MI == EndLoop;
754 std::optional<bool> createTripCountGreaterCondition(
755 int TC, MachineBasicBlock &
MBB,
756 SmallVectorImpl<MachineOperand> &
Cond)
override {
757 if (TripCount == -1) {
761 TII->get(Hexagon::C2_cmpgtui),
Done)
769 return TripCount > TC;
772 void setPreheader(MachineBasicBlock *NewPreheader)
override {
777 void adjustTripCount(
int TripCountAdjust)
override {
780 if (
Loop->getOpcode() == Hexagon::J2_loop0i ||
781 Loop->getOpcode() == Hexagon::J2_loop1i) {
782 int64_t TripCount =
Loop->getOperand(1).getImm() + TripCountAdjust;
783 assert(TripCount > 0 &&
"Can't create an empty or negative loop!");
784 Loop->getOperand(1).setImm(TripCount);
793 TII->get(Hexagon::A2_addi), NewLoopCount)
799 void disposed(LiveIntervals *LIS)
override {
802 Loop->eraseFromParent();
807std::unique_ptr<TargetInstrInfo::PipelinerLoopInfo>
815 LoopBB,
I->getOpcode(),
I->getOperand(0).getMBB(), VisitedBBs);
817 return std::make_unique<HexagonPipelinerLoopInfo>(LoopInst, &*
I);
823 unsigned NumCycles,
unsigned ExtraPredCycles,
837 return NumInstrs <= 4;
845 for (
auto I =
B.begin();
I !=
E; ++
I) {
855 for (
auto I =
B.rbegin();
I !=
E; ++
I)
864 bool RenamableSrc)
const {
868 if (Hexagon::IntRegsRegClass.
contains(SrcReg, DestReg)) {
870 .
addReg(SrcReg, KillFlag);
873 if (Hexagon::DoubleRegsRegClass.
contains(SrcReg, DestReg)) {
875 .
addReg(SrcReg, KillFlag);
878 if (Hexagon::PredRegsRegClass.
contains(SrcReg, DestReg)) {
884 if (Hexagon::CtrRegsRegClass.
contains(DestReg) &&
885 Hexagon::IntRegsRegClass.
contains(SrcReg)) {
887 .
addReg(SrcReg, KillFlag);
890 if (Hexagon::IntRegsRegClass.
contains(DestReg) &&
891 Hexagon::CtrRegsRegClass.
contains(SrcReg)) {
893 .
addReg(SrcReg, KillFlag);
896 if (Hexagon::ModRegsRegClass.
contains(DestReg) &&
897 Hexagon::IntRegsRegClass.
contains(SrcReg)) {
899 .
addReg(SrcReg, KillFlag);
902 if (Hexagon::PredRegsRegClass.
contains(SrcReg) &&
903 Hexagon::IntRegsRegClass.
contains(DestReg)) {
905 .
addReg(SrcReg, KillFlag);
908 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
909 Hexagon::PredRegsRegClass.
contains(DestReg)) {
911 .
addReg(SrcReg, KillFlag);
914 if (Hexagon::PredRegsRegClass.
contains(SrcReg) &&
915 Hexagon::IntRegsRegClass.
contains(DestReg)) {
917 .
addReg(SrcReg, KillFlag);
920 if (Hexagon::HvxVRRegClass.
contains(SrcReg, DestReg)) {
922 addReg(SrcReg, KillFlag);
925 if (Hexagon::HvxWRRegClass.
contains(SrcReg, DestReg)) {
928 Register SrcLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
929 Register SrcHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
933 .
addReg(SrcHi, KillFlag | UndefHi)
934 .
addReg(SrcLo, KillFlag | UndefLo);
937 if (Hexagon::HvxQRRegClass.
contains(SrcReg, DestReg)) {
940 .
addReg(SrcReg, KillFlag);
943 if (Hexagon::HvxQRRegClass.
contains(SrcReg) &&
944 Hexagon::HvxVRRegClass.
contains(DestReg)) {
948 if (Hexagon::HvxQRRegClass.
contains(DestReg) &&
949 Hexagon::HvxVRRegClass.
contains(SrcReg)) {
964 Register SrcReg,
bool isKill,
int FI,
977 if (Hexagon::IntRegsRegClass.hasSubClassEq(RC)) {
981 }
else if (Hexagon::DoubleRegsRegClass.hasSubClassEq(RC)) {
985 }
else if (Hexagon::PredRegsRegClass.hasSubClassEq(RC)) {
989 }
else if (Hexagon::ModRegsRegClass.hasSubClassEq(RC)) {
993 }
else if (Hexagon::CircRegsRegClass.hasSubClassEq(RC)) {
998 }
else if (Hexagon::HvxQRRegClass.hasSubClassEq(RC)) {
1002 }
else if (Hexagon::HvxVRRegClass.hasSubClassEq(RC)) {
1006 }
else if (Hexagon::HvxWRRegClass.hasSubClassEq(RC)) {
1029 if (Hexagon::IntRegsRegClass.hasSubClassEq(RC)) {
1032 }
else if (Hexagon::DoubleRegsRegClass.hasSubClassEq(RC)) {
1035 }
else if (Hexagon::PredRegsRegClass.hasSubClassEq(RC)) {
1038 }
else if (Hexagon::ModRegsRegClass.hasSubClassEq(RC)) {
1041 }
else if (Hexagon::CircRegsRegClass.hasSubClassEq(RC)) {
1045 }
else if (Hexagon::HvxQRRegClass.hasSubClassEq(RC)) {
1048 }
else if (Hexagon::HvxVRRegClass.hasSubClassEq(RC)) {
1051 }
else if (Hexagon::HvxWRRegClass.hasSubClassEq(RC)) {
1072 unsigned Opc =
MI.getOpcode();
1074 auto RealCirc = [&](
unsigned Opc,
bool HasImm,
unsigned MxOp) {
1075 Register M_CSx =
MI.getOperand(MxOp).getReg();
1076 Register Mx = HRI.getSubReg(M_CSx, Hexagon::isub_hi);
1077 unsigned CSOp = HasImm ? 5 : 4;
1079 for (
unsigned i = 0; i != CSOp; ++i)
1083 MIB.add(
MI.getOperand(i));
1084 Register CSx = (M_CSx == Hexagon::CS_M0 ? Hexagon::CS0 : Hexagon::CS1);
1091 if (
MI.memoperands().empty())
1094 return MMO->getAlign() >= NeedAlign;
1099 case Hexagon::PS_call_instrprof_custom: {
1100 auto Op0 =
MI.getOperand(0);
1102 "First operand must be a global containing handler name.");
1106 StringRef NameStr = Arr->isCString() ? Arr->getAsCString() : Arr->getAsString();
1132 MIB.addExternalSymbol(cstr);
1136 case TargetOpcode::COPY: {
1142 std::prev(
MBBI)->copyImplicitOps(*
MBB.getParent(),
MI);
1147 case Hexagon::PS_aligna:
1150 .
addImm(-
MI.getOperand(1).getImm());
1153 case Hexagon::V6_vassignp: {
1156 Register SrcLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
1157 Register SrcHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
1168 case Hexagon::V6_lo: {
1171 Register SrcSubLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
1176 case Hexagon::V6_hi: {
1179 Register SrcSubHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
1184 case Hexagon::PS_vloadrv_ai: {
1188 int Offset =
MI.getOperand(2).getImm();
1189 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1190 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vL32b_ai
1191 : Hexagon::V6_vL32Ub_ai;
1199 case Hexagon::PS_vloadrw_ai: {
1203 int Offset =
MI.getOperand(2).getImm();
1204 unsigned VecOffset = HRI.getSpillSize(Hexagon::HvxVRRegClass);
1205 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1206 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vL32b_ai
1207 : Hexagon::V6_vL32Ub_ai;
1209 HRI.getSubReg(DstReg, Hexagon::vsub_lo))
1214 HRI.getSubReg(DstReg, Hexagon::vsub_hi))
1221 case Hexagon::PS_vstorerv_ai: {
1226 int Offset =
MI.getOperand(1).getImm();
1227 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1228 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vS32b_ai
1229 : Hexagon::V6_vS32Ub_ai;
1238 case Hexagon::PS_vstorerw_ai: {
1242 int Offset =
MI.getOperand(1).getImm();
1243 unsigned VecOffset = HRI.getSpillSize(Hexagon::HvxVRRegClass);
1244 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1245 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vS32b_ai
1246 : Hexagon::V6_vS32Ub_ai;
1250 .
addReg(HRI.getSubReg(SrcReg, Hexagon::vsub_lo))
1255 .
addReg(HRI.getSubReg(SrcReg, Hexagon::vsub_hi))
1260 case Hexagon::PS_true: {
1268 case Hexagon::PS_false: {
1276 case Hexagon::PS_qtrue: {
1283 case Hexagon::PS_qfalse: {
1290 case Hexagon::PS_vdd0: {
1298 case Hexagon::PS_vmulw: {
1301 Register Src1Reg =
MI.getOperand(1).getReg();
1302 Register Src2Reg =
MI.getOperand(2).getReg();
1303 Register Src1SubHi = HRI.getSubReg(Src1Reg, Hexagon::isub_hi);
1304 Register Src1SubLo = HRI.getSubReg(Src1Reg, Hexagon::isub_lo);
1305 Register Src2SubHi = HRI.getSubReg(Src2Reg, Hexagon::isub_hi);
1306 Register Src2SubLo = HRI.getSubReg(Src2Reg, Hexagon::isub_lo);
1308 HRI.getSubReg(DstReg, Hexagon::isub_hi))
1312 HRI.getSubReg(DstReg, Hexagon::isub_lo))
1318 case Hexagon::PS_vmulw_acc: {
1321 Register Src1Reg =
MI.getOperand(1).getReg();
1322 Register Src2Reg =
MI.getOperand(2).getReg();
1323 Register Src3Reg =
MI.getOperand(3).getReg();
1324 Register Src1SubHi = HRI.getSubReg(Src1Reg, Hexagon::isub_hi);
1325 Register Src1SubLo = HRI.getSubReg(Src1Reg, Hexagon::isub_lo);
1326 Register Src2SubHi = HRI.getSubReg(Src2Reg, Hexagon::isub_hi);
1327 Register Src2SubLo = HRI.getSubReg(Src2Reg, Hexagon::isub_lo);
1328 Register Src3SubHi = HRI.getSubReg(Src3Reg, Hexagon::isub_hi);
1329 Register Src3SubLo = HRI.getSubReg(Src3Reg, Hexagon::isub_lo);
1331 HRI.getSubReg(DstReg, Hexagon::isub_hi))
1336 HRI.getSubReg(DstReg, Hexagon::isub_lo))
1343 case Hexagon::PS_pselect: {
1367 case Hexagon::PS_vselect: {
1400 case Hexagon::PS_wselect: {
1440 case Hexagon::PS_crash: {
1456 void printCustom(
raw_ostream &OS)
const override {
1457 OS <<
"MisalignedCrash";
1461 static const CrashPseudoSourceValue CrashPSV(MF.
getTarget());
1473 case Hexagon::PS_tailcall_i:
1474 MI.setDesc(
get(Hexagon::J2_jump));
1476 case Hexagon::PS_tailcall_r:
1477 case Hexagon::PS_jmpret:
1478 MI.setDesc(
get(Hexagon::J2_jumpr));
1480 case Hexagon::PS_jmprett:
1481 MI.setDesc(
get(Hexagon::J2_jumprt));
1483 case Hexagon::PS_jmpretf:
1484 MI.setDesc(
get(Hexagon::J2_jumprf));
1486 case Hexagon::PS_jmprettnewpt:
1487 MI.setDesc(
get(Hexagon::J2_jumprtnewpt));
1489 case Hexagon::PS_jmpretfnewpt:
1490 MI.setDesc(
get(Hexagon::J2_jumprfnewpt));
1492 case Hexagon::PS_jmprettnew:
1493 MI.setDesc(
get(Hexagon::J2_jumprtnew));
1495 case Hexagon::PS_jmpretfnew:
1496 MI.setDesc(
get(Hexagon::J2_jumprfnew));
1499 case Hexagon::PS_loadrub_pci:
1500 return RealCirc(Hexagon::L2_loadrub_pci,
true, 4);
1501 case Hexagon::PS_loadrb_pci:
1502 return RealCirc(Hexagon::L2_loadrb_pci,
true, 4);
1503 case Hexagon::PS_loadruh_pci:
1504 return RealCirc(Hexagon::L2_loadruh_pci,
true, 4);
1505 case Hexagon::PS_loadrh_pci:
1506 return RealCirc(Hexagon::L2_loadrh_pci,
true, 4);
1507 case Hexagon::PS_loadri_pci:
1508 return RealCirc(Hexagon::L2_loadri_pci,
true, 4);
1509 case Hexagon::PS_loadrd_pci:
1510 return RealCirc(Hexagon::L2_loadrd_pci,
true, 4);
1511 case Hexagon::PS_loadrub_pcr:
1512 return RealCirc(Hexagon::L2_loadrub_pcr,
false, 3);
1513 case Hexagon::PS_loadrb_pcr:
1514 return RealCirc(Hexagon::L2_loadrb_pcr,
false, 3);
1515 case Hexagon::PS_loadruh_pcr:
1516 return RealCirc(Hexagon::L2_loadruh_pcr,
false, 3);
1517 case Hexagon::PS_loadrh_pcr:
1518 return RealCirc(Hexagon::L2_loadrh_pcr,
false, 3);
1519 case Hexagon::PS_loadri_pcr:
1520 return RealCirc(Hexagon::L2_loadri_pcr,
false, 3);
1521 case Hexagon::PS_loadrd_pcr:
1522 return RealCirc(Hexagon::L2_loadrd_pcr,
false, 3);
1523 case Hexagon::PS_storerb_pci:
1524 return RealCirc(Hexagon::S2_storerb_pci,
true, 3);
1525 case Hexagon::PS_storerh_pci:
1526 return RealCirc(Hexagon::S2_storerh_pci,
true, 3);
1527 case Hexagon::PS_storerf_pci:
1528 return RealCirc(Hexagon::S2_storerf_pci,
true, 3);
1529 case Hexagon::PS_storeri_pci:
1530 return RealCirc(Hexagon::S2_storeri_pci,
true, 3);
1531 case Hexagon::PS_storerd_pci:
1532 return RealCirc(Hexagon::S2_storerd_pci,
true, 3);
1533 case Hexagon::PS_storerb_pcr:
1534 return RealCirc(Hexagon::S2_storerb_pcr,
false, 2);
1535 case Hexagon::PS_storerh_pcr:
1536 return RealCirc(Hexagon::S2_storerh_pcr,
false, 2);
1537 case Hexagon::PS_storerf_pcr:
1538 return RealCirc(Hexagon::S2_storerf_pcr,
false, 2);
1539 case Hexagon::PS_storeri_pcr:
1540 return RealCirc(Hexagon::S2_storeri_pcr,
false, 2);
1541 case Hexagon::PS_storerd_pcr:
1542 return RealCirc(Hexagon::S2_storerd_pcr,
false, 2);
1552 unsigned Opc =
MI.getOpcode();
1556 case Hexagon::V6_vgather_vscatter_mh_pseudo:
1559 .
add(
MI.getOperand(2))
1560 .
add(
MI.getOperand(3))
1561 .
add(
MI.getOperand(4));
1563 .
add(
MI.getOperand(2))
1564 .
add(
MI.getOperand(3))
1565 .
add(
MI.getOperand(4))
1568 return First.getInstrIterator();
1569 case Hexagon::V6_vgathermh_pseudo:
1571 .
add(
MI.getOperand(2))
1572 .
add(
MI.getOperand(3))
1573 .
add(
MI.getOperand(4));
1575 .
add(
MI.getOperand(0))
1579 return First.getInstrIterator();
1581 case Hexagon::V6_vgathermw_pseudo:
1583 .
add(
MI.getOperand(2))
1584 .
add(
MI.getOperand(3))
1585 .
add(
MI.getOperand(4));
1587 .
add(
MI.getOperand(0))
1591 return First.getInstrIterator();
1593 case Hexagon::V6_vgathermhw_pseudo:
1595 .
add(
MI.getOperand(2))
1596 .
add(
MI.getOperand(3))
1597 .
add(
MI.getOperand(4));
1599 .
add(
MI.getOperand(0))
1603 return First.getInstrIterator();
1605 case Hexagon::V6_vgathermhq_pseudo:
1607 .
add(
MI.getOperand(2))
1608 .
add(
MI.getOperand(3))
1609 .
add(
MI.getOperand(4))
1610 .
add(
MI.getOperand(5));
1612 .
add(
MI.getOperand(0))
1616 return First.getInstrIterator();
1618 case Hexagon::V6_vgathermwq_pseudo:
1620 .
add(
MI.getOperand(2))
1621 .
add(
MI.getOperand(3))
1622 .
add(
MI.getOperand(4))
1623 .
add(
MI.getOperand(5));
1625 .
add(
MI.getOperand(0))
1629 return First.getInstrIterator();
1631 case Hexagon::V6_vgathermhwq_pseudo:
1633 .
add(
MI.getOperand(2))
1634 .
add(
MI.getOperand(3))
1635 .
add(
MI.getOperand(4))
1636 .
add(
MI.getOperand(5));
1638 .
add(
MI.getOperand(0))
1642 return First.getInstrIterator();
1645 return MI.getIterator();
1654 assert(
Cond[0].isImm() &&
"First entry in the cond vector not imm-val");
1655 unsigned opcode =
Cond[0].getImm();
1661 Cond[0].setImm(NewOpcode);
1676 unsigned BasePos, OffsetPos;
1691 const uint64_t
F =
MI.getDesc().TSFlags;
1702 int Opc =
MI.getOpcode();
1715 unsigned NOp = 0,
NumOps =
MI.getNumOperands();
1718 if (!
Op.isReg() || !
Op.isDef() ||
Op.isImplicit())
1725 unsigned PredRegPos;
1727 bool GotPredReg =
getPredReg(
Cond, PredReg, PredRegPos, PredRegFlags);
1730 T.addReg(PredReg, PredRegFlags);
1732 T.add(
MI.getOperand(NOp++));
1734 MI.setDesc(
get(PredOpc));
1735 while (
unsigned n =
MI.getNumOperands())
1736 MI.removeOperand(n-1);
1737 for (
unsigned i = 0, n =
T->getNumOperands(); i < n; ++i)
1738 MI.addOperand(
T->getOperand(i));
1744 MRI.clearKillFlags(PredReg);
1755 std::vector<MachineOperand> &Pred,
1756 bool SkipDead)
const {
1764 if (RC == &Hexagon::PredRegsRegClass) {
1769 }
else if (MO.isRegMask()) {
1770 for (
Register PR : Hexagon::PredRegsRegClass) {
1771 if (!
MI.modifiesRegister(PR, &HRI))
1782 if (!
MI.getDesc().isPredicable())
1786 if (!Subtarget.usePredicatedCalls())
1791 if (!Subtarget.hasV62Ops()) {
1792 switch (
MI.getOpcode()) {
1793 case Hexagon::V6_vL32b_ai:
1794 case Hexagon::V6_vL32b_pi:
1795 case Hexagon::V6_vL32b_ppu:
1796 case Hexagon::V6_vL32b_cur_ai:
1797 case Hexagon::V6_vL32b_cur_pi:
1798 case Hexagon::V6_vL32b_cur_ppu:
1799 case Hexagon::V6_vL32b_nt_ai:
1800 case Hexagon::V6_vL32b_nt_pi:
1801 case Hexagon::V6_vL32b_nt_ppu:
1802 case Hexagon::V6_vL32b_tmp_ai:
1803 case Hexagon::V6_vL32b_tmp_pi:
1804 case Hexagon::V6_vL32b_tmp_ppu:
1805 case Hexagon::V6_vL32b_nt_cur_ai:
1806 case Hexagon::V6_vL32b_nt_cur_pi:
1807 case Hexagon::V6_vL32b_nt_cur_ppu:
1808 case Hexagon::V6_vL32b_nt_tmp_ai:
1809 case Hexagon::V6_vL32b_nt_tmp_pi:
1810 case Hexagon::V6_vL32b_nt_tmp_ppu:
1818 bool Invert)
const {
1824 case Hexagon::F2_sfadd:
1840 if (
MI.isDebugInstr())
1850 for (
auto *
I :
MBB->successors())
1856 if (
MI.getDesc().isTerminator() ||
MI.isPosition())
1860 if (
MI.getOpcode() == TargetOpcode::INLINEASM_BR)
1884 bool atInsnStart =
true;
1887 for (; *Str; ++Str) {
1891 if (atInsnStart && !
isSpace(
static_cast<unsigned char>(*Str))) {
1893 atInsnStart =
false;
1897 atInsnStart =
false;
1920 int64_t &
Value)
const {
1921 unsigned Opc =
MI.getOpcode();
1925 case Hexagon::C2_cmpeq:
1926 case Hexagon::C2_cmpeqp:
1927 case Hexagon::C2_cmpgt:
1928 case Hexagon::C2_cmpgtp:
1929 case Hexagon::C2_cmpgtu:
1930 case Hexagon::C2_cmpgtup:
1931 case Hexagon::C4_cmpneq:
1932 case Hexagon::C4_cmplte:
1933 case Hexagon::C4_cmplteu:
1934 case Hexagon::C2_cmpeqi:
1935 case Hexagon::C2_cmpgti:
1936 case Hexagon::C2_cmpgtui:
1937 case Hexagon::C4_cmpneqi:
1938 case Hexagon::C4_cmplteui:
1939 case Hexagon::C4_cmpltei:
1940 SrcReg =
MI.getOperand(1).getReg();
1943 case Hexagon::A4_cmpbeq:
1944 case Hexagon::A4_cmpbgt:
1945 case Hexagon::A4_cmpbgtu:
1946 case Hexagon::A4_cmpbeqi:
1947 case Hexagon::A4_cmpbgti:
1948 case Hexagon::A4_cmpbgtui:
1949 SrcReg =
MI.getOperand(1).getReg();
1952 case Hexagon::A4_cmpheq:
1953 case Hexagon::A4_cmphgt:
1954 case Hexagon::A4_cmphgtu:
1955 case Hexagon::A4_cmpheqi:
1956 case Hexagon::A4_cmphgti:
1957 case Hexagon::A4_cmphgtui:
1958 SrcReg =
MI.getOperand(1).getReg();
1965 case Hexagon::C2_cmpeq:
1966 case Hexagon::C2_cmpeqp:
1967 case Hexagon::C2_cmpgt:
1968 case Hexagon::C2_cmpgtp:
1969 case Hexagon::C2_cmpgtu:
1970 case Hexagon::C2_cmpgtup:
1971 case Hexagon::A4_cmpbeq:
1972 case Hexagon::A4_cmpbgt:
1973 case Hexagon::A4_cmpbgtu:
1974 case Hexagon::A4_cmpheq:
1975 case Hexagon::A4_cmphgt:
1976 case Hexagon::A4_cmphgtu:
1977 case Hexagon::C4_cmpneq:
1978 case Hexagon::C4_cmplte:
1979 case Hexagon::C4_cmplteu:
1980 SrcReg2 =
MI.getOperand(2).getReg();
1984 case Hexagon::C2_cmpeqi:
1985 case Hexagon::C2_cmpgtui:
1986 case Hexagon::C2_cmpgti:
1987 case Hexagon::C4_cmpneqi:
1988 case Hexagon::C4_cmplteui:
1989 case Hexagon::C4_cmpltei:
1990 case Hexagon::A4_cmpbeqi:
1991 case Hexagon::A4_cmpbgti:
1992 case Hexagon::A4_cmpbgtui:
1993 case Hexagon::A4_cmpheqi:
1994 case Hexagon::A4_cmphgti:
1995 case Hexagon::A4_cmphgtui: {
2000 Value =
MI.getOperand(2).getImm();
2010 unsigned *PredCost)
const {
2036 unsigned BasePosA, OffsetPosA;
2044 unsigned BasePosB, OffsetPosB;
2051 if (BaseRegA != BaseRegB || BaseSubA != BaseSubB)
2069 if (OffsetA > OffsetB) {
2070 uint64_t OffDiff = (uint64_t)((int64_t)OffsetA - (int64_t)OffsetB);
2071 return SizeB <= OffDiff;
2073 if (OffsetA < OffsetB) {
2074 uint64_t OffDiff = (uint64_t)((int64_t)OffsetB - (int64_t)OffsetA);
2075 return SizeA <= OffDiff;
2085 unsigned BasePos = 0, OffsetPos = 0;
2093 }
else if (
MI.getOpcode() == Hexagon::A2_addi) {
2095 if (AddOp.isImm()) {
2096 Value = AddOp.getImm();
2104std::pair<unsigned, unsigned>
2114 static const std::pair<unsigned, const char*> Flags[] = {
2115 {MO_PCREL,
"hexagon-pcrel"},
2116 {MO_GOT,
"hexagon-got"},
2117 {MO_LO16,
"hexagon-lo16"},
2118 {MO_HI16,
"hexagon-hi16"},
2119 {MO_GPREL,
"hexagon-gprel"},
2120 {MO_GDGOT,
"hexagon-gdgot"},
2121 {MO_GDPLT,
"hexagon-gdplt"},
2122 {MO_IE,
"hexagon-ie"},
2123 {MO_IEGOT,
"hexagon-iegot"},
2124 {MO_TPREL,
"hexagon-tprel"}
2133 static const std::pair<unsigned, const char*> Flags[] = {
2134 {HMOTF_ConstExtended,
"hexagon-ext"}
2142 if (VT == MVT::i1) {
2143 TRC = &Hexagon::PredRegsRegClass;
2144 }
else if (VT == MVT::i32 || VT == MVT::f32) {
2145 TRC = &Hexagon::IntRegsRegClass;
2146 }
else if (VT == MVT::i64 || VT == MVT::f64) {
2147 TRC = &Hexagon::DoubleRegsRegClass;
2161 const uint64_t
F =
MI.getDesc().TSFlags;
2171 !
MI.getDesc().mayStore() &&
2172 MI.getDesc().getOpcode() != Hexagon::S2_allocframe &&
2173 MI.getDesc().getOpcode() != Hexagon::L2_deallocframe &&
2185 const uint64_t
F =
MI.getDesc().TSFlags;
2218 assert(MO.
isImm() &&
"Extendable operand must be Immediate type");
2222 int32_t SValue =
Value;
2225 return SValue < MinValue || SValue > MaxValue;
2230 return UValue < MinValue || UValue > MaxValue;
2234 switch (
MI.getOpcode()) {
2235 case Hexagon::L4_return:
2236 case Hexagon::L4_return_t:
2237 case Hexagon::L4_return_f:
2238 case Hexagon::L4_return_tnew_pnt:
2239 case Hexagon::L4_return_fnew_pnt:
2240 case Hexagon::L4_return_tnew_pt:
2241 case Hexagon::L4_return_fnew_pt:
2262 for (
auto &RegA : DefsA)
2263 for (
auto &RegB : UsesB) {
2280 switch (
MI.getOpcode()) {
2281 case Hexagon::V6_vL32b_cur_pi:
2282 case Hexagon::V6_vL32b_cur_ai:
2306 return (Opcode == Hexagon::ENDLOOP0 ||
2307 Opcode == Hexagon::ENDLOOP1);
2332 switch (
MI.getOpcode()) {
2334 case Hexagon::PS_fi:
2335 case Hexagon::PS_fia:
2348 const uint64_t
F =
MI.getDesc().TSFlags;
2360 unsigned Opcode =
MI.getOpcode();
2361 const uint64_t
F =
get(Opcode).TSFlags;
2370 if (!
I.mayLoad() && !
I.mayStore())
2376 switch (
MI.getOpcode()) {
2377 case Hexagon::J2_callr:
2378 case Hexagon::J2_callrf:
2379 case Hexagon::J2_callrt:
2380 case Hexagon::PS_call_nr:
2387 switch (
MI.getOpcode()) {
2388 case Hexagon::L4_return:
2389 case Hexagon::L4_return_t:
2390 case Hexagon::L4_return_f:
2391 case Hexagon::L4_return_fnew_pnt:
2392 case Hexagon::L4_return_fnew_pt:
2393 case Hexagon::L4_return_tnew_pnt:
2394 case Hexagon::L4_return_tnew_pt:
2401 switch (
MI.getOpcode()) {
2402 case Hexagon::J2_jumpr:
2403 case Hexagon::J2_jumprt:
2404 case Hexagon::J2_jumprf:
2405 case Hexagon::J2_jumprtnewpt:
2406 case Hexagon::J2_jumprfnewpt:
2407 case Hexagon::J2_jumprtnew:
2408 case Hexagon::J2_jumprfnew:
2419 unsigned offset)
const {
2425 switch (
MI.getOpcode()) {
2429 case Hexagon::J2_jump:
2430 case Hexagon::J2_call:
2431 case Hexagon::PS_call_nr:
2433 case Hexagon::J2_jumpt:
2434 case Hexagon::J2_jumpf:
2435 case Hexagon::J2_jumptnew:
2436 case Hexagon::J2_jumptnewpt:
2437 case Hexagon::J2_jumpfnew:
2438 case Hexagon::J2_jumpfnewpt:
2439 case Hexagon::J2_callt:
2440 case Hexagon::J2_callf:
2442 case Hexagon::J2_loop0i:
2443 case Hexagon::J2_loop0iext:
2444 case Hexagon::J2_loop0r:
2445 case Hexagon::J2_loop0rext:
2446 case Hexagon::J2_loop1i:
2447 case Hexagon::J2_loop1iext:
2448 case Hexagon::J2_loop1r:
2449 case Hexagon::J2_loop1rext:
2452 case Hexagon::J4_cmpeqi_tp0_jump_nt:
2453 case Hexagon::J4_cmpeqi_tp1_jump_nt:
2454 case Hexagon::J4_cmpeqn1_tp0_jump_nt:
2455 case Hexagon::J4_cmpeqn1_tp1_jump_nt:
2467 unsigned Opcode =
MI.getOpcode();
2468 return Opcode == Hexagon::J2_loop0i ||
2469 Opcode == Hexagon::J2_loop0r ||
2470 Opcode == Hexagon::J2_loop0iext ||
2471 Opcode == Hexagon::J2_loop0rext ||
2472 Opcode == Hexagon::J2_loop1i ||
2473 Opcode == Hexagon::J2_loop1r ||
2474 Opcode == Hexagon::J2_loop1iext ||
2475 Opcode == Hexagon::J2_loop1rext;
2479 switch (
MI.getOpcode()) {
2480 default:
return false;
2481 case Hexagon::L4_iadd_memopw_io:
2482 case Hexagon::L4_isub_memopw_io:
2483 case Hexagon::L4_add_memopw_io:
2484 case Hexagon::L4_sub_memopw_io:
2485 case Hexagon::L4_and_memopw_io:
2486 case Hexagon::L4_or_memopw_io:
2487 case Hexagon::L4_iadd_memoph_io:
2488 case Hexagon::L4_isub_memoph_io:
2489 case Hexagon::L4_add_memoph_io:
2490 case Hexagon::L4_sub_memoph_io:
2491 case Hexagon::L4_and_memoph_io:
2492 case Hexagon::L4_or_memoph_io:
2493 case Hexagon::L4_iadd_memopb_io:
2494 case Hexagon::L4_isub_memopb_io:
2495 case Hexagon::L4_add_memopb_io:
2496 case Hexagon::L4_sub_memopb_io:
2497 case Hexagon::L4_and_memopb_io:
2498 case Hexagon::L4_or_memopb_io:
2499 case Hexagon::L4_ior_memopb_io:
2500 case Hexagon::L4_ior_memoph_io:
2501 case Hexagon::L4_ior_memopw_io:
2502 case Hexagon::L4_iand_memopb_io:
2503 case Hexagon::L4_iand_memoph_io:
2504 case Hexagon::L4_iand_memopw_io:
2511 const uint64_t
F =
MI.getDesc().TSFlags;
2516 const uint64_t
F =
get(Opcode).TSFlags;
2533 const uint64_t
F =
MI.getDesc().TSFlags;
2538 const uint64_t
F =
get(Opcode).TSFlags;
2544 unsigned OperandNum)
const {
2545 const uint64_t
F =
MI.getDesc().TSFlags;
2551 const uint64_t
F =
MI.getDesc().TSFlags;
2557 const uint64_t
F =
get(Opcode).TSFlags;
2563 const uint64_t
F =
MI.getDesc().TSFlags;
2569 const uint64_t
F =
get(Opcode).TSFlags;
2577 const uint64_t
F =
get(Opcode).TSFlags;
2582 const uint64_t
F =
get(Opcode).TSFlags;
2587 const uint64_t
F =
get(Opcode).TSFlags;
2594 return MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4 ||
2595 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_EXT ||
2596 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_PIC ||
2597 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_EXT_PIC;
2601 switch (
MI.getOpcode()) {
2603 case Hexagon::L2_loadrb_io:
2604 case Hexagon::L4_loadrb_ur:
2605 case Hexagon::L4_loadrb_ap:
2606 case Hexagon::L2_loadrb_pr:
2607 case Hexagon::L2_loadrb_pbr:
2608 case Hexagon::L2_loadrb_pi:
2609 case Hexagon::L2_loadrb_pci:
2610 case Hexagon::L2_loadrb_pcr:
2611 case Hexagon::L2_loadbsw2_io:
2612 case Hexagon::L4_loadbsw2_ur:
2613 case Hexagon::L4_loadbsw2_ap:
2614 case Hexagon::L2_loadbsw2_pr:
2615 case Hexagon::L2_loadbsw2_pbr:
2616 case Hexagon::L2_loadbsw2_pi:
2617 case Hexagon::L2_loadbsw2_pci:
2618 case Hexagon::L2_loadbsw2_pcr:
2619 case Hexagon::L2_loadbsw4_io:
2620 case Hexagon::L4_loadbsw4_ur:
2621 case Hexagon::L4_loadbsw4_ap:
2622 case Hexagon::L2_loadbsw4_pr:
2623 case Hexagon::L2_loadbsw4_pbr:
2624 case Hexagon::L2_loadbsw4_pi:
2625 case Hexagon::L2_loadbsw4_pci:
2626 case Hexagon::L2_loadbsw4_pcr:
2627 case Hexagon::L4_loadrb_rr:
2628 case Hexagon::L2_ploadrbt_io:
2629 case Hexagon::L2_ploadrbt_pi:
2630 case Hexagon::L2_ploadrbf_io:
2631 case Hexagon::L2_ploadrbf_pi:
2632 case Hexagon::L2_ploadrbtnew_io:
2633 case Hexagon::L2_ploadrbfnew_io:
2634 case Hexagon::L4_ploadrbt_rr:
2635 case Hexagon::L4_ploadrbf_rr:
2636 case Hexagon::L4_ploadrbtnew_rr:
2637 case Hexagon::L4_ploadrbfnew_rr:
2638 case Hexagon::L2_ploadrbtnew_pi:
2639 case Hexagon::L2_ploadrbfnew_pi:
2640 case Hexagon::L4_ploadrbt_abs:
2641 case Hexagon::L4_ploadrbf_abs:
2642 case Hexagon::L4_ploadrbtnew_abs:
2643 case Hexagon::L4_ploadrbfnew_abs:
2644 case Hexagon::L2_loadrbgp:
2646 case Hexagon::L2_loadrh_io:
2647 case Hexagon::L4_loadrh_ur:
2648 case Hexagon::L4_loadrh_ap:
2649 case Hexagon::L2_loadrh_pr:
2650 case Hexagon::L2_loadrh_pbr:
2651 case Hexagon::L2_loadrh_pi:
2652 case Hexagon::L2_loadrh_pci:
2653 case Hexagon::L2_loadrh_pcr:
2654 case Hexagon::L4_loadrh_rr:
2655 case Hexagon::L2_ploadrht_io:
2656 case Hexagon::L2_ploadrht_pi:
2657 case Hexagon::L2_ploadrhf_io:
2658 case Hexagon::L2_ploadrhf_pi:
2659 case Hexagon::L2_ploadrhtnew_io:
2660 case Hexagon::L2_ploadrhfnew_io:
2661 case Hexagon::L4_ploadrht_rr:
2662 case Hexagon::L4_ploadrhf_rr:
2663 case Hexagon::L4_ploadrhtnew_rr:
2664 case Hexagon::L4_ploadrhfnew_rr:
2665 case Hexagon::L2_ploadrhtnew_pi:
2666 case Hexagon::L2_ploadrhfnew_pi:
2667 case Hexagon::L4_ploadrht_abs:
2668 case Hexagon::L4_ploadrhf_abs:
2669 case Hexagon::L4_ploadrhtnew_abs:
2670 case Hexagon::L4_ploadrhfnew_abs:
2671 case Hexagon::L2_loadrhgp:
2679 const uint64_t
F =
MI.getDesc().TSFlags;
2684 switch (
MI.getOpcode()) {
2685 case Hexagon::STriw_pred:
2686 case Hexagon::LDriw_pred:
2697 for (
auto &
Op :
MI.operands())
2698 if (
Op.isGlobal() ||
Op.isSymbol())
2705 unsigned SchedClass =
MI.getDesc().getSchedClass();
2706 return is_TC1(SchedClass);
2710 unsigned SchedClass =
MI.getDesc().getSchedClass();
2711 return is_TC2(SchedClass);
2715 unsigned SchedClass =
MI.getDesc().getSchedClass();
2720 unsigned SchedClass =
MI.getDesc().getSchedClass();
2731 for (
int I = 0;
I <
N;
I++)
2736 if (MI2.
getOpcode() == Hexagon::V6_vS32b_pi)
2787 bool Extend)
const {
2797 case Hexagon::PS_vstorerq_ai:
2798 case Hexagon::PS_vstorerv_ai:
2799 case Hexagon::PS_vstorerw_ai:
2800 case Hexagon::PS_vstorerw_nt_ai:
2801 case Hexagon::PS_vloadrq_ai:
2802 case Hexagon::PS_vloadrv_ai:
2803 case Hexagon::PS_vloadrw_ai:
2804 case Hexagon::PS_vloadrw_nt_ai:
2805 case Hexagon::V6_vL32b_ai:
2806 case Hexagon::V6_vS32b_ai:
2807 case Hexagon::V6_vS32b_pred_ai:
2808 case Hexagon::V6_vS32b_npred_ai:
2809 case Hexagon::V6_vS32b_qpred_ai:
2810 case Hexagon::V6_vS32b_nqpred_ai:
2811 case Hexagon::V6_vS32b_new_ai:
2812 case Hexagon::V6_vS32b_new_pred_ai:
2813 case Hexagon::V6_vS32b_new_npred_ai:
2814 case Hexagon::V6_vS32b_nt_pred_ai:
2815 case Hexagon::V6_vS32b_nt_npred_ai:
2816 case Hexagon::V6_vS32b_nt_new_ai:
2817 case Hexagon::V6_vS32b_nt_new_pred_ai:
2818 case Hexagon::V6_vS32b_nt_new_npred_ai:
2819 case Hexagon::V6_vS32b_nt_qpred_ai:
2820 case Hexagon::V6_vS32b_nt_nqpred_ai:
2821 case Hexagon::V6_vL32b_nt_ai:
2822 case Hexagon::V6_vS32b_nt_ai:
2823 case Hexagon::V6_vL32Ub_ai:
2824 case Hexagon::V6_vS32Ub_ai:
2825 case Hexagon::V6_vL32b_cur_ai:
2826 case Hexagon::V6_vL32b_tmp_ai:
2827 case Hexagon::V6_vL32b_pred_ai:
2828 case Hexagon::V6_vL32b_npred_ai:
2829 case Hexagon::V6_vL32b_cur_pred_ai:
2830 case Hexagon::V6_vL32b_cur_npred_ai:
2831 case Hexagon::V6_vL32b_tmp_pred_ai:
2832 case Hexagon::V6_vL32b_tmp_npred_ai:
2833 case Hexagon::V6_vL32b_nt_cur_ai:
2834 case Hexagon::V6_vL32b_nt_tmp_ai:
2835 case Hexagon::V6_vL32b_nt_pred_ai:
2836 case Hexagon::V6_vL32b_nt_npred_ai:
2837 case Hexagon::V6_vL32b_nt_cur_pred_ai:
2838 case Hexagon::V6_vL32b_nt_cur_npred_ai:
2839 case Hexagon::V6_vL32b_nt_tmp_pred_ai:
2840 case Hexagon::V6_vL32b_nt_tmp_npred_ai:
2841 case Hexagon::V6_vS32Ub_pred_ai:
2842 case Hexagon::V6_vS32Ub_npred_ai:
2843 case Hexagon::V6_vgathermh_pseudo:
2844 case Hexagon::V6_vgather_vscatter_mh_pseudo:
2845 case Hexagon::V6_vgathermw_pseudo:
2846 case Hexagon::V6_vgathermhw_pseudo:
2847 case Hexagon::V6_vgathermhq_pseudo:
2848 case Hexagon::V6_vgathermwq_pseudo:
2849 case Hexagon::V6_vgathermhwq_pseudo: {
2850 unsigned VectorSize = RegInfo.getSpillSize(Hexagon::HvxVRRegClass);
2852 if (
Offset & (VectorSize-1))
2857 case Hexagon::J2_loop0i:
2858 case Hexagon::J2_loop1i:
2861 case Hexagon::S4_storeirb_io:
2862 case Hexagon::S4_storeirbt_io:
2863 case Hexagon::S4_storeirbf_io:
2866 case Hexagon::S4_storeirh_io:
2867 case Hexagon::S4_storeirht_io:
2868 case Hexagon::S4_storeirhf_io:
2871 case Hexagon::S4_storeiri_io:
2872 case Hexagon::S4_storeirit_io:
2873 case Hexagon::S4_storeirif_io:
2876 case Hexagon::A4_cmpbeqi:
2878 case Hexagon::A4_cmpbgti:
2886 case Hexagon::L2_loadri_io:
2887 case Hexagon::S2_storeri_io:
2891 case Hexagon::L2_loadrd_io:
2892 case Hexagon::S2_storerd_io:
2896 case Hexagon::L2_loadrh_io:
2897 case Hexagon::L2_loadruh_io:
2898 case Hexagon::S2_storerh_io:
2899 case Hexagon::S2_storerf_io:
2903 case Hexagon::L2_loadrb_io:
2904 case Hexagon::L2_loadrub_io:
2905 case Hexagon::S2_storerb_io:
2909 case Hexagon::A2_addi:
2913 case Hexagon::L4_iadd_memopw_io:
2914 case Hexagon::L4_isub_memopw_io:
2915 case Hexagon::L4_add_memopw_io:
2916 case Hexagon::L4_sub_memopw_io:
2917 case Hexagon::L4_iand_memopw_io:
2918 case Hexagon::L4_ior_memopw_io:
2919 case Hexagon::L4_and_memopw_io:
2920 case Hexagon::L4_or_memopw_io:
2923 case Hexagon::L4_iadd_memoph_io:
2924 case Hexagon::L4_isub_memoph_io:
2925 case Hexagon::L4_add_memoph_io:
2926 case Hexagon::L4_sub_memoph_io:
2927 case Hexagon::L4_iand_memoph_io:
2928 case Hexagon::L4_ior_memoph_io:
2929 case Hexagon::L4_and_memoph_io:
2930 case Hexagon::L4_or_memoph_io:
2933 case Hexagon::L4_iadd_memopb_io:
2934 case Hexagon::L4_isub_memopb_io:
2935 case Hexagon::L4_add_memopb_io:
2936 case Hexagon::L4_sub_memopb_io:
2937 case Hexagon::L4_iand_memopb_io:
2938 case Hexagon::L4_ior_memopb_io:
2939 case Hexagon::L4_and_memopb_io:
2940 case Hexagon::L4_or_memopb_io:
2945 case Hexagon::STriw_pred:
2946 case Hexagon::LDriw_pred:
2947 case Hexagon::STriw_ctr:
2948 case Hexagon::LDriw_ctr:
2951 case Hexagon::PS_fi:
2952 case Hexagon::PS_fia:
2953 case Hexagon::INLINEASM:
2956 case Hexagon::L2_ploadrbt_io:
2957 case Hexagon::L2_ploadrbf_io:
2958 case Hexagon::L2_ploadrubt_io:
2959 case Hexagon::L2_ploadrubf_io:
2960 case Hexagon::S2_pstorerbt_io:
2961 case Hexagon::S2_pstorerbf_io:
2964 case Hexagon::L2_ploadrht_io:
2965 case Hexagon::L2_ploadrhf_io:
2966 case Hexagon::L2_ploadruht_io:
2967 case Hexagon::L2_ploadruhf_io:
2968 case Hexagon::S2_pstorerht_io:
2969 case Hexagon::S2_pstorerhf_io:
2970 case Hexagon::S2_pstorerft_io:
2971 case Hexagon::S2_pstorerff_io:
2974 case Hexagon::L2_ploadrit_io:
2975 case Hexagon::L2_ploadrif_io:
2976 case Hexagon::S2_pstorerit_io:
2977 case Hexagon::S2_pstorerif_io:
2980 case Hexagon::L2_ploadrdt_io:
2981 case Hexagon::L2_ploadrdf_io:
2982 case Hexagon::S2_pstorerdt_io:
2983 case Hexagon::S2_pstorerdf_io:
2986 case Hexagon::L2_loadbsw2_io:
2987 case Hexagon::L2_loadbzw2_io:
2990 case Hexagon::L2_loadbsw4_io:
2991 case Hexagon::L2_loadbzw4_io:
2995 dbgs() <<
"Failed Opcode is : " << Opcode <<
" (" <<
getName(Opcode)
2998 "Please define it in the above switch statement!");
3006 const uint64_t
F =
get(
MI.getOpcode()).TSFlags;
3028 switch (
MI.getOpcode()) {
3030 case Hexagon::L2_loadrub_io:
3031 case Hexagon::L4_loadrub_ur:
3032 case Hexagon::L4_loadrub_ap:
3033 case Hexagon::L2_loadrub_pr:
3034 case Hexagon::L2_loadrub_pbr:
3035 case Hexagon::L2_loadrub_pi:
3036 case Hexagon::L2_loadrub_pci:
3037 case Hexagon::L2_loadrub_pcr:
3038 case Hexagon::L2_loadbzw2_io:
3039 case Hexagon::L4_loadbzw2_ur:
3040 case Hexagon::L4_loadbzw2_ap:
3041 case Hexagon::L2_loadbzw2_pr:
3042 case Hexagon::L2_loadbzw2_pbr:
3043 case Hexagon::L2_loadbzw2_pi:
3044 case Hexagon::L2_loadbzw2_pci:
3045 case Hexagon::L2_loadbzw2_pcr:
3046 case Hexagon::L2_loadbzw4_io:
3047 case Hexagon::L4_loadbzw4_ur:
3048 case Hexagon::L4_loadbzw4_ap:
3049 case Hexagon::L2_loadbzw4_pr:
3050 case Hexagon::L2_loadbzw4_pbr:
3051 case Hexagon::L2_loadbzw4_pi:
3052 case Hexagon::L2_loadbzw4_pci:
3053 case Hexagon::L2_loadbzw4_pcr:
3054 case Hexagon::L4_loadrub_rr:
3055 case Hexagon::L2_ploadrubt_io:
3056 case Hexagon::L2_ploadrubt_pi:
3057 case Hexagon::L2_ploadrubf_io:
3058 case Hexagon::L2_ploadrubf_pi:
3059 case Hexagon::L2_ploadrubtnew_io:
3060 case Hexagon::L2_ploadrubfnew_io:
3061 case Hexagon::L4_ploadrubt_rr:
3062 case Hexagon::L4_ploadrubf_rr:
3063 case Hexagon::L4_ploadrubtnew_rr:
3064 case Hexagon::L4_ploadrubfnew_rr:
3065 case Hexagon::L2_ploadrubtnew_pi:
3066 case Hexagon::L2_ploadrubfnew_pi:
3067 case Hexagon::L4_ploadrubt_abs:
3068 case Hexagon::L4_ploadrubf_abs:
3069 case Hexagon::L4_ploadrubtnew_abs:
3070 case Hexagon::L4_ploadrubfnew_abs:
3071 case Hexagon::L2_loadrubgp:
3073 case Hexagon::L2_loadruh_io:
3074 case Hexagon::L4_loadruh_ur:
3075 case Hexagon::L4_loadruh_ap:
3076 case Hexagon::L2_loadruh_pr:
3077 case Hexagon::L2_loadruh_pbr:
3078 case Hexagon::L2_loadruh_pi:
3079 case Hexagon::L2_loadruh_pci:
3080 case Hexagon::L2_loadruh_pcr:
3081 case Hexagon::L4_loadruh_rr:
3082 case Hexagon::L2_ploadruht_io:
3083 case Hexagon::L2_ploadruht_pi:
3084 case Hexagon::L2_ploadruhf_io:
3085 case Hexagon::L2_ploadruhf_pi:
3086 case Hexagon::L2_ploadruhtnew_io:
3087 case Hexagon::L2_ploadruhfnew_io:
3088 case Hexagon::L4_ploadruht_rr:
3089 case Hexagon::L4_ploadruhf_rr:
3090 case Hexagon::L4_ploadruhtnew_rr:
3091 case Hexagon::L4_ploadruhfnew_rr:
3092 case Hexagon::L2_ploadruhtnew_pi:
3093 case Hexagon::L2_ploadruhfnew_pi:
3094 case Hexagon::L4_ploadruht_abs:
3095 case Hexagon::L4_ploadruhf_abs:
3096 case Hexagon::L4_ploadruhtnew_abs:
3097 case Hexagon::L4_ploadruhfnew_abs:
3098 case Hexagon::L2_loadruhgp:
3118 OffsetIsScalable =
false;
3120 if (!BaseOp || !BaseOp->
isReg())
3129 if (Second.
mayStore() &&
First.getOpcode() == Hexagon::S2_allocframe) {
3131 if (
Op.isReg() &&
Op.isUse() &&
Op.getReg() == Hexagon::R29)
3141 if (!Stored.
isReg())
3143 for (
unsigned i = 0, e =
First.getNumOperands(); i < e; ++i) {
3145 if (
Op.isReg() &&
Op.isDef() &&
Op.getReg() == Stored.
getReg())
3154 return Opc == Hexagon::PS_call_nr ||
Opc == Hexagon::PS_callr_nr;
3170 if (Hexagon::getRegForm(
MI.getOpcode()) >= 0)
3173 if (
MI.getDesc().mayLoad() ||
MI.getDesc().mayStore()) {
3180 NonExtOpcode = Hexagon::changeAddrMode_abs_io(
MI.getOpcode());
3186 NonExtOpcode = Hexagon::changeAddrMode_io_rr(
MI.getOpcode());
3189 NonExtOpcode = Hexagon::changeAddrMode_ur_rr(
MI.getOpcode());
3194 if (NonExtOpcode < 0)
3214 const uint64_t
F =
MI.getDesc().TSFlags;
3216 Subtarget.hasV60Ops();
3221 if (
MI.mayStore() && !Subtarget.useNewValueStores())
3224 const uint64_t
F =
MI.getDesc().TSFlags;
3255 if (!MII->isBundle())
3258 for (++MII; MII != MIE && MII->isInsideBundle(); ++MII) {
3270 if (MO.isRegMask() && MO.clobbersPhysReg(PredReg))
3272 if (MO.isReg() && MO.isDef() && MO.isImplicit() && (MO.getReg() == PredReg))
3278 switch (
MI.getOpcode()) {
3279 case Hexagon::A4_addp_c:
3280 case Hexagon::A4_subp_c:
3281 case Hexagon::A4_tlbmatch:
3282 case Hexagon::A5_ACS:
3283 case Hexagon::F2_sfinvsqrta:
3284 case Hexagon::F2_sfrecipa:
3285 case Hexagon::J2_endloop0:
3286 case Hexagon::J2_endloop01:
3287 case Hexagon::J2_ploop1si:
3288 case Hexagon::J2_ploop1sr:
3289 case Hexagon::J2_ploop2si:
3290 case Hexagon::J2_ploop2sr:
3291 case Hexagon::J2_ploop3si:
3292 case Hexagon::J2_ploop3sr:
3293 case Hexagon::S2_cabacdecbin:
3294 case Hexagon::S2_storew_locked:
3295 case Hexagon::S4_stored_locked:
3302 return Opcode == Hexagon::J2_jumpt ||
3303 Opcode == Hexagon::J2_jumptpt ||
3304 Opcode == Hexagon::J2_jumpf ||
3305 Opcode == Hexagon::J2_jumpfpt ||
3306 Opcode == Hexagon::J2_jumptnew ||
3307 Opcode == Hexagon::J2_jumpfnew ||
3308 Opcode == Hexagon::J2_jumptnewpt ||
3309 Opcode == Hexagon::J2_jumpfnewpt;
3319 const uint64_t
F =
MI.getDesc().TSFlags;
3338 unsigned BasePos = 0, OffsetPos = 0;
3361 unsigned &BasePos,
unsigned &OffsetPos)
const {
3369 }
else if (
MI.mayStore()) {
3372 }
else if (
MI.mayLoad()) {
3387 if (!
MI.getOperand(BasePos).isReg() || !
MI.getOperand(OffsetPos).isImm())
3402 if (
I ==
MBB.instr_begin())
3421 }
while (
I !=
MBB.instr_begin());
3423 I =
MBB.instr_end();
3426 while (
I->isDebugInstr()) {
3427 if (
I ==
MBB.instr_begin())
3431 if (!isUnpredicatedTerminator(*
I))
3440 if (&*
I != LastInst && !
I->isBundle() && isUnpredicatedTerminator(*
I)) {
3441 if (!SecondLastInst) {
3442 SecondLastInst = &*
I;
3447 if (
I ==
MBB.instr_begin())
3456 const uint64_t
F =
MI.getDesc().TSFlags;
3464 Register DstReg, SrcReg, Src1Reg, Src2Reg;
3466 switch (
MI.getOpcode()) {
3475 case Hexagon::C2_cmpeq:
3476 case Hexagon::C2_cmpgt:
3477 case Hexagon::C2_cmpgtu:
3478 DstReg =
MI.getOperand(0).getReg();
3479 Src1Reg =
MI.getOperand(1).getReg();
3480 Src2Reg =
MI.getOperand(2).getReg();
3481 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3482 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3486 case Hexagon::C2_cmpeqi:
3487 case Hexagon::C2_cmpgti:
3488 case Hexagon::C2_cmpgtui:
3490 DstReg =
MI.getOperand(0).getReg();
3491 SrcReg =
MI.getOperand(1).getReg();
3492 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3493 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3496 (
MI.getOperand(2).getImm() == -1)))
3499 case Hexagon::A2_tfr:
3501 DstReg =
MI.getOperand(0).getReg();
3502 SrcReg =
MI.getOperand(1).getReg();
3506 case Hexagon::A2_tfrsi:
3510 DstReg =
MI.getOperand(0).getReg();
3514 case Hexagon::S2_tstbit_i:
3515 DstReg =
MI.getOperand(0).getReg();
3516 Src1Reg =
MI.getOperand(1).getReg();
3517 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3518 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3519 MI.getOperand(2).isImm() &&
3527 case Hexagon::J2_jumptnew:
3528 case Hexagon::J2_jumpfnew:
3529 case Hexagon::J2_jumptnewpt:
3530 case Hexagon::J2_jumpfnewpt:
3531 Src1Reg =
MI.getOperand(0).getReg();
3532 if (Hexagon::PredRegsRegClass.
contains(Src1Reg) &&
3533 (Hexagon::P0 == Src1Reg || Hexagon::P1 == Src1Reg))
3540 case Hexagon::J2_jump:
3541 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4:
3542 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4_PIC:
3554 if ((GA.
getOpcode() != Hexagon::C2_cmpeqi) ||
3555 (GB.
getOpcode() != Hexagon::J2_jumptnew))
3560 if (DestReg != Hexagon::P0 && DestReg != Hexagon::P1)
3568 return DestReg == Hexagon::P0 ? Hexagon::J4_cmpeqn1_tp0_jump_nt
3569 : Hexagon::J4_cmpeqn1_tp1_jump_nt;
3572 return DestReg == Hexagon::P0 ? Hexagon::J4_cmpeqi_tp0_jump_nt
3573 : Hexagon::J4_cmpeqi_tp1_jump_nt;
3578 bool ForBigCore)
const {
3586 static const std::map<unsigned, unsigned> DupMap = {
3587 {Hexagon::A2_add, Hexagon::dup_A2_add},
3588 {Hexagon::A2_addi, Hexagon::dup_A2_addi},
3589 {Hexagon::A2_andir, Hexagon::dup_A2_andir},
3590 {Hexagon::A2_combineii, Hexagon::dup_A2_combineii},
3591 {Hexagon::A2_sxtb, Hexagon::dup_A2_sxtb},
3592 {Hexagon::A2_sxth, Hexagon::dup_A2_sxth},
3593 {Hexagon::A2_tfr, Hexagon::dup_A2_tfr},
3594 {Hexagon::A2_tfrsi, Hexagon::dup_A2_tfrsi},
3595 {Hexagon::A2_zxtb, Hexagon::dup_A2_zxtb},
3596 {Hexagon::A2_zxth, Hexagon::dup_A2_zxth},
3597 {Hexagon::A4_combineii, Hexagon::dup_A4_combineii},
3598 {Hexagon::A4_combineir, Hexagon::dup_A4_combineir},
3599 {Hexagon::A4_combineri, Hexagon::dup_A4_combineri},
3600 {Hexagon::C2_cmoveif, Hexagon::dup_C2_cmoveif},
3601 {Hexagon::C2_cmoveit, Hexagon::dup_C2_cmoveit},
3602 {Hexagon::C2_cmovenewif, Hexagon::dup_C2_cmovenewif},
3603 {Hexagon::C2_cmovenewit, Hexagon::dup_C2_cmovenewit},
3604 {Hexagon::C2_cmpeqi, Hexagon::dup_C2_cmpeqi},
3605 {Hexagon::L2_deallocframe, Hexagon::dup_L2_deallocframe},
3606 {Hexagon::L2_loadrb_io, Hexagon::dup_L2_loadrb_io},
3607 {Hexagon::L2_loadrd_io, Hexagon::dup_L2_loadrd_io},
3608 {Hexagon::L2_loadrh_io, Hexagon::dup_L2_loadrh_io},
3609 {Hexagon::L2_loadri_io, Hexagon::dup_L2_loadri_io},
3610 {Hexagon::L2_loadrub_io, Hexagon::dup_L2_loadrub_io},
3611 {Hexagon::L2_loadruh_io, Hexagon::dup_L2_loadruh_io},
3612 {Hexagon::S2_allocframe, Hexagon::dup_S2_allocframe},
3613 {Hexagon::S2_storerb_io, Hexagon::dup_S2_storerb_io},
3614 {Hexagon::S2_storerd_io, Hexagon::dup_S2_storerd_io},
3615 {Hexagon::S2_storerh_io, Hexagon::dup_S2_storerh_io},
3616 {Hexagon::S2_storeri_io, Hexagon::dup_S2_storeri_io},
3617 {Hexagon::S4_storeirb_io, Hexagon::dup_S4_storeirb_io},
3618 {Hexagon::S4_storeiri_io, Hexagon::dup_S4_storeiri_io},
3620 unsigned OpNum =
MI.getOpcode();
3623 auto Iter = DupMap.find(OpNum);
3624 if (Iter != DupMap.end())
3625 return Iter->second;
3627 for (
const auto &Iter : DupMap)
3628 if (Iter.second == OpNum)
3635 enum Hexagon::PredSense inPredSense;
3636 inPredSense = invertPredicate ? Hexagon::PredSense_false :
3637 Hexagon::PredSense_true;
3638 int CondOpcode = Hexagon::getPredOpcode(
Opc, inPredSense);
3639 if (CondOpcode >= 0)
3647 switch (
MI.getOpcode()) {
3649 case Hexagon::V6_vL32b_pi:
3650 return Hexagon::V6_vL32b_cur_pi;
3651 case Hexagon::V6_vL32b_ai:
3652 return Hexagon::V6_vL32b_cur_ai;
3653 case Hexagon::V6_vL32b_nt_pi:
3654 return Hexagon::V6_vL32b_nt_cur_pi;
3655 case Hexagon::V6_vL32b_nt_ai:
3656 return Hexagon::V6_vL32b_nt_cur_ai;
3657 case Hexagon::V6_vL32b_ppu:
3658 return Hexagon::V6_vL32b_cur_ppu;
3659 case Hexagon::V6_vL32b_nt_ppu:
3660 return Hexagon::V6_vL32b_nt_cur_ppu;
3667 switch (
MI.getOpcode()) {
3669 case Hexagon::V6_vL32b_cur_pi:
3670 return Hexagon::V6_vL32b_pi;
3671 case Hexagon::V6_vL32b_cur_ai:
3672 return Hexagon::V6_vL32b_ai;
3673 case Hexagon::V6_vL32b_nt_cur_pi:
3674 return Hexagon::V6_vL32b_nt_pi;
3675 case Hexagon::V6_vL32b_nt_cur_ai:
3676 return Hexagon::V6_vL32b_nt_ai;
3677 case Hexagon::V6_vL32b_cur_ppu:
3678 return Hexagon::V6_vL32b_ppu;
3679 case Hexagon::V6_vL32b_nt_cur_ppu:
3680 return Hexagon::V6_vL32b_nt_ppu;
3768 int NVOpcode = Hexagon::getNewValueOpcode(
MI.getOpcode());
3772 switch (
MI.getOpcode()) {
3775 std::to_string(
MI.getOpcode()));
3776 case Hexagon::S4_storerb_ur:
3777 return Hexagon::S4_storerbnew_ur;
3779 case Hexagon::S2_storerb_pci:
3780 return Hexagon::S2_storerb_pci;
3782 case Hexagon::S2_storeri_pci:
3783 return Hexagon::S2_storeri_pci;
3785 case Hexagon::S2_storerh_pci:
3786 return Hexagon::S2_storerh_pci;
3788 case Hexagon::S2_storerd_pci:
3789 return Hexagon::S2_storerd_pci;
3791 case Hexagon::S2_storerf_pci:
3792 return Hexagon::S2_storerf_pci;
3794 case Hexagon::V6_vS32b_ai:
3795 return Hexagon::V6_vS32b_new_ai;
3797 case Hexagon::V6_vS32b_pi:
3798 return Hexagon::V6_vS32b_new_pi;
3823 if (BrTarget.
isMBB()) {
3825 Taken = getEdgeProbability(Src, Dst) >= OneHalf;
3838 bool SawCond =
false, Bad =
false;
3842 if (
I.isConditionalBranch()) {
3849 if (
I.isUnconditionalBranch() && !SawCond) {
3857 if (NextIt ==
B.instr_end()) {
3860 if (!
B.isLayoutSuccessor(SB))
3862 Taken = getEdgeProbability(Src, SB) < OneHalf;
3866 assert(NextIt->isUnconditionalBranch());
3875 Taken =
BT && getEdgeProbability(Src,
BT) < OneHalf;
3882 switch (
MI.getOpcode()) {
3883 case Hexagon::J2_jumpt:
3884 return Taken ? Hexagon::J2_jumptnewpt : Hexagon::J2_jumptnew;
3885 case Hexagon::J2_jumpf:
3886 return Taken ? Hexagon::J2_jumpfnewpt : Hexagon::J2_jumpfnew;
3896 switch (
MI.getOpcode()) {
3898 case Hexagon::J2_jumpt:
3899 case Hexagon::J2_jumpf:
3903 int NewOpcode = Hexagon::getPredNewOpcode(
MI.getOpcode());
3910 int NewOp =
MI.getOpcode();
3912 NewOp = Hexagon::getPredOldOpcode(NewOp);
3916 if (!Subtarget.hasFeature(Hexagon::ArchV60)) {
3918 case Hexagon::J2_jumptpt:
3919 NewOp = Hexagon::J2_jumpt;
3921 case Hexagon::J2_jumpfpt:
3922 NewOp = Hexagon::J2_jumpf;
3924 case Hexagon::J2_jumprtpt:
3925 NewOp = Hexagon::J2_jumprt;
3927 case Hexagon::J2_jumprfpt:
3928 NewOp = Hexagon::J2_jumprf;
3933 "Couldn't change predicate new instruction to its old form.");
3937 NewOp = Hexagon::getNonNVStore(NewOp);
3938 assert(NewOp >= 0 &&
"Couldn't change new-value store to its old form.");
3941 if (Subtarget.hasV60Ops())
3946 case Hexagon::J2_jumpfpt:
3947 return Hexagon::J2_jumpf;
3948 case Hexagon::J2_jumptpt:
3949 return Hexagon::J2_jumpt;
3950 case Hexagon::J2_jumprfpt:
3951 return Hexagon::J2_jumprf;
3952 case Hexagon::J2_jumprtpt:
3953 return Hexagon::J2_jumprt;
3962 Register DstReg, SrcReg, Src1Reg, Src2Reg;
3965 switch (
MI.getOpcode()) {
3973 case Hexagon::L2_loadri_io:
3974 case Hexagon::dup_L2_loadri_io:
3975 DstReg =
MI.getOperand(0).getReg();
3976 SrcReg =
MI.getOperand(1).getReg();
3980 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
3982 MI.getOperand(2).isImm() &&
3987 (
MI.getOperand(2).isImm() &&
3992 case Hexagon::L2_loadrub_io:
3993 case Hexagon::dup_L2_loadrub_io:
3995 DstReg =
MI.getOperand(0).getReg();
3996 SrcReg =
MI.getOperand(1).getReg();
3998 MI.getOperand(2).isImm() &&
isUInt<4>(
MI.getOperand(2).getImm()))
4011 case Hexagon::L2_loadrh_io:
4012 case Hexagon::L2_loadruh_io:
4013 case Hexagon::dup_L2_loadrh_io:
4014 case Hexagon::dup_L2_loadruh_io:
4016 DstReg =
MI.getOperand(0).getReg();
4017 SrcReg =
MI.getOperand(1).getReg();
4019 MI.getOperand(2).isImm() &&
4023 case Hexagon::L2_loadrb_io:
4024 case Hexagon::dup_L2_loadrb_io:
4026 DstReg =
MI.getOperand(0).getReg();
4027 SrcReg =
MI.getOperand(1).getReg();
4029 MI.getOperand(2).isImm() &&
4033 case Hexagon::L2_loadrd_io:
4034 case Hexagon::dup_L2_loadrd_io:
4036 DstReg =
MI.getOperand(0).getReg();
4037 SrcReg =
MI.getOperand(1).getReg();
4039 Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4041 MI.getOperand(2).isImm() &&
4047 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4:
4048 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4_PIC:
4049 case Hexagon::L4_return:
4050 case Hexagon::L2_deallocframe:
4051 case Hexagon::dup_L2_deallocframe:
4053 case Hexagon::EH_RETURN_JMPR:
4054 case Hexagon::PS_jmpret:
4055 case Hexagon::SL2_jumpr31:
4058 DstReg =
MI.getOperand(0).getReg();
4059 if (Hexagon::IntRegsRegClass.
contains(DstReg) && (Hexagon::R31 == DstReg))
4062 case Hexagon::PS_jmprett:
4063 case Hexagon::PS_jmpretf:
4064 case Hexagon::PS_jmprettnewpt:
4065 case Hexagon::PS_jmpretfnewpt:
4066 case Hexagon::PS_jmprettnew:
4067 case Hexagon::PS_jmpretfnew:
4068 case Hexagon::SL2_jumpr31_t:
4069 case Hexagon::SL2_jumpr31_f:
4070 case Hexagon::SL2_jumpr31_tnew:
4071 case Hexagon::SL2_jumpr31_fnew:
4072 DstReg =
MI.getOperand(1).getReg();
4073 SrcReg =
MI.getOperand(0).getReg();
4075 if ((Hexagon::PredRegsRegClass.
contains(SrcReg) &&
4076 (Hexagon::P0 == SrcReg)) &&
4077 (Hexagon::IntRegsRegClass.
contains(DstReg) && (Hexagon::R31 == DstReg)))
4080 case Hexagon::L4_return_t:
4081 case Hexagon::L4_return_f:
4082 case Hexagon::L4_return_tnew_pnt:
4083 case Hexagon::L4_return_fnew_pnt:
4084 case Hexagon::L4_return_tnew_pt:
4085 case Hexagon::L4_return_fnew_pt:
4087 SrcReg =
MI.getOperand(0).getReg();
4088 if (Hexagon::PredRegsRegClass.
contains(SrcReg) && (Hexagon::P0 == SrcReg))
4096 case Hexagon::S2_storeri_io:
4097 case Hexagon::dup_S2_storeri_io:
4100 Src1Reg =
MI.getOperand(0).getReg();
4101 Src2Reg =
MI.getOperand(2).getReg();
4102 if (Hexagon::IntRegsRegClass.
contains(Src1Reg) &&
4109 MI.getOperand(1).isImm() &&
4113 case Hexagon::S2_storerb_io:
4114 case Hexagon::dup_S2_storerb_io:
4116 Src1Reg =
MI.getOperand(0).getReg();
4117 Src2Reg =
MI.getOperand(2).getReg();
4119 MI.getOperand(1).isImm() &&
isUInt<4>(
MI.getOperand(1).getImm()))
4131 case Hexagon::S2_storerh_io:
4132 case Hexagon::dup_S2_storerh_io:
4134 Src1Reg =
MI.getOperand(0).getReg();
4135 Src2Reg =
MI.getOperand(2).getReg();
4137 MI.getOperand(1).isImm() &&
4141 case Hexagon::S2_storerd_io:
4142 case Hexagon::dup_S2_storerd_io:
4144 Src1Reg =
MI.getOperand(0).getReg();
4145 Src2Reg =
MI.getOperand(2).getReg();
4147 Hexagon::IntRegsRegClass.
contains(Src1Reg) &&
4152 case Hexagon::S4_storeiri_io:
4153 case Hexagon::dup_S4_storeiri_io:
4155 Src1Reg =
MI.getOperand(0).getReg();
4158 MI.getOperand(2).isImm() &&
isUInt<1>(
MI.getOperand(2).getImm()))
4161 case Hexagon::S4_storeirb_io:
4162 case Hexagon::dup_S4_storeirb_io:
4164 Src1Reg =
MI.getOperand(0).getReg();
4166 MI.getOperand(1).isImm() &&
isUInt<4>(
MI.getOperand(1).getImm()) &&
4167 MI.getOperand(2).isImm() &&
isUInt<1>(
MI.getOperand(2).getImm()))
4170 case Hexagon::S2_allocframe:
4171 case Hexagon::dup_S2_allocframe:
4172 if (
MI.getOperand(2).isImm() &&
4194 case Hexagon::A2_addi:
4195 case Hexagon::dup_A2_addi:
4196 DstReg =
MI.getOperand(0).getReg();
4197 SrcReg =
MI.getOperand(1).getReg();
4200 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4205 if ((DstReg == SrcReg) &&
MI.getOperand(2).isImm() &&
4211 ((
MI.getOperand(2).getImm() == 1) ||
4212 (
MI.getOperand(2).getImm() == -1)))
4216 case Hexagon::A2_add:
4217 case Hexagon::dup_A2_add:
4219 DstReg =
MI.getOperand(0).getReg();
4220 Src1Reg =
MI.getOperand(1).getReg();
4221 Src2Reg =
MI.getOperand(2).getReg();
4226 case Hexagon::A2_andir:
4227 case Hexagon::dup_A2_andir:
4231 DstReg =
MI.getOperand(0).getReg();
4232 SrcReg =
MI.getOperand(1).getReg();
4234 MI.getOperand(2).isImm() &&
4235 ((
MI.getOperand(2).getImm() == 1) ||
4236 (
MI.getOperand(2).getImm() == 255)))
4239 case Hexagon::A2_tfr:
4240 case Hexagon::dup_A2_tfr:
4242 DstReg =
MI.getOperand(0).getReg();
4243 SrcReg =
MI.getOperand(1).getReg();
4247 case Hexagon::A2_tfrsi:
4248 case Hexagon::dup_A2_tfrsi:
4253 DstReg =
MI.getOperand(0).getReg();
4257 case Hexagon::C2_cmoveit:
4258 case Hexagon::C2_cmovenewit:
4259 case Hexagon::C2_cmoveif:
4260 case Hexagon::C2_cmovenewif:
4261 case Hexagon::dup_C2_cmoveit:
4262 case Hexagon::dup_C2_cmovenewit:
4263 case Hexagon::dup_C2_cmoveif:
4264 case Hexagon::dup_C2_cmovenewif:
4268 DstReg =
MI.getOperand(0).getReg();
4269 SrcReg =
MI.getOperand(1).getReg();
4271 Hexagon::PredRegsRegClass.
contains(SrcReg) && Hexagon::P0 == SrcReg &&
4272 MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0)
4275 case Hexagon::C2_cmpeqi:
4276 case Hexagon::dup_C2_cmpeqi:
4278 DstReg =
MI.getOperand(0).getReg();
4279 SrcReg =
MI.getOperand(1).getReg();
4280 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
4282 MI.getOperand(2).isImm() &&
isUInt<2>(
MI.getOperand(2).getImm()))
4285 case Hexagon::A2_combineii:
4286 case Hexagon::A4_combineii:
4287 case Hexagon::dup_A2_combineii:
4288 case Hexagon::dup_A4_combineii:
4290 DstReg =
MI.getOperand(0).getReg();
4292 ((
MI.getOperand(1).isImm() &&
isUInt<2>(
MI.getOperand(1).getImm())) ||
4293 (
MI.getOperand(1).isGlobal() &&
4295 ((
MI.getOperand(2).isImm() &&
isUInt<2>(
MI.getOperand(2).getImm())) ||
4296 (
MI.getOperand(2).isGlobal() &&
4300 case Hexagon::A4_combineri:
4301 case Hexagon::dup_A4_combineri:
4304 DstReg =
MI.getOperand(0).getReg();
4305 SrcReg =
MI.getOperand(1).getReg();
4307 ((
MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0) ||
4308 (
MI.getOperand(2).isGlobal() &&
MI.getOperand(2).getOffset() == 0)))
4311 case Hexagon::A4_combineir:
4312 case Hexagon::dup_A4_combineir:
4314 DstReg =
MI.getOperand(0).getReg();
4315 SrcReg =
MI.getOperand(2).getReg();
4317 ((
MI.getOperand(1).isImm() &&
MI.getOperand(1).getImm() == 0) ||
4318 (
MI.getOperand(1).isGlobal() &&
MI.getOperand(1).getOffset() == 0)))
4321 case Hexagon::A2_sxtb:
4322 case Hexagon::A2_sxth:
4323 case Hexagon::A2_zxtb:
4324 case Hexagon::A2_zxth:
4325 case Hexagon::dup_A2_sxtb:
4326 case Hexagon::dup_A2_sxth:
4327 case Hexagon::dup_A2_zxtb:
4328 case Hexagon::dup_A2_zxth:
4330 DstReg =
MI.getOperand(0).getReg();
4331 SrcReg =
MI.getOperand(1).getReg();
4347 if (
MI.isTransient())
4371 int Idx =
DefMI.findRegisterDefOperandIdx(SR, &HRI,
false,
false);
4382 int Idx =
UseMI.findRegisterUseOperandIdx(SR, &HRI,
false);
4416 : Hexagon::getTruePredOpcode(
Opc);
4417 if (InvPredOpcode >= 0)
4418 return InvPredOpcode;
4425 const uint64_t
F =
MI.getDesc().TSFlags;
4432 return ~(-1U << (bits - 1));
4434 return ~(-1U << bits);
4439 switch (
MI.getOpcode()) {
4440 case Hexagon::L2_loadrbgp:
4441 case Hexagon::L2_loadrdgp:
4442 case Hexagon::L2_loadrhgp:
4443 case Hexagon::L2_loadrigp:
4444 case Hexagon::L2_loadrubgp:
4445 case Hexagon::L2_loadruhgp:
4446 case Hexagon::S2_storerbgp:
4447 case Hexagon::S2_storerbnewgp:
4448 case Hexagon::S2_storerhgp:
4449 case Hexagon::S2_storerhnewgp:
4450 case Hexagon::S2_storerigp:
4451 case Hexagon::S2_storerinewgp:
4452 case Hexagon::S2_storerdgp:
4453 case Hexagon::S2_storerfgp:
4456 const uint64_t
F =
MI.getDesc().TSFlags;
4471 if (
MI.getOpcode() == Hexagon::A4_ext)
4479 const uint64_t
F =
MI.getDesc().TSFlags;
4485 bool ToBigInstrs)
const {
4497 MII->setDesc(
get(Opcode));
4503 bool ToBigInstrs)
const {
4506 End = MB.instr_end();
4507 Instr !=
End; ++Instr)
4515 while ((MII !=
MBB->instr_end()) && MII->isInsideBundle()) {
4524 const uint64_t
F =
MI.getDesc().TSFlags;
4525 unsigned S = (
F >> MemAccessSizePos) & MemAccesSizeMask;
4526 unsigned Size = getMemAccessSizeInBytes(MemAccessSize(S));
4530 if (
MI.getOpcode() == Hexagon::Y2_dcfetchbo)
4537 return HRI.getSpillSize(Hexagon::HvxVRRegClass);
4545 const uint64_t
F =
MI.getDesc().TSFlags;
4552 return -1U << (bits - 1);
4561 short NonExtOpcode = Hexagon::getRegForm(
MI.getOpcode());
4562 if (NonExtOpcode >= 0)
4563 return NonExtOpcode;
4565 if (
MI.getDesc().mayLoad() ||
MI.getDesc().mayStore()) {
4569 return Hexagon::changeAddrMode_abs_io(
MI.getOpcode());
4571 return Hexagon::changeAddrMode_io_rr(
MI.getOpcode());
4573 return Hexagon::changeAddrMode_ur_rr(
MI.getOpcode());
4583 Register &PredReg,
unsigned &PredRegPos,
4592 PredReg =
Cond[1].getReg();
4596 if (
Cond[1].isImplicit())
4604 return Hexagon::getRegForm(
MI.getOpcode());
4612 if (
MI.isDebugInstr() ||
MI.isPosition())
4615 unsigned Size =
MI.getDesc().getSize();
4631 unsigned NumDefs = 0;
4632 for (;
MI.getOperand(NumDefs).
isReg() &&
MI.getOperand(NumDefs).isDef();
4634 assert(NumDefs !=
MI.getNumOperands()-2 &&
"No asm string?");
4636 assert(
MI.getOperand(NumDefs).isSymbol() &&
"No asm string?");
4638 const char *AsmStr =
MI.getOperand(NumDefs).getSymbolName();
4646 const uint64_t
F =
MI.getDesc().TSFlags;
4652 const InstrStage &IS = *
II.beginStage(
MI.getDesc().getSchedClass());
4654 return IS.getUnits();
4664 assert(BundleHead->isBundle() &&
"Not a bundle header");
4674 "Instruction must be extendable");
4680 "Branch with unknown extendable field type");
4692 int TargetPos =
MI.getNumOperands() - 1;
4695 while ((TargetPos > -1) && !
MI.getOperand(TargetPos).isMBB())
4697 assert((TargetPos >= 0) &&
MI.getOperand(TargetPos).isMBB());
4698 MI.getOperand(TargetPos).setMBB(NewTarget);
4702 MI.setDesc(
get(NewOpcode));
4714 for (
unsigned insn = TargetOpcode::GENERIC_OP_END+1;
4715 insn < Hexagon::INSTRUCTION_LIST_END; ++insn) {
4736 int PredRevOpcode = -1;
4738 PredRevOpcode = Hexagon::notTakenBranchPrediction(Opcode);
4740 PredRevOpcode = Hexagon::takenBranchPrediction(Opcode);
4741 assert(PredRevOpcode > 0);
4742 return PredRevOpcode;
4748 return Cond.empty() || (
Cond[0].isImm() && (
Cond.size() != 1));
4755 if (Operand.
isImm())
4756 Operand.
setImm(Operand.
getImm() | memShufDisabledMask);
4764 return (Operand.
isImm() && (Operand.
getImm() & memShufDisabledMask) != 0);
4768 return (
MI->getOpcode() == Hexagon::V6_vmpy_qf16_hf ||
4769 MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
4770 MI->getOpcode() == Hexagon::V6_vmpy_qf32_hf ||
4771 MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
4772 MI->getOpcode() == Hexagon::V6_vmpy_qf32_sf ||
4773 MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
4774 MI->getOpcode() == Hexagon::V6_vmpy_qf16 ||
4775 MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
4776 MI->getOpcode() == Hexagon::V6_vmpy_qf32_qf16 ||
4777 MI->getOpcode() == Hexagon::V6_vmpy_qf32);
4798 case Hexagon::V6_vabs_qf16_hf:
4800 case Hexagon::V6_vabs_qf16_qf16:
4802 case Hexagon::V6_vabs_qf32_qf32:
4804 case Hexagon::V6_vabs_qf32_sf:
4806 case Hexagon::V6_vadd_hf:
4808 case Hexagon::V6_vadd_qf16:
4810 case Hexagon::V6_vadd_qf16_mix:
4812 case Hexagon::V6_vadd_qf32:
4814 case Hexagon::V6_vadd_qf32_mix:
4816 case Hexagon::V6_vadd_sf:
4818 case Hexagon::V6_vconv_bf_qf32:
4820 case Hexagon::V6_vconv_f8_qf16:
4822 case Hexagon::V6_vconv_hf_qf16:
4824 case Hexagon::V6_vconv_hf_qf32:
4826 case Hexagon::V6_vconv_qf16_f8:
4828 case Hexagon::V6_vconv_qf16_hf:
4830 case Hexagon::V6_vconv_qf16_qf16:
4832 case Hexagon::V6_vconv_qf32_qf32:
4834 case Hexagon::V6_vconv_qf32_sf:
4836 case Hexagon::V6_vconv_sf_qf32:
4838 case Hexagon::V6_vilog2_qf16:
4840 case Hexagon::V6_vilog2_qf32:
4842 case Hexagon::V6_vmpy_qf16:
4844 case Hexagon::V6_vmpy_qf16_hf:
4846 case Hexagon::V6_vmpy_qf16_mix_hf:
4848 case Hexagon::V6_vmpy_qf32:
4850 case Hexagon::V6_vmpy_qf32_hf:
4852 case Hexagon::V6_vmpy_qf32_mix_hf:
4854 case Hexagon::V6_vmpy_qf32_qf16:
4856 case Hexagon::V6_vmpy_qf32_sf:
4858 case Hexagon::V6_vmpy_rt_hf:
4860 case Hexagon::V6_vmpy_rt_qf16:
4862 case Hexagon::V6_vmpy_rt_sf:
4864 case Hexagon::V6_vneg_qf16_hf:
4866 case Hexagon::V6_vneg_qf16_qf16:
4868 case Hexagon::V6_vneg_qf32_qf32:
4870 case Hexagon::V6_vneg_qf32_sf:
4872 case Hexagon::V6_vsub_hf:
4874 case Hexagon::V6_vsub_qf16:
4876 case Hexagon::V6_vsub_qf16_mix:
4878 case Hexagon::V6_vsub_qf32:
4880 case Hexagon::V6_vsub_qf32_mix:
4882 case Hexagon::V6_vsub_sf:
4884 case Hexagon::V6_vsub_sf_mix:
4886 case Hexagon::V6_vsub_hf_mix:
4959 if (!
A || !
B ||
A->getParent() !=
B->getParent())
4973 return Opc >= 0 ? Hexagon::changeAddrMode_abs_io(
Opc) :
Opc;
4977 return Opc >= 0 ? Hexagon::changeAddrMode_io_abs(
Opc) :
Opc;
4981 return Opc >= 0 ? Hexagon::changeAddrMode_io_pi(
Opc) :
Opc;
4985 return Opc >= 0 ? Hexagon::changeAddrMode_io_rr(
Opc) :
Opc;
4989 return Opc >= 0 ? Hexagon::changeAddrMode_pi_io(
Opc) :
Opc;
4993 return Opc >= 0 ? Hexagon::changeAddrMode_rr_io(
Opc) :
Opc;
4997 return Opc >= 0 ? Hexagon::changeAddrMode_rr_ur(
Opc) :
Opc;
5001 return Opc >= 0 ? Hexagon::changeAddrMode_ur_rr(
Opc) :
Opc;
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
static bool mayAlias(MachineInstr &MIa, SmallVectorImpl< MachineInstr * > &MemInsns, AliasAnalysis *AA)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool isConstant(const MachineInstr &MI)
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
static const Function * getParent(const Value *V)
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
DXIL Forward Handle Accesses
static bool isSigned(unsigned Opcode)
const HexagonInstrInfo * TII
static void parseOperands(MachineInstr *MI, SmallVector< unsigned, 4 > &Defs, SmallVector< unsigned, 8 > &Uses)
Gather register def/uses from MI.
static cl::opt< bool > DisableNVSchedule("disable-hexagon-nv-schedule", cl::Hidden, cl::desc("Disable schedule adjustment for new value stores."))
const int Hexagon_MEMH_OFFSET_MAX
const int Hexagon_MEMB_OFFSET_MAX
const int Hexagon_MEMH_OFFSET_MIN
const int Hexagon_MEMD_OFFSET_MAX
static cl::opt< bool > EnableTimingClassLatency("enable-timing-class-latency", cl::Hidden, cl::init(false), cl::desc("Enable timing class latency"))
const int Hexagon_MEMD_OFFSET_MIN
const int Hexagon_ADDI_OFFSET_MAX
static cl::opt< bool > EnableACCForwarding("enable-acc-forwarding", cl::Hidden, cl::init(true), cl::desc("Enable vec acc forwarding"))
static void getLiveInRegsAt(LivePhysRegs &Regs, const MachineInstr &MI)
const int Hexagon_MEMW_OFFSET_MAX
Constants for Hexagon instructions.
const int Hexagon_MEMW_OFFSET_MIN
cl::opt< bool > ScheduleInlineAsm("hexagon-sched-inline-asm", cl::Hidden, cl::init(false), cl::desc("Do not consider inline-asm a scheduling/" "packetization boundary."))
const int Hexagon_ADDI_OFFSET_MIN
static cl::opt< bool > BranchRelaxAsmLarge("branch-relax-asm-large", cl::init(true), cl::Hidden, cl::desc("branch relax asm"))
static cl::opt< bool > EnableALUForwarding("enable-alu-forwarding", cl::Hidden, cl::init(true), cl::desc("Enable vec alu forwarding"))
const int Hexagon_MEMB_OFFSET_MIN
static unsigned nonDbgMICount(MachineBasicBlock::const_instr_iterator MIB, MachineBasicBlock::const_instr_iterator MIE)
Calculate number of instructions excluding the debug instructions.
static cl::opt< bool > EnableBranchPrediction("hexagon-enable-branch-prediction", cl::Hidden, cl::init(true), cl::desc("Enable branch prediction"))
static bool isDblRegForSubInst(Register Reg, const HexagonRegisterInfo &HRI)
static void getLiveOutRegsAt(LivePhysRegs &Regs, const MachineInstr &MI)
static cl::opt< bool > UseDFAHazardRec("dfa-hazard-rec", cl::init(true), cl::Hidden, cl::desc("Use the DFA based hazard recognizer."))
static bool isIntRegForSubInst(Register Reg)
static bool isDuplexPairMatch(unsigned Ga, unsigned Gb)
#define HEXAGON_INSTR_SIZE
std::pair< Instruction::BinaryOps, Value * > OffsetOp
Find all possible pairs (BinOp, RHS) that BinOp V, RHS can be simplified.
const size_t AbstractManglingParser< Derived, Alloc >::NumOps
This file implements the LivePhysRegs utility for tracking liveness of physical registers.
static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
Return the first DebugLoc that has line number information, given a range of instructions.
static bool isUndef(const MachineInstr &MI)
Promote Memory to Register
static MCRegister getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo)
static bool isReg(const MCInst &MI, unsigned OpNo)
uint64_t IntrinsicInst * II
PassBuilder PB(Mod->getContext(), Machine, PassOpts->PTO, std::nullopt, &PIC)
static StringRef getName(Value *V)
static bool isBranch(unsigned Opcode)
SmallVector< MachineOperand, 4 > Cond
MachineRegisterInfo & MRI
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
Remove Loads Into Fake Uses
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
int getDuplexOpcode(const MachineInstr &MI, bool ForBigCore=true) 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
MachineInstr * findLoopInstr(MachineBasicBlock *BB, unsigned EndLoopOp, MachineBasicBlock *TargetBB, SmallPtrSet< MachineBasicBlock *, 8 > &Visited) const
Find the hardware loop instruction used to set-up the specified loop.
unsigned getInstrTimingClassLatency(const InstrItineraryData *ItinData, const MachineInstr &MI) const
bool usesQF32Operand(MachineInstr *MI, unsigned Index=0) const
bool isAccumulator(const MachineInstr &MI) const
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
Insert branch code into the end of the specified MachineBasicBlock.
unsigned getInstrLatency(const InstrItineraryData *ItinData, const MachineInstr &MI, unsigned *PredCost=nullptr) const override
Compute the instruction latency of a given instruction.
bool PredOpcodeHasJMP_c(unsigned Opcode) const
bool isNewValue(const MachineInstr &MI) const
Register createVR(MachineFunction *MF, MVT VT) const
HexagonInstrInfo specifics.
bool isDotCurInst(const MachineInstr &MI) const
bool validateBranchCond(const ArrayRef< MachineOperand > &Cond) const
bool isExtended(const MachineInstr &MI) const
bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, unsigned ExtraPredCycles, BranchProbability Probability) const override
Return true if it's profitable to predicate instructions with accumulated instruction latency of "Num...
bool isAsCheapAsAMove(const MachineInstr &MI) const override
int getMaxValue(const MachineInstr &MI) const
bool isPredicateLate(unsigned Opcode) const
short changeAddrMode_rr_ur(short Opc) const
bool isNewValueInst(const MachineInstr &MI) const
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 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 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
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
Register getStackRegister() const
Register getFrameRegister(const MachineFunction &MF) const override
Itinerary data supplied by a subtarget to be used by a target.
unsigned getStageLatency(unsigned ItinClassIndx) const
Return the total stage latency of the given class.
void RemoveMachineInstrFromMaps(MachineInstr &MI)
A set of physical registers with utility functions to track liveness when walking backward/forward th...
LLVM_ABI void stepForward(const MachineInstr &MI, SmallVectorImpl< std::pair< MCPhysReg, const MachineOperand * > > &Clobbers)
Simulates liveness when stepping forward over an instruction(bundle).
LLVM_ABI void stepBackward(const MachineInstr &MI)
Simulates liveness when stepping backwards over an instruction(bundle).
LLVM_ABI void addLiveIns(const MachineBasicBlock &MBB)
Adds all live-in registers of basic block MBB.
LLVM_ABI bool available(const MachineRegisterInfo &MRI, MCRegister Reg) const
Returns true if register Reg and no aliasing register is in the set.
LLVM_ABI void addLiveOuts(const MachineBasicBlock &MBB)
Adds all live-out registers of basic block MBB.
bool contains(MCRegister Reg) const
Returns true if register Reg is contained in the set.
static LocationSize precise(uint64_t Value)
Represents a single loop in the control flow graph.
This class is intended to be used as a base class for asm properties and features specific to the tar...
virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI=nullptr) const
Returns the maximum possible encoded instruction size in bytes.
StringRef getCommentString() const
const char * getSeparatorString() const
MCInstBuilder & addInst(const MCInst *Val)
Add a new MCInst operand.
MCInstBuilder & addImm(int64_t Val)
Add a new integer immediate operand.
Instances of this class represent a single low-level machine instruction.
Describe properties that are true of each instruction in the target description file.
unsigned getSchedClass() const
Return the scheduling class for this instruction.
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
instr_iterator instr_begin()
MachineInstrBundleIterator< const MachineInstr > const_iterator
LLVM_ABI iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
Instructions::iterator instr_iterator
instr_iterator instr_end()
Instructions::const_iterator const_instr_iterator
iterator_range< pred_iterator > predecessors()
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
MachineInstrBundleIterator< MachineInstr > iterator
LLVM_ABI BranchProbability getEdgeProbability(const MachineBasicBlock *Src, const MachineBasicBlock *Dst) const
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
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
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 readsRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr reads the specified register.
bool getFlag(MIFlag Flag) const
Return whether an MI flag is set.
unsigned getNumOperands() const
Retuns the total number of operands.
LLVM_ABI unsigned getNumExplicitOperands() const
Returns the number of non-implicit operands.
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
LLVM_ABI bool hasUnmodeledSideEffects() const
Return true if this instruction has side effects that are not modeled by mayLoad / mayStore,...
LLVM_ABI bool hasOrderedMemoryRef() const
Return true if this instruction may have an ordered or volatile memory reference, or if the informati...
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
const MachineOperand & getOperand(unsigned i) const
LLVM_ABI MachineInstrBundleIterator< MachineInstr > eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
bool isIndirectBranch(QueryType Type=AnyInBundle) const
Return true if this is an indirect branch, such as a branch through a register.
A description of a memory reference used in the backend.
@ MOVolatile
The memory access is volatile.
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
MachineOperand class - Representation of each machine instruction operand.
unsigned getSubReg() const
void setImm(int64_t immVal)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
MachineBasicBlock * getMBB() const
bool isCPI() const
isCPI - Tests if this is a MO_ConstantPoolIndex operand.
LLVM_ABI void setReg(Register Reg)
Change the register this operand corresponds to.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
bool isSymbol() const
isSymbol - Tests if this is a MO_ExternalSymbol operand.
bool isJTI() const
isJTI - Tests if this is a MO_JumpTableIndex operand.
unsigned getTargetFlags() const
static MachineOperand CreateImm(int64_t Val)
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
bool isBlockAddress() const
isBlockAddress - Tests if this is a MO_BlockAddress operand.
Register getReg() const
getReg - Returns the register number.
void addTargetFlag(unsigned F)
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
@ MO_ConstantPoolIndex
Address of indexed Constant in Constant Pool.
@ MO_GlobalAddress
Address of a global value.
@ MO_BlockAddress
Address of a basic block.
@ MO_MachineBasicBlock
MachineBasicBlock reference.
@ MO_ExternalSymbol
Name of external global symbol.
@ MO_JumpTableIndex
Address of indexed Jump Table for switch.
bool isFPImm() const
isFPImm - Tests if this is a MO_FPImmediate operand.
bool isMBB() const
isMBB - Tests if this is a MO_MachineBasicBlock operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Special value supplied for machine level alias analysis.
Wrapper class representing virtual and physical registers.
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
HazardRecognizer - This determines whether or not an instruction can be issued this cycle,...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
constexpr size_t size() const
Get the string size.
constexpr const char * data() const
Get a pointer to the start of the string (which may not be null terminated).
size_t count(char C) const
Return the number of occurrences of C in the string.
Object returned by analyzeLoopForPipelining.
virtual ScheduleHazardRecognizer * CreateTargetPostRAHazardRecognizer(const InstrItineraryData *, const ScheduleDAG *DAG) const
Allocate and return a hazard recognizer to use for this target when scheduling the machine instructio...
virtual bool hasStoreToStackSlot(const MachineInstr &MI, SmallVectorImpl< const MachineMemOperand * > &Accesses) const
If the specified machine instruction has a store to a stack slot, return true along with the FrameInd...
virtual std::optional< unsigned > getOperandLatency(const InstrItineraryData *ItinData, SDNode *DefNode, unsigned DefIdx, SDNode *UseNode, unsigned UseIdx) const
virtual bool hasLoadFromStackSlot(const MachineInstr &MI, SmallVectorImpl< const MachineMemOperand * > &Accesses) const
If the specified machine instruction has a load from a stack slot, return true along with the FrameIn...
Primary interface to the complete machine description for the target machine.
const MCAsmInfo & getMCAsmInfo() const
Return target specific asm information.
TargetSubtargetInfo - Generic base class for all target subtargets.
virtual const InstrItineraryData * getInstrItineraryData() const
getInstrItineraryData - Returns instruction itinerary data for the target or specific subtarget.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
self_iterator getIterator()
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool isSlot0Only(unsigned units)
HexagonII - This namespace holds all of the target specific flags that instruction info tracks.
unsigned const TypeCVI_LAST
static constexpr RegTypeInfo make(RegType Out, RegType In1=RegType::Unknown, RegType In2=RegType::Unknown, RegType In3=RegType::Unknown)
@ RestrictNoSlot1StoreMask
@ RestrictNoSlot1StorePos
unsigned const TypeCVI_FIRST
RegType getOpRegType(unsigned Opcode)
RegTypeInfo getRegTypeInfo(unsigned Opcode)
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
RegState
Flags to represent properties of register accesses.
@ Implicit
Not emitted register (e.g. carry, or temporary result).
@ Kill
The last use of a register.
@ InternalRead
Register reads a value that is defined inside the same instruction or bundle.
@ Undef
Value of the register doesn't matter.
@ NoFlags
No Specific Flags.
constexpr RegState getKillRegState(bool B)
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool is_TC1(unsigned SchedClass)
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.