[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Fri Aug 27 11:59:32 PDT 2004
Changes in directory llvm/lib/CodeGen:
LiveIntervalAnalysis.cpp updated: 1.119 -> 1.120
---
Log message:
Only update LiveVariables if it is available. addIntervalsForSpills
runs after the initial run of the live interval analysis.
---
Diffs of the changes: (+12 -9)
Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.119 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.120
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.119 Thu Aug 26 17:22:38 2004
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Aug 27 13:59:22 2004
@@ -186,6 +186,10 @@
VirtRegMap& vrm,
int slot)
{
+ // since this is called after the analysis is done we don't know if
+ // LiveVariables is available
+ lv_ = getAnalysisToUpdate<LiveVariables>();
+
std::vector<LiveInterval*> added;
assert(li.weight != HUGE_VAL &&
@@ -212,9 +216,9 @@
for (unsigned i = 0; i != mi->getNumOperands(); ++i) {
MachineOperand& mop = mi->getOperand(i);
if (mop.isRegister() && mop.getReg() == li.reg) {
- if (MachineInstr* fmi =
- mri_->foldMemoryOperand(mi, i, slot)) {
- lv_->instructionChanged(mi, fmi);
+ if (MachineInstr* fmi = mri_->foldMemoryOperand(mi, i, slot)) {
+ if (lv_)
+ lv_->instructionChanged(mi, fmi);
vrm.virtFolded(li.reg, mi, fmi);
mi2iMap_.erase(mi);
i2miMap_[index/InstrSlots::NUM] = fmi;
@@ -244,8 +248,7 @@
getUseIndex(index));
// create a new register for this spill
- unsigned nReg =
- mf_->getSSARegMap()->createVirtualRegister(rc);
+ unsigned nReg = mf_->getSSARegMap()->createVirtualRegister(rc);
mi->SetMachineOperandReg(i, nReg);
vrm.grow();
vrm.assignVirt2StackSlot(nReg, slot);
@@ -258,10 +261,10 @@
DEBUG(std::cerr << " +" << LR);
nI.addRange(LR);
added.push_back(&nI);
- // update live variables
- lv_->addVirtualRegisterKilled(nReg, mi);
- DEBUG(std::cerr << "\t\t\t\tadded new interval: "
- << nI << '\n');
+ // update live variables if it is available
+ if (lv_)
+ lv_->addVirtualRegisterKilled(nReg, mi);
+ DEBUG(std::cerr << "\t\t\t\tadded new interval: " << nI << '\n');
}
}
}
More information about the llvm-commits
mailing list