aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2013-02-20 22:10:00 +0000
committerCameron Zwarich <zwarich@apple.com>2013-02-20 22:10:00 +0000
commitc5b6135fb55362f5c052625043ebf3286f799f86 (patch)
treec3fad459126250734fb11e96a39a3462a3cad524 /lib/CodeGen
parent0e827ebc783ded58c11aeb0d66bed43e214de2de (diff)
downloadexternal_llvm-c5b6135fb55362f5c052625043ebf3286f799f86.zip
external_llvm-c5b6135fb55362f5c052625043ebf3286f799f86.tar.gz
external_llvm-c5b6135fb55362f5c052625043ebf3286f799f86.tar.bz2
Find anchoring end points for repairIntervalsInRange and repairIndexesInRange
automatically. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175673 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp7
-rw-r--r--lib/CodeGen/SlotIndexes.cpp9
-rw-r--r--lib/CodeGen/TwoAddressInstructionPass.cpp17
3 files changed, 21 insertions, 12 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index e07922b..a716e8b 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -1038,6 +1038,13 @@ LiveIntervals::repairIntervalsInRange(MachineBasicBlock *MBB,
MachineBasicBlock::iterator Begin,
MachineBasicBlock::iterator End,
ArrayRef<unsigned> OrigRegs) {
+ // Find anchor points, which are at the beginning/end of blocks or at
+ // instructions that already have indexes.
+ while (Begin != MBB->begin() && !Indexes->hasIndex(Begin))
+ --Begin;
+ while (End != MBB->end() && !Indexes->hasIndex(End))
+ ++End;
+
SlotIndex endIdx;
if (End == MBB->end())
endIdx = getMBBEndIdx(MBB).getPrevSlot();
diff --git a/lib/CodeGen/SlotIndexes.cpp b/lib/CodeGen/SlotIndexes.cpp
index b4e562e..f293794 100644
--- a/lib/CodeGen/SlotIndexes.cpp
+++ b/lib/CodeGen/SlotIndexes.cpp
@@ -146,6 +146,15 @@ void SlotIndexes::renumberIndexes(IndexList::iterator curItr) {
void SlotIndexes::repairIndexesInRange(MachineBasicBlock *MBB,
MachineBasicBlock::iterator Begin,
MachineBasicBlock::iterator End) {
+ // FIXME: Is this really necessary? The only caller repairIntervalsForRange()
+ // does the same thing.
+ // Find anchor points, which are at the beginning/end of blocks or at
+ // instructions that already have indexes.
+ while (Begin != MBB->begin() && !hasIndex(Begin))
+ --Begin;
+ while (End != MBB->end() && !hasIndex(End))
+ ++End;
+
bool includeStart = (Begin == MBB->begin());
SlotIndex startIdx;
if (includeStart)
diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp
index 99d3607..43d0655 100644
--- a/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -1150,15 +1150,8 @@ tryInstructionTransform(MachineBasicBlock::iterator &mi,
LV->addVirtualRegisterKilled(Reg, NewMIs[1]);
}
- MachineBasicBlock::iterator Begin;
- MachineBasicBlock::iterator End;
SmallVector<unsigned, 4> OrigRegs;
if (LIS) {
- Begin = MachineBasicBlock::iterator(NewMIs[0]);
- if (Begin != MBB->begin())
- --Begin;
- End = llvm::next(MachineBasicBlock::iterator(MI));
-
for (MachineInstr::const_mop_iterator MOI = MI.operands_begin(),
MOE = MI.operands_end(); MOI != MOE; ++MOI) {
if (MOI->isReg())
@@ -1169,8 +1162,11 @@ tryInstructionTransform(MachineBasicBlock::iterator &mi,
MI.eraseFromParent();
// Update LiveIntervals.
- if (LIS)
+ if (LIS) {
+ MachineBasicBlock::iterator Begin(NewMIs[0]);
+ MachineBasicBlock::iterator End(NewMIs[1]);
LIS->repairIntervalsInRange(MBB, Begin, End, OrigRegs);
+ }
mi = NewMIs[1];
if (TransformSuccess)
@@ -1576,9 +1572,6 @@ eliminateRegSequence(MachineBasicBlock::iterator &MBBI) {
}
// Udpate LiveIntervals.
- if (LIS) {
- if (MBBI != MBB->begin())
- --MBBI;
+ if (LIS)
LIS->repairIntervalsInRange(MBB, MBBI, EndMBBI, OrigRegs);
- }
}