aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2013-02-17 11:09:00 +0000
committerCameron Zwarich <zwarich@apple.com>2013-02-17 11:09:00 +0000
commit24955967926ea5bb5a16058707fc113e2cdcd7ab (patch)
treed02719fced5b5b6a075e7d0420fc2cc153585207 /llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
parent01248e4cdc087d75ece7150045aa78aab2797b6b (diff)
downloadllvm-24955967926ea5bb5a16058707fc113e2cdcd7ab.zip
llvm-24955967926ea5bb5a16058707fc113e2cdcd7ab.tar.gz
llvm-24955967926ea5bb5a16058707fc113e2cdcd7ab.tar.bz2
Remove use of reverse iterators in repairIntervalsInRange(). While they were
arguably better than forward iterators for this use case, they are confusing and there are some implementation problems with reverse iterators and MI bundles. llvm-svn: 175393
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index e09ac4b..0978d73 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -1035,19 +1035,24 @@ void LiveIntervals::handleMoveIntoBundle(MachineInstr* MI,
void
LiveIntervals::repairIntervalsInRange(MachineBasicBlock *MBB,
- MachineBasicBlock::reverse_iterator RBegin,
- MachineBasicBlock::reverse_iterator REnd,
+ MachineBasicBlock::iterator Begin,
+ MachineBasicBlock::iterator End,
ArrayRef<unsigned> OrigRegs) {
+ SlotIndex startIdx;
+ if (Begin == MBB->begin())
+ startIdx = getMBBStartIdx(MBB);
+ else
+ startIdx = getInstructionIndex(prior(Begin)).getRegSlot();
+
for (unsigned i = 0, e = OrigRegs.size(); i != e; ++i) {
unsigned Reg = OrigRegs[i];
if (!TargetRegisterInfo::isVirtualRegister(Reg))
continue;
LiveInterval &LI = getInterval(Reg);
- SlotIndex startIdx = (REnd == MBB->rend()) ? getMBBStartIdx(MBB)
- : getInstructionIndex(&*REnd);
- for (MachineBasicBlock::reverse_iterator I = RBegin; I != REnd; ++I) {
- MachineInstr *MI = &*I;
+ for (MachineBasicBlock::iterator I = End; I != Begin;) {
+ --I;
+ MachineInstr *MI = I;
SlotIndex instrIdx = getInstructionIndex(MI);
for (MachineInstr::mop_iterator OI = MI->operands_begin(),
@@ -1059,7 +1064,7 @@ LiveIntervals::repairIntervalsInRange(MachineBasicBlock *MBB,
assert(MO.isUse() && "Register defs are not yet supported.");
if (!LI.liveAt(instrIdx)) {
- LiveRange *LR = LI.getLiveRangeContaining(startIdx.getRegSlot());
+ LiveRange *LR = LI.getLiveRangeContaining(startIdx);
assert(LR && "Used registers must be live-in.");
LR->end = instrIdx.getRegSlot();
break;