Lines Matching defs:DefMI
167 const InstrItineraryData *ItinData, const MachineInstr &DefMI,
170 ItinData, DefMI, DefIdx, UseMI, UseIdx);
172 if (!DefMI.getParent())
175 const MachineOperand &DefMO = DefMI.getOperand(DefIdx);
181 &DefMI.getParent()->getParent()->getRegInfo();
191 Latency = getInstrLatency(ItinData, DefMI);
730 MachineInstr *DefMI = MRI->getVRegDef(Reg);
731 for (auto MO2 : DefMI->uses())
2045 bool PPCInstrInfo::onlyFoldImmediate(MachineInstr &UseMI, MachineInstr &DefMI,
2048 unsigned DefOpc = DefMI.getOpcode();
2051 if (!DefMI.getOperand(1).isImm())
2053 if (DefMI.getOperand(1).getImm() != 0)
2116 bool PPCInstrInfo::foldImmediate(MachineInstr &UseMI, MachineInstr &DefMI,
2118 bool Changed = onlyFoldImmediate(UseMI, DefMI, Reg);
2120 DefMI.eraseFromParent();
3405 MachineInstr *DefMI = nullptr;
3426 DefMI = DefMIForTrueReg;
3429 // and is more possible to be converted. So if current DefMI is
3431 if (DefMI->getOpcode() == PPC::LI || DefMI->getOpcode() == PPC::LI8)
3467 MachineInstr *DefMI = getDefMIPostRA(Reg, MI, SeenIntermediateUse);
3468 if (DefMI) {
3471 switch (DefMI->getOpcode()) {
3480 return DefMI;
3486 return OpNoForForwarding == ~0U ? nullptr : DefMI;
3748 MachineInstr *DefMI = getForwardingDefMI(MI, ForwardingOperand,
3750 if (!DefMI)
3757 *KilledDef = DefMI;
3759 // Conservatively add defs from DefMI and defs/uses from MI to the set of
3761 for (const MachineOperand &MO : DefMI->operands())
3772 transformToNewImmFormFedByAdd(MI, *DefMI, ForwardingOperand))
3784 transformToImmFormFedByAdd(MI, III, ForwardingOperand, *DefMI,
3791 transformToImmFormFedByLI(MI, III, ForwardingOperand, *DefMI))
3794 // If this is not a reg+reg, but the DefMI is LI/LI8, check if its user MI
3796 if (!HasImmForm && simplifyToLI(MI, *DefMI, ForwardingOperand, KilledDef))
4437 // Check if the DefMI is the add inst and set the ImmMO and RegMO
4439 bool PPCInstrInfo::isDefMIElgibleForForwarding(MachineInstr &DefMI,
4443 unsigned Opc = DefMI.getOpcode();
4453 assert(DefMI.getNumOperands() >= 3 &&
4455 RegMO = &DefMI.getOperand(1);
4456 ImmMO = &DefMI.getOperand(2);
4462 // This DefMI is elgible for forwarding if it is:
4469 const MachineOperand &RegMO, const MachineInstr &DefMI,
4484 // Walking the inst in reverse(MI-->DefMI) to get the last DEF of the Reg.
4489 if (It->modifiesRegister(Reg, &getRegisterInfo()) && (&*It) != &DefMI)
4491 else if (It->killsRegister(Reg, &getRegisterInfo()) && (&*It) != &DefMI)
4493 if (It->readsRegister(Reg, &getRegisterInfo()) && (&*It) != &DefMI)
4495 // Made it to DefMI without encountering a clobber.
4496 if ((&*It) == &DefMI)
4499 assert((&*It) == &DefMI && "DefMI is missing");
4501 // If DefMI also defines the register to be forwarded, we can only forward it
4502 // if DefMI is being erased.
4503 if (DefMI.modifiesRegister(Reg, &getRegisterInfo()))
4510 const MachineInstr &DefMI,
4515 if (DefMI.getOpcode() == PPC::ADDItocL8) {
4539 // DefMI may be folded with another imm form instruction, the result Imm is
4540 // the sum of Imm of DefMI and BaseImm which is from imm form instruction.
4561 bool PPCInstrInfo::simplifyToLI(MachineInstr &MI, MachineInstr &DefMI,
4564 if ((DefMI.getOpcode() != PPC::LI && DefMI.getOpcode() != PPC::LI8) ||
4565 !DefMI.getOperand(1).isImm())
4572 int64_t Immediate = DefMI.getOperand(1).getImm();
4629 LLVM_DEBUG(DefMI.dump(); MI.dump(); CompareUseMI.dump());
4758 if (MRI->hasOneUse(DefMI.getOperand(0).getReg()))
4759 DefMI.getOperand(1).setImm(NewImm);
4776 LLVM_DEBUG(DefMI.dump());
4798 MachineInstr &MI, MachineInstr &DefMI, unsigned OpNoForForwarding) const {
4834 // Check DefMI.
4837 if (!isDefMIElgibleForForwarding(DefMI, III, ImmMO, RegMO))
4846 if (!isImmElgibleForForwarding(*ImmMO, DefMI, III, Imm, ImmBase))
4853 LLVM_DEBUG(DefMI.dump());
4869 MachineInstr &DefMI, bool KillDefMI) const {
4872 // x = addi reg, imm <----- DefMI
4880 // Check if the DefMI meet the requirement
4884 if (!isDefMIElgibleForForwarding(DefMI, III, ImmMO, RegMO))
4891 if (!isImmElgibleForForwarding(*ImmMO, DefMI, III, Imm))
4897 if (!isRegElgibleForForwarding(*RegMO, DefMI, MI, KillDefMI,
4904 // We know that, the MI and DefMI both meet the pattern, and
4910 LLVM_DEBUG(DefMI.dump());
4929 if (DefMI.getOpcode() == PPC::ADDItocL8)
4965 MachineInstr &DefMI) const {
4966 // DefMI must be LI or LI8.
4967 if ((DefMI.getOpcode() != PPC::LI && DefMI.getOpcode() != PPC::LI8) ||
4968 !DefMI.getOperand(1).isImm())
4972 int64_t Imm = SignExtend64<16>(DefMI.getOperand(1).getImm());
5026 LLVM_DEBUG(DefMI.dump());