66#define DEBUG_TYPE "hexagon-instrinfo"
68#define GET_INSTRINFO_CTOR_DTOR
69#define GET_INSTRMAP_INFO
71#include "HexagonGenDFAPacketizer.inc"
72#include "HexagonGenInstrInfo.inc"
76 "packetization boundary."));
83 cl::desc(
"Disable schedule adjustment for new value stores."));
87 cl::desc(
"Enable timing class latency"));
91 cl::desc(
"Enable vec alu forwarding"));
95 cl::desc(
"Enable vec acc forwarding"));
103 cl::desc(
"Use the DFA based hazard recognizer."));
118void HexagonInstrInfo::anchor() {}
123 RegInfo(ST.getHwMode()), Subtarget(ST) {}
132 return (
Reg >= Hexagon::R0 &&
Reg <= Hexagon::R7) ||
133 (
Reg >= Hexagon::R16 &&
Reg <= Hexagon::R23);
145 for (; MIB != MIE; ++MIB) {
146 if (!MIB->isDebugInstr())
157 if (!(
MI.getMF()->getFunction().hasOptSize()))
158 return MI.isAsCheapAsAMove();
160 if (
MI.getOpcode() == Hexagon::A2_tfrsi) {
161 auto Op =
MI.getOperand(1);
169 int64_t
Imm =
Op.getImm();
174 return MI.isAsCheapAsAMove();
189 if (
isFloat(
MI) &&
MI.hasRegisterImplicitUseOperand(Hexagon::USR))
203 if (EndLoopOp == Hexagon::ENDLOOP0) {
204 LOOPi = Hexagon::J2_loop0i;
205 LOOPr = Hexagon::J2_loop0r;
207 LOOPi = Hexagon::J2_loop1i;
208 LOOPr = Hexagon::J2_loop1r;
219 unsigned Opc =
I.getOpcode();
220 if (
Opc == LOOPi ||
Opc == LOOPr)
224 if (
Opc == EndLoopOp &&
I.getOperand(0).getMBB() != TargetBB)
251 Uses.push_back(MO.getReg());
290 int &FrameIndex)
const {
291 switch (
MI.getOpcode()) {
294 case Hexagon::L2_loadri_io:
295 case Hexagon::L2_loadrd_io:
296 case Hexagon::V6_vL32b_ai:
297 case Hexagon::V6_vL32b_nt_ai:
298 case Hexagon::V6_vL32Ub_ai:
299 case Hexagon::LDriw_pred:
300 case Hexagon::LDriw_ctr:
301 case Hexagon::PS_vloadrq_ai:
302 case Hexagon::PS_vloadrw_ai:
303 case Hexagon::PS_vloadrw_nt_ai:
304 case Hexagon::PS_loadrl: {
312 return MI.getOperand(0).getReg();
315 case Hexagon::L2_ploadrit_io:
316 case Hexagon::L2_ploadrif_io:
317 case Hexagon::L2_ploadrdt_io:
318 case Hexagon::L2_ploadrdf_io: {
326 return MI.getOperand(0).getReg();
339 int &FrameIndex)
const {
340 switch (
MI.getOpcode()) {
343 case Hexagon::S2_storerb_io:
344 case Hexagon::S2_storerh_io:
345 case Hexagon::S2_storeri_io:
346 case Hexagon::S2_storerd_io:
347 case Hexagon::V6_vS32b_ai:
348 case Hexagon::V6_vS32Ub_ai:
349 case Hexagon::STriw_pred:
350 case Hexagon::STriw_ctr:
351 case Hexagon::PS_vstorerq_ai:
352 case Hexagon::PS_vstorerw_ai:
353 case Hexagon::PS_storerl: {
361 return MI.getOperand(2).getReg();
364 case Hexagon::S2_pstorerbt_io:
365 case Hexagon::S2_pstorerbf_io:
366 case Hexagon::S2_pstorerht_io:
367 case Hexagon::S2_pstorerhf_io:
368 case Hexagon::S2_pstorerit_io:
369 case Hexagon::S2_pstorerif_io:
370 case Hexagon::S2_pstorerdt_io:
371 case Hexagon::S2_pstorerdf_io: {
379 return MI.getOperand(3).getReg();
395 for (++MII; MII !=
MBB->instr_end() && MII->isInsideBundle(); ++MII)
413 for (++MII; MII !=
MBB->instr_end() && MII->isInsideBundle(); ++MII)
441 bool AllowModify)
const {
448 if (
I ==
MBB.instr_begin())
468 }
while (
I !=
MBB.instr_begin());
473 while (
I->isDebugInstr()) {
474 if (
I ==
MBB.instr_begin())
479 bool JumpToBlock =
I->getOpcode() == Hexagon::J2_jump &&
480 I->getOperand(0).isMBB();
482 if (AllowModify && JumpToBlock &&
483 MBB.isLayoutSuccessor(
I->getOperand(0).getMBB())) {
485 I->eraseFromParent();
487 if (
I ==
MBB.instr_begin())
491 if (!isUnpredicatedTerminator(*
I))
499 if (&*
I != LastInst && !
I->isBundle() && isUnpredicatedTerminator(*
I)) {
501 SecondLastInst = &*
I;
506 if (
I ==
MBB.instr_begin())
512 int SecLastOpcode = SecondLastInst ? SecondLastInst->
getOpcode() : 0;
515 if (LastOpcode == Hexagon::J2_jump && !LastInst->
getOperand(0).
isMBB())
517 if (SecLastOpcode == Hexagon::J2_jump &&
528 if (LastInst && !SecondLastInst) {
529 if (LastOpcode == Hexagon::J2_jump) {
539 if (LastOpcodeHasJMP_c) {
554 <<
" with one jump\n";);
561 if (SecLastOpcodeHasJMP_c && (LastOpcode == Hexagon::J2_jump)) {
572 if (SecLastOpcodeHasNVJump &&
574 (LastOpcode == Hexagon::J2_jump)) {
585 if (SecLastOpcode == Hexagon::J2_jump && LastOpcode == Hexagon::J2_jump) {
589 I->eraseFromParent();
594 if (
isEndLoopN(SecLastOpcode) && LastOpcode == Hexagon::J2_jump) {
602 <<
" with two jumps";);
608 int *BytesRemoved)
const {
609 assert(!BytesRemoved &&
"code size not handled");
614 while (
I !=
MBB.begin()) {
616 if (
I->isDebugInstr())
621 if (
Count && (
I->getOpcode() == Hexagon::J2_jump))
635 int *BytesAdded)
const {
636 unsigned BOpc = Hexagon::J2_jump;
637 unsigned BccOpc = Hexagon::J2_jumpt;
639 assert(
TBB &&
"insertBranch must not be told to insert a fallthrough");
640 assert(!BytesAdded &&
"code size not handled");
645 if (!
Cond.empty() &&
Cond[0].isImm())
646 BccOpc =
Cond[0].getImm();
656 auto Term =
MBB.getFirstTerminator();
666 int EndLoopOp =
Cond[0].getImm();
673 assert(
Loop !=
nullptr &&
"Inserting an ENDLOOP without a LOOP");
674 Loop->getOperand(0).setMBB(
TBB);
678 assert((
Cond.size() == 3) &&
"Only supporting rr/ri version of nvjump");
689 }
else if(
Cond[2].isImm()) {
695 assert((
Cond.size() == 2) &&
"Malformed cond vector");
703 "Cond. cannot be empty when multiple branchings are required");
705 "NV-jump cannot be inserted with another branch");
708 int EndLoopOp =
Cond[0].getImm();
715 assert(
Loop !=
nullptr &&
"Inserting an ENDLOOP without a LOOP");
716 Loop->getOperand(0).setMBB(
TBB);
745 TripCount =
Loop->getOpcode() == Hexagon::J2_loop0r
747 :
Loop->getOperand(1).getImm();
749 LoopCount =
Loop->getOperand(1).getReg();
752 bool shouldIgnoreForPipelining(
const MachineInstr *
MI)
const override {
754 return MI == EndLoop;
757 std::optional<bool> createTripCountGreaterCondition(
758 int TC, MachineBasicBlock &
MBB,
759 SmallVectorImpl<MachineOperand> &
Cond)
override {
760 if (TripCount == -1) {
764 TII->get(Hexagon::C2_cmpgtui),
Done)
772 return TripCount > TC;
775 void setPreheader(MachineBasicBlock *NewPreheader)
override {
780 void adjustTripCount(
int TripCountAdjust)
override {
783 if (
Loop->getOpcode() == Hexagon::J2_loop0i ||
784 Loop->getOpcode() == Hexagon::J2_loop1i) {
785 int64_t TripCount =
Loop->getOperand(1).getImm() + TripCountAdjust;
786 assert(TripCount > 0 &&
"Can't create an empty or negative loop!");
787 Loop->getOperand(1).setImm(TripCount);
796 TII->get(Hexagon::A2_addi), NewLoopCount)
802 void disposed(LiveIntervals *LIS)
override {
805 Loop->eraseFromParent();
810std::unique_ptr<TargetInstrInfo::PipelinerLoopInfo>
818 LoopBB,
I->getOpcode(),
I->getOperand(0).getMBB(), VisitedBBs);
820 return std::make_unique<HexagonPipelinerLoopInfo>(LoopInst, &*
I);
826 unsigned NumCycles,
unsigned ExtraPredCycles,
840 return NumInstrs <= 4;
848 for (
auto I =
B.begin();
I !=
E; ++
I) {
858 for (
auto I =
B.rbegin();
I !=
E; ++
I)
867 bool RenamableSrc)
const {
871 if (Hexagon::IntRegsRegClass.
contains(SrcReg, DestReg)) {
873 .
addReg(SrcReg, KillFlag);
876 if (Hexagon::DoubleRegsRegClass.
contains(SrcReg, DestReg)) {
878 .
addReg(SrcReg, KillFlag);
881 if (Hexagon::PredRegsRegClass.
contains(SrcReg, DestReg)) {
887 if (Hexagon::CtrRegsRegClass.
contains(DestReg) &&
888 Hexagon::IntRegsRegClass.
contains(SrcReg)) {
890 .
addReg(SrcReg, KillFlag);
893 if (Hexagon::IntRegsRegClass.
contains(DestReg) &&
894 Hexagon::CtrRegsRegClass.
contains(SrcReg)) {
896 .
addReg(SrcReg, KillFlag);
899 if (Hexagon::ModRegsRegClass.
contains(DestReg) &&
900 Hexagon::IntRegsRegClass.
contains(SrcReg)) {
902 .
addReg(SrcReg, KillFlag);
905 if (Hexagon::PredRegsRegClass.
contains(SrcReg) &&
906 Hexagon::IntRegsRegClass.
contains(DestReg)) {
908 .
addReg(SrcReg, KillFlag);
911 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
912 Hexagon::PredRegsRegClass.
contains(DestReg)) {
914 .
addReg(SrcReg, KillFlag);
917 if (Hexagon::PredRegsRegClass.
contains(SrcReg) &&
918 Hexagon::IntRegsRegClass.
contains(DestReg)) {
920 .
addReg(SrcReg, KillFlag);
923 if (Hexagon::HvxVRRegClass.
contains(SrcReg, DestReg)) {
925 addReg(SrcReg, KillFlag);
928 if (Hexagon::HvxWRRegClass.
contains(SrcReg, DestReg)) {
931 Register SrcLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
932 Register SrcHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
936 .
addReg(SrcHi, KillFlag | UndefHi)
937 .
addReg(SrcLo, KillFlag | UndefLo);
940 if (Hexagon::HvxQRRegClass.
contains(SrcReg, DestReg)) {
943 .
addReg(SrcReg, KillFlag);
946 if (Hexagon::HvxQRRegClass.
contains(SrcReg) &&
947 Hexagon::HvxVRRegClass.
contains(DestReg)) {
951 if (Hexagon::HvxQRRegClass.
contains(DestReg) &&
952 Hexagon::HvxVRRegClass.
contains(SrcReg)) {
956 if (Hexagon::HlxLRRegClass.
contains(SrcReg, DestReg)) {
958 .
addReg(SrcReg, KillFlag);
961 if (Hexagon::HlxLLRRegClass.
contains(SrcReg, DestReg)) {
963 .
addReg(SrcReg, KillFlag);
977 Register SrcReg,
bool isKill,
int FI,
989 if (HMFI.isVTCMStackIndex(FI)) {
990 MFIIndex = HMFI.getMappedVTCMObjectIndex(FI);
991 MMFI = &HMFI.getVTCMFrameInfo();
997 if (Hexagon::IntRegsRegClass.hasSubClassEq(RC)) {
1001 }
else if (Hexagon::DoubleRegsRegClass.hasSubClassEq(RC)) {
1005 }
else if (Hexagon::PredRegsRegClass.hasSubClassEq(RC)) {
1009 }
else if (Hexagon::ModRegsRegClass.hasSubClassEq(RC)) {
1013 }
else if (Hexagon::CircRegsRegClass.hasSubClassEq(RC)) {
1016 .
addReg(SrcReg, KillFlag)
1018 }
else if (Hexagon::HvxQRRegClass.hasSubClassEq(RC)) {
1022 }
else if (Hexagon::HvxVRRegClass.hasSubClassEq(RC)) {
1026 }
else if (Hexagon::HvxWRRegClass.hasSubClassEq(RC)) {
1030 }
else if (Hexagon::HlxLRRegClass.hasSubClassEq(RC)) {
1034 .
addReg(SrcReg, KillFlag)
1054 if (HMFI.isVTCMStackIndex(FI)) {
1055 MFIIndex = HMFI.getMappedVTCMObjectIndex(FI);
1056 MMFI = &HMFI.getVTCMFrameInfo();
1062 if (Hexagon::IntRegsRegClass.hasSubClassEq(RC)) {
1065 }
else if (Hexagon::DoubleRegsRegClass.hasSubClassEq(RC)) {
1068 }
else if (Hexagon::PredRegsRegClass.hasSubClassEq(RC)) {
1071 }
else if (Hexagon::ModRegsRegClass.hasSubClassEq(RC)) {
1074 }
else if (Hexagon::CircRegsRegClass.hasSubClassEq(RC)) {
1078 }
else if (Hexagon::HvxQRRegClass.hasSubClassEq(RC)) {
1081 }
else if (Hexagon::HvxVRRegClass.hasSubClassEq(RC)) {
1084 }
else if (Hexagon::HvxWRRegClass.hasSubClassEq(RC)) {
1087 }
else if (Hexagon::HlxLRRegClass.hasSubClassEq(RC)) {
1110 unsigned Opc =
MI.getOpcode();
1112 auto RealCirc = [&](
unsigned Opc,
bool HasImm,
unsigned MxOp) {
1113 Register M_CSx =
MI.getOperand(MxOp).getReg();
1114 Register Mx = HRI.getSubReg(M_CSx, Hexagon::isub_hi);
1115 unsigned CSOp = HasImm ? 5 : 4;
1117 for (
unsigned i = 0; i != CSOp; ++i)
1121 MIB.add(
MI.getOperand(i));
1122 Register CSx = (M_CSx == Hexagon::CS_M0 ? Hexagon::CS0 : Hexagon::CS1);
1129 if (
MI.memoperands().empty())
1132 return MMO->getAlign() >= NeedAlign;
1137 case Hexagon::PS_call_instrprof_custom: {
1138 auto Op0 =
MI.getOperand(0);
1140 "First operand must be a global containing handler name.");
1144 StringRef NameStr = Arr->isCString() ? Arr->getAsCString() : Arr->getAsString();
1170 MIB.addExternalSymbol(cstr);
1174 case TargetOpcode::COPY: {
1180 std::prev(
MBBI)->copyImplicitOps(*
MBB.getParent(),
MI);
1185 case Hexagon::PS_aligna:
1188 .
addImm(-
MI.getOperand(1).getImm());
1191 case Hexagon::V6_vassignp: {
1194 Register SrcLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
1195 Register SrcHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
1206 case Hexagon::V6_lo:
1207 case Hexagon::LX_lo: {
1210 Register SrcSubLo = HRI.getSubReg(SrcReg, Hexagon::vsub_lo);
1215 case Hexagon::V6_hi:
1216 case Hexagon::LX_hi: {
1219 Register SrcSubHi = HRI.getSubReg(SrcReg, Hexagon::vsub_hi);
1224 case Hexagon::PS_vloadrv_ai: {
1228 int Offset =
MI.getOperand(2).getImm();
1229 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1230 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vL32b_ai
1231 : Hexagon::V6_vL32Ub_ai;
1239 case Hexagon::PS_loadrl: {
1243 int Offset =
MI.getOperand(2).getImm();
1255 case Hexagon::PS_vloadrw_ai: {
1259 int Offset =
MI.getOperand(2).getImm();
1260 unsigned VecOffset = HRI.getSpillSize(Hexagon::HvxVRRegClass);
1261 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1262 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vL32b_ai
1263 : Hexagon::V6_vL32Ub_ai;
1265 HRI.getSubReg(DstReg, Hexagon::vsub_lo))
1270 HRI.getSubReg(DstReg, Hexagon::vsub_hi))
1277 case Hexagon::PS_vstorerv_ai: {
1282 int Offset =
MI.getOperand(1).getImm();
1283 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1284 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vS32b_ai
1285 : Hexagon::V6_vS32Ub_ai;
1294 case Hexagon::PS_storerl: {
1300 int Offset =
MI.getOperand(1).getImm();
1312 case Hexagon::PS_vstorerw_ai: {
1316 int Offset =
MI.getOperand(1).getImm();
1317 unsigned VecOffset = HRI.getSpillSize(Hexagon::HvxVRRegClass);
1318 Align NeedAlign = HRI.getSpillAlign(Hexagon::HvxVRRegClass);
1319 unsigned NewOpc = UseAligned(
MI, NeedAlign) ? Hexagon::V6_vS32b_ai
1320 : Hexagon::V6_vS32Ub_ai;
1324 .
addReg(HRI.getSubReg(SrcReg, Hexagon::vsub_lo))
1329 .
addReg(HRI.getSubReg(SrcReg, Hexagon::vsub_hi))
1334 case Hexagon::PS_true: {
1342 case Hexagon::PS_false: {
1350 case Hexagon::PS_qtrue: {
1357 case Hexagon::PS_qfalse: {
1364 case Hexagon::PS_vdd0: {
1372 case Hexagon::PS_vmulw: {
1375 Register Src1Reg =
MI.getOperand(1).getReg();
1376 Register Src2Reg =
MI.getOperand(2).getReg();
1377 Register Src1SubHi = HRI.getSubReg(Src1Reg, Hexagon::isub_hi);
1378 Register Src1SubLo = HRI.getSubReg(Src1Reg, Hexagon::isub_lo);
1379 Register Src2SubHi = HRI.getSubReg(Src2Reg, Hexagon::isub_hi);
1380 Register Src2SubLo = HRI.getSubReg(Src2Reg, Hexagon::isub_lo);
1382 HRI.getSubReg(DstReg, Hexagon::isub_hi))
1386 HRI.getSubReg(DstReg, Hexagon::isub_lo))
1392 case Hexagon::PS_vmulw_acc: {
1395 Register Src1Reg =
MI.getOperand(1).getReg();
1396 Register Src2Reg =
MI.getOperand(2).getReg();
1397 Register Src3Reg =
MI.getOperand(3).getReg();
1398 Register Src1SubHi = HRI.getSubReg(Src1Reg, Hexagon::isub_hi);
1399 Register Src1SubLo = HRI.getSubReg(Src1Reg, Hexagon::isub_lo);
1400 Register Src2SubHi = HRI.getSubReg(Src2Reg, Hexagon::isub_hi);
1401 Register Src2SubLo = HRI.getSubReg(Src2Reg, Hexagon::isub_lo);
1402 Register Src3SubHi = HRI.getSubReg(Src3Reg, Hexagon::isub_hi);
1403 Register Src3SubLo = HRI.getSubReg(Src3Reg, Hexagon::isub_lo);
1405 HRI.getSubReg(DstReg, Hexagon::isub_hi))
1410 HRI.getSubReg(DstReg, Hexagon::isub_lo))
1417 case Hexagon::PS_pselect: {
1441 case Hexagon::PS_vselect: {
1474 case Hexagon::PS_wselect: {
1514 case Hexagon::PS_crash: {
1530 void printCustom(
raw_ostream &OS)
const override {
1531 OS <<
"MisalignedCrash";
1535 static const CrashPseudoSourceValue CrashPSV(MF.
getTarget());
1547 case Hexagon::PS_tailcall_i:
1548 MI.setDesc(
get(Hexagon::J2_jump));
1550 case Hexagon::PS_tailcall_r:
1551 case Hexagon::PS_jmpret:
1552 MI.setDesc(
get(Hexagon::J2_jumpr));
1554 case Hexagon::PS_jmprett:
1555 MI.setDesc(
get(Hexagon::J2_jumprt));
1557 case Hexagon::PS_jmpretf:
1558 MI.setDesc(
get(Hexagon::J2_jumprf));
1560 case Hexagon::PS_jmprettnewpt:
1561 MI.setDesc(
get(Hexagon::J2_jumprtnewpt));
1563 case Hexagon::PS_jmpretfnewpt:
1564 MI.setDesc(
get(Hexagon::J2_jumprfnewpt));
1566 case Hexagon::PS_jmprettnew:
1567 MI.setDesc(
get(Hexagon::J2_jumprtnew));
1569 case Hexagon::PS_jmpretfnew:
1570 MI.setDesc(
get(Hexagon::J2_jumprfnew));
1573 case Hexagon::PS_loadrub_pci:
1574 return RealCirc(Hexagon::L2_loadrub_pci,
true, 4);
1575 case Hexagon::PS_loadrb_pci:
1576 return RealCirc(Hexagon::L2_loadrb_pci,
true, 4);
1577 case Hexagon::PS_loadruh_pci:
1578 return RealCirc(Hexagon::L2_loadruh_pci,
true, 4);
1579 case Hexagon::PS_loadrh_pci:
1580 return RealCirc(Hexagon::L2_loadrh_pci,
true, 4);
1581 case Hexagon::PS_loadri_pci:
1582 return RealCirc(Hexagon::L2_loadri_pci,
true, 4);
1583 case Hexagon::PS_loadrd_pci:
1584 return RealCirc(Hexagon::L2_loadrd_pci,
true, 4);
1585 case Hexagon::PS_loadrub_pcr:
1586 return RealCirc(Hexagon::L2_loadrub_pcr,
false, 3);
1587 case Hexagon::PS_loadrb_pcr:
1588 return RealCirc(Hexagon::L2_loadrb_pcr,
false, 3);
1589 case Hexagon::PS_loadruh_pcr:
1590 return RealCirc(Hexagon::L2_loadruh_pcr,
false, 3);
1591 case Hexagon::PS_loadrh_pcr:
1592 return RealCirc(Hexagon::L2_loadrh_pcr,
false, 3);
1593 case Hexagon::PS_loadri_pcr:
1594 return RealCirc(Hexagon::L2_loadri_pcr,
false, 3);
1595 case Hexagon::PS_loadrd_pcr:
1596 return RealCirc(Hexagon::L2_loadrd_pcr,
false, 3);
1597 case Hexagon::PS_storerb_pci:
1598 return RealCirc(Hexagon::S2_storerb_pci,
true, 3);
1599 case Hexagon::PS_storerh_pci:
1600 return RealCirc(Hexagon::S2_storerh_pci,
true, 3);
1601 case Hexagon::PS_storerf_pci:
1602 return RealCirc(Hexagon::S2_storerf_pci,
true, 3);
1603 case Hexagon::PS_storeri_pci:
1604 return RealCirc(Hexagon::S2_storeri_pci,
true, 3);
1605 case Hexagon::PS_storerd_pci:
1606 return RealCirc(Hexagon::S2_storerd_pci,
true, 3);
1607 case Hexagon::PS_storerb_pcr:
1608 return RealCirc(Hexagon::S2_storerb_pcr,
false, 2);
1609 case Hexagon::PS_storerh_pcr:
1610 return RealCirc(Hexagon::S2_storerh_pcr,
false, 2);
1611 case Hexagon::PS_storerf_pcr:
1612 return RealCirc(Hexagon::S2_storerf_pcr,
false, 2);
1613 case Hexagon::PS_storeri_pcr:
1614 return RealCirc(Hexagon::S2_storeri_pcr,
false, 2);
1615 case Hexagon::PS_storerd_pcr:
1616 return RealCirc(Hexagon::S2_storerd_pcr,
false, 2);
1626 unsigned Opc =
MI.getOpcode();
1630 case Hexagon::V6_vgather_vscatter_mh_pseudo:
1633 .
add(
MI.getOperand(2))
1634 .
add(
MI.getOperand(3))
1635 .
add(
MI.getOperand(4));
1637 .
add(
MI.getOperand(2))
1638 .
add(
MI.getOperand(3))
1639 .
add(
MI.getOperand(4))
1642 return First.getInstrIterator();
1643 case Hexagon::V6_vgathermh_pseudo:
1645 .
add(
MI.getOperand(2))
1646 .
add(
MI.getOperand(3))
1647 .
add(
MI.getOperand(4));
1649 .
add(
MI.getOperand(0))
1653 return First.getInstrIterator();
1655 case Hexagon::V6_vgathermw_pseudo:
1657 .
add(
MI.getOperand(2))
1658 .
add(
MI.getOperand(3))
1659 .
add(
MI.getOperand(4));
1661 .
add(
MI.getOperand(0))
1665 return First.getInstrIterator();
1667 case Hexagon::V6_vgathermhw_pseudo:
1669 .
add(
MI.getOperand(2))
1670 .
add(
MI.getOperand(3))
1671 .
add(
MI.getOperand(4));
1673 .
add(
MI.getOperand(0))
1677 return First.getInstrIterator();
1679 case Hexagon::V6_vgathermhq_pseudo:
1681 .
add(
MI.getOperand(2))
1682 .
add(
MI.getOperand(3))
1683 .
add(
MI.getOperand(4))
1684 .
add(
MI.getOperand(5));
1686 .
add(
MI.getOperand(0))
1690 return First.getInstrIterator();
1692 case Hexagon::V6_vgathermwq_pseudo:
1694 .
add(
MI.getOperand(2))
1695 .
add(
MI.getOperand(3))
1696 .
add(
MI.getOperand(4))
1697 .
add(
MI.getOperand(5));
1699 .
add(
MI.getOperand(0))
1703 return First.getInstrIterator();
1705 case Hexagon::V6_vgathermhwq_pseudo:
1707 .
add(
MI.getOperand(2))
1708 .
add(
MI.getOperand(3))
1709 .
add(
MI.getOperand(4))
1710 .
add(
MI.getOperand(5));
1712 .
add(
MI.getOperand(0))
1716 return First.getInstrIterator();
1719 return MI.getIterator();
1728 assert(
Cond[0].isImm() &&
"First entry in the cond vector not imm-val");
1729 unsigned opcode =
Cond[0].getImm();
1735 Cond[0].setImm(NewOpcode);
1750 unsigned BasePos, OffsetPos;
1765 const uint64_t
F =
MI.getDesc().TSFlags;
1776 int Opc =
MI.getOpcode();
1789 unsigned NOp = 0,
NumOps =
MI.getNumOperands();
1792 if (!
Op.isReg() || !
Op.isDef() ||
Op.isImplicit())
1799 unsigned PredRegPos;
1801 bool GotPredReg =
getPredReg(
Cond, PredReg, PredRegPos, PredRegFlags);
1804 T.addReg(PredReg, PredRegFlags);
1806 T.add(
MI.getOperand(NOp++));
1808 MI.setDesc(
get(PredOpc));
1809 while (
unsigned n =
MI.getNumOperands())
1810 MI.removeOperand(n-1);
1811 for (
unsigned i = 0, n =
T->getNumOperands(); i < n; ++i)
1812 MI.addOperand(
T->getOperand(i));
1818 MRI.clearKillFlags(PredReg);
1829 std::vector<MachineOperand> &Pred,
1830 bool SkipDead)
const {
1838 if (RC == &Hexagon::PredRegsRegClass) {
1843 }
else if (MO.isRegMask()) {
1844 for (
Register PR : Hexagon::PredRegsRegClass) {
1845 if (!
MI.modifiesRegister(PR, &HRI))
1856 if (!
MI.getDesc().isPredicable())
1860 if (!Subtarget.usePredicatedCalls())
1865 if (!Subtarget.hasV62Ops()) {
1866 switch (
MI.getOpcode()) {
1867 case Hexagon::V6_vL32b_ai:
1868 case Hexagon::V6_vL32b_pi:
1869 case Hexagon::V6_vL32b_ppu:
1870 case Hexagon::V6_vL32b_cur_ai:
1871 case Hexagon::V6_vL32b_cur_pi:
1872 case Hexagon::V6_vL32b_cur_ppu:
1873 case Hexagon::V6_vL32b_nt_ai:
1874 case Hexagon::V6_vL32b_nt_pi:
1875 case Hexagon::V6_vL32b_nt_ppu:
1876 case Hexagon::V6_vL32b_tmp_ai:
1877 case Hexagon::V6_vL32b_tmp_pi:
1878 case Hexagon::V6_vL32b_tmp_ppu:
1879 case Hexagon::V6_vL32b_nt_cur_ai:
1880 case Hexagon::V6_vL32b_nt_cur_pi:
1881 case Hexagon::V6_vL32b_nt_cur_ppu:
1882 case Hexagon::V6_vL32b_nt_tmp_ai:
1883 case Hexagon::V6_vL32b_nt_tmp_pi:
1884 case Hexagon::V6_vL32b_nt_tmp_ppu:
1892 bool Invert)
const {
1898 case Hexagon::F2_sfadd:
1914 if (
MI.isDebugInstr())
1924 for (
auto *
I :
MBB->successors())
1930 if (
MI.getDesc().isTerminator() ||
MI.isPosition())
1934 if (
MI.getOpcode() == TargetOpcode::INLINEASM_BR)
1958 bool atInsnStart =
true;
1961 for (; *Str; ++Str) {
1965 if (atInsnStart && !
isSpace(
static_cast<unsigned char>(*Str))) {
1967 atInsnStart =
false;
1971 atInsnStart =
false;
1994 int64_t &
Value)
const {
1995 unsigned Opc =
MI.getOpcode();
1999 case Hexagon::C2_cmpeq:
2000 case Hexagon::C2_cmpeqp:
2001 case Hexagon::C2_cmpgt:
2002 case Hexagon::C2_cmpgtp:
2003 case Hexagon::C2_cmpgtu:
2004 case Hexagon::C2_cmpgtup:
2005 case Hexagon::C4_cmpneq:
2006 case Hexagon::C4_cmplte:
2007 case Hexagon::C4_cmplteu:
2008 case Hexagon::C2_cmpeqi:
2009 case Hexagon::C2_cmpgti:
2010 case Hexagon::C2_cmpgtui:
2011 case Hexagon::C4_cmpneqi:
2012 case Hexagon::C4_cmplteui:
2013 case Hexagon::C4_cmpltei:
2014 SrcReg =
MI.getOperand(1).getReg();
2017 case Hexagon::A4_cmpbeq:
2018 case Hexagon::A4_cmpbgt:
2019 case Hexagon::A4_cmpbgtu:
2020 case Hexagon::A4_cmpbeqi:
2021 case Hexagon::A4_cmpbgti:
2022 case Hexagon::A4_cmpbgtui:
2023 SrcReg =
MI.getOperand(1).getReg();
2026 case Hexagon::A4_cmpheq:
2027 case Hexagon::A4_cmphgt:
2028 case Hexagon::A4_cmphgtu:
2029 case Hexagon::A4_cmpheqi:
2030 case Hexagon::A4_cmphgti:
2031 case Hexagon::A4_cmphgtui:
2032 SrcReg =
MI.getOperand(1).getReg();
2039 case Hexagon::C2_cmpeq:
2040 case Hexagon::C2_cmpeqp:
2041 case Hexagon::C2_cmpgt:
2042 case Hexagon::C2_cmpgtp:
2043 case Hexagon::C2_cmpgtu:
2044 case Hexagon::C2_cmpgtup:
2045 case Hexagon::A4_cmpbeq:
2046 case Hexagon::A4_cmpbgt:
2047 case Hexagon::A4_cmpbgtu:
2048 case Hexagon::A4_cmpheq:
2049 case Hexagon::A4_cmphgt:
2050 case Hexagon::A4_cmphgtu:
2051 case Hexagon::C4_cmpneq:
2052 case Hexagon::C4_cmplte:
2053 case Hexagon::C4_cmplteu:
2054 SrcReg2 =
MI.getOperand(2).getReg();
2058 case Hexagon::C2_cmpeqi:
2059 case Hexagon::C2_cmpgtui:
2060 case Hexagon::C2_cmpgti:
2061 case Hexagon::C4_cmpneqi:
2062 case Hexagon::C4_cmplteui:
2063 case Hexagon::C4_cmpltei:
2064 case Hexagon::A4_cmpbeqi:
2065 case Hexagon::A4_cmpbgti:
2066 case Hexagon::A4_cmpbgtui:
2067 case Hexagon::A4_cmpheqi:
2068 case Hexagon::A4_cmphgti:
2069 case Hexagon::A4_cmphgtui: {
2074 Value =
MI.getOperand(2).getImm();
2084 unsigned *PredCost)
const {
2110 unsigned BasePosA, OffsetPosA;
2118 unsigned BasePosB, OffsetPosB;
2125 if (BaseRegA != BaseRegB || BaseSubA != BaseSubB)
2143 if (OffsetA > OffsetB) {
2144 uint64_t OffDiff = (uint64_t)((int64_t)OffsetA - (int64_t)OffsetB);
2145 return SizeB <= OffDiff;
2147 if (OffsetA < OffsetB) {
2148 uint64_t OffDiff = (uint64_t)((int64_t)OffsetB - (int64_t)OffsetA);
2149 return SizeA <= OffDiff;
2159 unsigned BasePos = 0, OffsetPos = 0;
2167 }
else if (
MI.getOpcode() == Hexagon::A2_addi) {
2169 if (AddOp.isImm()) {
2170 Value = AddOp.getImm();
2178std::pair<unsigned, unsigned>
2188 static const std::pair<unsigned, const char*> Flags[] = {
2189 {MO_PCREL,
"hexagon-pcrel"},
2190 {MO_GOT,
"hexagon-got"},
2191 {MO_LO16,
"hexagon-lo16"},
2192 {MO_HI16,
"hexagon-hi16"},
2193 {MO_GPREL,
"hexagon-gprel"},
2194 {MO_GDGOT,
"hexagon-gdgot"},
2195 {MO_GDPLT,
"hexagon-gdplt"},
2196 {MO_IE,
"hexagon-ie"},
2197 {MO_IEGOT,
"hexagon-iegot"},
2198 {MO_TPREL,
"hexagon-tprel"}
2207 static const std::pair<unsigned, const char*> Flags[] = {
2208 {HMOTF_ConstExtended,
"hexagon-ext"}
2216 if (VT == MVT::i1) {
2217 TRC = &Hexagon::PredRegsRegClass;
2218 }
else if (VT == MVT::i32 || VT == MVT::f32) {
2219 TRC = &Hexagon::IntRegsRegClass;
2220 }
else if (VT == MVT::i64 || VT == MVT::f64) {
2221 TRC = &Hexagon::DoubleRegsRegClass;
2235 const uint64_t
F =
MI.getDesc().TSFlags;
2245 !
MI.getDesc().mayStore() &&
2246 MI.getDesc().getOpcode() != Hexagon::S2_allocframe &&
2247 MI.getDesc().getOpcode() != Hexagon::L2_deallocframe &&
2259 const uint64_t
F =
MI.getDesc().TSFlags;
2292 assert(MO.
isImm() &&
"Extendable operand must be Immediate type");
2296 int32_t SValue =
Value;
2299 return SValue < MinValue || SValue > MaxValue;
2304 return UValue < MinValue || UValue > MaxValue;
2308 switch (
MI.getOpcode()) {
2309 case Hexagon::L4_return:
2310 case Hexagon::L4_return_t:
2311 case Hexagon::L4_return_f:
2312 case Hexagon::L4_return_tnew_pnt:
2313 case Hexagon::L4_return_fnew_pnt:
2314 case Hexagon::L4_return_tnew_pt:
2315 case Hexagon::L4_return_fnew_pt:
2336 for (
auto &RegA : DefsA)
2337 for (
auto &RegB : UsesB) {
2354 switch (
MI.getOpcode()) {
2355 case Hexagon::V6_vL32b_cur_pi:
2356 case Hexagon::V6_vL32b_cur_ai:
2380 return (Opcode == Hexagon::ENDLOOP0 ||
2381 Opcode == Hexagon::ENDLOOP1);
2406 switch (
MI.getOpcode()) {
2408 case Hexagon::PS_fi:
2409 case Hexagon::PS_fia:
2422 const uint64_t
F =
MI.getDesc().TSFlags;
2434 unsigned Opcode =
MI.getOpcode();
2435 const uint64_t
F =
get(Opcode).TSFlags;
2444 if (!
I.mayLoad() && !
I.mayStore())
2450 switch (
MI.getOpcode()) {
2451 case Hexagon::J2_callr:
2452 case Hexagon::J2_callrf:
2453 case Hexagon::J2_callrt:
2454 case Hexagon::PS_call_nr:
2461 switch (
MI.getOpcode()) {
2462 case Hexagon::L4_return:
2463 case Hexagon::L4_return_t:
2464 case Hexagon::L4_return_f:
2465 case Hexagon::L4_return_fnew_pnt:
2466 case Hexagon::L4_return_fnew_pt:
2467 case Hexagon::L4_return_tnew_pnt:
2468 case Hexagon::L4_return_tnew_pt:
2475 switch (
MI.getOpcode()) {
2476 case Hexagon::J2_jumpr:
2477 case Hexagon::J2_jumprt:
2478 case Hexagon::J2_jumprf:
2479 case Hexagon::J2_jumprtnewpt:
2480 case Hexagon::J2_jumprfnewpt:
2481 case Hexagon::J2_jumprtnew:
2482 case Hexagon::J2_jumprfnew:
2493 unsigned offset)
const {
2499 switch (
MI.getOpcode()) {
2503 case Hexagon::J2_jump:
2504 case Hexagon::J2_call:
2505 case Hexagon::PS_call_nr:
2507 case Hexagon::J2_jumpt:
2508 case Hexagon::J2_jumpf:
2509 case Hexagon::J2_jumptnew:
2510 case Hexagon::J2_jumptnewpt:
2511 case Hexagon::J2_jumpfnew:
2512 case Hexagon::J2_jumpfnewpt:
2513 case Hexagon::J2_callt:
2514 case Hexagon::J2_callf:
2516 case Hexagon::J2_loop0i:
2517 case Hexagon::J2_loop0iext:
2518 case Hexagon::J2_loop0r:
2519 case Hexagon::J2_loop0rext:
2520 case Hexagon::J2_loop1i:
2521 case Hexagon::J2_loop1iext:
2522 case Hexagon::J2_loop1r:
2523 case Hexagon::J2_loop1rext:
2526 case Hexagon::J4_cmpeqi_tp0_jump_nt:
2527 case Hexagon::J4_cmpeqi_tp1_jump_nt:
2528 case Hexagon::J4_cmpeqn1_tp0_jump_nt:
2529 case Hexagon::J4_cmpeqn1_tp1_jump_nt:
2541 unsigned Opcode =
MI.getOpcode();
2542 return Opcode == Hexagon::J2_loop0i ||
2543 Opcode == Hexagon::J2_loop0r ||
2544 Opcode == Hexagon::J2_loop0iext ||
2545 Opcode == Hexagon::J2_loop0rext ||
2546 Opcode == Hexagon::J2_loop1i ||
2547 Opcode == Hexagon::J2_loop1r ||
2548 Opcode == Hexagon::J2_loop1iext ||
2549 Opcode == Hexagon::J2_loop1rext;
2553 switch (
MI.getOpcode()) {
2554 default:
return false;
2555 case Hexagon::L4_iadd_memopw_io:
2556 case Hexagon::L4_isub_memopw_io:
2557 case Hexagon::L4_add_memopw_io:
2558 case Hexagon::L4_sub_memopw_io:
2559 case Hexagon::L4_and_memopw_io:
2560 case Hexagon::L4_or_memopw_io:
2561 case Hexagon::L4_iadd_memoph_io:
2562 case Hexagon::L4_isub_memoph_io:
2563 case Hexagon::L4_add_memoph_io:
2564 case Hexagon::L4_sub_memoph_io:
2565 case Hexagon::L4_and_memoph_io:
2566 case Hexagon::L4_or_memoph_io:
2567 case Hexagon::L4_iadd_memopb_io:
2568 case Hexagon::L4_isub_memopb_io:
2569 case Hexagon::L4_add_memopb_io:
2570 case Hexagon::L4_sub_memopb_io:
2571 case Hexagon::L4_and_memopb_io:
2572 case Hexagon::L4_or_memopb_io:
2573 case Hexagon::L4_ior_memopb_io:
2574 case Hexagon::L4_ior_memoph_io:
2575 case Hexagon::L4_ior_memopw_io:
2576 case Hexagon::L4_iand_memopb_io:
2577 case Hexagon::L4_iand_memoph_io:
2578 case Hexagon::L4_iand_memopw_io:
2585 const uint64_t
F =
MI.getDesc().TSFlags;
2590 const uint64_t
F =
get(Opcode).TSFlags;
2607 const uint64_t
F =
MI.getDesc().TSFlags;
2612 const uint64_t
F =
get(Opcode).TSFlags;
2618 unsigned OperandNum)
const {
2619 const uint64_t
F =
MI.getDesc().TSFlags;
2625 const uint64_t
F =
MI.getDesc().TSFlags;
2631 const uint64_t
F =
get(Opcode).TSFlags;
2637 const uint64_t
F =
MI.getDesc().TSFlags;
2643 const uint64_t
F =
get(Opcode).TSFlags;
2651 const uint64_t
F =
get(Opcode).TSFlags;
2656 const uint64_t
F =
get(Opcode).TSFlags;
2661 const uint64_t
F =
get(Opcode).TSFlags;
2668 return MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4 ||
2669 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_EXT ||
2670 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_PIC ||
2671 MI.getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4_EXT_PIC;
2675 switch (
MI.getOpcode()) {
2677 case Hexagon::L2_loadrb_io:
2678 case Hexagon::L4_loadrb_ur:
2679 case Hexagon::L4_loadrb_ap:
2680 case Hexagon::L2_loadrb_pr:
2681 case Hexagon::L2_loadrb_pbr:
2682 case Hexagon::L2_loadrb_pi:
2683 case Hexagon::L2_loadrb_pci:
2684 case Hexagon::L2_loadrb_pcr:
2685 case Hexagon::L2_loadbsw2_io:
2686 case Hexagon::L4_loadbsw2_ur:
2687 case Hexagon::L4_loadbsw2_ap:
2688 case Hexagon::L2_loadbsw2_pr:
2689 case Hexagon::L2_loadbsw2_pbr:
2690 case Hexagon::L2_loadbsw2_pi:
2691 case Hexagon::L2_loadbsw2_pci:
2692 case Hexagon::L2_loadbsw2_pcr:
2693 case Hexagon::L2_loadbsw4_io:
2694 case Hexagon::L4_loadbsw4_ur:
2695 case Hexagon::L4_loadbsw4_ap:
2696 case Hexagon::L2_loadbsw4_pr:
2697 case Hexagon::L2_loadbsw4_pbr:
2698 case Hexagon::L2_loadbsw4_pi:
2699 case Hexagon::L2_loadbsw4_pci:
2700 case Hexagon::L2_loadbsw4_pcr:
2701 case Hexagon::L4_loadrb_rr:
2702 case Hexagon::L2_ploadrbt_io:
2703 case Hexagon::L2_ploadrbt_pi:
2704 case Hexagon::L2_ploadrbf_io:
2705 case Hexagon::L2_ploadrbf_pi:
2706 case Hexagon::L2_ploadrbtnew_io:
2707 case Hexagon::L2_ploadrbfnew_io:
2708 case Hexagon::L4_ploadrbt_rr:
2709 case Hexagon::L4_ploadrbf_rr:
2710 case Hexagon::L4_ploadrbtnew_rr:
2711 case Hexagon::L4_ploadrbfnew_rr:
2712 case Hexagon::L2_ploadrbtnew_pi:
2713 case Hexagon::L2_ploadrbfnew_pi:
2714 case Hexagon::L4_ploadrbt_abs:
2715 case Hexagon::L4_ploadrbf_abs:
2716 case Hexagon::L4_ploadrbtnew_abs:
2717 case Hexagon::L4_ploadrbfnew_abs:
2718 case Hexagon::L2_loadrbgp:
2720 case Hexagon::L2_loadrh_io:
2721 case Hexagon::L4_loadrh_ur:
2722 case Hexagon::L4_loadrh_ap:
2723 case Hexagon::L2_loadrh_pr:
2724 case Hexagon::L2_loadrh_pbr:
2725 case Hexagon::L2_loadrh_pi:
2726 case Hexagon::L2_loadrh_pci:
2727 case Hexagon::L2_loadrh_pcr:
2728 case Hexagon::L4_loadrh_rr:
2729 case Hexagon::L2_ploadrht_io:
2730 case Hexagon::L2_ploadrht_pi:
2731 case Hexagon::L2_ploadrhf_io:
2732 case Hexagon::L2_ploadrhf_pi:
2733 case Hexagon::L2_ploadrhtnew_io:
2734 case Hexagon::L2_ploadrhfnew_io:
2735 case Hexagon::L4_ploadrht_rr:
2736 case Hexagon::L4_ploadrhf_rr:
2737 case Hexagon::L4_ploadrhtnew_rr:
2738 case Hexagon::L4_ploadrhfnew_rr:
2739 case Hexagon::L2_ploadrhtnew_pi:
2740 case Hexagon::L2_ploadrhfnew_pi:
2741 case Hexagon::L4_ploadrht_abs:
2742 case Hexagon::L4_ploadrhf_abs:
2743 case Hexagon::L4_ploadrhtnew_abs:
2744 case Hexagon::L4_ploadrhfnew_abs:
2745 case Hexagon::L2_loadrhgp:
2753 const uint64_t
F =
MI.getDesc().TSFlags;
2758 switch (
MI.getOpcode()) {
2759 case Hexagon::STriw_pred:
2760 case Hexagon::LDriw_pred:
2771 for (
auto &
Op :
MI.operands())
2772 if (
Op.isGlobal() ||
Op.isSymbol())
2779 unsigned SchedClass =
MI.getDesc().getSchedClass();
2780 return is_TC1(SchedClass);
2784 unsigned SchedClass =
MI.getDesc().getSchedClass();
2785 return is_TC2(SchedClass);
2789 unsigned SchedClass =
MI.getDesc().getSchedClass();
2794 unsigned SchedClass =
MI.getDesc().getSchedClass();
2805 for (
int I = 0;
I <
N;
I++)
2810 if (MI2.
getOpcode() == Hexagon::V6_vS32b_pi)
2865 bool Extend)
const {
2875 case Hexagon::PS_vstorerq_ai:
2876 case Hexagon::PS_vstorerv_ai:
2877 case Hexagon::PS_vstorerw_ai:
2878 case Hexagon::PS_vstorerw_nt_ai:
2879 case Hexagon::PS_vloadrq_ai:
2880 case Hexagon::PS_vloadrv_ai:
2881 case Hexagon::PS_vloadrw_ai:
2882 case Hexagon::PS_vloadrw_nt_ai:
2883 case Hexagon::V6_vL32b_ai:
2884 case Hexagon::V6_vS32b_ai:
2885 case Hexagon::V6_vS32b_pred_ai:
2886 case Hexagon::V6_vS32b_npred_ai:
2887 case Hexagon::V6_vS32b_qpred_ai:
2888 case Hexagon::V6_vS32b_nqpred_ai:
2889 case Hexagon::V6_vS32b_new_ai:
2890 case Hexagon::V6_vS32b_new_pred_ai:
2891 case Hexagon::V6_vS32b_new_npred_ai:
2892 case Hexagon::V6_vS32b_nt_pred_ai:
2893 case Hexagon::V6_vS32b_nt_npred_ai:
2894 case Hexagon::V6_vS32b_nt_new_ai:
2895 case Hexagon::V6_vS32b_nt_new_pred_ai:
2896 case Hexagon::V6_vS32b_nt_new_npred_ai:
2897 case Hexagon::V6_vS32b_nt_qpred_ai:
2898 case Hexagon::V6_vS32b_nt_nqpred_ai:
2899 case Hexagon::V6_vL32b_nt_ai:
2900 case Hexagon::V6_vS32b_nt_ai:
2901 case Hexagon::V6_vL32Ub_ai:
2902 case Hexagon::V6_vS32Ub_ai:
2903 case Hexagon::V6_vL32b_cur_ai:
2904 case Hexagon::V6_vL32b_tmp_ai:
2905 case Hexagon::V6_vL32b_pred_ai:
2906 case Hexagon::V6_vL32b_npred_ai:
2907 case Hexagon::V6_vL32b_cur_pred_ai:
2908 case Hexagon::V6_vL32b_cur_npred_ai:
2909 case Hexagon::V6_vL32b_tmp_pred_ai:
2910 case Hexagon::V6_vL32b_tmp_npred_ai:
2911 case Hexagon::V6_vL32b_nt_cur_ai:
2912 case Hexagon::V6_vL32b_nt_tmp_ai:
2913 case Hexagon::V6_vL32b_nt_pred_ai:
2914 case Hexagon::V6_vL32b_nt_npred_ai:
2915 case Hexagon::V6_vL32b_nt_cur_pred_ai:
2916 case Hexagon::V6_vL32b_nt_cur_npred_ai:
2917 case Hexagon::V6_vL32b_nt_tmp_pred_ai:
2918 case Hexagon::V6_vL32b_nt_tmp_npred_ai:
2919 case Hexagon::V6_vS32Ub_pred_ai:
2920 case Hexagon::V6_vS32Ub_npred_ai:
2921 case Hexagon::V6_vgathermh_pseudo:
2922 case Hexagon::V6_vgather_vscatter_mh_pseudo:
2923 case Hexagon::V6_vgathermw_pseudo:
2924 case Hexagon::V6_vgathermhw_pseudo:
2925 case Hexagon::V6_vgathermhq_pseudo:
2926 case Hexagon::V6_vgathermwq_pseudo:
2927 case Hexagon::V6_vgathermhwq_pseudo: {
2928 unsigned VectorSize = RegInfo.getSpillSize(Hexagon::HvxVRRegClass);
2930 if (
Offset & (VectorSize-1))
2935 case Hexagon::J2_loop0i:
2936 case Hexagon::J2_loop1i:
2939 case Hexagon::S4_storeirb_io:
2940 case Hexagon::S4_storeirbt_io:
2941 case Hexagon::S4_storeirbf_io:
2944 case Hexagon::S4_storeirh_io:
2945 case Hexagon::S4_storeirht_io:
2946 case Hexagon::S4_storeirhf_io:
2949 case Hexagon::S4_storeiri_io:
2950 case Hexagon::S4_storeirit_io:
2951 case Hexagon::S4_storeirif_io:
2954 case Hexagon::A4_cmpbeqi:
2956 case Hexagon::A4_cmpbgti:
2964 case Hexagon::L2_loadri_io:
2965 case Hexagon::S2_storeri_io:
2969 case Hexagon::L2_loadrd_io:
2970 case Hexagon::S2_storerd_io:
2974 case Hexagon::L2_loadrh_io:
2975 case Hexagon::L2_loadruh_io:
2976 case Hexagon::S2_storerh_io:
2977 case Hexagon::S2_storerf_io:
2981 case Hexagon::L2_loadrb_io:
2982 case Hexagon::L2_loadrub_io:
2983 case Hexagon::S2_storerb_io:
2987 case Hexagon::A2_addi:
2991 case Hexagon::L4_iadd_memopw_io:
2992 case Hexagon::L4_isub_memopw_io:
2993 case Hexagon::L4_add_memopw_io:
2994 case Hexagon::L4_sub_memopw_io:
2995 case Hexagon::L4_iand_memopw_io:
2996 case Hexagon::L4_ior_memopw_io:
2997 case Hexagon::L4_and_memopw_io:
2998 case Hexagon::L4_or_memopw_io:
3001 case Hexagon::L4_iadd_memoph_io:
3002 case Hexagon::L4_isub_memoph_io:
3003 case Hexagon::L4_add_memoph_io:
3004 case Hexagon::L4_sub_memoph_io:
3005 case Hexagon::L4_iand_memoph_io:
3006 case Hexagon::L4_ior_memoph_io:
3007 case Hexagon::L4_and_memoph_io:
3008 case Hexagon::L4_or_memoph_io:
3011 case Hexagon::L4_iadd_memopb_io:
3012 case Hexagon::L4_isub_memopb_io:
3013 case Hexagon::L4_add_memopb_io:
3014 case Hexagon::L4_sub_memopb_io:
3015 case Hexagon::L4_iand_memopb_io:
3016 case Hexagon::L4_ior_memopb_io:
3017 case Hexagon::L4_and_memopb_io:
3018 case Hexagon::L4_or_memopb_io:
3023 case Hexagon::STriw_pred:
3024 case Hexagon::LDriw_pred:
3025 case Hexagon::STriw_ctr:
3026 case Hexagon::LDriw_ctr:
3029 case Hexagon::PS_fi:
3030 case Hexagon::PS_fia:
3031 case Hexagon::INLINEASM:
3034 case Hexagon::L2_ploadrbt_io:
3035 case Hexagon::L2_ploadrbf_io:
3036 case Hexagon::L2_ploadrubt_io:
3037 case Hexagon::L2_ploadrubf_io:
3038 case Hexagon::S2_pstorerbt_io:
3039 case Hexagon::S2_pstorerbf_io:
3042 case Hexagon::L2_ploadrht_io:
3043 case Hexagon::L2_ploadrhf_io:
3044 case Hexagon::L2_ploadruht_io:
3045 case Hexagon::L2_ploadruhf_io:
3046 case Hexagon::S2_pstorerht_io:
3047 case Hexagon::S2_pstorerhf_io:
3048 case Hexagon::S2_pstorerft_io:
3049 case Hexagon::S2_pstorerff_io:
3052 case Hexagon::L2_ploadrit_io:
3053 case Hexagon::L2_ploadrif_io:
3054 case Hexagon::S2_pstorerit_io:
3055 case Hexagon::S2_pstorerif_io:
3058 case Hexagon::L2_ploadrdt_io:
3059 case Hexagon::L2_ploadrdf_io:
3060 case Hexagon::S2_pstorerdt_io:
3061 case Hexagon::S2_pstorerdf_io:
3064 case Hexagon::L2_loadbsw2_io:
3065 case Hexagon::L2_loadbzw2_io:
3068 case Hexagon::L2_loadbsw4_io:
3069 case Hexagon::L2_loadbzw4_io:
3073 dbgs() <<
"Failed Opcode is : " << Opcode <<
" (" <<
getName(Opcode)
3076 "Please define it in the above switch statement!");
3084 const uint64_t
F =
get(
MI.getOpcode()).TSFlags;
3106 switch (
MI.getOpcode()) {
3108 case Hexagon::L2_loadrub_io:
3109 case Hexagon::L4_loadrub_ur:
3110 case Hexagon::L4_loadrub_ap:
3111 case Hexagon::L2_loadrub_pr:
3112 case Hexagon::L2_loadrub_pbr:
3113 case Hexagon::L2_loadrub_pi:
3114 case Hexagon::L2_loadrub_pci:
3115 case Hexagon::L2_loadrub_pcr:
3116 case Hexagon::L2_loadbzw2_io:
3117 case Hexagon::L4_loadbzw2_ur:
3118 case Hexagon::L4_loadbzw2_ap:
3119 case Hexagon::L2_loadbzw2_pr:
3120 case Hexagon::L2_loadbzw2_pbr:
3121 case Hexagon::L2_loadbzw2_pi:
3122 case Hexagon::L2_loadbzw2_pci:
3123 case Hexagon::L2_loadbzw2_pcr:
3124 case Hexagon::L2_loadbzw4_io:
3125 case Hexagon::L4_loadbzw4_ur:
3126 case Hexagon::L4_loadbzw4_ap:
3127 case Hexagon::L2_loadbzw4_pr:
3128 case Hexagon::L2_loadbzw4_pbr:
3129 case Hexagon::L2_loadbzw4_pi:
3130 case Hexagon::L2_loadbzw4_pci:
3131 case Hexagon::L2_loadbzw4_pcr:
3132 case Hexagon::L4_loadrub_rr:
3133 case Hexagon::L2_ploadrubt_io:
3134 case Hexagon::L2_ploadrubt_pi:
3135 case Hexagon::L2_ploadrubf_io:
3136 case Hexagon::L2_ploadrubf_pi:
3137 case Hexagon::L2_ploadrubtnew_io:
3138 case Hexagon::L2_ploadrubfnew_io:
3139 case Hexagon::L4_ploadrubt_rr:
3140 case Hexagon::L4_ploadrubf_rr:
3141 case Hexagon::L4_ploadrubtnew_rr:
3142 case Hexagon::L4_ploadrubfnew_rr:
3143 case Hexagon::L2_ploadrubtnew_pi:
3144 case Hexagon::L2_ploadrubfnew_pi:
3145 case Hexagon::L4_ploadrubt_abs:
3146 case Hexagon::L4_ploadrubf_abs:
3147 case Hexagon::L4_ploadrubtnew_abs:
3148 case Hexagon::L4_ploadrubfnew_abs:
3149 case Hexagon::L2_loadrubgp:
3151 case Hexagon::L2_loadruh_io:
3152 case Hexagon::L4_loadruh_ur:
3153 case Hexagon::L4_loadruh_ap:
3154 case Hexagon::L2_loadruh_pr:
3155 case Hexagon::L2_loadruh_pbr:
3156 case Hexagon::L2_loadruh_pi:
3157 case Hexagon::L2_loadruh_pci:
3158 case Hexagon::L2_loadruh_pcr:
3159 case Hexagon::L4_loadruh_rr:
3160 case Hexagon::L2_ploadruht_io:
3161 case Hexagon::L2_ploadruht_pi:
3162 case Hexagon::L2_ploadruhf_io:
3163 case Hexagon::L2_ploadruhf_pi:
3164 case Hexagon::L2_ploadruhtnew_io:
3165 case Hexagon::L2_ploadruhfnew_io:
3166 case Hexagon::L4_ploadruht_rr:
3167 case Hexagon::L4_ploadruhf_rr:
3168 case Hexagon::L4_ploadruhtnew_rr:
3169 case Hexagon::L4_ploadruhfnew_rr:
3170 case Hexagon::L2_ploadruhtnew_pi:
3171 case Hexagon::L2_ploadruhfnew_pi:
3172 case Hexagon::L4_ploadruht_abs:
3173 case Hexagon::L4_ploadruhf_abs:
3174 case Hexagon::L4_ploadruhtnew_abs:
3175 case Hexagon::L4_ploadruhfnew_abs:
3176 case Hexagon::L2_loadruhgp:
3196 OffsetIsScalable =
false;
3198 if (!BaseOp || !BaseOp->
isReg())
3207 if (Second.
mayStore() &&
First.getOpcode() == Hexagon::S2_allocframe) {
3209 if (
Op.isReg() &&
Op.isUse() &&
Op.getReg() == Hexagon::R29)
3219 if (!Stored.
isReg())
3221 for (
unsigned i = 0, e =
First.getNumOperands(); i < e; ++i) {
3223 if (
Op.isReg() &&
Op.isDef() &&
Op.getReg() == Stored.
getReg())
3232 return Opc == Hexagon::PS_call_nr ||
Opc == Hexagon::PS_callr_nr;
3248 if (Hexagon::getRegForm(
MI.getOpcode()) >= 0)
3251 if (
MI.getDesc().mayLoad() ||
MI.getDesc().mayStore()) {
3258 NonExtOpcode = Hexagon::changeAddrMode_abs_io(
MI.getOpcode());
3264 NonExtOpcode = Hexagon::changeAddrMode_io_rr(
MI.getOpcode());
3267 NonExtOpcode = Hexagon::changeAddrMode_ur_rr(
MI.getOpcode());
3272 if (NonExtOpcode < 0)
3292 const uint64_t
F =
MI.getDesc().TSFlags;
3294 Subtarget.hasV60Ops();
3299 if (
MI.mayStore() && !Subtarget.useNewValueStores())
3302 const uint64_t
F =
MI.getDesc().TSFlags;
3307 return MI.getOpcode() == Hexagon::LX_L16b_pseudo;
3311 return MI.getOpcode() == Hexagon::LX_S16b_pseudo;
3341 if (!MII->isBundle())
3344 for (++MII; MII != MIE && MII->isInsideBundle(); ++MII) {
3356 if (MO.isRegMask() && MO.clobbersPhysReg(PredReg))
3358 if (MO.isReg() && MO.isDef() && MO.isImplicit() && (MO.getReg() == PredReg))
3364 switch (
MI.getOpcode()) {
3365 case Hexagon::A4_addp_c:
3366 case Hexagon::A4_subp_c:
3367 case Hexagon::A4_tlbmatch:
3368 case Hexagon::A5_ACS:
3369 case Hexagon::F2_sfinvsqrta:
3370 case Hexagon::F2_sfrecipa:
3371 case Hexagon::J2_endloop0:
3372 case Hexagon::J2_endloop01:
3373 case Hexagon::J2_ploop1si:
3374 case Hexagon::J2_ploop1sr:
3375 case Hexagon::J2_ploop2si:
3376 case Hexagon::J2_ploop2sr:
3377 case Hexagon::J2_ploop3si:
3378 case Hexagon::J2_ploop3sr:
3379 case Hexagon::S2_cabacdecbin:
3380 case Hexagon::S2_storew_locked:
3381 case Hexagon::S4_stored_locked:
3388 return Opcode == Hexagon::J2_jumpt ||
3389 Opcode == Hexagon::J2_jumptpt ||
3390 Opcode == Hexagon::J2_jumpf ||
3391 Opcode == Hexagon::J2_jumpfpt ||
3392 Opcode == Hexagon::J2_jumptnew ||
3393 Opcode == Hexagon::J2_jumpfnew ||
3394 Opcode == Hexagon::J2_jumptnewpt ||
3395 Opcode == Hexagon::J2_jumpfnewpt;
3405 const uint64_t
F =
MI.getDesc().TSFlags;
3424 unsigned BasePos = 0, OffsetPos = 0;
3447 unsigned &BasePos,
unsigned &OffsetPos)
const {
3455 }
else if (
MI.mayStore()) {
3458 }
else if (
MI.mayLoad()) {
3473 if (!
MI.getOperand(BasePos).isReg() || !
MI.getOperand(OffsetPos).isImm())
3488 if (
I ==
MBB.instr_begin())
3507 }
while (
I !=
MBB.instr_begin());
3509 I =
MBB.instr_end();
3512 while (
I->isDebugInstr()) {
3513 if (
I ==
MBB.instr_begin())
3517 if (!isUnpredicatedTerminator(*
I))
3526 if (&*
I != LastInst && !
I->isBundle() && isUnpredicatedTerminator(*
I)) {
3527 if (!SecondLastInst) {
3528 SecondLastInst = &*
I;
3533 if (
I ==
MBB.instr_begin())
3542 const uint64_t
F =
MI.getDesc().TSFlags;
3550 Register DstReg, SrcReg, Src1Reg, Src2Reg;
3552 switch (
MI.getOpcode()) {
3561 case Hexagon::C2_cmpeq:
3562 case Hexagon::C2_cmpgt:
3563 case Hexagon::C2_cmpgtu:
3564 DstReg =
MI.getOperand(0).getReg();
3565 Src1Reg =
MI.getOperand(1).getReg();
3566 Src2Reg =
MI.getOperand(2).getReg();
3567 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3568 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3572 case Hexagon::C2_cmpeqi:
3573 case Hexagon::C2_cmpgti:
3574 case Hexagon::C2_cmpgtui:
3576 DstReg =
MI.getOperand(0).getReg();
3577 SrcReg =
MI.getOperand(1).getReg();
3578 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3579 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3582 (
MI.getOperand(2).getImm() == -1)))
3585 case Hexagon::A2_tfr:
3587 DstReg =
MI.getOperand(0).getReg();
3588 SrcReg =
MI.getOperand(1).getReg();
3592 case Hexagon::A2_tfrsi:
3596 DstReg =
MI.getOperand(0).getReg();
3600 case Hexagon::S2_tstbit_i:
3601 DstReg =
MI.getOperand(0).getReg();
3602 Src1Reg =
MI.getOperand(1).getReg();
3603 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
3604 (Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
3605 MI.getOperand(2).isImm() &&
3613 case Hexagon::J2_jumptnew:
3614 case Hexagon::J2_jumpfnew:
3615 case Hexagon::J2_jumptnewpt:
3616 case Hexagon::J2_jumpfnewpt:
3617 Src1Reg =
MI.getOperand(0).getReg();
3618 if (Hexagon::PredRegsRegClass.
contains(Src1Reg) &&
3619 (Hexagon::P0 == Src1Reg || Hexagon::P1 == Src1Reg))
3626 case Hexagon::J2_jump:
3627 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4:
3628 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4_PIC:
3640 if ((GA.
getOpcode() != Hexagon::C2_cmpeqi) ||
3641 (GB.
getOpcode() != Hexagon::J2_jumptnew))
3646 if (DestReg != Hexagon::P0 && DestReg != Hexagon::P1)
3654 return DestReg == Hexagon::P0 ? Hexagon::J4_cmpeqn1_tp0_jump_nt
3655 : Hexagon::J4_cmpeqn1_tp1_jump_nt;
3658 return DestReg == Hexagon::P0 ? Hexagon::J4_cmpeqi_tp0_jump_nt
3659 : Hexagon::J4_cmpeqi_tp1_jump_nt;
3664 bool ForBigCore)
const {
3672 static const std::map<unsigned, unsigned> DupMap = {
3673 {Hexagon::A2_add, Hexagon::dup_A2_add},
3674 {Hexagon::A2_addi, Hexagon::dup_A2_addi},
3675 {Hexagon::A2_andir, Hexagon::dup_A2_andir},
3676 {Hexagon::A2_combineii, Hexagon::dup_A2_combineii},
3677 {Hexagon::A2_sxtb, Hexagon::dup_A2_sxtb},
3678 {Hexagon::A2_sxth, Hexagon::dup_A2_sxth},
3679 {Hexagon::A2_tfr, Hexagon::dup_A2_tfr},
3680 {Hexagon::A2_tfrsi, Hexagon::dup_A2_tfrsi},
3681 {Hexagon::A2_zxtb, Hexagon::dup_A2_zxtb},
3682 {Hexagon::A2_zxth, Hexagon::dup_A2_zxth},
3683 {Hexagon::A4_combineii, Hexagon::dup_A4_combineii},
3684 {Hexagon::A4_combineir, Hexagon::dup_A4_combineir},
3685 {Hexagon::A4_combineri, Hexagon::dup_A4_combineri},
3686 {Hexagon::C2_cmoveif, Hexagon::dup_C2_cmoveif},
3687 {Hexagon::C2_cmoveit, Hexagon::dup_C2_cmoveit},
3688 {Hexagon::C2_cmovenewif, Hexagon::dup_C2_cmovenewif},
3689 {Hexagon::C2_cmovenewit, Hexagon::dup_C2_cmovenewit},
3690 {Hexagon::C2_cmpeqi, Hexagon::dup_C2_cmpeqi},
3691 {Hexagon::L2_deallocframe, Hexagon::dup_L2_deallocframe},
3692 {Hexagon::L2_loadrb_io, Hexagon::dup_L2_loadrb_io},
3693 {Hexagon::L2_loadrd_io, Hexagon::dup_L2_loadrd_io},
3694 {Hexagon::L2_loadrh_io, Hexagon::dup_L2_loadrh_io},
3695 {Hexagon::L2_loadri_io, Hexagon::dup_L2_loadri_io},
3696 {Hexagon::L2_loadrub_io, Hexagon::dup_L2_loadrub_io},
3697 {Hexagon::L2_loadruh_io, Hexagon::dup_L2_loadruh_io},
3698 {Hexagon::S2_allocframe, Hexagon::dup_S2_allocframe},
3699 {Hexagon::S2_storerb_io, Hexagon::dup_S2_storerb_io},
3700 {Hexagon::S2_storerd_io, Hexagon::dup_S2_storerd_io},
3701 {Hexagon::S2_storerh_io, Hexagon::dup_S2_storerh_io},
3702 {Hexagon::S2_storeri_io, Hexagon::dup_S2_storeri_io},
3703 {Hexagon::S4_storeirb_io, Hexagon::dup_S4_storeirb_io},
3704 {Hexagon::S4_storeiri_io, Hexagon::dup_S4_storeiri_io},
3706 unsigned OpNum =
MI.getOpcode();
3709 auto Iter = DupMap.find(OpNum);
3710 if (Iter != DupMap.end())
3711 return Iter->second;
3713 for (
const auto &Iter : DupMap)
3714 if (Iter.second == OpNum)
3721 enum Hexagon::PredSense inPredSense;
3722 inPredSense = invertPredicate ? Hexagon::PredSense_false :
3723 Hexagon::PredSense_true;
3724 int CondOpcode = Hexagon::getPredOpcode(
Opc, inPredSense);
3725 if (CondOpcode >= 0)
3733 switch (
MI.getOpcode()) {
3735 case Hexagon::V6_vL32b_pi:
3736 return Hexagon::V6_vL32b_cur_pi;
3737 case Hexagon::V6_vL32b_ai:
3738 return Hexagon::V6_vL32b_cur_ai;
3739 case Hexagon::V6_vL32b_nt_pi:
3740 return Hexagon::V6_vL32b_nt_cur_pi;
3741 case Hexagon::V6_vL32b_nt_ai:
3742 return Hexagon::V6_vL32b_nt_cur_ai;
3743 case Hexagon::V6_vL32b_ppu:
3744 return Hexagon::V6_vL32b_cur_ppu;
3745 case Hexagon::V6_vL32b_nt_ppu:
3746 return Hexagon::V6_vL32b_nt_cur_ppu;
3753 switch (
MI.getOpcode()) {
3755 case Hexagon::V6_vL32b_cur_pi:
3756 return Hexagon::V6_vL32b_pi;
3757 case Hexagon::V6_vL32b_cur_ai:
3758 return Hexagon::V6_vL32b_ai;
3759 case Hexagon::V6_vL32b_nt_cur_pi:
3760 return Hexagon::V6_vL32b_nt_pi;
3761 case Hexagon::V6_vL32b_nt_cur_ai:
3762 return Hexagon::V6_vL32b_nt_ai;
3763 case Hexagon::V6_vL32b_cur_ppu:
3764 return Hexagon::V6_vL32b_ppu;
3765 case Hexagon::V6_vL32b_nt_cur_ppu:
3766 return Hexagon::V6_vL32b_nt_ppu;
3854 int NVOpcode = Hexagon::getNewValueOpcode(
MI.getOpcode());
3858 switch (
MI.getOpcode()) {
3861 std::to_string(
MI.getOpcode()));
3862 case Hexagon::S4_storerb_ur:
3863 return Hexagon::S4_storerbnew_ur;
3865 case Hexagon::S2_storerb_pci:
3866 return Hexagon::S2_storerb_pci;
3868 case Hexagon::S2_storeri_pci:
3869 return Hexagon::S2_storeri_pci;
3871 case Hexagon::S2_storerh_pci:
3872 return Hexagon::S2_storerh_pci;
3874 case Hexagon::S2_storerd_pci:
3875 return Hexagon::S2_storerd_pci;
3877 case Hexagon::S2_storerf_pci:
3878 return Hexagon::S2_storerf_pci;
3880 case Hexagon::V6_vS32b_ai:
3881 return Hexagon::V6_vS32b_new_ai;
3883 case Hexagon::V6_vS32b_pi:
3884 return Hexagon::V6_vS32b_new_pi;
3909 if (BrTarget.
isMBB()) {
3911 Taken = getEdgeProbability(Src, Dst) >= OneHalf;
3924 bool SawCond =
false, Bad =
false;
3928 if (
I.isConditionalBranch()) {
3935 if (
I.isUnconditionalBranch() && !SawCond) {
3943 if (NextIt ==
B.instr_end()) {
3946 if (!
B.isLayoutSuccessor(SB))
3948 Taken = getEdgeProbability(Src, SB) < OneHalf;
3952 assert(NextIt->isUnconditionalBranch());
3961 Taken =
BT && getEdgeProbability(Src,
BT) < OneHalf;
3968 switch (
MI.getOpcode()) {
3969 case Hexagon::J2_jumpt:
3970 return Taken ? Hexagon::J2_jumptnewpt : Hexagon::J2_jumptnew;
3971 case Hexagon::J2_jumpf:
3972 return Taken ? Hexagon::J2_jumpfnewpt : Hexagon::J2_jumpfnew;
3982 switch (
MI.getOpcode()) {
3984 case Hexagon::J2_jumpt:
3985 case Hexagon::J2_jumpf:
3989 int NewOpcode = Hexagon::getPredNewOpcode(
MI.getOpcode());
3996 int NewOp =
MI.getOpcode();
3998 NewOp = Hexagon::getPredOldOpcode(NewOp);
4002 if (!Subtarget.hasFeature(Hexagon::ArchV60)) {
4004 case Hexagon::J2_jumptpt:
4005 NewOp = Hexagon::J2_jumpt;
4007 case Hexagon::J2_jumpfpt:
4008 NewOp = Hexagon::J2_jumpf;
4010 case Hexagon::J2_jumprtpt:
4011 NewOp = Hexagon::J2_jumprt;
4013 case Hexagon::J2_jumprfpt:
4014 NewOp = Hexagon::J2_jumprf;
4019 "Couldn't change predicate new instruction to its old form.");
4023 NewOp = Hexagon::getNonNVStore(NewOp);
4024 assert(NewOp >= 0 &&
"Couldn't change new-value store to its old form.");
4027 if (Subtarget.hasV60Ops())
4032 case Hexagon::J2_jumpfpt:
4033 return Hexagon::J2_jumpf;
4034 case Hexagon::J2_jumptpt:
4035 return Hexagon::J2_jumpt;
4036 case Hexagon::J2_jumprfpt:
4037 return Hexagon::J2_jumprf;
4038 case Hexagon::J2_jumprtpt:
4039 return Hexagon::J2_jumprt;
4048 Register DstReg, SrcReg, Src1Reg, Src2Reg;
4051 switch (
MI.getOpcode()) {
4059 case Hexagon::L2_loadri_io:
4060 case Hexagon::dup_L2_loadri_io:
4061 DstReg =
MI.getOperand(0).getReg();
4062 SrcReg =
MI.getOperand(1).getReg();
4066 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4068 MI.getOperand(2).isImm() &&
4073 (
MI.getOperand(2).isImm() &&
4078 case Hexagon::L2_loadrub_io:
4079 case Hexagon::dup_L2_loadrub_io:
4081 DstReg =
MI.getOperand(0).getReg();
4082 SrcReg =
MI.getOperand(1).getReg();
4084 MI.getOperand(2).isImm() &&
isUInt<4>(
MI.getOperand(2).getImm()))
4097 case Hexagon::L2_loadrh_io:
4098 case Hexagon::L2_loadruh_io:
4099 case Hexagon::dup_L2_loadrh_io:
4100 case Hexagon::dup_L2_loadruh_io:
4102 DstReg =
MI.getOperand(0).getReg();
4103 SrcReg =
MI.getOperand(1).getReg();
4105 MI.getOperand(2).isImm() &&
4109 case Hexagon::L2_loadrb_io:
4110 case Hexagon::dup_L2_loadrb_io:
4112 DstReg =
MI.getOperand(0).getReg();
4113 SrcReg =
MI.getOperand(1).getReg();
4115 MI.getOperand(2).isImm() &&
4119 case Hexagon::L2_loadrd_io:
4120 case Hexagon::dup_L2_loadrd_io:
4122 DstReg =
MI.getOperand(0).getReg();
4123 SrcReg =
MI.getOperand(1).getReg();
4125 Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4127 MI.getOperand(2).isImm() &&
4133 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4:
4134 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4_PIC:
4135 case Hexagon::L4_return:
4136 case Hexagon::L2_deallocframe:
4137 case Hexagon::dup_L2_deallocframe:
4139 case Hexagon::EH_RETURN_JMPR:
4140 case Hexagon::PS_jmpret:
4141 case Hexagon::SL2_jumpr31:
4144 DstReg =
MI.getOperand(0).getReg();
4145 if (Hexagon::IntRegsRegClass.
contains(DstReg) && (Hexagon::R31 == DstReg))
4148 case Hexagon::PS_jmprett:
4149 case Hexagon::PS_jmpretf:
4150 case Hexagon::PS_jmprettnewpt:
4151 case Hexagon::PS_jmpretfnewpt:
4152 case Hexagon::PS_jmprettnew:
4153 case Hexagon::PS_jmpretfnew:
4154 case Hexagon::SL2_jumpr31_t:
4155 case Hexagon::SL2_jumpr31_f:
4156 case Hexagon::SL2_jumpr31_tnew:
4157 case Hexagon::SL2_jumpr31_fnew:
4158 DstReg =
MI.getOperand(1).getReg();
4159 SrcReg =
MI.getOperand(0).getReg();
4161 if ((Hexagon::PredRegsRegClass.
contains(SrcReg) &&
4162 (Hexagon::P0 == SrcReg)) &&
4163 (Hexagon::IntRegsRegClass.
contains(DstReg) && (Hexagon::R31 == DstReg)))
4166 case Hexagon::L4_return_t:
4167 case Hexagon::L4_return_f:
4168 case Hexagon::L4_return_tnew_pnt:
4169 case Hexagon::L4_return_fnew_pnt:
4170 case Hexagon::L4_return_tnew_pt:
4171 case Hexagon::L4_return_fnew_pt:
4173 SrcReg =
MI.getOperand(0).getReg();
4174 if (Hexagon::PredRegsRegClass.
contains(SrcReg) && (Hexagon::P0 == SrcReg))
4182 case Hexagon::S2_storeri_io:
4183 case Hexagon::dup_S2_storeri_io:
4186 Src1Reg =
MI.getOperand(0).getReg();
4187 Src2Reg =
MI.getOperand(2).getReg();
4188 if (Hexagon::IntRegsRegClass.
contains(Src1Reg) &&
4195 MI.getOperand(1).isImm() &&
4199 case Hexagon::S2_storerb_io:
4200 case Hexagon::dup_S2_storerb_io:
4202 Src1Reg =
MI.getOperand(0).getReg();
4203 Src2Reg =
MI.getOperand(2).getReg();
4205 MI.getOperand(1).isImm() &&
isUInt<4>(
MI.getOperand(1).getImm()))
4217 case Hexagon::S2_storerh_io:
4218 case Hexagon::dup_S2_storerh_io:
4220 Src1Reg =
MI.getOperand(0).getReg();
4221 Src2Reg =
MI.getOperand(2).getReg();
4223 MI.getOperand(1).isImm() &&
4227 case Hexagon::S2_storerd_io:
4228 case Hexagon::dup_S2_storerd_io:
4230 Src1Reg =
MI.getOperand(0).getReg();
4231 Src2Reg =
MI.getOperand(2).getReg();
4233 Hexagon::IntRegsRegClass.
contains(Src1Reg) &&
4238 case Hexagon::S4_storeiri_io:
4239 case Hexagon::dup_S4_storeiri_io:
4241 Src1Reg =
MI.getOperand(0).getReg();
4244 MI.getOperand(2).isImm() &&
isUInt<1>(
MI.getOperand(2).getImm()))
4247 case Hexagon::S4_storeirb_io:
4248 case Hexagon::dup_S4_storeirb_io:
4250 Src1Reg =
MI.getOperand(0).getReg();
4252 MI.getOperand(1).isImm() &&
isUInt<4>(
MI.getOperand(1).getImm()) &&
4253 MI.getOperand(2).isImm() &&
isUInt<1>(
MI.getOperand(2).getImm()))
4256 case Hexagon::S2_allocframe:
4257 case Hexagon::dup_S2_allocframe:
4258 if (
MI.getOperand(2).isImm() &&
4280 case Hexagon::A2_addi:
4281 case Hexagon::dup_A2_addi:
4282 DstReg =
MI.getOperand(0).getReg();
4283 SrcReg =
MI.getOperand(1).getReg();
4286 if (Hexagon::IntRegsRegClass.
contains(SrcReg) &&
4291 if ((DstReg == SrcReg) &&
MI.getOperand(2).isImm() &&
4297 ((
MI.getOperand(2).getImm() == 1) ||
4298 (
MI.getOperand(2).getImm() == -1)))
4302 case Hexagon::A2_add:
4303 case Hexagon::dup_A2_add:
4305 DstReg =
MI.getOperand(0).getReg();
4306 Src1Reg =
MI.getOperand(1).getReg();
4307 Src2Reg =
MI.getOperand(2).getReg();
4312 case Hexagon::A2_andir:
4313 case Hexagon::dup_A2_andir:
4317 DstReg =
MI.getOperand(0).getReg();
4318 SrcReg =
MI.getOperand(1).getReg();
4320 MI.getOperand(2).isImm() &&
4321 ((
MI.getOperand(2).getImm() == 1) ||
4322 (
MI.getOperand(2).getImm() == 255)))
4325 case Hexagon::A2_tfr:
4326 case Hexagon::dup_A2_tfr:
4328 DstReg =
MI.getOperand(0).getReg();
4329 SrcReg =
MI.getOperand(1).getReg();
4333 case Hexagon::A2_tfrsi:
4334 case Hexagon::dup_A2_tfrsi:
4339 DstReg =
MI.getOperand(0).getReg();
4343 case Hexagon::C2_cmoveit:
4344 case Hexagon::C2_cmovenewit:
4345 case Hexagon::C2_cmoveif:
4346 case Hexagon::C2_cmovenewif:
4347 case Hexagon::dup_C2_cmoveit:
4348 case Hexagon::dup_C2_cmovenewit:
4349 case Hexagon::dup_C2_cmoveif:
4350 case Hexagon::dup_C2_cmovenewif:
4354 DstReg =
MI.getOperand(0).getReg();
4355 SrcReg =
MI.getOperand(1).getReg();
4357 Hexagon::PredRegsRegClass.
contains(SrcReg) && Hexagon::P0 == SrcReg &&
4358 MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0)
4361 case Hexagon::C2_cmpeqi:
4362 case Hexagon::dup_C2_cmpeqi:
4364 DstReg =
MI.getOperand(0).getReg();
4365 SrcReg =
MI.getOperand(1).getReg();
4366 if (Hexagon::PredRegsRegClass.
contains(DstReg) &&
4368 MI.getOperand(2).isImm() &&
isUInt<2>(
MI.getOperand(2).getImm()))
4371 case Hexagon::A2_combineii:
4372 case Hexagon::A4_combineii:
4373 case Hexagon::dup_A2_combineii:
4374 case Hexagon::dup_A4_combineii:
4376 DstReg =
MI.getOperand(0).getReg();
4378 ((
MI.getOperand(1).isImm() &&
isUInt<2>(
MI.getOperand(1).getImm())) ||
4379 (
MI.getOperand(1).isGlobal() &&
4381 ((
MI.getOperand(2).isImm() &&
isUInt<2>(
MI.getOperand(2).getImm())) ||
4382 (
MI.getOperand(2).isGlobal() &&
4386 case Hexagon::A4_combineri:
4387 case Hexagon::dup_A4_combineri:
4390 DstReg =
MI.getOperand(0).getReg();
4391 SrcReg =
MI.getOperand(1).getReg();
4393 ((
MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0) ||
4394 (
MI.getOperand(2).isGlobal() &&
MI.getOperand(2).getOffset() == 0)))
4397 case Hexagon::A4_combineir:
4398 case Hexagon::dup_A4_combineir:
4400 DstReg =
MI.getOperand(0).getReg();
4401 SrcReg =
MI.getOperand(2).getReg();
4403 ((
MI.getOperand(1).isImm() &&
MI.getOperand(1).getImm() == 0) ||
4404 (
MI.getOperand(1).isGlobal() &&
MI.getOperand(1).getOffset() == 0)))
4407 case Hexagon::A2_sxtb:
4408 case Hexagon::A2_sxth:
4409 case Hexagon::A2_zxtb:
4410 case Hexagon::A2_zxth:
4411 case Hexagon::dup_A2_sxtb:
4412 case Hexagon::dup_A2_sxth:
4413 case Hexagon::dup_A2_zxtb:
4414 case Hexagon::dup_A2_zxth:
4416 DstReg =
MI.getOperand(0).getReg();
4417 SrcReg =
MI.getOperand(1).getReg();
4433 if (
MI.isTransient())
4457 int Idx =
DefMI.findRegisterDefOperandIdx(SR, &HRI,
false,
false);
4468 int Idx =
UseMI.findRegisterUseOperandIdx(SR, &HRI,
false);
4502 : Hexagon::getTruePredOpcode(
Opc);
4503 if (InvPredOpcode >= 0)
4504 return InvPredOpcode;
4511 const uint64_t
F =
MI.getDesc().TSFlags;
4518 return ~(-1U << (bits - 1));
4520 return ~(-1U << bits);
4525 switch (
MI.getOpcode()) {
4526 case Hexagon::L2_loadrbgp:
4527 case Hexagon::L2_loadrdgp:
4528 case Hexagon::L2_loadrhgp:
4529 case Hexagon::L2_loadrigp:
4530 case Hexagon::L2_loadrubgp:
4531 case Hexagon::L2_loadruhgp:
4532 case Hexagon::S2_storerbgp:
4533 case Hexagon::S2_storerbnewgp:
4534 case Hexagon::S2_storerhgp:
4535 case Hexagon::S2_storerhnewgp:
4536 case Hexagon::S2_storerigp:
4537 case Hexagon::S2_storerinewgp:
4538 case Hexagon::S2_storerdgp:
4539 case Hexagon::S2_storerfgp:
4542 const uint64_t
F =
MI.getDesc().TSFlags;
4557 if (
MI.getOpcode() == Hexagon::A4_ext)
4565 const uint64_t
F =
MI.getDesc().TSFlags;
4571 bool ToBigInstrs)
const {
4583 MII->setDesc(
get(Opcode));
4589 bool ToBigInstrs)
const {
4592 End = MB.instr_end();
4593 Instr !=
End; ++Instr)
4601 while ((MII !=
MBB->instr_end()) && MII->isInsideBundle()) {
4610 const uint64_t
F =
MI.getDesc().TSFlags;
4611 unsigned S = (
F >> MemAccessSizePos) & MemAccesSizeMask;
4612 unsigned Size = getMemAccessSizeInBytes(MemAccessSize(S));
4616 if (
MI.getOpcode() == Hexagon::Y2_dcfetchbo)
4623 return HRI.getSpillSize(Hexagon::HvxVRRegClass);
4625 return HRI.getSpillSize(Hexagon::HlxLRRegClass);
4633 const uint64_t
F =
MI.getDesc().TSFlags;
4640 return -1U << (bits - 1);
4649 short NonExtOpcode = Hexagon::getRegForm(
MI.getOpcode());
4650 if (NonExtOpcode >= 0)
4651 return NonExtOpcode;
4653 if (
MI.getDesc().mayLoad() ||
MI.getDesc().mayStore()) {
4657 return Hexagon::changeAddrMode_abs_io(
MI.getOpcode());
4659 return Hexagon::changeAddrMode_io_rr(
MI.getOpcode());
4661 return Hexagon::changeAddrMode_ur_rr(
MI.getOpcode());
4671 Register &PredReg,
unsigned &PredRegPos,
4680 PredReg =
Cond[1].getReg();
4684 if (
Cond[1].isImplicit())
4692 return Hexagon::getRegForm(
MI.getOpcode());
4700 if (
MI.isDebugInstr() ||
MI.isPosition())
4703 unsigned Size =
MI.getDesc().getSize();
4719 unsigned NumDefs = 0;
4720 for (;
MI.getOperand(NumDefs).
isReg() &&
MI.getOperand(NumDefs).isDef();
4722 assert(NumDefs !=
MI.getNumOperands()-2 &&
"No asm string?");
4724 assert(
MI.getOperand(NumDefs).isSymbol() &&
"No asm string?");
4726 const char *AsmStr =
MI.getOperand(NumDefs).getSymbolName();
4734 const uint64_t
F =
MI.getDesc().TSFlags;
4740 const InstrStage &IS = *
II.beginStage(
MI.getDesc().getSchedClass());
4742 return IS.getUnits();
4752 assert(BundleHead->isBundle() &&
"Not a bundle header");
4762 "Instruction must be extendable");
4768 "Branch with unknown extendable field type");
4780 int TargetPos =
MI.getNumOperands() - 1;
4783 while ((TargetPos > -1) && !
MI.getOperand(TargetPos).isMBB())
4785 assert((TargetPos >= 0) &&
MI.getOperand(TargetPos).isMBB());
4786 MI.getOperand(TargetPos).setMBB(NewTarget);
4790 MI.setDesc(
get(NewOpcode));
4802 for (
unsigned insn = TargetOpcode::GENERIC_OP_END+1;
4803 insn < Hexagon::INSTRUCTION_LIST_END; ++insn) {
4824 int PredRevOpcode = -1;
4826 PredRevOpcode = Hexagon::notTakenBranchPrediction(Opcode);
4828 PredRevOpcode = Hexagon::takenBranchPrediction(Opcode);
4829 assert(PredRevOpcode > 0);
4830 return PredRevOpcode;
4836 return Cond.empty() || (
Cond[0].isImm() && (
Cond.size() != 1));
4843 if (Operand.
isImm())
4844 Operand.
setImm(Operand.
getImm() | memShufDisabledMask);
4852 return (Operand.
isImm() && (Operand.
getImm() & memShufDisabledMask) != 0);
4856 return (
MI->getOpcode() == Hexagon::V6_vmpy_qf16_hf ||
4857 MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
4858 MI->getOpcode() == Hexagon::V6_vmpy_qf32_hf ||
4859 MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
4860 MI->getOpcode() == Hexagon::V6_vmpy_qf32_sf ||
4861 MI->getOpcode() == Hexagon::V6_vmpy_qf16_mix_hf ||
4862 MI->getOpcode() == Hexagon::V6_vmpy_qf16 ||
4863 MI->getOpcode() == Hexagon::V6_vmpy_qf32_mix_hf ||
4864 MI->getOpcode() == Hexagon::V6_vmpy_qf32_qf16 ||
4865 MI->getOpcode() == Hexagon::V6_vmpy_qf32);
4886 case Hexagon::V6_vabs_qf16_hf:
4888 case Hexagon::V6_vabs_qf16_qf16:
4890 case Hexagon::V6_vabs_qf32_qf32:
4892 case Hexagon::V6_vabs_qf32_sf:
4894 case Hexagon::V6_vadd_hf:
4896 case Hexagon::V6_vadd_qf16:
4898 case Hexagon::V6_vadd_qf16_mix:
4900 case Hexagon::V6_vadd_qf32:
4902 case Hexagon::V6_vadd_qf32_mix:
4904 case Hexagon::V6_vadd_sf:
4906 case Hexagon::V6_vconv_bf_qf32:
4908 case Hexagon::V6_vconv_f8_qf16:
4910 case Hexagon::V6_vconv_hf_qf16:
4912 case Hexagon::V6_vconv_hf_qf32:
4914 case Hexagon::V6_vconv_qf16_f8:
4916 case Hexagon::V6_vconv_qf16_hf:
4918 case Hexagon::V6_vconv_qf16_qf16:
4920 case Hexagon::V6_vconv_qf32_qf32:
4922 case Hexagon::V6_vconv_qf32_sf:
4924 case Hexagon::V6_vconv_sf_qf32:
4926 case Hexagon::V6_vilog2_qf16:
4928 case Hexagon::V6_vilog2_qf32:
4930 case Hexagon::V6_vmpy_qf16:
4932 case Hexagon::V6_vmpy_qf16_hf:
4934 case Hexagon::V6_vmpy_qf16_mix_hf:
4936 case Hexagon::V6_vmpy_qf32:
4938 case Hexagon::V6_vmpy_qf32_hf:
4940 case Hexagon::V6_vmpy_qf32_mix_hf:
4942 case Hexagon::V6_vmpy_qf32_qf16:
4944 case Hexagon::V6_vmpy_qf32_sf:
4946 case Hexagon::V6_vmpy_rt_hf:
4948 case Hexagon::V6_vmpy_rt_qf16:
4950 case Hexagon::V6_vmpy_rt_sf:
4952 case Hexagon::V6_vneg_qf16_hf:
4954 case Hexagon::V6_vneg_qf16_qf16:
4956 case Hexagon::V6_vneg_qf32_qf32:
4958 case Hexagon::V6_vneg_qf32_sf:
4960 case Hexagon::V6_vsub_hf:
4962 case Hexagon::V6_vsub_qf16:
4964 case Hexagon::V6_vsub_qf16_mix:
4966 case Hexagon::V6_vsub_qf32:
4968 case Hexagon::V6_vsub_qf32_mix:
4970 case Hexagon::V6_vsub_sf:
4972 case Hexagon::V6_vsub_sf_mix:
4974 case Hexagon::V6_vsub_hf_mix:
5047 if (!
A || !
B ||
A->getParent() !=
B->getParent())
5061 return Opc >= 0 ? Hexagon::changeAddrMode_abs_io(
Opc) :
Opc;
5065 return Opc >= 0 ? Hexagon::changeAddrMode_io_abs(
Opc) :
Opc;
5069 return Opc >= 0 ? Hexagon::changeAddrMode_io_pi(
Opc) :
Opc;
5073 return Opc >= 0 ? Hexagon::changeAddrMode_io_rr(
Opc) :
Opc;
5077 return Opc >= 0 ? Hexagon::changeAddrMode_pi_io(
Opc) :
Opc;
5081 return Opc >= 0 ? Hexagon::changeAddrMode_rr_io(
Opc) :
Opc;
5085 return Opc >= 0 ? Hexagon::changeAddrMode_rr_ur(
Opc) :
Opc;
5089 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.
bool isTmpLoadPseudo(const MachineInstr &MI) const
int getDuplexOpcode(const MachineInstr &MI, bool ForBigCore=true) const
bool isHLXVec(const MachineInstr &MI) const
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
Remove the branching code at the end of the specific MBB.
bool isPredicated(const MachineInstr &MI) const override
Returns true if the instruction is already predicated.
bool isHVXMemWithAIndirect(const MachineInstr &I, const MachineInstr &J) const
short changeAddrMode_abs_io(short Opc) const
bool isRestrictNoSlot1Store(const MachineInstr &MI) const
short getRegForm(const MachineInstr &MI) const
bool isVecALU(const MachineInstr &MI) const
bool isCompoundBranchInstr(const MachineInstr &MI) const
bool isDuplexPair(const MachineInstr &MIa, const MachineInstr &MIb) const
Symmetrical. See if these two instructions are fit for duplex pair.
bool isJumpR(const MachineInstr &MI) const
ScheduleHazardRecognizer * CreateTargetPostRAHazardRecognizer(const InstrItineraryData *II, const ScheduleDAG *DAG) const override
Allocate and return a hazard recognizer to use for this target when scheduling the machine instructio...
std::pair< unsigned, unsigned > decomposeMachineOperandsTargetFlags(unsigned TF) const override
Decompose the machine operand's target flags into two values - the direct target flag value and any o...
bool getMemOperandsWithOffsetWidth(const MachineInstr &LdSt, SmallVectorImpl< const MachineOperand * > &BaseOps, int64_t &Offset, bool &OffsetIsScalable, LocationSize &Width) const override
Get the base register and byte offset of a load/store instr.
bool producesStall(const MachineInstr &ProdMI, const MachineInstr &ConsMI) const
bool invertAndChangeJumpTarget(MachineInstr &MI, MachineBasicBlock *NewTarget) const
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
Store the specified register of the given register class to the specified stack frame index.
bool isPredictedTaken(unsigned Opcode) const
bool isSaveCalleeSavedRegsCall(const MachineInstr &MI) const
bool hasQFPInstrs(const MachineFunction &MF) const
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
TargetInstrInfo overrides.
unsigned nonDbgBundleSize(MachineBasicBlock::const_iterator BundleHead) const
int getDotNewPredOp(const MachineInstr &MI, const MachineBranchProbabilityInfo *MBPI) const
bool isQFP32Instr(MachineInstr *MI) const
bool ClobbersPredicate(MachineInstr &MI, std::vector< MachineOperand > &Pred, bool SkipDead) const override
If the specified instruction defines any predicate or condition code register(s) used for predication...
unsigned getInvertedPredicatedOpcode(const int Opc) const
bool isPureSlot0(const MachineInstr &MI) const
bool doesNotReturn(const MachineInstr &CallMI) const
HexagonII::SubInstructionGroup getDuplexCandidateGroup(const MachineInstr &MI) const
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
Analyze the branching code at the end of MBB, returning true if it cannot be understood (e....
bool usesQF16Operand(MachineInstr *MI, unsigned Index=0) const
bool isPredicatedNew(const MachineInstr &MI) const
bool isSignExtendingLoad(const MachineInstr &MI) const
bool isVecAcc(const MachineInstr &MI) const
bool reversePredSense(MachineInstr &MI) const
bool isPostIncWithImmOffset(const MachineInstr &MI) const
bool isQFPMul(const MachineInstr *MF) const
unsigned getAddrMode(const MachineInstr &MI) const
MCInst getNop() const override
bool isJumpWithinBranchRange(const MachineInstr &MI, unsigned offset) const
bool mayBeNewStore(const MachineInstr &MI) const
bool isOperandExtended(const MachineInstr &MI, unsigned OperandNum) const
bool canExecuteInBundle(const MachineInstr &First, const MachineInstr &Second) const
Can these instructions execute at the same time in a bundle.
bool isQFP16Instr(MachineInstr *MI) const
std::optional< unsigned > getOperandLatency(const InstrItineraryData *ItinData, const MachineInstr &DefMI, unsigned DefIdx, const MachineInstr &UseMI, unsigned UseIdx) const override
getOperandLatency - Compute and return the use operand latency of a given pair of def and use.
bool isAddrModeWithOffset(const MachineInstr &MI) const
bool isBaseImmOffset(const MachineInstr &MI) const
bool isAbsoluteSet(const MachineInstr &MI) const
short changeAddrMode_io_pi(short Opc) const
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register DestReg, Register SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
Emit instructions to copy a pair of physical registers.
short changeAddrMode_pi_io(short Opc) const
bool analyzeCompare(const MachineInstr &MI, Register &SrcReg, Register &SrcReg2, int64_t &Mask, int64_t &Value) const override
For a comparison instruction, return the source registers in SrcReg and SrcReg2 if having two registe...
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
Reverses the branch condition of the specified condition list, returning false on success and true if...
std::unique_ptr< PipelinerLoopInfo > analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const override
Analyze loop L, which must be a single-basic-block loop, and if the conditions can be understood enou...
bool isLoopN(const MachineInstr &MI) const
bool isSpillPredRegOp(const MachineInstr &MI) const
bool hasStoreToStackSlot(const MachineInstr &MI, SmallVectorImpl< const MachineMemOperand * > &Accesses) const override
Check if the instruction or the bundle of instructions has store to stack slots.
ArrayRef< std::pair< unsigned, const char * > > getSerializableDirectMachineOperandTargetFlags() const override
Return an array that contains the direct target flag values and their names.
bool isIndirectCall(const MachineInstr &MI) const
short changeAddrMode_ur_rr(short Opc) const
bool isValidAutoIncImm(const EVT VT, const int Offset) const
bool hasNonExtEquivalent(const MachineInstr &MI) const
bool isConstExtended(const MachineInstr &MI) const
bool getIncrementValue(const MachineInstr &MI, int &Value) const override
If the instruction is an increment of a constant value, return the amount.
int getCondOpcode(int Opc, bool sense) const
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 isNewStorePseudo(const MachineInstr &MI) const
bool isTailCall(const MachineInstr &MI) const override
void insertNoop(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override
Insert a noop into the instruction stream at the specified point.
bool isDeallocRet(const MachineInstr &MI) const
HexagonInstrInfo(const HexagonSubtarget &ST)
unsigned getCExtOpNum(const MachineInstr &MI) const
bool isSolo(const MachineInstr &MI) const
DFAPacketizer * CreateTargetScheduleState(const TargetSubtargetInfo &STI) const override
Create machine specific model for scheduling.
bool isLateSourceInstr(const MachineInstr &MI) const
bool isDotNewInst(const MachineInstr &MI) const
void translateInstrsForDup(MachineFunction &MF, bool ToBigInstrs=true) const
bool isTC1(const MachineInstr &MI) const
bool isSchedulingBoundary(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const override
Test if the given instruction should be considered a scheduling boundary.
bool predCanBeUsedAsDotNew(const MachineInstr &MI, Register PredReg) const
unsigned getSize(const MachineInstr &MI) const
bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, BranchProbability Probability) const override
Return true if it's profitable for if-converter to duplicate instructions of specified accumulated in...
short changeAddrMode_io_abs(short Opc) const
int getDotCurOp(const MachineInstr &MI) const
bool expandPostRAPseudo(MachineInstr &MI) const override
This function is called for all pseudo instructions that remain after register allocation.
bool isMIBefore(const MachineInstr *A, const MachineInstr *B) const
bool isExpr(unsigned OpType) const
void genAllInsnTimingClasses(MachineFunction &MF) const
bool isTC2Early(const MachineInstr &MI) const
bool hasEHLabel(const MachineBasicBlock *B) const
bool shouldSink(const MachineInstr &MI) const override
bool isZeroExtendingLoad(const MachineInstr &MI) const
short changeAddrMode_rr_io(short Opc) const
bool isHVXVec(const MachineInstr &MI) const
bool isDependent(const MachineInstr &ProdMI, const MachineInstr &ConsMI) const
short changeAddrMode_io_rr(short Opc) const
bool SubsumesPredicate(ArrayRef< MachineOperand > Pred1, ArrayRef< MachineOperand > Pred2) const override
Returns true if the first specified predicate subsumes the second, e.g.
bool mayBeCurLoad(const MachineInstr &MI) const
bool getBundleNoShuf(const MachineInstr &MIB) const
bool isNewValueJump(const MachineInstr &MI) const
bool isTC4x(const MachineInstr &MI) const
bool PredicateInstruction(MachineInstr &MI, ArrayRef< MachineOperand > Cond) const override
Convert the instruction into a predicated instruction.
bool getPredReg(ArrayRef< MachineOperand > Cond, Register &PredReg, unsigned &PredRegPos, RegState &PredRegFlags) const
bool isFloat(const MachineInstr &MI) const
bool isQFPInstr(MachineInstr *MI) const
bool isToBeScheduledASAP(const MachineInstr &MI1, const MachineInstr &MI2) const
MachineOperand * getBaseAndOffset(const MachineInstr &MI, int64_t &Offset, LocationSize &AccessSize) const
bool getInvertedPredSense(SmallVectorImpl< MachineOperand > &Cond) const
unsigned nonDbgBBSize(const MachineBasicBlock *BB) const
getInstrTimingClassLatency - Compute the instruction latency of a given instruction using Timing Clas...
uint64_t getType(const MachineInstr &MI) const
bool isEndLoopN(unsigned Opcode) const
bool getBaseAndOffsetPosition(const MachineInstr &MI, unsigned &BasePos, unsigned &OffsetPos) const override
For instructions with a base and offset, return the position of the base register and offset operands...
bool isPredicable(const MachineInstr &MI) const override
Return true if the specified instruction can be predicated.
bool 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
Hexagon target-specific information for each MachineFunction.
Register getStackRegister() const
Register getFrameRegister(const MachineFunction &MF) const override
Itinerary data supplied by a subtarget to be used by a target.
unsigned getStageLatency(unsigned ItinClassIndx) const
Return the total stage latency of the given class.
void RemoveMachineInstrFromMaps(MachineInstr &MI)
A set of physical registers with utility functions to track liveness when walking backward/forward th...
LLVM_ABI void stepForward(const MachineInstr &MI, SmallVectorImpl< std::pair< MCPhysReg, const MachineOperand * > > &Clobbers)
Simulates liveness when stepping forward over an instruction(bundle).
LLVM_ABI void stepBackward(const MachineInstr &MI)
Simulates liveness when stepping backwards over an instruction(bundle).
LLVM_ABI void addLiveIns(const MachineBasicBlock &MBB)
Adds all live-in registers of basic block MBB.
LLVM_ABI bool available(const MachineRegisterInfo &MRI, MCRegister Reg) const
Returns true if register Reg and no aliasing register is in the set.
LLVM_ABI void addLiveOuts(const MachineBasicBlock &MBB)
Adds all live-out registers of basic block MBB.
bool contains(MCRegister Reg) const
Returns true if register Reg is contained in the set.
static LocationSize precise(uint64_t Value)
Represents a single loop in the control flow graph.
This class is intended to be used as a base class for asm properties and features specific to the tar...
virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI=nullptr) const
Returns the maximum possible encoded instruction size in bytes.
StringRef getCommentString() const
const char * getSeparatorString() const
MCInstBuilder & addInst(const MCInst *Val)
Add a new MCInst operand.
MCInstBuilder & addImm(int64_t Val)
Add a new integer immediate operand.
Instances of this class represent a single low-level machine instruction.
Describe properties that are true of each instruction in the target description file.
unsigned getSchedClass() const
Return the scheduling class for this instruction.
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
instr_iterator instr_begin()
MachineInstrBundleIterator< const MachineInstr > const_iterator
LLVM_ABI iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
Instructions::iterator instr_iterator
instr_iterator instr_end()
Instructions::const_iterator const_instr_iterator
iterator_range< pred_iterator > predecessors()
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
MachineInstrBundleIterator< MachineInstr > iterator
LLVM_ABI BranchProbability getEdgeProbability(const MachineBasicBlock *Src, const MachineBasicBlock *Dst) const
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const char * createExternalSymbolName(StringRef Name)
Allocate a string and populate it with the given external symbol name.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
BasicBlockListType::iterator iterator
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags F, LLT MemTy, Align BaseAlignment, const MMOMetadata &Metadata=MMOMetadata(), SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
const MachineInstrBuilder & addUse(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a virtual register use operand.
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & add(const MachineOperand &MO) const
const MachineInstrBuilder & addFrameIndex(int Idx) const
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
const MachineInstrBuilder & addDef(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a virtual register definition operand.
const MachineInstrBuilder & cloneMemRefs(const MachineInstr &OtherMI) const
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
reverse_iterator getReverse() const
Get a reverse iterator to the same node.
instr_iterator getInstrIterator() const
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool 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.