Lines Matching refs:MI

51   void replaceWithBRcc(MachineInstr *MI) const;
52 void replaceWithCmpBcc(MachineInstr *MI) const;
95 static bool isBRccPseudo(MachineInstr *MI) { in isBRccPseudo() argument
96 return !(MI->getOpcode() != ARC::BRcc_rr_p && in isBRccPseudo()
97 MI->getOpcode() != ARC::BRcc_ru6_p); in isBRccPseudo()
100 static unsigned getBRccForPseudo(MachineInstr *MI) { in getBRccForPseudo() argument
101 assert(isBRccPseudo(MI) && "Can't get BRcc for wrong instruction."); in getBRccForPseudo()
102 if (MI->getOpcode() == ARC::BRcc_rr_p) in getBRccForPseudo()
107 static unsigned getCmpForPseudo(MachineInstr *MI) { in getCmpForPseudo() argument
108 assert(isBRccPseudo(MI) && "Can't get BRcc for wrong instruction."); in getCmpForPseudo()
109 if (MI->getOpcode() == ARC::BRcc_rr_p) in getCmpForPseudo()
114 void ARCBranchFinalize::replaceWithBRcc(MachineInstr *MI) const { in replaceWithBRcc()
116 unsigned CC = getCCForBRcc(MI->getOperand(3).getImm()); in replaceWithBRcc()
118 BuildMI(*MI->getParent(), MI, MI->getDebugLoc(), in replaceWithBRcc()
119 TII->get(getBRccForPseudo(MI))) in replaceWithBRcc()
120 .addMBB(MI->getOperand(0).getMBB()) in replaceWithBRcc()
121 .addReg(MI->getOperand(1).getReg()) in replaceWithBRcc()
122 .add(MI->getOperand(2)) in replaceWithBRcc()
123 .addImm(getCCForBRcc(MI->getOperand(3).getImm())); in replaceWithBRcc()
124 MI->eraseFromParent(); in replaceWithBRcc()
126 replaceWithCmpBcc(MI); in replaceWithBRcc()
130 void ARCBranchFinalize::replaceWithCmpBcc(MachineInstr *MI) const { in replaceWithCmpBcc()
131 LLVM_DEBUG(dbgs() << "Branch: " << *MI << "\n"); in replaceWithCmpBcc()
133 BuildMI(*MI->getParent(), MI, MI->getDebugLoc(), in replaceWithCmpBcc()
134 TII->get(getCmpForPseudo(MI))) in replaceWithCmpBcc()
135 .addReg(MI->getOperand(1).getReg()) in replaceWithCmpBcc()
136 .add(MI->getOperand(2)); in replaceWithCmpBcc()
137 BuildMI(*MI->getParent(), MI, MI->getDebugLoc(), TII->get(ARC::Bcc)) in replaceWithCmpBcc()
138 .addMBB(MI->getOperand(0).getMBB()) in replaceWithCmpBcc()
139 .addImm(MI->getOperand(3).getImm()); in replaceWithCmpBcc()
140 MI->eraseFromParent(); in replaceWithCmpBcc()
156 for (auto &MI : MBB) { in runOnMachineFunction() local
157 unsigned Size = TII->getInstSizeInBytes(MI); in runOnMachineFunction()
159 LLVM_DEBUG(dbgs() << "Unknown (or size 0) size for: " << MI << "\n"); in runOnMachineFunction()
163 if (MI.isBranch()) { in runOnMachineFunction()
164 Branches.push_back(&MI); in runOnMachineFunction()
165 BranchToPCList.emplace_back(&MI, PC); in runOnMachineFunction()