aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp19
-rw-r--r--lib/CodeGen/MachineScheduler.cpp3
2 files changed, 9 insertions, 13 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index 30374da18f..d27b8e5fd9 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -963,22 +963,17 @@ static void handleMoveUses(const MachineBasicBlock *mbb,
}
}
-void LiveIntervals::moveInstr(MachineBasicBlock::iterator insertPt,
- MachineInstr *mi) {
- MachineBasicBlock* mbb = mi->getParent();
- assert((insertPt == mbb->end() || insertPt->getParent() == mbb) &&
- "Cannot handle moves across basic block boundaries.");
- assert(&*insertPt != mi && "No-op move requested?");
- assert(!mi->isBundled() && "Can't handle bundled instructions yet.");
-
- // Grab the original instruction index.
+void LiveIntervals::handleMove(MachineInstr *mi) {
SlotIndex origIdx = indexes_->getInstructionIndex(mi);
-
- // Move the machine instr and obtain its new index.
indexes_->removeMachineInstrFromMaps(mi);
- mbb->splice(insertPt, mbb, mi);
SlotIndex miIdx = indexes_->insertMachineInstrInMaps(mi);
+ MachineBasicBlock* mbb = mi->getParent();
+
+ assert(getMBBFromIndex(origIdx) == mbb &&
+ "Cannot handle moves across basic block boundaries.");
+ assert(!mi->isBundled() && "Can't handle bundled instructions yet.");
+
// Pick the direction.
bool movingUp = miIdx < origIdx;
diff --git a/lib/CodeGen/MachineScheduler.cpp b/lib/CodeGen/MachineScheduler.cpp
index ba87f5a7ab..da52df9fea 100644
--- a/lib/CodeGen/MachineScheduler.cpp
+++ b/lib/CodeGen/MachineScheduler.cpp
@@ -229,7 +229,8 @@ void ScheduleTopDownLive::Schedule() {
if (&*InsertPos == MI)
++InsertPos;
else {
- Pass->LIS->moveInstr(InsertPos, MI);
+ BB->splice(InsertPos, BB, MI);
+ Pass->LIS->handleMove(MI);
if (Begin == InsertPos)
Begin = MI;
}