diff options
| author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-03-14 07:19:51 +0000 |
|---|---|---|
| committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-03-14 07:19:51 +0000 |
| commit | 48da2f8a6d7e7d21657f7f81f116a7e4263119c9 (patch) | |
| tree | 060733758f80d9bb89a0bc44da27c55a18e40f0d /llvm/lib/CodeGen | |
| parent | 0137de5ecb4992a4a7425e51e827fe955a82f980 (diff) | |
| download | bcm5719-llvm-48da2f8a6d7e7d21657f7f81f116a7e4263119c9.tar.gz bcm5719-llvm-48da2f8a6d7e7d21657f7f81f116a7e4263119c9.zip | |
Change MRegisterInfo::foldMemoryOperand to return the folded
instruction to make the API more flexible.
llvm-svn: 12386
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/LiveIntervals.cpp | 16 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/RegAllocLocal.cpp | 7 |
2 files changed, 12 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervals.cpp b/llvm/lib/CodeGen/LiveIntervals.cpp index d6cc357fd54..7f6afc549d8 100644 --- a/llvm/lib/CodeGen/LiveIntervals.cpp +++ b/llvm/lib/CodeGen/LiveIntervals.cpp @@ -209,13 +209,15 @@ void LiveIntervals::updateSpilledInterval(Interval& li, for (unsigned i = 0; i < mi->getNumOperands(); ++i) { MachineOperand& mop = mi->getOperand(i); if (mop.isRegister() && mop.getReg() == li.reg) { - MachineInstr* old = mi; - if (mri_->foldMemoryOperand(mi, i, slot)) { - lv_->instructionChanged(old, mi); - vrm.virtFolded(li.reg, old, mi); - mi2iMap_.erase(old); - i2miMap_[index/InstrSlots::NUM] = mi; - mi2iMap_[mi] = index; + if (MachineInstr* fmi = + mri_->foldMemoryOperand(mi, i, slot)) { + lv_->instructionChanged(mi, fmi); + vrm.virtFolded(li.reg, mi, fmi); + mi2iMap_.erase(mi); + i2miMap_[index/InstrSlots::NUM] = fmi; + mi2iMap_[fmi] = index; + MachineBasicBlock& mbb = *mi->getParent(); + mi = mbb.insert(mbb.erase(mi), fmi); ++numFolded; goto for_operand; } diff --git a/llvm/lib/CodeGen/RegAllocLocal.cpp b/llvm/lib/CodeGen/RegAllocLocal.cpp index bd1e090a6fe..0b5fdc5fea2 100644 --- a/llvm/lib/CodeGen/RegAllocLocal.cpp +++ b/llvm/lib/CodeGen/RegAllocLocal.cpp @@ -487,13 +487,12 @@ MachineInstr *RA::reloadVirtReg(MachineBasicBlock &MBB, MachineInstr *MI, assignVirtToPhysReg(VirtReg, PhysReg); } else { // No registers available. // If we can fold this spill into this instruction, do so now. - MachineBasicBlock::iterator MII = MI; - if (RegInfo->foldMemoryOperand(MII, OpNum, FrameIndex)) { + if (MachineInstr* FMI = RegInfo->foldMemoryOperand(MI, OpNum, FrameIndex)){ ++NumFolded; // Since we changed the address of MI, make sure to update live variables // to know that the new instruction has the properties of the old one. - LV->instructionChanged(MI, MII); - return MII; + LV->instructionChanged(MI, FMI); + return MBB.insert(MBB.erase(MI), FMI); } // It looks like we can't fold this virtual register load into this |

