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);
1174 MRI.clearKillFlags(SrcSubLo);
1177 case Hexagon::V6_hi: {
1180 Register SrcSubHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
1183 MRI.clearKillFlags(SrcSubHi);
1186 case Hexagon::PS_vloadrv_ai: {
1190 int Offset =
MI.getOperand(2).getImm();
1191 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1192 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vL32b_ai
1193 : Hexagon::V6_vL32Ub_ai;
1201 case Hexagon::PS_vloadrw_ai: {
1205 int Offset =
MI.getOperand(2).getImm();
1206 unsigned VecOffset = HRI.getSpillSize(Hexagon::HvxVRRegClass);
1207 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1208 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vL32b_ai
1209 : Hexagon::V6_vL32Ub_ai;
1211 HRI.getSubReg(DstReg, Hexagon::vsub_lo))
1216 HRI.getSubReg(DstReg, Hexagon::vsub_hi))
1223 case Hexagon::PS_vstorerv_ai: {
1228 int Offset =
MI.getOperand(1).getImm();
1229 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1230 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vS32b_ai
1231 : Hexagon::V6_vS32Ub_ai;
1240 case Hexagon::PS_vstorerw_ai: {
1244 int Offset =
MI.getOperand(1).getImm();
1245 unsigned VecOffset = HRI.getSpillSize(Hexagon::HvxVRRegClass);
1246 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1247 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vS32b_ai
1248 : Hexagon::V6_vS32Ub_ai;
1252 .
addReg(HRI.getSubReg(SrcReg, Hexagon::vsub_lo))
1257 .
addReg(HRI.getSubReg(SrcReg, Hexagon::vsub_hi))
1262 case Hexagon::PS_true: {
1270 case Hexagon::PS_false: {
1278 case Hexagon::PS_qtrue: {
1285 case Hexagon::PS_qfalse: {
1292 case Hexagon::PS_vdd0: {
1300 case Hexagon::PS_vmulw: {
1303 Register Src1Reg =
MI.getOperand(1).getReg();
1304 Register Src2Reg =
MI.getOperand(2).getReg();
1305 Register Src1SubHi = HRI.getSubReg(Src1Reg, Hexagon::isub_hi);
1306 Register Src1SubLo = HRI.getSubReg(Src1Reg, Hexagon::isub_lo);
1307 Register Src2SubHi = HRI.getSubReg(Src2Reg, Hexagon::isub_hi);
1308 Register Src2SubLo = HRI.getSubReg(Src2Reg, Hexagon::isub_lo);
1310 HRI.getSubReg(DstReg, Hexagon::isub_hi))
1314 HRI.getSubReg(DstReg, Hexagon::isub_lo))
1318 MRI.clearKillFlags(Src1SubHi);
1319 MRI.clearKillFlags(Src1SubLo);
1320 MRI.clearKillFlags(Src2SubHi);
1321 MRI.clearKillFlags(Src2SubLo);
1324 case Hexagon::PS_vmulw_acc: {
1327 Register Src1Reg =
MI.getOperand(1).getReg();
1328 Register Src2Reg =
MI.getOperand(2).getReg();
1329 Register Src3Reg =
MI.getOperand(3).getReg();
1330 Register Src1SubHi = HRI.getSubReg(Src1Reg, Hexagon::isub_hi);
1331 Register Src1SubLo = HRI.getSubReg(Src1Reg, Hexagon::isub_lo);
1332 Register Src2SubHi = HRI.getSubReg(Src2Reg, Hexagon::isub_hi);
1333 Register Src2SubLo = HRI.getSubReg(Src2Reg, Hexagon::isub_lo);
1334 Register Src3SubHi = HRI.getSubReg(Src3Reg, Hexagon::isub_hi);
1335 Register Src3SubLo = HRI.getSubReg(Src3Reg, Hexagon::isub_lo);
1337 HRI.getSubReg(DstReg, Hexagon::isub_hi))
1342 HRI.getSubReg(DstReg, Hexagon::isub_lo))
1347 MRI.clearKillFlags(Src1SubHi);
1348 MRI.clearKillFlags(Src1SubLo);
1349 MRI.clearKillFlags(Src2SubHi);
1350 MRI.clearKillFlags(Src2SubLo);
1351 MRI.clearKillFlags(Src3SubHi);
1352 MRI.clearKillFlags(Src3SubLo);
1355 case Hexagon::PS_pselect: {
1379 case Hexagon::PS_vselect: {
1412 case Hexagon::PS_wselect: {
1452 case Hexagon::PS_crash: {
1468 void printCustom(
raw_ostream &OS)
const override {
1469 OS <<
"MisalignedCrash";
1473 static const CrashPseudoSourceValue CrashPSV(MF.
getTarget());
1485 case Hexagon::PS_tailcall_i:
1486 MI.setDesc(
get(Hexagon::J2_jump));
1488 case Hexagon::PS_tailcall_r:
1489 case Hexagon::PS_jmpret:
1490 MI.setDesc(
get(Hexagon::J2_jumpr));
1492 case Hexagon::PS_jmprett:
1493 MI.setDesc(
get(Hexagon::J2_jumprt));
1495 case Hexagon::PS_jmpretf:
1496 MI.setDesc(
get(Hexagon::J2_jumprf));
1498 case Hexagon::PS_jmprettnewpt:
1499 MI.setDesc(
get(Hexagon::J2_jumprtnewpt));
1501 case Hexagon::PS_jmpretfnewpt:
1502 MI.setDesc(
get(Hexagon::J2_jumprfnewpt));
1504 case Hexagon::PS_jmprettnew:
1505 MI.setDesc(
get(Hexagon::J2_jumprtnew));
1507 case Hexagon::PS_jmpretfnew:
1508 MI.setDesc(
get(Hexagon::J2_jumprfnew));
1511 case Hexagon::PS_loadrub_pci:
1512 return RealCirc(Hexagon::L2_loadrub_pci,
true, 4);
1513 case Hexagon::PS_loadrb_pci:
1514 return RealCirc(Hexagon::L2_loadrb_pci,
true, 4);
1515 case Hexagon::PS_loadruh_pci:
1516 return RealCirc(Hexagon::L2_loadruh_pci,
true, 4);
1517 case Hexagon::PS_loadrh_pci:
1518 return RealCirc(Hexagon::L2_loadrh_pci,
true, 4);
1519 case Hexagon::PS_loadri_pci:
1520 return RealCirc(Hexagon::L2_loadri_pci,
true, 4);
1521 case Hexagon::PS_loadrd_pci:
1522 return RealCirc(Hexagon::L2_loadrd_pci,
true, 4);
1523 case Hexagon::PS_loadrub_pcr:
1524 return RealCirc(Hexagon::L2_loadrub_pcr,
false, 3);
1525 case Hexagon::PS_loadrb_pcr:
1526 return RealCirc(Hexagon::L2_loadrb_pcr,
false, 3);
1527 case Hexagon::PS_loadruh_pcr:
1528 return RealCirc(Hexagon::L2_loadruh_pcr,
false, 3);
1529 case Hexagon::PS_loadrh_pcr:
1530 return RealCirc(Hexagon::L2_loadrh_pcr,
false, 3);
1531 case Hexagon::PS_loadri_pcr:
1532 return RealCirc(Hexagon::L2_loadri_pcr,
false, 3);
1533 case Hexagon::PS_loadrd_pcr:
1534 return RealCirc(Hexagon::L2_loadrd_pcr,
false, 3);
1535 case Hexagon::PS_storerb_pci:
1536 return RealCirc(Hexagon::S2_storerb_pci,
true, 3);
1537 case Hexagon::PS_storerh_pci:
1538 return RealCirc(Hexagon::S2_storerh_pci,
true, 3);
1539 case Hexagon::PS_storerf_pci:
1540 return RealCirc(Hexagon::S2_storerf_pci,
true, 3);
1541 case Hexagon::PS_storeri_pci:
1542 return RealCirc(Hexagon::S2_storeri_pci,
true, 3);
1543 case Hexagon::PS_storerd_pci:
1544 return RealCirc(Hexagon::S2_storerd_pci,
true, 3);
1545 case Hexagon::PS_storerb_pcr:
1546 return RealCirc(Hexagon::S2_storerb_pcr,
false, 2);
1547 case Hexagon::PS_storerh_pcr:
1548 return RealCirc(Hexagon::S2_storerh_pcr,
false, 2);
1549 case Hexagon::PS_storerf_pcr:
1550 return RealCirc(Hexagon::S2_storerf_pcr,
false, 2);
1551 case Hexagon::PS_storeri_pcr:
1552 return RealCirc(Hexagon::S2_storeri_pcr,
false, 2);
1553 case Hexagon::PS_storerd_pcr:
1554 return RealCirc(Hexagon::S2_storerd_pcr,
false, 2);
1564 unsigned Opc =
MI.getOpcode();
1568 case Hexagon::V6_vgather_vscatter_mh_pseudo:
1571 .
add(
MI.getOperand(2))
1572 .
add(
MI.getOperand(3))
1573 .
add(
MI.getOperand(4));
1575 .
add(
MI.getOperand(2))
1576 .
add(
MI.getOperand(3))
1577 .
add(
MI.getOperand(4))
1580 return First.getInstrIterator();
1581 case Hexagon::V6_vgathermh_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_vgathermw_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_vgathermhw_pseudo:
1607 .
add(
MI.getOperand(2))
1608 .
add(
MI.getOperand(3))
1609 .
add(
MI.getOperand(4));
1611 .
add(
MI.getOperand(0))
1615 return First.getInstrIterator();
1617 case Hexagon::V6_vgathermhq_pseudo:
1619 .
add(
MI.getOperand(2))
1620 .
add(
MI.getOperand(3))
1621 .
add(
MI.getOperand(4))
1622 .
add(
MI.getOperand(5));
1624 .
add(
MI.getOperand(0))
1628 return First.getInstrIterator();
1630 case Hexagon::V6_vgathermwq_pseudo:
1632 .
add(
MI.getOperand(2))
1633 .
add(
MI.getOperand(3))
1634 .
add(
MI.getOperand(4))
1635 .
add(
MI.getOperand(5));
1637 .
add(
MI.getOperand(0))
1641 return First.getInstrIterator();
1643 case Hexagon::V6_vgathermhwq_pseudo:
1645 .
add(
MI.getOperand(2))
1646 .
add(
MI.getOperand(3))
1647 .
add(
MI.getOperand(4))
1648 .
add(
MI.getOperand(5));
1650 .
add(
MI.getOperand(0))
1654 return First.getInstrIterator();
1657 return MI.getIterator();
1666 assert(
Cond[0].isImm() &&
"First entry in the cond vector not imm-val");
1667 unsigned opcode =
Cond[0].getImm();
1673 Cond[0].setImm(NewOpcode);
1688 unsigned BasePos, OffsetPos;
1703 const uint64_t
F =
MI.getDesc().TSFlags;
1714 int Opc =
MI.getOpcode();
1727 unsigned NOp = 0,
NumOps =
MI.getNumOperands();
1730 if (!
Op.isReg() || !
Op.isDef() ||
Op.isImplicit())
1737 unsigned PredRegPos;
1739 bool GotPredReg =
getPredReg(
Cond, PredReg, PredRegPos, PredRegFlags);
1742 T.addReg(PredReg, PredRegFlags);
1744 T.add(
MI.getOperand(NOp++));
1746 MI.setDesc(
get(PredOpc));
1747 while (
unsigned n =
MI.getNumOperands())
1748 MI.removeOperand(n-1);
1749 for (
unsigned i = 0, n =
T->getNumOperands(); i < n; ++i)
1750 MI.addOperand(
T->getOperand(i));
1756 MRI.clearKillFlags(PredReg);
1767 std::vector<MachineOperand> &Pred,
1768 bool SkipDead)
const {
1776 if (RC == &Hexagon::PredRegsRegClass) {
1781 }
else if (MO.isRegMask()) {
1782 for (
Register PR : Hexagon::PredRegsRegClass) {
1783 if (!
MI.modifiesRegister(PR, &HRI))
1794 if (!
MI.getDesc().isPredicable())
1798 if (!Subtarget.usePredicatedCalls())
1803 if (!Subtarget.hasV62Ops()) {
1804 switch (
MI.getOpcode()) {
1805 case Hexagon::V6_vL32b_ai:
1806 case Hexagon::V6_vL32b_pi:
1807 case Hexagon::V6_vL32b_ppu:
1808 case Hexagon::V6_vL32b_cur_ai:
1809 case Hexagon::V6_vL32b_cur_pi:
1810 case Hexagon::V6_vL32b_cur_ppu:
1811 case Hexagon::V6_vL32b_nt_ai:
1812 case Hexagon::V6_vL32b_nt_pi:
1813 case Hexagon::V6_vL32b_nt_ppu:
1814 case Hexagon::V6_vL32b_tmp_ai:
1815 case Hexagon::V6_vL32b_tmp_pi:
1816 case Hexagon::V6_vL32b_tmp_ppu:
1817 case Hexagon::V6_vL32b_nt_cur_ai:
1818 case Hexagon::V6_vL32b_nt_cur_pi:
1819 case Hexagon::V6_vL32b_nt_cur_ppu:
1820 case Hexagon::V6_vL32b_nt_tmp_ai:
1821 case Hexagon::V6_vL32b_nt_tmp_pi:
1822 case Hexagon::V6_vL32b_nt_tmp_ppu:
1830 bool Invert)
const {
1836 case Hexagon::F2_sfadd:
1852 if (
MI.isDebugInstr())
1862 for (
auto *
I :
MBB->successors())
1868 if (
MI.getDesc().isTerminator() ||
MI.isPosition())
1872 if (
MI.getOpcode() == TargetOpcode::INLINEASM_BR)
1896 bool atInsnStart =
true;
1899 for (; *Str; ++Str) {
1903 if (atInsnStart && !
isSpace(
static_cast<unsigned char>(*Str))) {
1905 atInsnStart =
false;
1909 atInsnStart =
false;
1932 int64_t &
Value)
const {
1933 unsigned Opc =
MI.getOpcode();
1937 case Hexagon::C2_cmpeq:
1938 case Hexagon::C2_cmpeqp:
1939 case Hexagon::C2_cmpgt:
1940 case Hexagon::C2_cmpgtp:
1941 case Hexagon::C2_cmpgtu:
1942 case Hexagon::C2_cmpgtup:
1943 case Hexagon::C4_cmpneq:
1944 case Hexagon::C4_cmplte:
1945 case Hexagon::C4_cmplteu:
1946 case Hexagon::C2_cmpeqi:
1947 case Hexagon::C2_cmpgti:
1948 case Hexagon::C2_cmpgtui:
1949 case Hexagon::C4_cmpneqi:
1950 case Hexagon::C4_cmplteui:
1951 case Hexagon::C4_cmpltei:
1952 SrcReg =
MI.getOperand(1).getReg();
1955 case Hexagon::A4_cmpbeq:
1956 case Hexagon::A4_cmpbgt:
1957 case Hexagon::A4_cmpbgtu:
1958 case Hexagon::A4_cmpbeqi:
1959 case Hexagon::A4_cmpbgti:
1960 case Hexagon::A4_cmpbgtui:
1961 SrcReg =
MI.getOperand(1).getReg();
1964 case Hexagon::A4_cmpheq:
1965 case Hexagon::A4_cmphgt:
1966 case Hexagon::A4_cmphgtu:
1967 case Hexagon::A4_cmpheqi:
1968 case Hexagon::A4_cmphgti:
1969 case Hexagon::A4_cmphgtui:
1970 SrcReg =
MI.getOperand(1).getReg();
1977 case Hexagon::C2_cmpeq:
1978 case Hexagon::C2_cmpeqp:
1979 case Hexagon::C2_cmpgt:
1980 case Hexagon::C2_cmpgtp:
1981 case Hexagon::C2_cmpgtu:
1982 case Hexagon::C2_cmpgtup:
1983 case Hexagon::A4_cmpbeq:
1984 case Hexagon::A4_cmpbgt:
1985 case Hexagon::A4_cmpbgtu:
1986 case Hexagon::A4_cmpheq:
1987 case Hexagon::A4_cmphgt:
1988 case Hexagon::A4_cmphgtu:
1989 case Hexagon::C4_cmpneq:
1990 case Hexagon::C4_cmplte:
1991 case Hexagon::C4_cmplteu:
1992 SrcReg2 =
MI.getOperand(2).getReg();
1996 case Hexagon::C2_cmpeqi:
1997 case Hexagon::C2_cmpgtui:
1998 case Hexagon::C2_cmpgti:
1999 case Hexagon::C4_cmpneqi:
2000 case Hexagon::C4_cmplteui:
2001 case Hexagon::C4_cmpltei:
2002 case Hexagon::A4_cmpbeqi:
2003 case Hexagon::A4_cmpbgti:
2004 case Hexagon::A4_cmpbgtui:
2005 case Hexagon::A4_cmpheqi:
2006 case Hexagon::A4_cmphgti:
2007 case Hexagon::A4_cmphgtui: {
2012 Value =
MI.getOperand(2).getImm();
2022 unsigned *PredCost)
const {
2048 unsigned BasePosA, OffsetPosA;
2056 unsigned BasePosB, OffsetPosB;
2063 if (BaseRegA != BaseRegB || BaseSubA != BaseSubB)
2081 if (OffsetA > OffsetB) {
2082 uint64_t OffDiff = (uint64_t)((int64_t)OffsetA - (int64_t)OffsetB);
2083 return SizeB <= OffDiff;
2085 if (OffsetA < OffsetB) {
2086 uint64_t OffDiff = (uint64_t)((int64_t)OffsetB - (int64_t)OffsetA);
2087 return SizeA <= OffDiff;
2097 unsigned BasePos = 0, OffsetPos = 0;
2105 }
else if (
MI.getOpcode() == Hexagon::A2_addi) {
2107 if (AddOp.isImm()) {
2108 Value = AddOp.getImm();
2116std::pair<unsigned, unsigned>
2126 static const std::pair<unsigned, const char*> Flags[] = {
2127 {MO_PCREL,
"hexagon-pcrel"},
2128 {MO_GOT,
"hexagon-got"},
2129 {MO_LO16,
"hexagon-lo16"},
2130 {MO_HI16,
"hexagon-hi16"},
2131 {MO_GPREL,
"hexagon-gprel"},
2132 {MO_GDGOT,
"hexagon-gdgot"},
2133 {MO_GDPLT,
"hexagon-gdplt"},
2134 {MO_IE,
"hexagon-ie"},
2135 {MO_IEGOT,
"hexagon-iegot"},
2136 {MO_TPREL,
"hexagon-tprel"}
2145 static const std::pair<unsigned, const char*> Flags[] = {
2146 {HMOTF_ConstExtended,
"hexagon-ext"}
2154 if (VT == MVT::i1) {
2155 TRC = &Hexagon::PredRegsRegClass;
2156 }
else if (VT == MVT::i32 || VT == MVT::f32) {
2157 TRC = &Hexagon::IntRegsRegClass;
2158 }
else if (VT == MVT::i64 || VT == MVT::f64) {
2159 TRC = &Hexagon::DoubleRegsRegClass;
2173 const uint64_t
F =
MI.getDesc().TSFlags;
2183 !
MI.getDesc().mayStore() &&
2184 MI.getDesc().getOpcode() != Hexagon::S2_allocframe &&
2185 MI.getDesc().getOpcode() != Hexagon::L2_deallocframe &&
2197 const uint64_t
F =
MI.getDesc().TSFlags;
2230 assert(MO.
isImm() &&
"Extendable operand must be Immediate type");
2234 int32_t SValue =
Value;
2237 return SValue < MinValue || SValue > MaxValue;
2242 return UValue < MinValue || UValue > MaxValue;
2246 switch (
MI.getOpcode()) {
2247 case Hexagon::L4_return:
2248 case Hexagon::L4_return_t:
2249 case Hexagon::L4_return_f:
2250 case Hexagon::L4_return_tnew_pnt:
2251 case Hexagon::L4_return_fnew_pnt:
2252 case Hexagon::L4_return_tnew_pt:
2253 case Hexagon::L4_return_fnew_pt:
2274 for (
auto &RegA : DefsA)
2275 for (
auto &RegB : UsesB) {
2292 switch (
MI.getOpcode()) {
2293 case Hexagon::V6_vL32b_cur_pi:
2294 case Hexagon::V6_vL32b_cur_ai:
2318 return (Opcode == Hexagon::ENDLOOP0 ||
2319 Opcode == Hexagon::ENDLOOP1);
2344 switch (
MI.getOpcode()) {
2346 case Hexagon::PS_fi:
2347 case Hexagon::PS_fia:
2360 const uint64_t
F =
MI.getDesc().TSFlags;
2372 unsigned Opcode =
MI.getOpcode();
2373 const uint64_t
F =
get(Opcode).TSFlags;
2382 if (!
I.mayLoad() && !
I.mayStore())
2388 switch (
MI.getOpcode()) {
2389 case Hexagon::J2_callr:
2390 case Hexagon::J2_callrf:
2391 case Hexagon::J2_callrt:
2392 case Hexagon::PS_call_nr:
2399 switch (
MI.getOpcode()) {
2400 case Hexagon::L4_return:
2401 case Hexagon::L4_return_t:
2402 case Hexagon::L4_return_f:
2403 case Hexagon::L4_return_fnew_pnt:
2404 case Hexagon::L4_return_fnew_pt:
2405 case Hexagon::L4_return_tnew_pnt:
2406 case Hexagon::L4_return_tnew_pt:
2413 switch (
MI.getOpcode()) {
2414 case Hexagon::J2_jumpr:
2415 case Hexagon::J2_jumprt:
2416 case Hexagon::J2_jumprf:
2417 case Hexagon::J2_jumprtnewpt:
2418 case Hexagon::J2_jumprfnewpt:
2419 case Hexagon::J2_jumprtnew:
2420 case Hexagon::J2_jumprfnew:
2431 unsigned offset)
const {
2437 switch (
MI.getOpcode()) {
2441 case Hexagon::J2_jump:
2442 case Hexagon::J2_call:
2443 case Hexagon::PS_call_nr:
2445 case Hexagon::J2_jumpt:
2446 case Hexagon::J2_jumpf:
2447 case Hexagon::J2_jumptnew:
2448 case Hexagon::J2_jumptnewpt:
2449 case Hexagon::J2_jumpfnew:
2450 case Hexagon::J2_jumpfnewpt:
2451 case Hexagon::J2_callt:
2452 case Hexagon::J2_callf:
2454 case Hexagon::J2_loop0i:
2455 case Hexagon::J2_loop0iext:
2456 case Hexagon::J2_loop0r:
2457 case Hexagon::J2_loop0rext:
2458 case Hexagon::J2_loop1i:
2459 case Hexagon::J2_loop1iext:
2460 case Hexagon::J2_loop1r:
2461 case Hexagon::J2_loop1rext:
2464 case Hexagon::J4_cmpeqi_tp0_jump_nt:
2465 case Hexagon::J4_cmpeqi_tp1_jump_nt:
2466 case Hexagon::J4_cmpeqn1_tp0_jump_nt:
2467 case Hexagon::J4_cmpeqn1_tp1_jump_nt:
2479 unsigned Opcode =
MI.getOpcode();
2480 return Opcode == Hexagon::J2_loop0i ||
2481 Opcode == Hexagon::J2_loop0r ||
2482 Opcode == Hexagon::J2_loop0iext ||
2483 Opcode == Hexagon::J2_loop0rext ||
2484 Opcode == Hexagon::J2_loop1i ||
2485 Opcode == Hexagon::J2_loop1r ||
2486 Opcode == Hexagon::J2_loop1iext ||
2487 Opcode == Hexagon::J2_loop1rext;
2491 switch (
MI.getOpcode()) {
2492 default:
return false;
2493 case Hexagon::L4_iadd_memopw_io:
2494 case Hexagon::L4_isub_memopw_io:
2495 case Hexagon::L4_add_memopw_io:
2496 case Hexagon::L4_sub_memopw_io:
2497 case Hexagon::L4_and_memopw_io:
2498 case Hexagon::L4_or_memopw_io:
2499 case Hexagon::L4_iadd_memoph_io:
2500 case Hexagon::L4_isub_memoph_io:
2501 case Hexagon::L4_add_memoph_io:
2502 case Hexagon::L4_sub_memoph_io:
2503 case Hexagon::L4_and_memoph_io:
2504 case Hexagon::L4_or_memoph_io:
2505 case Hexagon::L4_iadd_memopb_io:
2506 case Hexagon::L4_isub_memopb_io:
2507 case Hexagon::L4_add_memopb_io:
2508 case Hexagon::L4_sub_memopb_io:
2509 case Hexagon::L4_and_memopb_io:
2510 case Hexagon::L4_or_memopb_io:
2511 case Hexagon::L4_ior_memopb_io:
2512 case Hexagon::L4_ior_memoph_io:
2513 case Hexagon::L4_ior_memopw_io:
2514 case Hexagon::L4_iand_memopb_io:
2515 case Hexagon::L4_iand_memoph_io:
2516 case Hexagon::L4_iand_memopw_io:
2523 const uint64_t
F =
MI.getDesc().TSFlags;
2528 const uint64_t
F =
get(Opcode).TSFlags;
2545 const uint64_t
F =
MI.getDesc().TSFlags;
2550 const uint64_t
F =
get(Opcode).TSFlags;
2556 unsigned OperandNum)
const {
2557 const uint64_t
F =
MI.getDesc().TSFlags;
2563 const uint64_t
F =
MI.getDesc().TSFlags;
2569 const uint64_t
F =
get(Opcode).TSFlags;
2575 const uint64_t
F =
MI.getDesc().TSFlags;
2581 const uint64_t
F =
get(Opcode).TSFlags;
2589 const uint64_t
F =
get(Opcode).TSFlags;
2594 const uint64_t
F =
get(Opcode).TSFlags;
2599 const uint64_t
F =
get(Opcode).TSFlags;
2606 return MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4 ||
2607 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_EXT ||
2608 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_PIC ||
2609 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_EXT_PIC;
2613 switch (
MI.getOpcode()) {
2615 case Hexagon::L2_loadrb_io:
2616 case Hexagon::L4_loadrb_ur:
2617 case Hexagon::L4_loadrb_ap:
2618 case Hexagon::L2_loadrb_pr:
2619 case Hexagon::L2_loadrb_pbr:
2620 case Hexagon::L2_loadrb_pi:
2621 case Hexagon::L2_loadrb_pci:
2622 case Hexagon::L2_loadrb_pcr:
2623 case Hexagon::L2_loadbsw2_io:
2624 case Hexagon::L4_loadbsw2_ur:
2625 case Hexagon::L4_loadbsw2_ap:
2626 case Hexagon::L2_loadbsw2_pr:
2627 case Hexagon::L2_loadbsw2_pbr:
2628 case Hexagon::L2_loadbsw2_pi:
2629 case Hexagon::L2_loadbsw2_pci:
2630 case Hexagon::L2_loadbsw2_pcr:
2631 case Hexagon::L2_loadbsw4_io:
2632 case Hexagon::L4_loadbsw4_ur:
2633 case Hexagon::L4_loadbsw4_ap:
2634 case Hexagon::L2_loadbsw4_pr:
2635 case Hexagon::L2_loadbsw4_pbr:
2636 case Hexagon::L2_loadbsw4_pi:
2637 case Hexagon::L2_loadbsw4_pci:
2638 case Hexagon::L2_loadbsw4_pcr:
2639 case Hexagon::L4_loadrb_rr:
2640 case Hexagon::L2_ploadrbt_io:
2641 case Hexagon::L2_ploadrbt_pi:
2642 case Hexagon::L2_ploadrbf_io:
2643 case Hexagon::L2_ploadrbf_pi:
2644 case Hexagon::L2_ploadrbtnew_io:
2645 case Hexagon::L2_ploadrbfnew_io:
2646 case Hexagon::L4_ploadrbt_rr:
2647 case Hexagon::L4_ploadrbf_rr:
2648 case Hexagon::L4_ploadrbtnew_rr:
2649 case Hexagon::L4_ploadrbfnew_rr:
2650 case Hexagon::L2_ploadrbtnew_pi:
2651 case Hexagon::L2_ploadrbfnew_pi:
2652 case Hexagon::L4_ploadrbt_abs:
2653 case Hexagon::L4_ploadrbf_abs:
2654 case Hexagon::L4_ploadrbtnew_abs:
2655 case Hexagon::L4_ploadrbfnew_abs:
2656 case Hexagon::L2_loadrbgp:
2658 case Hexagon::L2_loadrh_io:
2659 case Hexagon::L4_loadrh_ur:
2660 case Hexagon::L4_loadrh_ap:
2661 case Hexagon::L2_loadrh_pr:
2662 case Hexagon::L2_loadrh_pbr:
2663 case Hexagon::L2_loadrh_pi:
2664 case Hexagon::L2_loadrh_pci:
2665 case Hexagon::L2_loadrh_pcr:
2666 case Hexagon::L4_loadrh_rr:
2667 case Hexagon::L2_ploadrht_io:
2668 case Hexagon::L2_ploadrht_pi:
2669 case Hexagon::L2_ploadrhf_io:
2670 case Hexagon::L2_ploadrhf_pi:
2671 case Hexagon::L2_ploadrhtnew_io:
2672 case Hexagon::L2_ploadrhfnew_io:
2673 case Hexagon::L4_ploadrht_rr:
2674 case Hexagon::L4_ploadrhf_rr:
2675 case Hexagon::L4_ploadrhtnew_rr:
2676 case Hexagon::L4_ploadrhfnew_rr:
2677 case Hexagon::L2_ploadrhtnew_pi:
2678 case Hexagon::L2_ploadrhfnew_pi:
2679 case Hexagon::L4_ploadrht_abs:
2680 case Hexagon::L4_ploadrhf_abs:
2681 case Hexagon::L4_ploadrhtnew_abs:
2682 case Hexagon::L4_ploadrhfnew_abs:
2683 case Hexagon::L2_loadrhgp:
2691 const uint64_t
F =
MI.getDesc().TSFlags;
2696 switch (
MI.getOpcode()) {
2697 case Hexagon::STriw_pred:
2698 case Hexagon::LDriw_pred:
2709 for (
auto &
Op :
MI.operands())
2710 if (
Op.isGlobal() ||
Op.isSymbol())
2717 unsigned SchedClass =
MI.getDesc().getSchedClass();
2718 return is_TC1(SchedClass);
2722 unsigned SchedClass =
MI.getDesc().getSchedClass();
2723 return is_TC2(SchedClass);
2727 unsigned SchedClass =
MI.getDesc().getSchedClass();
2732 unsigned SchedClass =
MI.getDesc().getSchedClass();
2743 for (
int I = 0;
I <
N;
I++)
2748 if (MI2.
getOpcode() == Hexagon::V6_vS32b_pi)
2799 bool Extend)
const {
2809 case Hexagon::PS_vstorerq_ai:
2810 case Hexagon::PS_vstorerv_ai:
2811 case Hexagon::PS_vstorerw_ai:
2812 case Hexagon::PS_vstorerw_nt_ai:
2813 case Hexagon::PS_vloadrq_ai:
2814 case Hexagon::PS_vloadrv_ai:
2815 case Hexagon::PS_vloadrw_ai:
2816 case Hexagon::PS_vloadrw_nt_ai:
2817 case Hexagon::V6_vL32b_ai:
2818 case Hexagon::V6_vS32b_ai:
2819 case Hexagon::V6_vS32b_pred_ai:
2820 case Hexagon::V6_vS32b_npred_ai:
2821 case Hexagon::V6_vS32b_qpred_ai:
2822 case Hexagon::V6_vS32b_nqpred_ai:
2823 case Hexagon::V6_vS32b_new_ai:
2824 case Hexagon::V6_vS32b_new_pred_ai:
2825 case Hexagon::V6_vS32b_new_npred_ai:
2826 case Hexagon::V6_vS32b_nt_pred_ai:
2827 case Hexagon::V6_vS32b_nt_npred_ai:
2828 case Hexagon::V6_vS32b_nt_new_ai:
2829 case Hexagon::V6_vS32b_nt_new_pred_ai:
2830 case Hexagon::V6_vS32b_nt_new_npred_ai:
2831 case Hexagon::V6_vS32b_nt_qpred_ai:
2832 case Hexagon::V6_vS32b_nt_nqpred_ai:
2833 case Hexagon::V6_vL32b_nt_ai:
2834 case Hexagon::V6_vS32b_nt_ai:
2835 case Hexagon::V6_vL32Ub_ai:
2836 case Hexagon::V6_vS32Ub_ai:
2837 case Hexagon::V6_vL32b_cur_ai:
2838 case Hexagon::V6_vL32b_tmp_ai:
2839 case Hexagon::V6_vL32b_pred_ai:
2840 case Hexagon::V6_vL32b_npred_ai:
2841 case Hexagon::V6_vL32b_cur_pred_ai:
2842 case Hexagon::V6_vL32b_cur_npred_ai:
2843 case Hexagon::V6_vL32b_tmp_pred_ai:
2844 case Hexagon::V6_vL32b_tmp_npred_ai:
2845 case Hexagon::V6_vL32b_nt_cur_ai:
2846 case Hexagon::V6_vL32b_nt_tmp_ai:
2847 case Hexagon::V6_vL32b_nt_pred_ai:
2848 case Hexagon::V6_vL32b_nt_npred_ai:
2849 case Hexagon::V6_vL32b_nt_cur_pred_ai:
2850 case Hexagon::V6_vL32b_nt_cur_npred_ai:
2851 case Hexagon::V6_vL32b_nt_tmp_pred_ai:
2852 case Hexagon::V6_vL32b_nt_tmp_npred_ai:
2853 case Hexagon::V6_vS32Ub_pred_ai:
2854 case Hexagon::V6_vS32Ub_npred_ai:
2855 case Hexagon::V6_vgathermh_pseudo:
2856 case Hexagon::V6_vgather_vscatter_mh_pseudo:
2857 case Hexagon::V6_vgathermw_pseudo:
2858 case Hexagon::V6_vgathermhw_pseudo:
2859 case Hexagon::V6_vgathermhq_pseudo:
2860 case Hexagon::V6_vgathermwq_pseudo:
2861 case Hexagon::V6_vgathermhwq_pseudo: {
2862 unsigned VectorSize = RegInfo.getSpillSize(Hexagon::HvxVRRegClass);
2864 if (
Offset & (VectorSize-1))
2869 case Hexagon::J2_loop0i:
2870 case Hexagon::J2_loop1i:
2873 case Hexagon::S4_storeirb_io:
2874 case Hexagon::S4_storeirbt_io:
2875 case Hexagon::S4_storeirbf_io:
2878 case Hexagon::S4_storeirh_io:
2879 case Hexagon::S4_storeirht_io:
2880 case Hexagon::S4_storeirhf_io:
2883 case Hexagon::S4_storeiri_io:
2884 case Hexagon::S4_storeirit_io:
2885 case Hexagon::S4_storeirif_io:
2888 case Hexagon::A4_cmpbeqi:
2890 case Hexagon::A4_cmpbgti:
2898 case Hexagon::L2_loadri_io:
2899 case Hexagon::S2_storeri_io:
2903 case Hexagon::L2_loadrd_io:
2904 case Hexagon::S2_storerd_io:
2908 case Hexagon::L2_loadrh_io:
2909 case Hexagon::L2_loadruh_io:
2910 case Hexagon::S2_storerh_io:
2911 case Hexagon::S2_storerf_io:
2915 case Hexagon::L2_loadrb_io:
2916 case Hexagon::L2_loadrub_io:
2917 case Hexagon::S2_storerb_io:
2921 case Hexagon::A2_addi:
2925 case Hexagon::L4_iadd_memopw_io:
2926 case Hexagon::L4_isub_memopw_io:
2927 case Hexagon::L4_add_memopw_io:
2928 case Hexagon::L4_sub_memopw_io:
2929 case Hexagon::L4_iand_memopw_io:
2930 case Hexagon::L4_ior_memopw_io:
2931 case Hexagon::L4_and_memopw_io:
2932 case Hexagon::L4_or_memopw_io:
2935 case Hexagon::L4_iadd_memoph_io:
2936 case Hexagon::L4_isub_memoph_io:
2937 case Hexagon::L4_add_memoph_io:
2938 case Hexagon::L4_sub_memoph_io:
2939 case Hexagon::L4_iand_memoph_io:
2940 case Hexagon::L4_ior_memoph_io:
2941 case Hexagon::L4_and_memoph_io:
2942 case Hexagon::L4_or_memoph_io:
2945 case Hexagon::L4_iadd_memopb_io:
2946 case Hexagon::L4_isub_memopb_io:
2947 case Hexagon::L4_add_memopb_io:
2948 case Hexagon::L4_sub_memopb_io:
2949 case Hexagon::L4_iand_memopb_io:
2950 case Hexagon::L4_ior_memopb_io:
2951 case Hexagon::L4_and_memopb_io:
2952 case Hexagon::L4_or_memopb_io:
2957 case Hexagon::STriw_pred:
2958 case Hexagon::LDriw_pred:
2959 case Hexagon::STriw_ctr:
2960 case Hexagon::LDriw_ctr:
2963 case Hexagon::PS_fi:
2964 case Hexagon::PS_fia:
2965 case Hexagon::INLINEASM:
2968 case Hexagon::L2_ploadrbt_io:
2969 case Hexagon::L2_ploadrbf_io:
2970 case Hexagon::L2_ploadrubt_io:
2971 case Hexagon::L2_ploadrubf_io:
2972 case Hexagon::S2_pstorerbt_io:
2973 case Hexagon::S2_pstorerbf_io:
2976 case Hexagon::L2_ploadrht_io:
2977 case Hexagon::L2_ploadrhf_io:
2978 case Hexagon::L2_ploadruht_io:
2979 case Hexagon::L2_ploadruhf_io:
2980 case Hexagon::S2_pstorerht_io:
2981 case Hexagon::S2_pstorerhf_io:
2982 case Hexagon::S2_pstorerft_io:
2983 case Hexagon::S2_pstorerff_io:
2986 case Hexagon::L2_ploadrit_io:
2987 case Hexagon::L2_ploadrif_io:
2988 case Hexagon::S2_pstorerit_io:
2989 case Hexagon::S2_pstorerif_io:
2992 case Hexagon::L2_ploadrdt_io:
2993 case Hexagon::L2_ploadrdf_io:
2994 case Hexagon::S2_pstorerdt_io:
2995 case Hexagon::S2_pstorerdf_io:
2998 case Hexagon::L2_loadbsw2_io:
2999 case Hexagon::L2_loadbzw2_io:
3002 case Hexagon::L2_loadbsw4_io:
3003 case Hexagon::L2_loadbzw4_io:
3007 dbgs() <<
"Failed Opcode is : " << Opcode <<
" (" <<
getName(Opcode)
3010 "Please define it in the above switch statement!");
3018 const uint64_t
F =
get(
MI.getOpcode()).TSFlags;
3040 switch (
MI.getOpcode()) {
3042 case Hexagon::L2_loadrub_io:
3043 case Hexagon::L4_loadrub_ur:
3044 case Hexagon::L4_loadrub_ap:
3045 case Hexagon::L2_loadrub_pr:
3046 case Hexagon::L2_loadrub_pbr:
3047 case Hexagon::L2_loadrub_pi:
3048 case Hexagon::L2_loadrub_pci:
3049 case Hexagon::L2_loadrub_pcr:
3050 case Hexagon::L2_loadbzw2_io:
3051 case Hexagon::L4_loadbzw2_ur:
3052 case Hexagon::L4_loadbzw2_ap:
3053 case Hexagon::L2_loadbzw2_pr:
3054 case Hexagon::L2_loadbzw2_pbr:
3055 case Hexagon::L2_loadbzw2_pi:
3056 case Hexagon::L2_loadbzw2_pci:
3057 case Hexagon::L2_loadbzw2_pcr:
3058 case Hexagon::L2_loadbzw4_io:
3059 case Hexagon::L4_loadbzw4_ur:
3060 case Hexagon::L4_loadbzw4_ap:
3061 case Hexagon::L2_loadbzw4_pr:
3062 case Hexagon::L2_loadbzw4_pbr:
3063 case Hexagon::L2_loadbzw4_pi:
3064 case Hexagon::L2_loadbzw4_pci:
3065 case Hexagon::L2_loadbzw4_pcr:
3066 case Hexagon::L4_loadrub_rr:
3067 case Hexagon::L2_ploadrubt_io:
3068 case Hexagon::L2_ploadrubt_pi:
3069 case Hexagon::L2_ploadrubf_io:
3070 case Hexagon::L2_ploadrubf_pi:
3071 case Hexagon::L2_ploadrubtnew_io:
3072 case Hexagon::L2_ploadrubfnew_io:
3073 case Hexagon::L4_ploadrubt_rr:
3074 case Hexagon::L4_ploadrubf_rr:
3075 case Hexagon::L4_ploadrubtnew_rr:
3076 case Hexagon::L4_ploadrubfnew_rr:
3077 case Hexagon::L2_ploadrubtnew_pi:
3078 case Hexagon::L2_ploadrubfnew_pi:
3079 case Hexagon::L4_ploadrubt_abs:
3080 case Hexagon::L4_ploadrubf_abs:
3081 case Hexagon::L4_ploadrubtnew_abs:
3082 case Hexagon::L4_ploadrubfnew_abs:
3083 case Hexagon::L2_loadrubgp:
3085 case Hexagon::L2_loadruh_io:
3086 case Hexagon::L4_loadruh_ur:
3087 case Hexagon::L4_loadruh_ap:
3088 case Hexagon::L2_loadruh_pr:
3089 case Hexagon::L2_loadruh_pbr:
3090 case Hexagon::L2_loadruh_pi:
3091 case Hexagon::L2_loadruh_pci:
3092 case Hexagon::L2_loadruh_pcr:
3093 case Hexagon::L4_loadruh_rr:
3094 case Hexagon::L2_ploadruht_io:
3095 case Hexagon::L2_ploadruht_pi:
3096 case Hexagon::L2_ploadruhf_io:
3097 case Hexagon::L2_ploadruhf_pi:
3098 case Hexagon::L2_ploadruhtnew_io:
3099 case Hexagon::L2_ploadruhfnew_io:
3100 case Hexagon::L4_ploadruht_rr:
3101 case Hexagon::L4_ploadruhf_rr:
3102 case Hexagon::L4_ploadruhtnew_rr:
3103 case Hexagon::L4_ploadruhfnew_rr:
3104 case Hexagon::L2_ploadruhtnew_pi:
3105 case Hexagon::L2_ploadruhfnew_pi:
3106 case Hexagon::L4_ploadruht_abs:
3107 case Hexagon::L4_ploadruhf_abs:
3108 case Hexagon::L4_ploadruhtnew_abs:
3109 case Hexagon::L4_ploadruhfnew_abs:
3110 case Hexagon::L2_loadruhgp:
3130 OffsetIsScalable =
false;
3132 if (!BaseOp || !BaseOp->
isReg())
3141 if (Second.
mayStore() &&
First.getOpcode() == Hexagon::S2_allocframe) {
3143 if (
Op.isReg() &&
Op.isUse() &&
Op.getReg() == Hexagon::R29)
3153 if (!Stored.
isReg())
3155 for (
unsigned i = 0, e =
First.getNumOperands(); i < e; ++i) {
3157 if (
Op.isReg() &&
Op.isDef() &&
Op.getReg() == Stored.
getReg())
3166 return Opc == Hexagon::PS_call_nr ||
Opc == Hexagon::PS_callr_nr;
3182 if (Hexagon::getRegForm(
MI.getOpcode()) >= 0)
3185 if (
MI.getDesc().mayLoad() ||
MI.getDesc().mayStore()) {
3192 NonExtOpcode = Hexagon::changeAddrMode_abs_io(
MI.getOpcode());
3198 NonExtOpcode = Hexagon::changeAddrMode_io_rr(
MI.getOpcode());
3201 NonExtOpcode = Hexagon::changeAddrMode_ur_rr(
MI.getOpcode());
3206 if (NonExtOpcode < 0)
3226 const uint64_t
F =
MI.getDesc().TSFlags;
3228 Subtarget.hasV60Ops();
3233 if (
MI.mayStore() && !Subtarget.useNewValueStores())
3236 const uint64_t
F =
MI.getDesc().TSFlags;
3267 if (!MII->isBundle())
3270 for (++MII; MII != MIE && MII->isInsideBundle(); ++MII) {
3282 if (MO.isRegMask() && MO.clobbersPhysReg(PredReg))
3284 if (MO.isReg() && MO.isDef() && MO.isImplicit() && (MO.getReg() == PredReg))
3290 switch (
MI.getOpcode()) {
3291 case Hexagon::A4_addp_c:
3292 case Hexagon::A4_subp_c:
3293 case Hexagon::A4_tlbmatch:
3294 case Hexagon::A5_ACS:
3295 case Hexagon::F2_sfinvsqrta:
3296 case Hexagon::F2_sfrecipa:
3297 case Hexagon::J2_endloop0:
3298 case Hexagon::J2_endloop01:
3299 case Hexagon::J2_ploop1si:
3300 case Hexagon::J2_ploop1sr:
3301 case Hexagon::J2_ploop2si:
3302 case Hexagon::J2_ploop2sr:
3303 case Hexagon::J2_ploop3si:
3304 case Hexagon::J2_ploop3sr:
3305 case Hexagon::S2_cabacdecbin:
3306 case Hexagon::S2_storew_locked:
3307 case Hexagon::S4_stored_locked:
3314 return Opcode == Hexagon::J2_jumpt ||
3315 Opcode == Hexagon::J2_jumptpt ||
3316 Opcode == Hexagon::J2_jumpf ||
3317 Opcode == Hexagon::J2_jumpfpt ||
3318 Opcode == Hexagon::J2_jumptnew ||
3319 Opcode == Hexagon::J2_jumpfnew ||
3320 Opcode == Hexagon::J2_jumptnewpt ||
3321 Opcode == Hexagon::J2_jumpfnewpt;
3331 const uint64_t
F =
MI.getDesc().TSFlags;
3350 unsigned BasePos = 0, OffsetPos = 0;
3373 unsigned &BasePos,
unsigned &OffsetPos)
const {
3381 }
else if (
MI.mayStore()) {
3384 }
else if (
MI.mayLoad()) {
3399 if (!
MI.getOperand(BasePos).isReg() || !
MI.getOperand(OffsetPos).isImm())
3414 if (
I ==
MBB.instr_begin())
3433 }
while (
I !=
MBB.instr_begin());
3435 I =
MBB.instr_end();
3438 while (
I->isDebugInstr()) {
3439 if (
I ==
MBB.instr_begin())
3443 if (!isUnpredicatedTerminator(*
I))
3452 if (&*
I != LastInst && !
I->isBundle() && isUnpredicatedTerminator(*
I)) {
3453 if (!SecondLastInst) {
3454 SecondLastInst = &*
I;
3459 if (
I ==
MBB.instr_begin())
3468 const uint64_t
F =
MI.getDesc().TSFlags;
3476 Register DstReg, SrcReg, Src1Reg, Src2Reg;
3478 switch (
MI.getOpcode()) {
3487 case Hexagon::C2_cmpeq:
3488 case Hexagon::C2_cmpgt:
3489 case Hexagon::C2_cmpgtu:
3490 DstReg =
MI.getOperand(0).getReg();
3491 Src1Reg =
MI.getOperand(1).getReg();
3492 Src2Reg =
MI.getOperand(2).getReg();
3493 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3494 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3498 case Hexagon::C2_cmpeqi:
3499 case Hexagon::C2_cmpgti:
3500 case Hexagon::C2_cmpgtui:
3502 DstReg =
MI.getOperand(0).getReg();
3503 SrcReg =
MI.getOperand(1).getReg();
3504 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3505 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3508 (
MI.getOperand(2).getImm() == -1)))
3511 case Hexagon::A2_tfr:
3513 DstReg =
MI.getOperand(0).getReg();
3514 SrcReg =
MI.getOperand(1).getReg();
3518 case Hexagon::A2_tfrsi:
3522 DstReg =
MI.getOperand(0).getReg();
3526 case Hexagon::S2_tstbit_i:
3527 DstReg =
MI.getOperand(0).getReg();
3528 Src1Reg =
MI.getOperand(1).getReg();
3529 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3530 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3531 MI.getOperand(2).isImm() &&
3539 case Hexagon::J2_jumptnew:
3540 case Hexagon::J2_jumpfnew:
3541 case Hexagon::J2_jumptnewpt:
3542 case Hexagon::J2_jumpfnewpt:
3543 Src1Reg =
MI.getOperand(0).getReg();
3544 if (Hexagon::PredRegsRegClass.
contains(Src1Reg) &&
3545 (Hexagon::P0 == Src1Reg || Hexagon::P1 == Src1Reg))
3552 case Hexagon::J2_jump:
3553 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4:
3554 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4_PIC:
3566 if ((GA.
getOpcode() != Hexagon::C2_cmpeqi) ||
3567 (GB.
getOpcode() != Hexagon::J2_jumptnew))
3572 if (DestReg != Hexagon::P0 && DestReg != Hexagon::P1)
3580 return DestReg == Hexagon::P0 ? Hexagon::J4_cmpeqn1_tp0_jump_nt
3581 : Hexagon::J4_cmpeqn1_tp1_jump_nt;
3584 return DestReg == Hexagon::P0 ? Hexagon::J4_cmpeqi_tp0_jump_nt
3585 : Hexagon::J4_cmpeqi_tp1_jump_nt;
3590 bool ForBigCore)
const {
3598 static const std::map<unsigned, unsigned> DupMap = {
3599 {Hexagon::A2_add, Hexagon::dup_A2_add},
3600 {Hexagon::A2_addi, Hexagon::dup_A2_addi},
3601 {Hexagon::A2_andir, Hexagon::dup_A2_andir},
3602 {Hexagon::A2_combineii, Hexagon::dup_A2_combineii},
3603 {Hexagon::A2_sxtb, Hexagon::dup_A2_sxtb},
3604 {Hexagon::A2_sxth, Hexagon::dup_A2_sxth},
3605 {Hexagon::A2_tfr, Hexagon::dup_A2_tfr},
3606 {Hexagon::A2_tfrsi, Hexagon::dup_A2_tfrsi},
3607 {Hexagon::A2_zxtb, Hexagon::dup_A2_zxtb},
3608 {Hexagon::A2_zxth, Hexagon::dup_A2_zxth},
3609 {Hexagon::A4_combineii, Hexagon::dup_A4_combineii},
3610 {Hexagon::A4_combineir, Hexagon::dup_A4_combineir},
3611 {Hexagon::A4_combineri, Hexagon::dup_A4_combineri},
3612 {Hexagon::C2_cmoveif, Hexagon::dup_C2_cmoveif},
3613 {Hexagon::C2_cmoveit, Hexagon::dup_C2_cmoveit},
3614 {Hexagon::C2_cmovenewif, Hexagon::dup_C2_cmovenewif},
3615 {Hexagon::C2_cmovenewit, Hexagon::dup_C2_cmovenewit},
3616 {Hexagon::C2_cmpeqi, Hexagon::dup_C2_cmpeqi},
3617 {Hexagon::L2_deallocframe, Hexagon::dup_L2_deallocframe},
3618 {Hexagon::L2_loadrb_io, Hexagon::dup_L2_loadrb_io},
3619 {Hexagon::L2_loadrd_io, Hexagon::dup_L2_loadrd_io},
3620 {Hexagon::L2_loadrh_io, Hexagon::dup_L2_loadrh_io},
3621 {Hexagon::L2_loadri_io, Hexagon::dup_L2_loadri_io},
3622 {Hexagon::L2_loadrub_io, Hexagon::dup_L2_loadrub_io},
3623 {Hexagon::L2_loadruh_io, Hexagon::dup_L2_loadruh_io},
3624 {Hexagon::S2_allocframe, Hexagon::dup_S2_allocframe},
3625 {Hexagon::S2_storerb_io, Hexagon::dup_S2_storerb_io},
3626 {Hexagon::S2_storerd_io, Hexagon::dup_S2_storerd_io},
3627 {Hexagon::S2_storerh_io, Hexagon::dup_S2_storerh_io},
3628 {Hexagon::S2_storeri_io, Hexagon::dup_S2_storeri_io},
3629 {Hexagon::S4_storeirb_io, Hexagon::dup_S4_storeirb_io},
3630 {Hexagon::S4_storeiri_io, Hexagon::dup_S4_storeiri_io},
3632 unsigned OpNum =
MI.getOpcode();
3635 auto Iter = DupMap.find(OpNum);
3636 if (Iter != DupMap.end())
3637 return Iter->second;
3639 for (
const auto &Iter : DupMap)
3640 if (Iter.second == OpNum)
3647 enum Hexagon::PredSense inPredSense;
3648 inPredSense = invertPredicate ? Hexagon::PredSense_false :
3649 Hexagon::PredSense_true;
3650 int CondOpcode = Hexagon::getPredOpcode(
Opc, inPredSense);
3651 if (CondOpcode >= 0)
3659 switch (
MI.getOpcode()) {
3661 case Hexagon::V6_vL32b_pi:
3662 return Hexagon::V6_vL32b_cur_pi;
3663 case Hexagon::V6_vL32b_ai:
3664 return Hexagon::V6_vL32b_cur_ai;
3665 case Hexagon::V6_vL32b_nt_pi:
3666 return Hexagon::V6_vL32b_nt_cur_pi;
3667 case Hexagon::V6_vL32b_nt_ai:
3668 return Hexagon::V6_vL32b_nt_cur_ai;
3669 case Hexagon::V6_vL32b_ppu:
3670 return Hexagon::V6_vL32b_cur_ppu;
3671 case Hexagon::V6_vL32b_nt_ppu:
3672 return Hexagon::V6_vL32b_nt_cur_ppu;
3679 switch (
MI.getOpcode()) {
3681 case Hexagon::V6_vL32b_cur_pi:
3682 return Hexagon::V6_vL32b_pi;
3683 case Hexagon::V6_vL32b_cur_ai:
3684 return Hexagon::V6_vL32b_ai;
3685 case Hexagon::V6_vL32b_nt_cur_pi:
3686 return Hexagon::V6_vL32b_nt_pi;
3687 case Hexagon::V6_vL32b_nt_cur_ai:
3688 return Hexagon::V6_vL32b_nt_ai;
3689 case Hexagon::V6_vL32b_cur_ppu:
3690 return Hexagon::V6_vL32b_ppu;
3691 case Hexagon::V6_vL32b_nt_cur_ppu:
3692 return Hexagon::V6_vL32b_nt_ppu;
3780 int NVOpcode = Hexagon::getNewValueOpcode(
MI.getOpcode());
3784 switch (
MI.getOpcode()) {
3787 std::to_string(
MI.getOpcode()));
3788 case Hexagon::S4_storerb_ur:
3789 return Hexagon::S4_storerbnew_ur;
3791 case Hexagon::S2_storerb_pci:
3792 return Hexagon::S2_storerb_pci;
3794 case Hexagon::S2_storeri_pci:
3795 return Hexagon::S2_storeri_pci;
3797 case Hexagon::S2_storerh_pci:
3798 return Hexagon::S2_storerh_pci;
3800 case Hexagon::S2_storerd_pci:
3801 return Hexagon::S2_storerd_pci;
3803 case Hexagon::S2_storerf_pci:
3804 return Hexagon::S2_storerf_pci;
3806 case Hexagon::V6_vS32b_ai:
3807 return Hexagon::V6_vS32b_new_ai;
3809 case Hexagon::V6_vS32b_pi:
3810 return Hexagon::V6_vS32b_new_pi;
3835 if (BrTarget.
isMBB()) {
3837 Taken = getEdgeProbability(Src, Dst) >= OneHalf;
3850 bool SawCond =
false, Bad =
false;
3854 if (
I.isConditionalBranch()) {
3861 if (
I.isUnconditionalBranch() && !SawCond) {
3869 if (NextIt ==
B.instr_end()) {
3872 if (!
B.isLayoutSuccessor(SB))
3874 Taken = getEdgeProbability(Src, SB) < OneHalf;
3878 assert(NextIt->isUnconditionalBranch());
3887 Taken =
BT && getEdgeProbability(Src,
BT) < OneHalf;
3894 switch (
MI.getOpcode()) {
3895 case Hexagon::J2_jumpt:
3896 return Taken ? Hexagon::J2_jumptnewpt : Hexagon::J2_jumptnew;
3897 case Hexagon::J2_jumpf:
3898 return Taken ? Hexagon::J2_jumpfnewpt : Hexagon::J2_jumpfnew;
3908 switch (
MI.getOpcode()) {
3910 case Hexagon::J2_jumpt:
3911 case Hexagon::J2_jumpf:
3915 int NewOpcode = Hexagon::getPredNewOpcode(
MI.getOpcode());
3922 int NewOp =
MI.getOpcode();
3924 NewOp = Hexagon::getPredOldOpcode(NewOp);
3928 if (!Subtarget.hasFeature(Hexagon::ArchV60)) {
3930 case Hexagon::J2_jumptpt:
3931 NewOp = Hexagon::J2_jumpt;
3933 case Hexagon::J2_jumpfpt:
3934 NewOp = Hexagon::J2_jumpf;
3936 case Hexagon::J2_jumprtpt:
3937 NewOp = Hexagon::J2_jumprt;
3939 case Hexagon::J2_jumprfpt:
3940 NewOp = Hexagon::J2_jumprf;
3945 "Couldn't change predicate new instruction to its old form.");
3949 NewOp = Hexagon::getNonNVStore(NewOp);
3950 assert(NewOp >= 0 &&
"Couldn't change new-value store to its old form.");
3953 if (Subtarget.hasV60Ops())
3958 case Hexagon::J2_jumpfpt:
3959 return Hexagon::J2_jumpf;
3960 case Hexagon::J2_jumptpt:
3961 return Hexagon::J2_jumpt;
3962 case Hexagon::J2_jumprfpt:
3963 return Hexagon::J2_jumprf;
3964 case Hexagon::J2_jumprtpt:
3965 return Hexagon::J2_jumprt;
3974 Register DstReg, SrcReg, Src1Reg, Src2Reg;
3977 switch (
MI.getOpcode()) {
3985 case Hexagon::L2_loadri_io:
3986 case Hexagon::dup_L2_loadri_io:
3987 DstReg =
MI.getOperand(0).getReg();
3988 SrcReg =
MI.getOperand(1).getReg();
3992 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
3994 MI.getOperand(2).isImm() &&
3999 (
MI.getOperand(2).isImm() &&
4004 case Hexagon::L2_loadrub_io:
4005 case Hexagon::dup_L2_loadrub_io:
4007 DstReg =
MI.getOperand(0).getReg();
4008 SrcReg =
MI.getOperand(1).getReg();
4010 MI.getOperand(2).isImm() &&
isUInt<4>(
MI.getOperand(2).getImm()))
4023 case Hexagon::L2_loadrh_io:
4024 case Hexagon::L2_loadruh_io:
4025 case Hexagon::dup_L2_loadrh_io:
4026 case Hexagon::dup_L2_loadruh_io:
4028 DstReg =
MI.getOperand(0).getReg();
4029 SrcReg =
MI.getOperand(1).getReg();
4031 MI.getOperand(2).isImm() &&
4035 case Hexagon::L2_loadrb_io:
4036 case Hexagon::dup_L2_loadrb_io:
4038 DstReg =
MI.getOperand(0).getReg();
4039 SrcReg =
MI.getOperand(1).getReg();
4041 MI.getOperand(2).isImm() &&
4045 case Hexagon::L2_loadrd_io:
4046 case Hexagon::dup_L2_loadrd_io:
4048 DstReg =
MI.getOperand(0).getReg();
4049 SrcReg =
MI.getOperand(1).getReg();
4051 Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4053 MI.getOperand(2).isImm() &&
4059 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4:
4060 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4_PIC:
4061 case Hexagon::L4_return:
4062 case Hexagon::L2_deallocframe:
4063 case Hexagon::dup_L2_deallocframe:
4065 case Hexagon::EH_RETURN_JMPR:
4066 case Hexagon::PS_jmpret:
4067 case Hexagon::SL2_jumpr31:
4070 DstReg =
MI.getOperand(0).getReg();
4071 if (Hexagon::IntRegsRegClass.
contains(DstReg) && (Hexagon::R31 == DstReg))
4074 case Hexagon::PS_jmprett:
4075 case Hexagon::PS_jmpretf:
4076 case Hexagon::PS_jmprettnewpt:
4077 case Hexagon::PS_jmpretfnewpt:
4078 case Hexagon::PS_jmprettnew:
4079 case Hexagon::PS_jmpretfnew:
4080 case Hexagon::SL2_jumpr31_t:
4081 case Hexagon::SL2_jumpr31_f:
4082 case Hexagon::SL2_jumpr31_tnew:
4083 case Hexagon::SL2_jumpr31_fnew:
4084 DstReg =
MI.getOperand(1).getReg();
4085 SrcReg =
MI.getOperand(0).getReg();
4087 if ((Hexagon::PredRegsRegClass.
contains(SrcReg) &&
4088 (Hexagon::P0 == SrcReg)) &&
4089 (Hexagon::IntRegsRegClass.
contains(DstReg) && (Hexagon::R31 == DstReg)))
4092 case Hexagon::L4_return_t:
4093 case Hexagon::L4_return_f:
4094 case Hexagon::L4_return_tnew_pnt:
4095 case Hexagon::L4_return_fnew_pnt:
4096 case Hexagon::L4_return_tnew_pt:
4097 case Hexagon::L4_return_fnew_pt:
4099 SrcReg =
MI.getOperand(0).getReg();
4100 if (Hexagon::PredRegsRegClass.
contains(SrcReg) && (Hexagon::P0 == SrcReg))
4108 case Hexagon::S2_storeri_io:
4109 case Hexagon::dup_S2_storeri_io:
4112 Src1Reg =
MI.getOperand(0).getReg();
4113 Src2Reg =
MI.getOperand(2).getReg();
4114 if (Hexagon::IntRegsRegClass.
contains(Src1Reg) &&
4121 MI.getOperand(1).isImm() &&
4125 case Hexagon::S2_storerb_io:
4126 case Hexagon::dup_S2_storerb_io:
4128 Src1Reg =
MI.getOperand(0).getReg();
4129 Src2Reg =
MI.getOperand(2).getReg();
4131 MI.getOperand(1).isImm() &&
isUInt<4>(
MI.getOperand(1).getImm()))
4143 case Hexagon::S2_storerh_io:
4144 case Hexagon::dup_S2_storerh_io:
4146 Src1Reg =
MI.getOperand(0).getReg();
4147 Src2Reg =
MI.getOperand(2).getReg();
4149 MI.getOperand(1).isImm() &&
4153 case Hexagon::S2_storerd_io:
4154 case Hexagon::dup_S2_storerd_io:
4156 Src1Reg =
MI.getOperand(0).getReg();
4157 Src2Reg =
MI.getOperand(2).getReg();
4159 Hexagon::IntRegsRegClass.
contains(Src1Reg) &&
4164 case Hexagon::S4_storeiri_io:
4165 case Hexagon::dup_S4_storeiri_io:
4167 Src1Reg =
MI.getOperand(0).getReg();
4170 MI.getOperand(2).isImm() &&
isUInt<1>(
MI.getOperand(2).getImm()))
4173 case Hexagon::S4_storeirb_io:
4174 case Hexagon::dup_S4_storeirb_io:
4176 Src1Reg =
MI.getOperand(0).getReg();
4178 MI.getOperand(1).isImm() &&
isUInt<4>(
MI.getOperand(1).getImm()) &&
4179 MI.getOperand(2).isImm() &&
isUInt<1>(
MI.getOperand(2).getImm()))
4182 case Hexagon::S2_allocframe:
4183 case Hexagon::dup_S2_allocframe:
4184 if (
MI.getOperand(2).isImm() &&
4206 case Hexagon::A2_addi:
4207 case Hexagon::dup_A2_addi:
4208 DstReg =
MI.getOperand(0).getReg();
4209 SrcReg =
MI.getOperand(1).getReg();
4212 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4217 if ((DstReg == SrcReg) &&
MI.getOperand(2).isImm() &&
4223 ((
MI.getOperand(2).getImm() == 1) ||
4224 (
MI.getOperand(2).getImm() == -1)))
4228 case Hexagon::A2_add:
4229 case Hexagon::dup_A2_add:
4231 DstReg =
MI.getOperand(0).getReg();
4232 Src1Reg =
MI.getOperand(1).getReg();
4233 Src2Reg =
MI.getOperand(2).getReg();
4238 case Hexagon::A2_andir:
4239 case Hexagon::dup_A2_andir:
4243 DstReg =
MI.getOperand(0).getReg();
4244 SrcReg =
MI.getOperand(1).getReg();
4246 MI.getOperand(2).isImm() &&
4247 ((
MI.getOperand(2).getImm() == 1) ||
4248 (
MI.getOperand(2).getImm() == 255)))
4251 case Hexagon::A2_tfr:
4252 case Hexagon::dup_A2_tfr:
4254 DstReg =
MI.getOperand(0).getReg();
4255 SrcReg =
MI.getOperand(1).getReg();
4259 case Hexagon::A2_tfrsi:
4260 case Hexagon::dup_A2_tfrsi:
4265 DstReg =
MI.getOperand(0).getReg();
4269 case Hexagon::C2_cmoveit:
4270 case Hexagon::C2_cmovenewit:
4271 case Hexagon::C2_cmoveif:
4272 case Hexagon::C2_cmovenewif:
4273 case Hexagon::dup_C2_cmoveit:
4274 case Hexagon::dup_C2_cmovenewit:
4275 case Hexagon::dup_C2_cmoveif:
4276 case Hexagon::dup_C2_cmovenewif:
4280 DstReg =
MI.getOperand(0).getReg();
4281 SrcReg =
MI.getOperand(1).getReg();
4283 Hexagon::PredRegsRegClass.
contains(SrcReg) && Hexagon::P0 == SrcReg &&
4284 MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0)
4287 case Hexagon::C2_cmpeqi:
4288 case Hexagon::dup_C2_cmpeqi:
4290 DstReg =
MI.getOperand(0).getReg();
4291 SrcReg =
MI.getOperand(1).getReg();
4292 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
4294 MI.getOperand(2).isImm() &&
isUInt<2>(
MI.getOperand(2).getImm()))
4297 case Hexagon::A2_combineii:
4298 case Hexagon::A4_combineii:
4299 case Hexagon::dup_A2_combineii:
4300 case Hexagon::dup_A4_combineii:
4302 DstReg =
MI.getOperand(0).getReg();
4304 ((
MI.getOperand(1).isImm() &&
isUInt<2>(
MI.getOperand(1).getImm())) ||
4305 (
MI.getOperand(1).isGlobal() &&
4307 ((
MI.getOperand(2).isImm() &&
isUInt<2>(
MI.getOperand(2).getImm())) ||
4308 (
MI.getOperand(2).isGlobal() &&
4312 case Hexagon::A4_combineri:
4313 case Hexagon::dup_A4_combineri:
4316 DstReg =
MI.getOperand(0).getReg();
4317 SrcReg =
MI.getOperand(1).getReg();
4319 ((
MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0) ||
4320 (
MI.getOperand(2).isGlobal() &&
MI.getOperand(2).getOffset() == 0)))
4323 case Hexagon::A4_combineir:
4324 case Hexagon::dup_A4_combineir:
4326 DstReg =
MI.getOperand(0).getReg();
4327 SrcReg =
MI.getOperand(2).getReg();
4329 ((
MI.getOperand(1).isImm() &&
MI.getOperand(1).getImm() == 0) ||
4330 (
MI.getOperand(1).isGlobal() &&
MI.getOperand(1).getOffset() == 0)))
4333 case Hexagon::A2_sxtb:
4334 case Hexagon::A2_sxth:
4335 case Hexagon::A2_zxtb:
4336 case Hexagon::A2_zxth:
4337 case Hexagon::dup_A2_sxtb:
4338 case Hexagon::dup_A2_sxth:
4339 case Hexagon::dup_A2_zxtb:
4340 case Hexagon::dup_A2_zxth:
4342 DstReg =
MI.getOperand(0).getReg();
4343 SrcReg =
MI.getOperand(1).getReg();
4359 if (
MI.isTransient())
4383 int Idx =
DefMI.findRegisterDefOperandIdx(SR, &HRI,
false,
false);
4394 int Idx =
UseMI.findRegisterUseOperandIdx(SR, &HRI,
false);
4428 : Hexagon::getTruePredOpcode(
Opc);
4429 if (InvPredOpcode >= 0)
4430 return InvPredOpcode;
4437 const uint64_t
F =
MI.getDesc().TSFlags;
4444 return ~(-1U << (bits - 1));
4446 return ~(-1U << bits);
4451 switch (
MI.getOpcode()) {
4452 case Hexagon::L2_loadrbgp:
4453 case Hexagon::L2_loadrdgp:
4454 case Hexagon::L2_loadrhgp:
4455 case Hexagon::L2_loadrigp:
4456 case Hexagon::L2_loadrubgp:
4457 case Hexagon::L2_loadruhgp:
4458 case Hexagon::S2_storerbgp:
4459 case Hexagon::S2_storerbnewgp:
4460 case Hexagon::S2_storerhgp:
4461 case Hexagon::S2_storerhnewgp:
4462 case Hexagon::S2_storerigp:
4463 case Hexagon::S2_storerinewgp:
4464 case Hexagon::S2_storerdgp:
4465 case Hexagon::S2_storerfgp:
4468 const uint64_t
F =
MI.getDesc().TSFlags;
4483 if (
MI.getOpcode() == Hexagon::A4_ext)
4491 const uint64_t
F =
MI.getDesc().TSFlags;
4497 bool ToBigInstrs)
const {
4509 MII->setDesc(
get(Opcode));
4515 bool ToBigInstrs)
const {
4518 End = MB.instr_end();
4519 Instr !=
End; ++Instr)
4527 while ((MII !=
MBB->instr_end()) && MII->isInsideBundle()) {
4536 const uint64_t
F =
MI.getDesc().TSFlags;
4537 unsigned S = (
F >> MemAccessSizePos) & MemAccesSizeMask;
4538 unsigned Size = getMemAccessSizeInBytes(MemAccessSize(S));
4542 if (
MI.getOpcode() == Hexagon::Y2_dcfetchbo)
4549 return HRI.getSpillSize(Hexagon::HvxVRRegClass);
4557 const uint64_t
F =
MI.getDesc().TSFlags;
4564 return -1U << (bits - 1);
4573 short NonExtOpcode = Hexagon::getRegForm(
MI.getOpcode());
4574 if (NonExtOpcode >= 0)
4575 return NonExtOpcode;
4577 if (
MI.getDesc().mayLoad() ||
MI.getDesc().mayStore()) {
4581 return Hexagon::changeAddrMode_abs_io(
MI.getOpcode());
4583 return Hexagon::changeAddrMode_io_rr(
MI.getOpcode());
4585 return Hexagon::changeAddrMode_ur_rr(
MI.getOpcode());
4595 Register &PredReg,
unsigned &PredRegPos,
4604 PredReg =
Cond[1].getReg();
4608 if (
Cond[1].isImplicit())
4616 return Hexagon::getRegForm(
MI.getOpcode());
4624 if (
MI.isDebugInstr() ||
MI.isPosition())
4627 unsigned Size =
MI.getDesc().getSize();
4643 unsigned NumDefs = 0;
4644 for (;
MI.getOperand(NumDefs).
isReg() &&
MI.getOperand(NumDefs).isDef();
4646 assert(NumDefs !=
MI.getNumOperands()-2 &&
"No asm string?");
4648 assert(
MI.getOperand(NumDefs).isSymbol() &&
"No asm string?");
4650 const char *AsmStr =
MI.getOperand(NumDefs).getSymbolName();
4658 const uint64_t
F =
MI.getDesc().TSFlags;
4664 const InstrStage &IS = *
II.beginStage(
MI.getDesc().getSchedClass());
4666 return IS.getUnits();
4676 assert(BundleHead->isBundle() &&
"Not a bundle header");
4686 "Instruction must be extendable");
4692 "Branch with unknown extendable field type");
4704 int TargetPos =
MI.getNumOperands() - 1;
4707 while ((TargetPos > -1) && !
MI.getOperand(TargetPos).isMBB())
4709 assert((TargetPos >= 0) &&
MI.getOperand(TargetPos).isMBB());
4710 MI.getOperand(TargetPos).setMBB(NewTarget);
4714 MI.setDesc(
get(NewOpcode));
4726 for (
unsigned insn = TargetOpcode::GENERIC_OP_END+1;
4727 insn < Hexagon::INSTRUCTION_LIST_END; ++insn) {
4748 int PredRevOpcode = -1;
4750 PredRevOpcode = Hexagon::notTakenBranchPrediction(Opcode);
4752 PredRevOpcode = Hexagon::takenBranchPrediction(Opcode);
4753 assert(PredRevOpcode > 0);
4754 return PredRevOpcode;
4760 return Cond.empty() || (
Cond[0].isImm() && (
Cond.size() != 1));
4767 if (Operand.
isImm())
4768 Operand.
setImm(Operand.
getImm() | memShufDisabledMask);
4776 return (Operand.
isImm() && (Operand.
getImm() & memShufDisabledMask) != 0);
4780 return (
MI->getOpcode() == Hexagon::V6_vmpy_qf16_hf ||
4781 MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
4782 MI->getOpcode() == Hexagon::V6_vmpy_qf32_hf ||
4783 MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
4784 MI->getOpcode() == Hexagon::V6_vmpy_qf32_sf ||
4785 MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
4786 MI->getOpcode() == Hexagon::V6_vmpy_qf16 ||
4787 MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
4788 MI->getOpcode() == Hexagon::V6_vmpy_qf32_qf16 ||
4789 MI->getOpcode() == Hexagon::V6_vmpy_qf32);
4810 case Hexagon::V6_vabs_qf16_hf:
4812 case Hexagon::V6_vabs_qf16_qf16:
4814 case Hexagon::V6_vabs_qf32_qf32:
4816 case Hexagon::V6_vabs_qf32_sf:
4818 case Hexagon::V6_vadd_hf:
4820 case Hexagon::V6_vadd_qf16:
4822 case Hexagon::V6_vadd_qf16_mix:
4824 case Hexagon::V6_vadd_qf32:
4826 case Hexagon::V6_vadd_qf32_mix:
4828 case Hexagon::V6_vadd_sf:
4830 case Hexagon::V6_vconv_bf_qf32:
4832 case Hexagon::V6_vconv_f8_qf16:
4834 case Hexagon::V6_vconv_hf_qf16:
4836 case Hexagon::V6_vconv_hf_qf32:
4838 case Hexagon::V6_vconv_qf16_f8:
4840 case Hexagon::V6_vconv_qf16_hf:
4842 case Hexagon::V6_vconv_qf16_qf16:
4844 case Hexagon::V6_vconv_qf32_qf32:
4846 case Hexagon::V6_vconv_qf32_sf:
4848 case Hexagon::V6_vconv_sf_qf32:
4850 case Hexagon::V6_vilog2_qf16:
4852 case Hexagon::V6_vilog2_qf32:
4854 case Hexagon::V6_vmpy_qf16:
4856 case Hexagon::V6_vmpy_qf16_hf:
4858 case Hexagon::V6_vmpy_qf16_mix_hf:
4860 case Hexagon::V6_vmpy_qf32:
4862 case Hexagon::V6_vmpy_qf32_hf:
4864 case Hexagon::V6_vmpy_qf32_mix_hf:
4866 case Hexagon::V6_vmpy_qf32_qf16:
4868 case Hexagon::V6_vmpy_qf32_sf:
4870 case Hexagon::V6_vmpy_rt_hf:
4872 case Hexagon::V6_vmpy_rt_qf16:
4874 case Hexagon::V6_vmpy_rt_sf:
4876 case Hexagon::V6_vneg_qf16_hf:
4878 case Hexagon::V6_vneg_qf16_qf16:
4880 case Hexagon::V6_vneg_qf32_qf32:
4882 case Hexagon::V6_vneg_qf32_sf:
4884 case Hexagon::V6_vsub_hf:
4886 case Hexagon::V6_vsub_qf16:
4888 case Hexagon::V6_vsub_qf16_mix:
4890 case Hexagon::V6_vsub_qf32:
4892 case Hexagon::V6_vsub_qf32_mix:
4894 case Hexagon::V6_vsub_sf:
4896 case Hexagon::V6_vsub_sf_mix:
4898 case Hexagon::V6_vsub_hf_mix:
4971 if (!
A || !
B ||
A->getParent() !=
B->getParent())
4985 return Opc >= 0 ? Hexagon::changeAddrMode_abs_io(
Opc) :
Opc;
4989 return Opc >= 0 ? Hexagon::changeAddrMode_io_abs(
Opc) :
Opc;
4993 return Opc >= 0 ? Hexagon::changeAddrMode_io_pi(
Opc) :
Opc;
4997 return Opc >= 0 ? Hexagon::changeAddrMode_io_rr(
Opc) :
Opc;
5001 return Opc >= 0 ? Hexagon::changeAddrMode_pi_io(
Opc) :
Opc;
5005 return Opc >= 0 ? Hexagon::changeAddrMode_rr_io(
Opc) :
Opc;
5009 return Opc >= 0 ? Hexagon::changeAddrMode_rr_ur(
Opc) :
Opc;
5013 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.