diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2007-04-02 18:49:18 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2007-04-02 18:49:18 +0000 |
| commit | 476fb6a5c97bf9f6dcd6ac175fc7bce24b0ee216 (patch) | |
| tree | a73c623bab6664554b2a9d394cc9442de281e057 /llvm/lib/CodeGen | |
| parent | f7f8e349d6dc62399e4ea79fa40391b5cd2faf3a (diff) | |
| download | bcm5719-llvm-476fb6a5c97bf9f6dcd6ac175fc7bce24b0ee216.tar.gz bcm5719-llvm-476fb6a5c97bf9f6dcd6ac175fc7bce24b0ee216.zip | |
Ugh. Copy coalescer does not update register numbers.
llvm-svn: 35600
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp index bc4f6016f36..a01889a643e 100644 --- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -945,7 +945,7 @@ bool LiveIntervals::JoinCopy(MachineInstr *CopyMI, } 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 @@ TryJoin: } 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 @@ LiveIntervals::lastRegisterUse(unsigned Reg, unsigned Start, unsigned End, 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) { |

