diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2008-07-10 07:35:43 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2008-07-10 07:35:43 +0000 |
| commit | e9ba28dd68178530dbfb211f5d64604c20018328 (patch) | |
| tree | cfee405d642f971f29a198d980986610e92b9075 /llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | |
| parent | 6193a564ab908ec828c8f1e4747e34b5b4508a24 (diff) | |
| download | bcm5719-llvm-e9ba28dd68178530dbfb211f5d64604c20018328.tar.gz bcm5719-llvm-e9ba28dd68178530dbfb211f5d64604c20018328.zip | |
- Change the horrible N^2 isRegReDefinedByTwoAddr. Now callers must supply the operand index of def machineoperand and at most one full scan of non-implicit operands is needed.
- Change local register allocator to use the new isRegReDefinedByTwoAddr instead of reinventing the wheel.
llvm-svn: 53394
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalAnalysis.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp index 7b0eaeb341b..974571944a8 100644 --- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -298,6 +298,7 @@ void LiveIntervals::printRegName(unsigned reg) const { void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb, MachineBasicBlock::iterator mi, unsigned MIIdx, MachineOperand& MO, + unsigned MOIdx, LiveInterval &interval) { DOUT << "\t\tregister: "; DEBUG(printRegName(interval.reg)); LiveVariables::VarInfo& vi = lv_->getVarInfo(interval.reg); @@ -390,7 +391,7 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb, // must be due to phi elimination or two addr elimination. If this is // the result of two address elimination, then the vreg is one of the // def-and-use register operand. - if (mi->isRegReDefinedByTwoAddr(interval.reg)) { + if (mi->isRegReDefinedByTwoAddr(interval.reg, MOIdx)) { // If this is a two-address definition, then we have already processed // the live range. The only problem is that we didn't realize there // are actually two values in the live interval. Because of this we @@ -553,9 +554,10 @@ exit: void LiveIntervals::handleRegisterDef(MachineBasicBlock *MBB, MachineBasicBlock::iterator MI, unsigned MIIdx, - MachineOperand& MO) { + MachineOperand& MO, + unsigned MOIdx) { if (TargetRegisterInfo::isVirtualRegister(MO.getReg())) - handleVirtualRegisterDef(MBB, MI, MIIdx, MO, + handleVirtualRegisterDef(MBB, MI, MIIdx, MO, MOIdx, getOrCreateInterval(MO.getReg())); else if (allocatableRegs_[MO.getReg()]) { MachineInstr *CopyMI = NULL; @@ -660,7 +662,7 @@ void LiveIntervals::computeIntervals() { MachineOperand &MO = MI->getOperand(i); // handle register defs - build intervals if (MO.isRegister() && MO.getReg() && MO.isDef()) - handleRegisterDef(MBB, MI, MIIndex, MO); + handleRegisterDef(MBB, MI, MIIndex, MO, i); } MIIndex += InstrSlots::NUM; |

