summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2012-02-15 01:23:52 +0000
committerLang Hames <lhames@gmail.com>2012-02-15 01:23:52 +0000
commit77d205152a2bbbbe10aef16266f3c66c461dc3fd (patch)
treec3a64140d077700e63243053dd1e0d7bed77d3b0
parentc62bb3914260c9b864dcf88e8a12ee645f5368da (diff)
downloadbcm5719-llvm-77d205152a2bbbbe10aef16266f3c66c461dc3fd.tar.gz
bcm5719-llvm-77d205152a2bbbbe10aef16266f3c66c461dc3fd.zip
Disentangle moving a machine instr from updating LiveIntervals.
llvm-svn: 150552
-rw-r--r--llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h9
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp19
-rw-r--r--llvm/lib/CodeGen/MachineScheduler.cpp3
3 files changed, 14 insertions, 17 deletions
diff --git a/llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h b/llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
index c18c479ce8d..4bc37fd1daf 100644
--- a/llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -280,10 +280,11 @@ namespace llvm {
/// register.
void addKillFlags();
- /// moveInstr - Move MachineInstr mi to insertPt, updating the live
- /// intervals of mi's operands to reflect the new position. The insertion
- /// point can be above or below mi, but must be in the same basic block.
- void moveInstr(MachineBasicBlock::iterator insertPt, MachineInstr* mi);
+ /// handleMove - call this method to notify LiveIntervals that
+ /// instruction 'mi' has been moved within a basic block. This will update
+ /// the live intervals for all operands of mi. Moves between basic blocks
+ /// are not supported.
+ void handleMove(MachineInstr* mi);
// Register mask functions.
//
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index 30374da18f2..d27b8e5fd9f 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/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/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index ba87f5a7ab3..da52df9feae 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud