diff options
author | Owen Anderson <resistor@mac.com> | 2008-08-18 21:20:32 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-08-18 21:20:32 +0000 |
commit | 60f6b2cac0692e7ae2d55d14fba56b4919bdbe93 (patch) | |
tree | 61e209960161deeb273f8facaf092d4f9f3fc8b8 /llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | |
parent | b3c98d3a885e692b2ccb2209d22ee0506344ec87 (diff) | |
download | bcm5719-llvm-60f6b2cac0692e7ae2d55d14fba56b4919bdbe93.tar.gz bcm5719-llvm-60f6b2cac0692e7ae2d55d14fba56b4919bdbe93.zip |
Fix several bugs in the new fast-path:
1) Remove an incorrect assertion.
2) Set the stack slot weight properly.
3) Resize the VirtRegMap when needed.
llvm-svn: 54949
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp index 8781c2b7905..ae090f58ec6 100644 --- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -1608,11 +1608,7 @@ std::vector<LiveInterval*> LiveIntervals:: addIntervalsForSpillsFast(const LiveInterval &li, const MachineLoopInfo *loopInfo, VirtRegMap &vrm, float& SSWeight) { - unsigned slot = vrm.assignVirt2StackSlot(li.reg); - - // since this is called after the analysis is done we don't know if - // LiveVariables is available - lv_ = getAnalysisToUpdate<LiveVariables>(); + vrm.assignVirt2StackSlot(li.reg); std::vector<LiveInterval*> added; @@ -1628,14 +1624,17 @@ addIntervalsForSpillsFast(const LiveInterval &li, DenseMap<MachineInstr*, unsigned> VRegMap; DenseMap<MachineInstr*, VNInfo*> VNMap; + SSWeight = 0.0f; + for (MachineRegisterInfo::reg_iterator RI = mri_->reg_begin(li.reg), RE = mri_->reg_end(); RI != RE; ) { // Create a new virtual register for the spill interval. MachineOperand& MO = RI.getOperand(); unsigned NewVReg = 0; - if (!VRegMap.count(MO.getParent())) + if (!VRegMap.count(MO.getParent())) { VRegMap[MO.getParent()] = NewVReg = mri_->createVirtualRegister(rc); - else + vrm.grow(); + } else NewVReg = VRegMap[MO.getParent()]; // Increment iterator to avoid invalidation. @@ -1644,10 +1643,7 @@ addIntervalsForSpillsFast(const LiveInterval &li, MO.setReg(NewVReg); // create a new register for this spill - vrm.grow(); - vrm.assignVirt2StackSlot(NewVReg, slot); LiveInterval &nI = getOrCreateInterval(NewVReg); - assert(nI.empty()); // the spill weight is now infinity as it // cannot be spilled again @@ -1672,17 +1668,21 @@ addIntervalsForSpillsFast(const LiveInterval &li, } added.push_back(&nI); - - // update live variables if it is available - if (lv_) - lv_->addVirtualRegisterKilled(NewVReg, MO.getParent()); DOUT << "\t\t\t\tadded new interval: "; DEBUG(nI.dump()); DOUT << '\n'; + + unsigned loopDepth = loopInfo->getLoopDepth(MO.getParent()->getParent()); + if (HasUse) { + if (HasDef) + SSWeight += getSpillWeight(true, true, loopDepth); + else + SSWeight += getSpillWeight(false, true, loopDepth); + } else + SSWeight += getSpillWeight(true, false, loopDepth); + } - - SSWeight = HUGE_VALF; std::sort(added.begin(), added.end(), LISorter()); |