[llvm-commits] [llvm] r150630 - in /llvm/trunk: include/llvm/CodeGen/MachineInstr.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/MachineInstr.cpp
Lang Hames
lhames at gmail.com
Wed Feb 15 15:21:33 PST 2012
Author: lhames
Date: Wed Feb 15 17:21:33 2012
New Revision: 150630
URL: http://llvm.org/viewvc/llvm-project?rev=150630&view=rev
Log:
Make LiveIntervals::handleMove() bundle aware.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineInstr.h
llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
llvm/trunk/lib/CodeGen/MachineInstr.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=150630&r1=150629&r2=150630&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Wed Feb 15 17:21:33 2012
@@ -234,6 +234,11 @@
/// if either itself or its following instruction is marked "InsideBundle".
bool isBundled() const;
+ /// getBundleStart - If this instruction is inside a bundle return the
+ /// instruction at the start of the bundle. Otherwise just returns the
+ /// instruction itself.
+ MachineInstr* getBundleStart();
+
/// getDebugLoc - Returns the debug location id of this MachineInstr.
///
DebugLoc getDebugLoc() const { return debugLoc; }
Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=150630&r1=150629&r2=150630&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Feb 15 17:21:33 2012
@@ -963,13 +963,15 @@
}
}
-void LiveIntervals::handleMove(MachineInstr *mi) {
+
+
+void LiveIntervals::handleMove(MachineInstr* mi) {
SlotIndex origIdx = indexes_->getInstructionIndex(mi);
indexes_->removeMachineInstrFromMaps(mi);
- SlotIndex miIdx = indexes_->insertMachineInstrInMaps(mi);
-
+ SlotIndex miIdx = mi->isInsideBundle() ?
+ indexes_->getInstructionIndex(mi->getBundleStart()) :
+ indexes_->insertMachineInstrInMaps(mi);
MachineBasicBlock* mbb = mi->getParent();
-
assert(getMBBStartIdx(mbb) <= origIdx && origIdx < getMBBEndIdx(mbb) &&
"Cannot handle moves across basic block boundaries.");
assert(!mi->isBundled() && "Can't handle bundled instructions yet.");
Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=150630&r1=150629&r2=150630&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Wed Feb 15 17:21:33 2012
@@ -900,6 +900,16 @@
return nextMI != Parent->instr_end() && nextMI->isInsideBundle();
}
+MachineInstr* MachineInstr::getBundleStart() {
+ if (!isInsideBundle())
+ return this;
+ MachineBasicBlock::reverse_instr_iterator MII(this);
+ --MII;
+ while (MII->isInsideBundle())
+ --MII;
+ return &*MII;
+}
+
bool MachineInstr::isStackAligningInlineAsm() const {
if (isInlineAsm()) {
unsigned ExtraInfo = getOperand(InlineAsm::MIOp_ExtraInfo).getImm();
More information about the llvm-commits
mailing list