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
This commit is contained in:
Chris Lattner 2004-09-30 16:10:45 +00:00
parent 70ca358b7d
commit 477e4555de
2 changed files with 18 additions and 18 deletions

View File

@ -180,8 +180,7 @@ void LiveIntervals::print(std::ostream &O) const {
O << ((Value*)mbbi->getBasicBlock())->getName() << ":\n"; O << ((Value*)mbbi->getBasicBlock())->getName() << ":\n";
for (MachineBasicBlock::iterator mii = mbbi->begin(), for (MachineBasicBlock::iterator mii = mbbi->begin(),
mie = mbbi->end(); mii != mie; ++mii) { mie = mbbi->end(); mii != mie; ++mii) {
O << getInstructionIndex(mii) << '\t'; O << getInstructionIndex(mii) << '\t' << *mii;
mii->print(O, tm_);
} }
} }
} }
@ -219,6 +218,9 @@ addIntervalsForSpills(const LiveInterval &li, VirtRegMap &vrm, int slot) {
for (unsigned i = 0; i != mi->getNumOperands(); ++i) { for (unsigned i = 0; i != mi->getNumOperands(); ++i) {
MachineOperand& mop = mi->getOperand(i); MachineOperand& mop = mi->getOperand(i);
if (mop.isRegister() && mop.getReg() == li.reg) { 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 (MachineInstr* fmi = mri_->foldMemoryOperand(mi, i, slot)) {
if (lv_) if (lv_)
lv_->instructionChanged(mi, fmi); lv_->instructionChanged(mi, fmi);
@ -226,12 +228,14 @@ addIntervalsForSpills(const LiveInterval &li, VirtRegMap &vrm, int slot) {
mi2iMap_.erase(mi); mi2iMap_.erase(mi);
i2miMap_[index/InstrSlots::NUM] = fmi; i2miMap_[index/InstrSlots::NUM] = fmi;
mi2iMap_[fmi] = index; mi2iMap_[fmi] = index;
MachineBasicBlock& mbb = *mi->getParent(); MachineBasicBlock &MBB = *mi->getParent();
mi = mbb.insert(mbb.erase(mi), fmi); mi = MBB.insert(MBB.erase(mi), fmi);
++numFolded; ++numFolded;
// Folding the load/store can completely change the instruction in
// unpredictable ways, rescan it from the beginning.
goto for_operand; goto for_operand;
} } else {
else {
// This is tricky. We need to add information in the interval about // 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. // the spill code so we have to use our extra load/store slots.
// //
@ -519,8 +523,7 @@ void LiveIntervals::computeIntervals()
mi != miEnd; ++mi) { mi != miEnd; ++mi) {
const TargetInstrDescriptor& tid = const TargetInstrDescriptor& tid =
tm_->getInstrInfo()->get(mi->getOpcode()); tm_->getInstrInfo()->get(mi->getOpcode());
DEBUG(std::cerr << getInstructionIndex(mi) << "\t"; DEBUG(std::cerr << getInstructionIndex(mi) << "\t" << *mi);
mi->print(std::cerr, tm_));
// handle implicit defs // handle implicit defs
for (const unsigned* id = tid.ImplicitDefs; *id; ++id) for (const unsigned* id = tid.ImplicitDefs; *id; ++id)

View File

@ -153,7 +153,7 @@ bool SimpleSpiller::runOnMachineFunction(MachineFunction& MF,
unsigned VirtReg = MOP.getReg(); unsigned VirtReg = MOP.getReg();
unsigned PhysReg = VRM.getPhys(VirtReg); unsigned PhysReg = VRM.getPhys(VirtReg);
if (VRM.hasStackSlot(VirtReg)) { if (VRM.hasStackSlot(VirtReg)) {
int StackSlot = VRM.getStackSlot(VirtReg); int StackSlot = VRM.getStackSlot(VirtReg);
if (MOP.isUse() && if (MOP.isUse() &&
std::find(LoadedRegs.begin(), LoadedRegs.end(), VirtReg) std::find(LoadedRegs.begin(), LoadedRegs.end(), VirtReg)
@ -161,7 +161,7 @@ bool SimpleSpiller::runOnMachineFunction(MachineFunction& MF,
MRI.loadRegFromStackSlot(MBB, &MI, PhysReg, StackSlot); MRI.loadRegFromStackSlot(MBB, &MI, PhysReg, StackSlot);
LoadedRegs.push_back(VirtReg); LoadedRegs.push_back(VirtReg);
++NumLoads; ++NumLoads;
DEBUG(std::cerr << '\t'; prior(MII)->print(std::cerr, &TM)); DEBUG(std::cerr << '\t' << *prior(MII));
} }
if (MOP.isDef()) { if (MOP.isDef()) {
@ -173,7 +173,7 @@ bool SimpleSpiller::runOnMachineFunction(MachineFunction& MF,
MI.SetMachineOperandReg(i, PhysReg); MI.SetMachineOperandReg(i, PhysReg);
} }
} }
DEBUG(std::cerr << '\t'; MI.print(std::cerr, &TM)); DEBUG(std::cerr << '\t' << MI);
LoadedRegs.clear(); LoadedRegs.clear();
} }
} }
@ -228,8 +228,7 @@ namespace {
MRI->loadRegFromStackSlot(MBB, MII, PhysReg, MRI->loadRegFromStackSlot(MBB, MII, PhysReg,
VRM->getStackSlot(VirtReg)); VRM->getStackSlot(VirtReg));
++NumLoads; ++NumLoads;
DEBUG(std::cerr << "added: "; DEBUG(std::cerr << "added: " << *prior(MII));
prior(MII)->print(std::cerr, TM));
lastDef_[VirtReg] = MII; lastDef_[VirtReg] = MII;
} }
} }
@ -293,10 +292,8 @@ void LocalSpiller::vacateJustPhysReg(MachineBasicBlock& MBB,
PhysReg, PhysReg,
VRM->getStackSlot(VirtReg)); VRM->getStackSlot(VirtReg));
++NumStores; ++NumStores;
DEBUG(std::cerr << "added: "; DEBUG(std::cerr << "added: " << *prior(nextLastRef);
prior(nextLastRef)->print(std::cerr, TM); std::cerr << "after: " << *lastDef);
std::cerr << "after: ";
lastDef->print(std::cerr, TM));
lastDef_[VirtReg] = 0; lastDef_[VirtReg] = 0;
} }
p2vMap_[PhysReg] = 0; p2vMap_[PhysReg] = 0;
@ -360,7 +357,7 @@ void LocalSpiller::eliminateVirtRegsInMBB(MachineBasicBlock &MBB) {
} }
} }
DEBUG(std::cerr << '\t'; MI->print(std::cerr, TM)); DEBUG(std::cerr << '\t' << *MI);
} }
for (unsigned i = 1, e = p2vMap_.size(); i != e; ++i) for (unsigned i = 1, e = p2vMap_.size(); i != e; ++i)