39 int &FrameIndex)
const {
40 unsigned Opc =
MI.getOpcode();
42 if ((
Opc == Mips::LW) || (
Opc == Mips::LD) ||
43 (
Opc == Mips::LWC1) || (
Opc == Mips::LDC1) || (
Opc == Mips::LDC164)) {
44 if ((
MI.getOperand(1).isFI()) &&
45 (
MI.getOperand(2).isImm()) &&
47 FrameIndex =
MI.getOperand(1).getIndex();
48 return MI.getOperand(0).getReg();
61 int &FrameIndex)
const {
62 unsigned Opc =
MI.getOpcode();
64 if ((
Opc == Mips::SW) || (
Opc == Mips::SD) ||
65 (
Opc == Mips::SWC1) || (
Opc == Mips::SDC1) || (
Opc == Mips::SDC164)) {
66 if ((
MI.getOperand(1).isFI()) &&
67 (
MI.getOperand(2).isImm()) &&
69 FrameIndex =
MI.getOperand(1).getIndex();
70 return MI.getOperand(0).getReg();
82 assert(RegF32 != Mips::NoRegister &&
"Reg is not a Float Register");
87 if (MORegF32 == Mips::NoRegister)
89 if (MORegF32 == RegF32) {
97 return std::make_pair(Reads, Writes);
102 if (
I ==
MBB->begin())
105 for (; RevI !=
MBB->rend(); RevI++) {
108 unsigned Opcode = RevI->getOpcode();
110 if (Opcode >= Mips::CMP_AF_D_MMR6 && Opcode <= Mips::CMP_UN_S_MMR6)
121 bool MaybeOK =
false;
122 for (; NextI !=
MBB->end(); NextI++) {
125 unsigned Opcode = NextI->getOpcode();
127 if (Opcode < Mips::SEL_D || Opcode > Mips::SEL_S_MMR6)
129 else if (
I->getOperand(1).isKill())
144 bool RenamableDest,
bool RenamableSrc)
const {
145 unsigned Opc = 0, ZeroReg = 0;
148 if (Mips::GPR32RegClass.
contains(DestReg)) {
149 if (Mips::GPR32RegClass.
contains(SrcReg)) {
151 Opc = Mips::MOVE16_MM;
153 Opc = Mips::OR, ZeroReg = Mips::ZERO;
154 }
else if (Mips::CCRRegClass.
contains(SrcReg))
156 else if (Mips::FGR32RegClass.
contains(SrcReg))
158 else if (Mips::HI32RegClass.
contains(SrcReg)) {
161 }
else if (Mips::LO32RegClass.
contains(SrcReg)) {
164 }
else if (Mips::HI32DSPRegClass.
contains(SrcReg))
165 Opc = Mips::MFHI_DSP;
166 else if (Mips::LO32DSPRegClass.
contains(SrcReg))
167 Opc = Mips::MFLO_DSP;
168 else if (Mips::DSPCCRegClass.
contains(SrcReg)) {
172 }
else if (Mips::MSACtrlRegClass.
contains(SrcReg)) {
174 }
else if (Mips::FGR64RegClass.
contains(SrcReg) &&
176 Opc = Mips::MFC1_D64;
179 else if (Mips::GPR32RegClass.
contains(SrcReg)) {
180 if (Mips::CCRRegClass.
contains(DestReg))
182 else if (Mips::FGR32RegClass.
contains(DestReg))
184 else if (Mips::HI32RegClass.
contains(DestReg))
185 Opc = Mips::MTHI, DestReg = 0;
186 else if (Mips::LO32RegClass.
contains(DestReg))
187 Opc = Mips::MTLO, DestReg = 0;
188 else if (Mips::HI32DSPRegClass.
contains(DestReg))
189 Opc = Mips::MTHI_DSP;
190 else if (Mips::LO32DSPRegClass.
contains(DestReg))
191 Opc = Mips::MTLO_DSP;
192 else if (Mips::DSPCCRegClass.
contains(DestReg)) {
197 }
else if (Mips::MSACtrlRegClass.
contains(DestReg)) {
202 }
else if (Mips::FGR64RegClass.
contains(DestReg) &&
204 Opc = Mips::MTC1_D64;
207 else if (Mips::FGR32RegClass.
contains(DestReg, SrcReg))
209 else if (Mips::AFGR64RegClass.
contains(DestReg, SrcReg))
210 Opc = Mips::FMOV_D32;
211 else if (Mips::FGR64RegClass.
contains(DestReg, SrcReg))
212 Opc = Mips::FMOV_D64;
213 else if (Mips::GPR64RegClass.
contains(DestReg)) {
214 if (Mips::GPR64RegClass.
contains(SrcReg))
215 Opc = Mips::OR64, ZeroReg = Mips::ZERO_64;
216 else if (Mips::HI64RegClass.
contains(SrcReg))
217 Opc = Mips::MFHI64, SrcReg = 0;
218 else if (Mips::LO64RegClass.
contains(SrcReg))
219 Opc = Mips::MFLO64, SrcReg = 0;
220 else if (Mips::FGR64RegClass.
contains(SrcReg))
223 else if (Mips::GPR64RegClass.
contains(SrcReg)) {
224 if (Mips::HI64RegClass.
contains(DestReg))
225 Opc = Mips::MTHI64, DestReg = 0;
226 else if (Mips::LO64RegClass.
contains(DestReg))
227 Opc = Mips::MTLO64, DestReg = 0;
228 else if (Mips::FGR64RegClass.
contains(DestReg))
230 }
else if (Mips::MSA128BRegClass.
contains(DestReg)) {
231 if (Mips::MSA128BRegClass.
contains(SrcReg))
237 if (
Opc == 0 && Mips::FGR32RegClass.
contains(SrcReg) &&
238 Mips::FGR64RegClass.
contains(DestReg) &&
I !=
MBB.begin()) {
242 Opc = Mips::FMOV_D64;
243 unsigned DestRegOff = DestReg.
id() - Mips::D0_64;
244 unsigned SrcRegOff = SrcReg.
id() - Mips::F0;
245 if (SrcRegOff == DestRegOff && SrcRegOff >= 0 && SrcRegOff <= 31)
248 }
else if (
Opc == 0 && Mips::FGR32RegClass.
contains(DestReg) &&
249 Mips::FGR64RegClass.
contains(SrcReg) &&
I !=
MBB.begin()) {
253 Opc = Mips::FMOV_D32;
254 unsigned DestRegOff = DestReg.
id() - Mips::F0;
255 unsigned SrcRegOff = SrcReg.
id() - Mips::D0_64;
256 if (SrcRegOff == DestRegOff && SrcRegOff >= 0 && SrcRegOff <= 31)
275 switch (
MI.getOpcode()) {
280 if (
MI.getOperand(2).getReg() == Mips::ZERO)
284 if (
MI.getOperand(2).getReg() == Mips::ZERO_64)
294std::optional<DestSourcePair>
304 Register SrcReg,
bool isKill,
int FI,
313 if (Mips::GPR32RegClass.hasSubClassEq(RC))
315 else if (Mips::GPR64RegClass.hasSubClassEq(RC))
317 else if (Mips::ACC64RegClass.hasSubClassEq(RC))
318 Opc = Mips::STORE_ACC64;
319 else if (Mips::ACC64DSPRegClass.hasSubClassEq(RC))
320 Opc = Mips::STORE_ACC64DSP;
321 else if (Mips::ACC128RegClass.hasSubClassEq(RC))
322 Opc = Mips::STORE_ACC128;
323 else if (Mips::DSPCCRegClass.hasSubClassEq(RC))
324 Opc = Mips::STORE_CCOND_DSP;
325 else if (Mips::FGR32RegClass.hasSubClassEq(RC))
327 else if (Mips::AFGR64RegClass.hasSubClassEq(RC))
329 else if (Mips::FGR64RegClass.hasSubClassEq(RC))
331 else if (RI.isTypeLegalForClass(*RC, MVT::v16i8))
333 else if (RI.isTypeLegalForClass(*RC, MVT::v8i16) ||
334 RI.isTypeLegalForClass(*RC, MVT::v8f16))
336 else if (RI.isTypeLegalForClass(*RC, MVT::v4i32) ||
337 RI.isTypeLegalForClass(*RC, MVT::v4f32))
339 else if (RI.isTypeLegalForClass(*RC, MVT::v2i64) ||
340 RI.isTypeLegalForClass(*RC, MVT::v2f64))
342 else if (Mips::LO32RegClass.hasSubClassEq(RC))
344 else if (Mips::LO64RegClass.hasSubClassEq(RC))
346 else if (Mips::HI32RegClass.hasSubClassEq(RC))
348 else if (Mips::HI64RegClass.hasSubClassEq(RC))
350 else if (Mips::DSPRRegClass.hasSubClassEq(RC))
355 const Function &Func =
MBB.getParent()->getFunction();
356 if (Func.hasFnAttribute(
"interrupt")) {
357 if (Mips::HI32RegClass.hasSubClassEq(RC)) {
360 }
else if (Mips::HI64RegClass.hasSubClassEq(RC)) {
362 SrcReg = Mips::K0_64;
363 }
else if (Mips::LO32RegClass.hasSubClassEq(RC)) {
366 }
else if (Mips::LO64RegClass.hasSubClassEq(RC)) {
368 SrcReg = Mips::K0_64;
372 assert(
Opc &&
"Register class not handled!");
384 if (
I !=
MBB.end())
DL =
I->getDebugLoc();
388 const Function &Func =
MBB.getParent()->getFunction();
389 bool ReqIndirectLoad = Func.hasFnAttribute(
"interrupt") &&
390 (DestReg == Mips::LO0 || DestReg == Mips::LO0_64 ||
391 DestReg == Mips::HI0 || DestReg == Mips::HI0_64);
393 if (Mips::GPR32RegClass.hasSubClassEq(RC))
395 else if (Mips::GPR64RegClass.hasSubClassEq(RC))
397 else if (Mips::ACC64RegClass.hasSubClassEq(RC))
398 Opc = Mips::LOAD_ACC64;
399 else if (Mips::ACC64DSPRegClass.hasSubClassEq(RC))
400 Opc = Mips::LOAD_ACC64DSP;
401 else if (Mips::ACC128RegClass.hasSubClassEq(RC))
402 Opc = Mips::LOAD_ACC128;
403 else if (Mips::DSPCCRegClass.hasSubClassEq(RC))
404 Opc = Mips::LOAD_CCOND_DSP;
405 else if (Mips::FGR32RegClass.hasSubClassEq(RC))
407 else if (Mips::AFGR64RegClass.hasSubClassEq(RC))
409 else if (Mips::FGR64RegClass.hasSubClassEq(RC))
411 else if (RI.isTypeLegalForClass(*RC, MVT::v16i8))
413 else if (RI.isTypeLegalForClass(*RC, MVT::v8i16) ||
414 RI.isTypeLegalForClass(*RC, MVT::v8f16))
416 else if (RI.isTypeLegalForClass(*RC, MVT::v4i32) ||
417 RI.isTypeLegalForClass(*RC, MVT::v4f32))
419 else if (RI.isTypeLegalForClass(*RC, MVT::v2i64) ||
420 RI.isTypeLegalForClass(*RC, MVT::v2f64))
422 else if (Mips::HI32RegClass.hasSubClassEq(RC))
424 else if (Mips::HI64RegClass.hasSubClassEq(RC))
426 else if (Mips::LO32RegClass.hasSubClassEq(RC))
428 else if (Mips::LO64RegClass.hasSubClassEq(RC))
430 else if (Mips::DSPRRegClass.hasSubClassEq(RC))
433 assert(
Opc &&
"Register class not handled!");
435 if (!ReqIndirectLoad)
443 unsigned Reg = Mips::K0;
444 unsigned LdOp = Mips::MTLO;
445 if (DestReg == Mips::HI0)
450 if (DestReg == Mips::HI0_64)
469 switch (
MI.getDesc().getOpcode()) {
473 expandRetRA(
MBB,
MI);
478 case Mips::PseudoMFHI:
479 expandPseudoMFHiLo(
MBB,
MI, Mips::MFHI);
481 case Mips::PseudoMFHI_MM:
482 expandPseudoMFHiLo(
MBB,
MI, Mips::MFHI16_MM);
484 case Mips::PseudoMFLO:
485 expandPseudoMFHiLo(
MBB,
MI, Mips::MFLO);
487 case Mips::PseudoMFLO_MM:
488 expandPseudoMFHiLo(
MBB,
MI, Mips::MFLO16_MM);
490 case Mips::PseudoMFHI64:
491 expandPseudoMFHiLo(
MBB,
MI, Mips::MFHI64);
493 case Mips::PseudoMFLO64:
494 expandPseudoMFHiLo(
MBB,
MI, Mips::MFLO64);
496 case Mips::PseudoMTLOHI:
497 expandPseudoMTLoHi(
MBB,
MI, Mips::MTLO, Mips::MTHI,
false);
499 case Mips::PseudoMTLOHI64:
500 expandPseudoMTLoHi(
MBB,
MI, Mips::MTLO64, Mips::MTHI64,
false);
502 case Mips::PseudoMTLOHI_DSP:
503 expandPseudoMTLoHi(
MBB,
MI, Mips::MTLO_DSP, Mips::MTHI_DSP,
true);
505 case Mips::PseudoMTLOHI_MM:
506 expandPseudoMTLoHi(
MBB,
MI, Mips::MTLO_MM, Mips::MTHI_MM,
false);
508 case Mips::PseudoCVT_S_W:
509 expandCvtFPInt(
MBB,
MI, Mips::CVT_S_W, Mips::MTC1,
false);
511 case Mips::PseudoCVT_D32_W:
513 expandCvtFPInt(
MBB,
MI,
Opc, Mips::MTC1,
false);
515 case Mips::PseudoCVT_S_L:
516 expandCvtFPInt(
MBB,
MI, Mips::CVT_S_L, Mips::DMTC1,
true);
518 case Mips::PseudoCVT_D64_W:
520 expandCvtFPInt(
MBB,
MI,
Opc, Mips::MTC1,
true);
522 case Mips::PseudoCVT_D64_L:
523 expandCvtFPInt(
MBB,
MI, Mips::CVT_D64_L, Mips::DMTC1,
true);
525 case Mips::BuildPairF64:
528 case Mips::BuildPairF64_64:
531 case Mips::ExtractElementF64:
534 case Mips::ExtractElementF64_64:
537 case Mips::MIPSeh_return32:
538 case Mips::MIPSeh_return64:
539 expandEhReturn(
MBB,
MI);
566 case Mips::BEQ:
return Mips::BNE;
567 case Mips::BEQ_MM:
return Mips::BNE_MM;
568 case Mips::BNE:
return Mips::BEQ;
569 case Mips::BNE_MM:
return Mips::BEQ_MM;
570 case Mips::BGTZ:
return Mips::BLEZ;
571 case Mips::BGEZ:
return Mips::BLTZ;
572 case Mips::BLTZ:
return Mips::BGEZ;
573 case Mips::BLEZ:
return Mips::BGTZ;
574 case Mips::BGTZ_MM:
return Mips::BLEZ_MM;
575 case Mips::BGEZ_MM:
return Mips::BLTZ_MM;
576 case Mips::BLTZ_MM:
return Mips::BGEZ_MM;
577 case Mips::BLEZ_MM:
return Mips::BGTZ_MM;
578 case Mips::BEQ64:
return Mips::BNE64;
579 case Mips::BNE64:
return Mips::BEQ64;
580 case Mips::BGTZ64:
return Mips::BLEZ64;
581 case Mips::BGEZ64:
return Mips::BLTZ64;
582 case Mips::BLTZ64:
return Mips::BGEZ64;
583 case Mips::BLEZ64:
return Mips::BGTZ64;
584 case Mips::BC1T:
return Mips::BC1F;
585 case Mips::BC1F:
return Mips::BC1T;
586 case Mips::BC1T_MM:
return Mips::BC1F_MM;
587 case Mips::BC1F_MM:
return Mips::BC1T_MM;
588 case Mips::BEQZ16_MM:
return Mips::BNEZ16_MM;
589 case Mips::BNEZ16_MM:
return Mips::BEQZ16_MM;
590 case Mips::BEQZC_MM:
return Mips::BNEZC_MM;
591 case Mips::BNEZC_MM:
return Mips::BEQZC_MM;
592 case Mips::BEQZC:
return Mips::BNEZC;
593 case Mips::BNEZC:
return Mips::BEQZC;
594 case Mips::BLEZC:
return Mips::BGTZC;
595 case Mips::BGEZC:
return Mips::BLTZC;
596 case Mips::BGEC:
return Mips::BLTC;
597 case Mips::BGTZC:
return Mips::BLEZC;
598 case Mips::BLTZC:
return Mips::BGEZC;
599 case Mips::BLTC:
return Mips::BGEC;
600 case Mips::BGEUC:
return Mips::BLTUC;
601 case Mips::BLTUC:
return Mips::BGEUC;
602 case Mips::BEQC:
return Mips::BNEC;
603 case Mips::BNEC:
return Mips::BEQC;
604 case Mips::BC1EQZ:
return Mips::BC1NEZ;
605 case Mips::BC1NEZ:
return Mips::BC1EQZ;
606 case Mips::BEQZC_MMR6:
return Mips::BNEZC_MMR6;
607 case Mips::BNEZC_MMR6:
return Mips::BEQZC_MMR6;
608 case Mips::BLEZC_MMR6:
return Mips::BGTZC_MMR6;
609 case Mips::BGEZC_MMR6:
return Mips::BLTZC_MMR6;
610 case Mips::BGEC_MMR6:
return Mips::BLTC_MMR6;
611 case Mips::BGTZC_MMR6:
return Mips::BLEZC_MMR6;
612 case Mips::BLTZC_MMR6:
return Mips::BGEZC_MMR6;
613 case Mips::BLTC_MMR6:
return Mips::BGEC_MMR6;
614 case Mips::BGEUC_MMR6:
return Mips::BLTUC_MMR6;
615 case Mips::BLTUC_MMR6:
return Mips::BGEUC_MMR6;
616 case Mips::BEQC_MMR6:
return Mips::BNEC_MMR6;
617 case Mips::BNEC_MMR6:
return Mips::BEQC_MMR6;
618 case Mips::BC1EQZC_MMR6:
return Mips::BC1NEZC_MMR6;
619 case Mips::BC1NEZC_MMR6:
return Mips::BC1EQZC_MMR6;
620 case Mips::BEQZC64:
return Mips::BNEZC64;
621 case Mips::BNEZC64:
return Mips::BEQZC64;
622 case Mips::BEQC64:
return Mips::BNEC64;
623 case Mips::BNEC64:
return Mips::BEQC64;
624 case Mips::BGEC64:
return Mips::BLTC64;
625 case Mips::BGEUC64:
return Mips::BLTUC64;
626 case Mips::BLTC64:
return Mips::BGEC64;
627 case Mips::BLTUC64:
return Mips::BGEUC64;
628 case Mips::BGTZC64:
return Mips::BLEZC64;
629 case Mips::BGEZC64:
return Mips::BLTZC64;
630 case Mips::BLTZC64:
return Mips::BGEZC64;
631 case Mips::BLEZC64:
return Mips::BGTZC64;
632 case Mips::BBIT0:
return Mips::BBIT1;
633 case Mips::BBIT1:
return Mips::BBIT0;
634 case Mips::BBIT032:
return Mips::BBIT132;
635 case Mips::BBIT132:
return Mips::BBIT032;
636 case Mips::BZ_B:
return Mips::BNZ_B;
637 case Mips::BZ_H:
return Mips::BNZ_H;
638 case Mips::BZ_W:
return Mips::BNZ_W;
639 case Mips::BZ_D:
return Mips::BNZ_D;
640 case Mips::BZ_V:
return Mips::BNZ_V;
641 case Mips::BNZ_B:
return Mips::BZ_B;
642 case Mips::BNZ_H:
return Mips::BZ_H;
643 case Mips::BNZ_W:
return Mips::BZ_W;
644 case Mips::BNZ_D:
return Mips::BZ_D;
645 case Mips::BNZ_V:
return Mips::BZ_V;
655 unsigned ADDiu = ABI.GetPtrAddiuOp();
666 unsigned Opc = ABI.GetPtrAdduOp();
668 Opc = ABI.GetPtrSubuOp();
681 unsigned *NewImm)
const {
686 unsigned LUi = STI.
isABI_N64() ? Mips::LUi64 : Mips::LUi;
687 unsigned ZEROReg = STI.
isABI_N64() ? Mips::ZERO_64 : Mips::ZERO;
689 &Mips::GPR64RegClass : &Mips::GPR32RegClass;
690 bool LastInstrIsADDiu = NewImm;
701 Register Reg = RegInfo.createVirtualRegister(RC);
703 if (Inst->Opc == LUi)
710 for (++Inst; Inst != Seq.
end() - LastInstrIsADDiu; ++Inst)
714 if (LastInstrIsADDiu)
715 *NewImm = Inst->ImmOpnd;
720unsigned MipsSEInstrInfo::getAnalyzableBrOpc(
unsigned Opc)
const {
721 return (
Opc == Mips::BEQ ||
Opc == Mips::BEQ_MM ||
Opc == Mips::BNE ||
722 Opc == Mips::BNE_MM ||
Opc == Mips::BGTZ ||
Opc == Mips::BGEZ ||
723 Opc == Mips::BLTZ ||
Opc == Mips::BLEZ ||
Opc == Mips::BEQ64 ||
724 Opc == Mips::BNE64 ||
Opc == Mips::BGTZ64 ||
Opc == Mips::BGEZ64 ||
725 Opc == Mips::BLTZ64 ||
Opc == Mips::BLEZ64 ||
Opc == Mips::BC1T ||
726 Opc == Mips::BC1F ||
Opc == Mips::B ||
Opc == Mips::J ||
727 Opc == Mips::J_MM ||
Opc == Mips::B_MM ||
Opc == Mips::BEQZC_MM ||
728 Opc == Mips::BNEZC_MM ||
Opc == Mips::BEQC ||
Opc == Mips::BNEC ||
729 Opc == Mips::BLTC ||
Opc == Mips::BGEC ||
Opc == Mips::BLTUC ||
730 Opc == Mips::BGEUC ||
Opc == Mips::BGTZC ||
Opc == Mips::BLEZC ||
731 Opc == Mips::BGEZC ||
Opc == Mips::BLTZC ||
Opc == Mips::BEQZC ||
732 Opc == Mips::BNEZC ||
Opc == Mips::BEQZC64 ||
Opc == Mips::BNEZC64 ||
733 Opc == Mips::BEQC64 ||
Opc == Mips::BNEC64 ||
Opc == Mips::BGEC64 ||
734 Opc == Mips::BGEUC64 ||
Opc == Mips::BLTC64 ||
Opc == Mips::BLTUC64 ||
735 Opc == Mips::BGTZC64 ||
Opc == Mips::BGEZC64 ||
736 Opc == Mips::BLTZC64 ||
Opc == Mips::BLEZC64 ||
Opc == Mips::BC ||
737 Opc == Mips::BBIT0 ||
Opc == Mips::BBIT1 ||
Opc == Mips::BBIT032 ||
738 Opc == Mips::BBIT132 ||
Opc == Mips::BC_MMR6 ||
739 Opc == Mips::BEQC_MMR6 ||
Opc == Mips::BNEC_MMR6 ||
740 Opc == Mips::BLTC_MMR6 ||
Opc == Mips::BGEC_MMR6 ||
741 Opc == Mips::BLTUC_MMR6 ||
Opc == Mips::BGEUC_MMR6 ||
742 Opc == Mips::BGTZC_MMR6 ||
Opc == Mips::BLEZC_MMR6 ||
743 Opc == Mips::BGEZC_MMR6 ||
Opc == Mips::BLTZC_MMR6 ||
744 Opc == Mips::BEQZC_MMR6 ||
Opc == Mips::BNEZC_MMR6) ?
Opc : 0;
759 for (
auto & MO :
I->operands()) {
771MipsSEInstrInfo::compareOpndSize(
unsigned Opc,
774 assert(
Desc.NumOperands == 2 &&
"Unary instruction expected.");
779 return std::make_pair(DstRegSize > SrcRegSize, DstRegSize < SrcRegSize);
784 unsigned NewOpc)
const {
792 bool HasExplicitDef)
const {
800 const MachineOperand &SrcLo =
I->getOperand(1), &SrcHi =
I->getOperand(2);
806 if (HasExplicitDef) {
807 Register DstReg =
I->getOperand(0).getReg();
820 unsigned CvtOpc,
unsigned MovOpc,
822 const MCInstrDesc &CvtDesc =
get(CvtOpc), &MovDesc =
get(MovOpc);
823 const MachineOperand &Dst =
I->getOperand(0), &Src =
I->getOperand(1);
824 unsigned DstReg = Dst.getReg(), SrcReg = Src.getReg(), TmpReg = DstReg;
827 bool DstIsLarger, SrcIsLarger;
829 std::tie(DstIsLarger, SrcIsLarger) =
846 Register DstReg =
I->getOperand(0).getReg();
847 Register SrcReg =
I->getOperand(1).getReg();
848 unsigned N =
I->getOperand(2).getImm();
851 assert(
N < 2 &&
"Invalid immediate");
852 unsigned SubIdx =
N ? Mips::sub_hi : Mips::sub_lo;
863 if (SubIdx == Mips::sub_hi &&
Subtarget.hasMTHC1()) {
877 get(
isMicroMips ? (FP64 ? Mips::MFHC1_D64_MM : Mips::MFHC1_D32_MM)
878 : (FP64 ? Mips::MFHC1_D64 : Mips::MFHC1_D32)),
888 Register DstReg =
I->getOperand(0).getReg();
889 unsigned LoReg =
I->getOperand(1).getReg(), HiReg =
I->getOperand(2).getReg();
890 const MCInstrDesc& Mtc1Tdd =
get(Mips::MTC1);
933 get(
isMicroMips ? (FP64 ? Mips::MTHC1_D64_MM : Mips::MTHC1_D32_MM)
934 : (FP64 ? Mips::MTHC1_D64 : Mips::MTHC1_D32)),
951 unsigned ADDU =
ABI.GetPtrAdduOp();
952 unsigned SP =
Subtarget.isGP64bit() ? Mips::SP_64 : Mips::SP;
953 unsigned RA =
Subtarget.isGP64bit() ? Mips::RA_64 : Mips::RA;
954 unsigned T9 =
Subtarget.isGP64bit() ? Mips::T9_64 : Mips::T9;
955 unsigned ZERO =
Subtarget.isGP64bit() ? Mips::ZERO_64 : Mips::ZERO;
956 Register OffsetReg =
I->getOperand(0).getReg();
957 Register TargetReg =
I->getOperand(1).getReg();
static const TargetRegisterClass * getRegClass(const MachineInstr &MI, Register Reg)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
@ ZERO
Special weight used for cases with exact zero probability.
Register const TargetRegisterInfo * TRI
Promote Memory to Register
static bool isORCopyInst(const MachineInstr &MI)
static std::pair< bool, bool > readsWritesFloatRegister(MachineInstr &MI, Register Reg)
static unsigned getUnconditionalBranch(const MipsSubtarget &STI)
static bool isOnlyReadsBySEL(MachineBasicBlock::iterator I, Register Reg)
static bool isWritedByFCMP(MachineBasicBlock::iterator I, Register Reg)
static bool isMicroMips(const MCSubtargetInfo *STI)
uint64_t IntrinsicInst * II
SI optimize exec mask operations pre RA
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
MachineInstrBundleIterator< MachineInstr, true > reverse_iterator
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineInstrBundleIterator< MachineInstr > iterator
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
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 & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
Representation of each machine instruction.
A description of a memory reference used in the backend.
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
MachineOperand class - Representation of each machine instruction operand.
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
const MipsSubtarget & Subtarget
MachineMemOperand * GetMemOperand(MachineBasicBlock &MBB, int FI, MachineMemOperand::Flags Flags) const
bool isZeroImm(const MachineOperand &op) const
MipsInstrInfo(const MipsSubtarget &STI, const MipsRegisterInfo &RI, unsigned UncondBrOpc)
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, Register DestReg, Register SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
isLoadFromStackSlot - If the specified machine instruction is a direct load from a stack slot,...
Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
isStoreToStackSlot - If the specified machine instruction is a direct store to a stack slot,...
void adjustStackPtr(unsigned SP, int64_t Amount, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const override
Adjust SP by Amount bytes.
std::optional< DestSourcePair > isCopyInstrImpl(const MachineInstr &MI) const override
If the specific machine instruction is a instruction that moves/copies value from one register to ano...
unsigned loadImmediate(int64_t Imm, MachineBasicBlock &MBB, MachineBasicBlock::iterator II, const DebugLoc &DL, unsigned *NewImm) const
Emit a series of instructions to load an immediate.
bool isBranchWithImm(unsigned Opc) const override
isBranchWithImm - Return true if the branch contains an immediate operand (
MipsSEInstrInfo(const MipsSubtarget &STI)
bool expandPostRAPseudo(MachineInstr &MI) const override
void loadRegFromStack(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register DestReg, int FrameIndex, const TargetRegisterClass *RC, int64_t Offset, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
void storeRegToStack(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, int64_t Offset, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
unsigned getOppositeBranchOpc(unsigned Opc) const override
getOppositeBranchOpc - Return the inverse of the specified opcode, e.g.
const MipsSERegisterInfo & getRegisterInfo() const
bool inMicroMipsMode() const
bool isPositionIndependent() const
Wrapper class representing virtual and physical registers.
constexpr unsigned id() const
bool isPositionIndependent() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ Implicit
Not emitted register (e.g. carry, or temporary result).
@ Define
Register definition.
@ Kill
The last use of a register.
@ Undef
Value of the register doesn't matter.
This is an optimization pass for GlobalISel generic memory operations.
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.
const MipsInstrInfo * createMipsSEInstrInfo(const MipsSubtarget &STI)
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
static MCRegister getFloatRegFromFReg(MCRegister Reg)
unsigned getKillRegState(bool B)
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.