Home | History | Annotate | Download | only in CodeGen

Lines Matching refs:MI

49   bool LowerSubregToReg(MachineInstr *MI);
50 bool LowerCopy(MachineInstr *MI);
52 void TransferImplicitDefs(MachineInstr *MI);
62 /// TransferImplicitDefs - MI is a pseudo-instruction, and the lowered
64 /// operands from MI to the replacement instruction.
66 ExpandPostRA::TransferImplicitDefs(MachineInstr *MI) {
67 MachineBasicBlock::iterator CopyMI = MI;
70 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
71 MachineOperand &MO = MI->getOperand(i);
78 bool ExpandPostRA::LowerSubregToReg(MachineInstr *MI) {
79 MachineBasicBlock *MBB = MI->getParent();
80 assert((MI->getOperand(0).isReg() && MI->getOperand(0).isDef()) &&
81 MI->getOperand(1).isImm() &&
82 (MI->getOperand(2).isReg() && MI->getOperand(2).isUse()) &&
83 MI->getOperand(3).isImm() && "Invalid subreg_to_reg");
85 unsigned DstReg = MI->getOperand(0).getReg();
86 unsigned InsReg = MI->getOperand(2).getReg();
87 assert(!MI->getOperand(2).getSubReg() && "SubIdx on physreg?");
88 unsigned SubIdx = MI->getOperand(3).getImm();
98 DEBUG(dbgs() << "subreg: CONVERTING: " << *MI);
100 if (MI->allDefsAreDead()) {
101 MI->setDesc(TII->get(TargetOpcode::KILL));
102 DEBUG(dbgs() << "subreg: replaced by: " << *MI);
112 MI->setDesc(TII->get(TargetOpcode::KILL));
113 MI->RemoveOperand(3); // SubIdx
114 MI->RemoveOperand(1); // Imm
115 DEBUG(dbgs() << "subreg: replace by: " << *MI);
120 TII->copyPhysReg(*MBB, MI, MI->getDebugLoc(), DstSubReg, InsReg,
121 MI->getOperand(2).isKill());
124 MachineBasicBlock::iterator CopyMI = MI;
131 MBB->erase(MI);
135 bool ExpandPostRA::LowerCopy(MachineInstr *MI) {
137 if (MI->allDefsAreDead()) {
138 DEBUG(dbgs() << "dead copy: " << *MI);
139 MI->setDesc(TII->get(TargetOpcode::KILL));
140 DEBUG(dbgs() << "replaced by: " << *MI);
144 MachineOperand &DstMO = MI->getOperand(0);
145 MachineOperand &SrcMO = MI->getOperand(1);
148 DEBUG(dbgs() << "identity copy: " << *MI);
151 if (SrcMO.isUndef() || MI->getNumOperands() > 2) {
154 MI->setDesc(TII->get(TargetOpcode::KILL));
155 DEBUG(dbgs() << "replaced by: " << *MI);
159 MI->eraseFromParent();
163 DEBUG(dbgs() << "real copy: " << *MI);
164 TII->copyPhysReg(*MI->getParent(), MI, MI->getDebugLoc(),
167 if (MI->getNumOperands() > 2)
168 TransferImplicitDefs(MI);
170 MachineBasicBlock::iterator dMI = MI;
173 MI->eraseFromParent();
191 for (MachineBasicBlock::iterator mi = mbbi->begin(), me = mbbi->end();
192 mi != me;) {
193 MachineInstr *MI = mi;
194 // Advance iterator here because MI may be erased.
195 ++mi;
198 if (!MI->isPseudo())
202 if (TII->expandPostRAPseudo(MI)) {
208 switch (MI->getOpcode()) {
210 MadeChange |= LowerSubregToReg(MI);
213 MadeChange |= LowerCopy(MI);