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 | bcfd4665b5597ed1ba679584a69080396d68bcf9 (patch) | |
tree | 0b16e89489a29015f5ef26d61c831ca044f45087 /lib/CodeGen/LiveIntervalAnalysis.cpp | |
parent | ff6ad39bfbb662ebd04b229c5b25e228d4507f52 (diff) | |
download | llvm-bcfd4665b5597ed1ba679584a69080396d68bcf9.tar.gz llvm-bcfd4665b5597ed1ba679584a69080396d68bcf9.tar.bz2 llvm-bcfd4665b5597ed1ba679584a69080396d68bcf9.tar.xz |
Ugh. Copy coalescer does not update register numbers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35600 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r-- | lib/CodeGen/LiveIntervalAnalysis.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index bc4f6016f3..a01889a643 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/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) { |