Lines Matching refs:MBBI
61 bool expandMI(Block &MBB, BlockIt MBBI);
62 template <unsigned OP> bool expand(Block &MBB, BlockIt MBBI);
64 MachineInstrBuilder buildMI(Block &MBB, BlockIt MBBI, unsigned Opcode) { in buildMI() argument
65 return BuildMI(MBB, MBBI, MBBI->getDebugLoc(), TII->get(Opcode)); in buildMI()
68 MachineInstrBuilder buildMI(Block &MBB, BlockIt MBBI, unsigned Opcode, in buildMI() argument
70 return BuildMI(MBB, MBBI, MBBI->getDebugLoc(), TII->get(Opcode), DstReg); in buildMI()
75 bool expandArith(unsigned OpLo, unsigned OpHi, Block &MBB, BlockIt MBBI);
76 bool expandLogic(unsigned Op, Block &MBB, BlockIt MBBI);
77 bool expandLogicImm(unsigned Op, Block &MBB, BlockIt MBBI);
81 bool expandAtomic(Block &MBB, BlockIt MBBI, Func f);
84 bool expandAtomicBinaryOp(unsigned Opcode, Block &MBB, BlockIt MBBI, Func f);
86 bool expandAtomicBinaryOp(unsigned Opcode, Block &MBB, BlockIt MBBI);
91 BlockIt MBBI);
102 BlockIt MBBI = MBB.begin(), E = MBB.end(); in expandMBB() local
103 while (MBBI != E) { in expandMBB()
104 BlockIt NMBBI = std::next(MBBI); in expandMBB()
105 Modified |= expandMI(MBB, MBBI); in expandMBB()
106 MBBI = NMBBI; in expandMBB()
142 expandArith(unsigned OpLo, unsigned OpHi, Block &MBB, BlockIt MBBI) { in expandArith() argument
143 MachineInstr &MI = *MBBI; in expandArith()
154 buildMI(MBB, MBBI, OpLo) in expandArith()
159 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expandArith()
175 expandLogic(unsigned Op, Block &MBB, BlockIt MBBI) { in expandLogic() argument
176 MachineInstr &MI = *MBBI; in expandLogic()
187 auto MIBLO = buildMI(MBB, MBBI, Op) in expandLogic()
195 auto MIBHI = buildMI(MBB, MBBI, Op) in expandLogic()
222 expandLogicImm(unsigned Op, Block &MBB, BlockIt MBBI) { in expandLogicImm() argument
223 MachineInstr &MI = *MBBI; in expandLogicImm()
235 auto MIBLO = buildMI(MBB, MBBI, Op) in expandLogicImm()
245 auto MIBHI = buildMI(MBB, MBBI, Op) in expandLogicImm()
259 bool AVRExpandPseudo::expand<AVR::ADDWRdRr>(Block &MBB, BlockIt MBBI) { in expand() argument
260 return expandArith(AVR::ADDRdRr, AVR::ADCRdRr, MBB, MBBI); in expand()
264 bool AVRExpandPseudo::expand<AVR::ADCWRdRr>(Block &MBB, BlockIt MBBI) { in expand() argument
265 return expandArith(AVR::ADCRdRr, AVR::ADCRdRr, MBB, MBBI); in expand()
269 bool AVRExpandPseudo::expand<AVR::SUBWRdRr>(Block &MBB, BlockIt MBBI) { in expand() argument
270 return expandArith(AVR::SUBRdRr, AVR::SBCRdRr, MBB, MBBI); in expand()
274 bool AVRExpandPseudo::expand<AVR::SUBIWRdK>(Block &MBB, BlockIt MBBI) { in expand() argument
275 MachineInstr &MI = *MBBI; in expand()
283 auto MIBLO = buildMI(MBB, MBBI, AVR::SUBIRdK) in expand()
287 auto MIBHI = buildMI(MBB, MBBI, AVR::SBCIRdK) in expand()
321 bool AVRExpandPseudo::expand<AVR::SBCWRdRr>(Block &MBB, BlockIt MBBI) { in expand() argument
322 return expandArith(AVR::SBCRdRr, AVR::SBCRdRr, MBB, MBBI); in expand()
326 bool AVRExpandPseudo::expand<AVR::SBCIWRdK>(Block &MBB, BlockIt MBBI) { in expand() argument
327 MachineInstr &MI = *MBBI; in expand()
340 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
348 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
364 bool AVRExpandPseudo::expand<AVR::ANDWRdRr>(Block &MBB, BlockIt MBBI) { in expand() argument
365 return expandLogic(AVR::ANDRdRr, MBB, MBBI); in expand()
369 bool AVRExpandPseudo::expand<AVR::ANDIWRdK>(Block &MBB, BlockIt MBBI) { in expand() argument
370 return expandLogicImm(AVR::ANDIRdK, MBB, MBBI); in expand()
374 bool AVRExpandPseudo::expand<AVR::ORWRdRr>(Block &MBB, BlockIt MBBI) { in expand() argument
375 return expandLogic(AVR::ORRdRr, MBB, MBBI); in expand()
379 bool AVRExpandPseudo::expand<AVR::ORIWRdK>(Block &MBB, BlockIt MBBI) { in expand() argument
380 return expandLogicImm(AVR::ORIRdK, MBB, MBBI); in expand()
384 bool AVRExpandPseudo::expand<AVR::EORWRdRr>(Block &MBB, BlockIt MBBI) { in expand() argument
385 return expandLogic(AVR::EORRdRr, MBB, MBBI); in expand()
389 bool AVRExpandPseudo::expand<AVR::COMWRd>(Block &MBB, BlockIt MBBI) { in expand() argument
390 MachineInstr &MI = *MBBI; in expand()
400 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
407 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
419 bool AVRExpandPseudo::expand<AVR::NEGWRd>(Block &MBB, BlockIt MBBI) { in expand() argument
420 MachineInstr &MI = *MBBI; in expand()
430 buildMI(MBB, MBBI, AVR::NEGRd) in expand()
437 buildMI(MBB, MBBI, AVR::NEGRd) in expand()
443 buildMI(MBB, MBBI, AVR::SBCIRdK) in expand()
457 bool AVRExpandPseudo::expand<AVR::CPWRdRr>(Block &MBB, BlockIt MBBI) { in expand() argument
458 MachineInstr &MI = *MBBI; in expand()
471 buildMI(MBB, MBBI, OpLo) in expand()
475 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
490 bool AVRExpandPseudo::expand<AVR::CPCWRdRr>(Block &MBB, BlockIt MBBI) { in expand() argument
491 MachineInstr &MI = *MBBI; in expand()
503 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
510 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
525 bool AVRExpandPseudo::expand<AVR::LDIWRdK>(Block &MBB, BlockIt MBBI) { in expand() argument
526 MachineInstr &MI = *MBBI; in expand()
534 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
537 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
574 bool AVRExpandPseudo::expand<AVR::LDSWRdK>(Block &MBB, BlockIt MBBI) { in expand() argument
575 MachineInstr &MI = *MBBI; in expand()
583 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
586 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
618 bool AVRExpandPseudo::expand<AVR::LDWRdPtr>(Block &MBB, BlockIt MBBI) { in expand() argument
619 MachineInstr &MI = *MBBI; in expand()
637 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
643 buildMI(MBB, MBBI, AVR::PUSHRr).addReg(TmpReg); in expand()
646 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
653 buildMI(MBB, MBBI, AVR::MOVRdRr).addReg(DstHiReg).addReg(TmpReg); in expand()
656 buildMI(MBB, MBBI, AVR::POPRd).addReg(DstLoReg); in expand()
667 bool AVRExpandPseudo::expand<AVR::LDWRdPtrPi>(Block &MBB, BlockIt MBBI) { in expand() argument
668 MachineInstr &MI = *MBBI; in expand()
680 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
685 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
698 bool AVRExpandPseudo::expand<AVR::LDWRdPtrPd>(Block &MBB, BlockIt MBBI) { in expand() argument
699 MachineInstr &MI = *MBBI; in expand()
711 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
716 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
729 bool AVRExpandPseudo::expand<AVR::LDDWRdPtrQ>(Block &MBB, BlockIt MBBI) { in expand() argument
730 MachineInstr &MI = *MBBI; in expand()
753 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
760 buildMI(MBB, MBBI, AVR::PUSHRr).addReg(TmpReg); in expand()
763 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
770 buildMI(MBB, MBBI, AVR::MOVRdRr).addReg(DstHiReg).addReg(TmpReg); in expand()
773 buildMI(MBB, MBBI, AVR::POPRd).addReg(DstLoReg); in expand()
784 bool AVRExpandPseudo::expand<AVR::LPMWRdZ>(Block &MBB, BlockIt MBBI) { in expand() argument
785 MachineInstr &MI = *MBBI; in expand()
803 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
809 buildMI(MBB, MBBI, AVR::PUSHRr).addReg(TmpReg); in expand()
812 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
818 buildMI(MBB, MBBI, AVR::MOVRdRr).addReg(DstHiReg).addReg(TmpReg); in expand()
821 buildMI(MBB, MBBI, AVR::POPRd).addReg(DstLoReg); in expand()
832 bool AVRExpandPseudo::expand<AVR::LPMWRdZPi>(Block &MBB, BlockIt MBBI) { in expand() argument
837 bool AVRExpandPseudo::expandAtomic(Block &MBB, BlockIt MBBI, Func f) { in expandAtomic() argument
839 MachineInstr &MI = *MBBI; in expandAtomic()
842 buildMI(MBB, MBBI, AVR::INRdA) in expandAtomic()
847 buildMI(MBB, MBBI, AVR::BCLRs).addImm(7); // CLI in expandAtomic()
852 buildMI(MBB, MBBI, AVR::OUTARr) in expandAtomic()
863 BlockIt MBBI, in expandAtomicBinaryOp() argument
865 return expandAtomic(MBB, MBBI, [&](MachineInstr &MI) { in expandAtomicBinaryOp()
870 *buildMI(MBB, MBBI, Opcode).add(Op1).add(Op2).getInstr(); in expandAtomicBinaryOp()
877 BlockIt MBBI) { in expandAtomicBinaryOp() argument
878 return expandAtomicBinaryOp(Opcode, MBB, MBBI, [](MachineInstr &MI) {}); in expandAtomicBinaryOp()
884 BlockIt MBBI) { in expandAtomicArithmeticOp() argument
885 return expandAtomic(MBB, MBBI, [&](MachineInstr &MI) { in expandAtomicArithmeticOp()
893 buildMI(MBB, MBBI, LoadOpcode).add(Op1).add(Op2); in expandAtomicArithmeticOp()
896 buildMI(MBB, MBBI, ArithOpcode).add(Op1).add(Op1).add(Op2); in expandAtomicArithmeticOp()
899 buildMI(MBB, MBBI, StoreOpcode).add(Op2).add(Op1); in expandAtomicArithmeticOp()
930 bool AVRExpandPseudo::expand<AVR::AtomicLoad8>(Block &MBB, BlockIt MBBI) { in expand() argument
931 return expandAtomicBinaryOp(AVR::LDRdPtr, MBB, MBBI); in expand()
935 bool AVRExpandPseudo::expand<AVR::AtomicLoad16>(Block &MBB, BlockIt MBBI) { in expand() argument
936 return expandAtomicBinaryOp(AVR::LDWRdPtr, MBB, MBBI); in expand()
940 bool AVRExpandPseudo::expand<AVR::AtomicStore8>(Block &MBB, BlockIt MBBI) { in expand() argument
941 return expandAtomicBinaryOp(AVR::STPtrRr, MBB, MBBI); in expand()
945 bool AVRExpandPseudo::expand<AVR::AtomicStore16>(Block &MBB, BlockIt MBBI) { in expand() argument
946 return expandAtomicBinaryOp(AVR::STWPtrRr, MBB, MBBI); in expand()
950 bool AVRExpandPseudo::expand<AVR::AtomicLoadAdd8>(Block &MBB, BlockIt MBBI) { in expand() argument
951 return expandAtomicArithmeticOp(8, AVR::ADDRdRr, MBB, MBBI); in expand()
955 bool AVRExpandPseudo::expand<AVR::AtomicLoadAdd16>(Block &MBB, BlockIt MBBI) { in expand() argument
956 return expandAtomicArithmeticOp(16, AVR::ADDWRdRr, MBB, MBBI); in expand()
960 bool AVRExpandPseudo::expand<AVR::AtomicLoadSub8>(Block &MBB, BlockIt MBBI) { in expand() argument
961 return expandAtomicArithmeticOp(8, AVR::SUBRdRr, MBB, MBBI); in expand()
965 bool AVRExpandPseudo::expand<AVR::AtomicLoadSub16>(Block &MBB, BlockIt MBBI) { in expand() argument
966 return expandAtomicArithmeticOp(16, AVR::SUBWRdRr, MBB, MBBI); in expand()
970 bool AVRExpandPseudo::expand<AVR::AtomicLoadAnd8>(Block &MBB, BlockIt MBBI) { in expand() argument
971 return expandAtomicArithmeticOp(8, AVR::ANDRdRr, MBB, MBBI); in expand()
975 bool AVRExpandPseudo::expand<AVR::AtomicLoadAnd16>(Block &MBB, BlockIt MBBI) { in expand() argument
976 return expandAtomicArithmeticOp(16, AVR::ANDWRdRr, MBB, MBBI); in expand()
980 bool AVRExpandPseudo::expand<AVR::AtomicLoadOr8>(Block &MBB, BlockIt MBBI) { in expand() argument
981 return expandAtomicArithmeticOp(8, AVR::ORRdRr, MBB, MBBI); in expand()
985 bool AVRExpandPseudo::expand<AVR::AtomicLoadOr16>(Block &MBB, BlockIt MBBI) { in expand() argument
986 return expandAtomicArithmeticOp(16, AVR::ORWRdRr, MBB, MBBI); in expand()
990 bool AVRExpandPseudo::expand<AVR::AtomicLoadXor8>(Block &MBB, BlockIt MBBI) { in expand() argument
991 return expandAtomicArithmeticOp(8, AVR::EORRdRr, MBB, MBBI); in expand()
995 bool AVRExpandPseudo::expand<AVR::AtomicLoadXor16>(Block &MBB, BlockIt MBBI) { in expand() argument
996 return expandAtomicArithmeticOp(16, AVR::EORWRdRr, MBB, MBBI); in expand()
1000 bool AVRExpandPseudo::expand<AVR::AtomicFence>(Block &MBB, BlockIt MBBI) { in expand() argument
1002 MBBI->eraseFromParent(); in expand()
1007 bool AVRExpandPseudo::expand<AVR::STSWKRr>(Block &MBB, BlockIt MBBI) { in expand() argument
1008 MachineInstr &MI = *MBBI; in expand()
1018 auto MIBHI = buildMI(MBB, MBBI, OpHi); in expand()
1019 auto MIBLO = buildMI(MBB, MBBI, OpLo); in expand()
1053 bool AVRExpandPseudo::expand<AVR::STWPtrRr>(Block &MBB, BlockIt MBBI) { in expand() argument
1054 MachineInstr &MI = *MBBI; in expand()
1064 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
1068 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
1081 bool AVRExpandPseudo::expand<AVR::STWPtrPiRr>(Block &MBB, BlockIt MBBI) { in expand() argument
1082 MachineInstr &MI = *MBBI; in expand()
1095 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
1101 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
1115 bool AVRExpandPseudo::expand<AVR::STWPtrPdRr>(Block &MBB, BlockIt MBBI) { in expand() argument
1116 MachineInstr &MI = *MBBI; in expand()
1129 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
1135 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
1149 bool AVRExpandPseudo::expand<AVR::STDWPtrQRr>(Block &MBB, BlockIt MBBI) { in expand() argument
1150 MachineInstr &MI = *MBBI; in expand()
1165 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
1170 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
1183 bool AVRExpandPseudo::expand<AVR::INWRdA>(Block &MBB, BlockIt MBBI) { in expand() argument
1184 MachineInstr &MI = *MBBI; in expand()
1197 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
1201 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
1213 bool AVRExpandPseudo::expand<AVR::OUTWARr>(Block &MBB, BlockIt MBBI) { in expand() argument
1214 MachineInstr &MI = *MBBI; in expand()
1228 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
1232 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
1244 bool AVRExpandPseudo::expand<AVR::PUSHWRr>(Block &MBB, BlockIt MBBI) { in expand() argument
1245 MachineInstr &MI = *MBBI; in expand()
1255 buildMI(MBB, MBBI, OpLo) in expand()
1260 buildMI(MBB, MBBI, OpHi) in expand()
1269 bool AVRExpandPseudo::expand<AVR::POPWRd>(Block &MBB, BlockIt MBBI) { in expand() argument
1270 MachineInstr &MI = *MBBI; in expand()
1278 buildMI(MBB, MBBI, OpHi, DstHiReg).setMIFlags(Flags); // High in expand()
1279 buildMI(MBB, MBBI, OpLo, DstLoReg).setMIFlags(Flags); // Low in expand()
1286 bool AVRExpandPseudo::expand<AVR::ROLBRd>(Block &MBB, BlockIt MBBI) { in expand() argument
1293 MachineInstr &MI = *MBBI; in expand()
1304 buildMI(MBB, MBBI, OpShift) in expand()
1310 auto MIB = buildMI(MBB, MBBI, OpCarry) in expand()
1323 bool AVRExpandPseudo::expand<AVR::RORBRd>(Block &MBB, BlockIt MBBI) { in expand() argument
1330 MachineInstr &MI = *MBBI; in expand()
1345 buildMI(MBB, MBBI, OpShiftOut) in expand()
1350 buildMI(MBB, MBBI, OpLoad) in expand()
1355 buildMI(MBB, MBBI, OpShiftIn) in expand()
1360 auto MIB = buildMI(MBB, MBBI, OpAdd) in expand()
1373 bool AVRExpandPseudo::expand<AVR::LSLWRd>(Block &MBB, BlockIt MBBI) { in expand() argument
1374 MachineInstr &MI = *MBBI; in expand()
1385 buildMI(MBB, MBBI, OpLo) in expand()
1390 auto MIBHI = buildMI(MBB, MBBI, OpHi) in expand()
1406 bool AVRExpandPseudo::expand<AVR::LSRWRd>(Block &MBB, BlockIt MBBI) { in expand() argument
1407 MachineInstr &MI = *MBBI; in expand()
1418 buildMI(MBB, MBBI, OpHi) in expand()
1422 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
1437 bool AVRExpandPseudo::expand<AVR::RORWRd>(Block &MBB, BlockIt MBBI) { in expand() argument
1443 bool AVRExpandPseudo::expand<AVR::ROLWRd>(Block &MBB, BlockIt MBBI) { in expand() argument
1449 bool AVRExpandPseudo::expand<AVR::ASRWRd>(Block &MBB, BlockIt MBBI) { in expand() argument
1450 MachineInstr &MI = *MBBI; in expand()
1461 buildMI(MBB, MBBI, OpHi) in expand()
1465 auto MIBLO = buildMI(MBB, MBBI, OpLo) in expand()
1479 template <> bool AVRExpandPseudo::expand<AVR::SEXT>(Block &MBB, BlockIt MBBI) { in expand() argument
1480 MachineInstr &MI = *MBBI; in expand()
1503 auto MOV = buildMI(MBB, MBBI, AVR::MOVRdRr) in expand()
1513 buildMI(MBB, MBBI, AVR::MOVRdRr) in expand()
1518 buildMI(MBB, MBBI, AVR::ADDRdRr) // LSL Rd <==> ADD Rd, Rr in expand()
1523 auto SBC = buildMI(MBB, MBBI, AVR::SBCRdRr) in expand()
1538 template <> bool AVRExpandPseudo::expand<AVR::ZEXT>(Block &MBB, BlockIt MBBI) { in expand() argument
1539 MachineInstr &MI = *MBBI; in expand()
1557 buildMI(MBB, MBBI, AVR::MOVRdRr) in expand()
1562 auto EOR = buildMI(MBB, MBBI, AVR::EORRdRr) in expand()
1575 bool AVRExpandPseudo::expand<AVR::SPREAD>(Block &MBB, BlockIt MBBI) { in expand() argument
1576 MachineInstr &MI = *MBBI; in expand()
1586 buildMI(MBB, MBBI, OpLo) in expand()
1592 buildMI(MBB, MBBI, OpHi) in expand()
1602 bool AVRExpandPseudo::expand<AVR::SPWRITE>(Block &MBB, BlockIt MBBI) { in expand() argument
1603 MachineInstr &MI = *MBBI; in expand()
1610 buildMI(MBB, MBBI, AVR::INRdA) in expand()
1615 buildMI(MBB, MBBI, AVR::BCLRs).addImm(0x07).setMIFlags(Flags); in expand()
1617 buildMI(MBB, MBBI, AVR::OUTARr) in expand()
1622 buildMI(MBB, MBBI, AVR::OUTARr) in expand()
1627 buildMI(MBB, MBBI, AVR::OUTARr) in expand()
1636 bool AVRExpandPseudo::expandMI(Block &MBB, BlockIt MBBI) { in expandMI() argument
1637 MachineInstr &MI = *MBBI; in expandMI()
1638 int Opcode = MBBI->getOpcode(); in expandMI()