[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
Evan Cheng
evan.cheng at apple.com
Mon Apr 2 11:49:38 PDT 2007
Changes in directory llvm/lib/CodeGen:
LiveIntervalAnalysis.cpp updated: 1.231 -> 1.232
---
Log message:
Ugh. Copy coalescer does not update register numbers.
---
Diffs of the changes: (+15 -2)
LiveIntervalAnalysis.cpp | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.231 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.232
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.231 Fri Mar 30 15:18:35 2007
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Apr 2 13:49:18 2007
@@ -945,7 +945,7 @@
} else {
MachineInstr *SrcMI = getInstructionFromIndex(SrcStart);
if (SrcMI) {
- MachineOperand *mops = SrcMI->findRegisterDefOperand(SrcReg);
+ MachineOperand *mops = findDefOperand(SrcMI, repSrcReg);
if (mops)
// A dead def should have a single cycle interval.
++RemoveStart;
@@ -1022,7 +1022,7 @@
} else {
MachineInstr *SrcMI = getInstructionFromIndex(SrcStart);
if (SrcMI) {
- MachineOperand *mops = SrcMI->findRegisterDefOperand(SrcReg);
+ MachineOperand *mops = findDefOperand(SrcMI, repSrcReg);
if (mops)
mops->setIsDead();
}
@@ -1617,6 +1617,19 @@
return NULL;
}
+
+/// findDefOperand - Returns the MachineOperand that is a def of the specific
+/// register. It returns NULL if the def is not found.
+MachineOperand *LiveIntervals::findDefOperand(MachineInstr *MI, unsigned Reg) {
+ for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
+ MachineOperand &MO = MI->getOperand(i);
+ if (MO.isReg() && MO.isDef() &&
+ mri_->regsOverlap(rep(MO.getReg()), Reg))
+ return &MO;
+ }
+ return NULL;
+}
+
/// unsetRegisterKill - Unset IsKill property of all uses of specific register
/// of the specific instruction.
void LiveIntervals::unsetRegisterKill(MachineInstr *MI, unsigned Reg) {
More information about the llvm-commits
mailing list