llvm.org GIT mirror llvm / be04dc1
- Add LiveVariables::replaceKillInstruction. This does a subset of instructionChanged. That is, it only update the VarInfo.kills if the new instruction is known to have the correct dead and kill markers. - CommuteInstruction copies kill / dead markers over to new instruction. So use replaceKillInstruction instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53061 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 12 years ago
3 changed file(s) with 16 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
188188 /// the records for NewMI.
189189 void instructionChanged(MachineInstr *OldMI, MachineInstr *NewMI);
190190
191 /// replaceKillInstruction - Update register kill info by replacing a kill
192 /// instruction with a new one.
193 void replaceKillInstruction(unsigned Reg, MachineInstr *OldMI,
194 MachineInstr *NewMI);
195
191196 /// addVirtualRegisterKilled - Add information about the fact that the
192197 /// specified register is killed after being used by the specified
193198 /// instruction. If AddIfNotFound is true, add a implicit operand if it's
683683 }
684684 }
685685
686 /// replaceKillInstruction - Update register kill info by replacing a kill
687 /// instruction with a new one.
688 void LiveVariables::replaceKillInstruction(unsigned Reg, MachineInstr *OldMI,
689 MachineInstr *NewMI) {
690 VarInfo &VI = getVarInfo(Reg);
691 if (VI.removeKill(OldMI))
692 VI.Kills.push_back(NewMI); // Yes, there was a kill of it
693 }
694
686695 /// removeVirtualRegistersKilled - Remove all killed info for the specified
687696 /// instruction.
688697 void LiveVariables::removeVirtualRegistersKilled(MachineInstr *MI) {
374374 DOUT << "2addr: COMMUTED TO: " << *NewMI;
375375 // If the instruction changed to commute it, update livevar.
376376 if (NewMI != mi) {
377 if (LV) {
377 if (LV)
378378 // Update live variables
379 LV->instructionChanged(mi, NewMI);
380 }
379 LV->replaceKillInstruction(regC, mi, NewMI);
381380
382381 mbbi->insert(mi, NewMI); // Insert the new inst
383382 mbbi->erase(mi); // Nuke the old inst.