[llvm-commits] [llvm] r150552 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/MachineScheduler.cpp
Lang Hames
lhames at gmail.com
Tue Feb 14 17:23:52 PST 2012
Author: lhames
Date: Tue Feb 14 19:23:52 2012
New Revision: 150552
URL: http://llvm.org/viewvc/llvm-project?rev=150552&view=rev
Log:
Disentangle moving a machine instr from updating LiveIntervals.
Modified:
llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
llvm/trunk/lib/CodeGen/MachineScheduler.cpp
Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=150552&r1=150551&r2=150552&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Tue Feb 14 19:23:52 2012
@@ -280,10 +280,11 @@
/// 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.
//
Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=150552&r1=150551&r2=150552&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Feb 14 19:23:52 2012
@@ -963,22 +963,17 @@
}
}
-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;
Modified: llvm/trunk/lib/CodeGen/MachineScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineScheduler.cpp?rev=150552&r1=150551&r2=150552&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineScheduler.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineScheduler.cpp Tue Feb 14 19:23:52 2012
@@ -229,7 +229,8 @@
if (&*InsertPos == MI)
++InsertPos;
else {
- Pass->LIS->moveInstr(InsertPos, MI);
+ BB->splice(InsertPos, BB, MI);
+ Pass->LIS->handleMove(MI);
if (Begin == InsertPos)
Begin = MI;
}
More information about the llvm-commits
mailing list