aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-09-30 16:10:45 +0000
committerChris Lattner <sabre@nondot.org>2004-09-30 16:10:45 +0000
commit477e4555de341c5de780de3720d6f115ec133c4e (patch)
tree762d00f298e9f7239c954ddb590d0e4f2289d4fb /lib/CodeGen/LiveIntervalAnalysis.cpp
parent70ca358b7d540b6061236ddf757085042873c12c (diff)
There is no need to call MachineInstr::print directly, just send the MI& to an ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16613 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index d4269849cf..c3c6fee983 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -180,8 +180,7 @@ void LiveIntervals::print(std::ostream &O) const {
O << ((Value*)mbbi->getBasicBlock())->getName() << ":\n";
for (MachineBasicBlock::iterator mii = mbbi->begin(),
mie = mbbi->end(); mii != mie; ++mii) {
- O << getInstructionIndex(mii) << '\t';
- mii->print(O, tm_);
+ O << getInstructionIndex(mii) << '\t' << *mii;
}
}
}
@@ -219,6 +218,9 @@ addIntervalsForSpills(const LiveInterval &li, VirtRegMap &vrm, int slot) {
for (unsigned i = 0; i != mi->getNumOperands(); ++i) {
MachineOperand& mop = mi->getOperand(i);
if (mop.isRegister() && mop.getReg() == li.reg) {
+ // First thing, attempt to fold the memory reference into the
+ // instruction. If we can do this, we don't need to insert spill
+ // code.
if (MachineInstr* fmi = mri_->foldMemoryOperand(mi, i, slot)) {
if (lv_)
lv_->instructionChanged(mi, fmi);
@@ -226,12 +228,14 @@ addIntervalsForSpills(const LiveInterval &li, VirtRegMap &vrm, int slot) {
mi2iMap_.erase(mi);
i2miMap_[index/InstrSlots::NUM] = fmi;
mi2iMap_[fmi] = index;
- MachineBasicBlock& mbb = *mi->getParent();
- mi = mbb.insert(mbb.erase(mi), fmi);
+ MachineBasicBlock &MBB = *mi->getParent();
+ mi = MBB.insert(MBB.erase(mi), fmi);
++numFolded;
+
+ // Folding the load/store can completely change the instruction in
+ // unpredictable ways, rescan it from the beginning.
goto for_operand;
- }
- else {
+ } else {
// This is tricky. We need to add information in the interval about
// the spill code so we have to use our extra load/store slots.
//
@@ -519,8 +523,7 @@ void LiveIntervals::computeIntervals()
mi != miEnd; ++mi) {
const TargetInstrDescriptor& tid =
tm_->getInstrInfo()->get(mi->getOpcode());
- DEBUG(std::cerr << getInstructionIndex(mi) << "\t";
- mi->print(std::cerr, tm_));
+ DEBUG(std::cerr << getInstructionIndex(mi) << "\t" << *mi);
// handle implicit defs
for (const unsigned* id = tid.ImplicitDefs; *id; ++id)