summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-10-05 22:19:33 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-10-05 22:19:33 +0000
commit57d0f2deb0afefe69770a28937a4363e7b1f9753 (patch)
tree9dd691b0e7d9524889d981e0db0778189eacf15c
parentdbc36091ff7be76d22105b67db73e18224bebb2f (diff)
downloadllvm-57d0f2deb0afefe69770a28937a4363e7b1f9753.tar.gz
llvm-57d0f2deb0afefe69770a28937a4363e7b1f9753.tar.bz2
llvm-57d0f2deb0afefe69770a28937a4363e7b1f9753.tar.xz
Update SplitEditor API to reflect the fact that the original live interval is
never kept after splitting. Keeping the original interval made sense when the split region doesn't modify the register, and the original is spilled. We can get the same effect by detecting reloaded values when spilling around copies. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115695 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/InlineSpiller.cpp22
-rw-r--r--lib/CodeGen/SplitKit.cpp22
-rw-r--r--lib/CodeGen/SplitKit.h22
3 files changed, 27 insertions, 39 deletions
diff --git a/lib/CodeGen/InlineSpiller.cpp b/lib/CodeGen/InlineSpiller.cpp
index a79f7a892b..5fdc59ad66 100644
--- a/lib/CodeGen/InlineSpiller.cpp
+++ b/lib/CodeGen/InlineSpiller.cpp
@@ -107,30 +107,28 @@ Spiller *createInlineSpiller(MachineFunctionPass &pass,
bool InlineSpiller::split() {
splitAnalysis_.analyze(li_);
+ // Try splitting around loops.
if (const MachineLoop *loop = splitAnalysis_.getBestSplitLoop()) {
- // We can split, but li_ may be left intact with fewer uses.
- if (SplitEditor(splitAnalysis_, lis_, vrm_, *newIntervals_)
- .splitAroundLoop(loop))
- return true;
+ SplitEditor(splitAnalysis_, lis_, vrm_, *newIntervals_)
+ .splitAroundLoop(loop);
+ return true;
}
// Try splitting into single block intervals.
SplitAnalysis::BlockPtrSet blocks;
if (splitAnalysis_.getMultiUseBlocks(blocks)) {
- if (SplitEditor(splitAnalysis_, lis_, vrm_, *newIntervals_)
- .splitSingleBlocks(blocks))
- return true;
+ SplitEditor(splitAnalysis_, lis_, vrm_, *newIntervals_)
+ .splitSingleBlocks(blocks);
+ return true;
}
// Try splitting inside a basic block.
if (const MachineBasicBlock *MBB = splitAnalysis_.getBlockForInsideSplit()) {
- if (SplitEditor(splitAnalysis_, lis_, vrm_, *newIntervals_)
- .splitInsideBlock(MBB))
- return true;
+ SplitEditor(splitAnalysis_, lis_, vrm_, *newIntervals_)
+ .splitInsideBlock(MBB);
+ return true;
}
- // We may have been able to split out some uses, but the original interval is
- // intact, and it should still be spilled.
return false;
}
diff --git a/lib/CodeGen/SplitKit.cpp b/lib/CodeGen/SplitKit.cpp
index bd164a30d9..bb372403a6 100644
--- a/lib/CodeGen/SplitKit.cpp
+++ b/lib/CodeGen/SplitKit.cpp
@@ -802,7 +802,7 @@ SplitEditor::addTruncSimpleRange(SlotIndex Start, SlotIndex End, VNInfo *VNI) {
/// rewrite - after all the new live ranges have been created, rewrite
/// instructions using curli to use the new intervals.
-bool SplitEditor::rewrite() {
+void SplitEditor::rewrite() {
assert(!openli_.getLI() && "Previous LI not closed before rewrite");
// First we need to fill in the live ranges in dupli.
@@ -897,7 +897,6 @@ bool SplitEditor::rewrite() {
DEBUG(dbgs() << " new interval " << mri_.getRegClass(li.reg)->getName()
<< ":" << li << '\n');
}
- return dupli_.getLI();
}
@@ -905,7 +904,7 @@ bool SplitEditor::rewrite() {
// Loop Splitting
//===----------------------------------------------------------------------===//
-bool SplitEditor::splitAroundLoop(const MachineLoop *Loop) {
+void SplitEditor::splitAroundLoop(const MachineLoop *Loop) {
SplitAnalysis::LoopBlocks Blocks;
sa_.getLoopBlocks(Loop, Blocks);
@@ -938,7 +937,7 @@ bool SplitEditor::splitAroundLoop(const MachineLoop *Loop) {
// Done.
closeIntv();
- return rewrite();
+ rewrite();
}
@@ -947,9 +946,8 @@ bool SplitEditor::splitAroundLoop(const MachineLoop *Loop) {
//===----------------------------------------------------------------------===//
/// splitSingleBlocks - Split curli into a separate live interval inside each
-/// basic block in Blocks. Return true if curli has been completely replaced,
-/// false if curli is still intact, and needs to be spilled or split further.
-bool SplitEditor::splitSingleBlocks(const SplitAnalysis::BlockPtrSet &Blocks) {
+/// basic block in Blocks.
+void SplitEditor::splitSingleBlocks(const SplitAnalysis::BlockPtrSet &Blocks) {
DEBUG(dbgs() << " splitSingleBlocks for " << Blocks.size() << " blocks.\n");
// Determine the first and last instruction using curli in each block.
typedef std::pair<SlotIndex,SlotIndex> IndexPair;
@@ -983,7 +981,7 @@ bool SplitEditor::splitSingleBlocks(const SplitAnalysis::BlockPtrSet &Blocks) {
leaveIntvAfter(IP.second);
closeIntv();
}
- return rewrite();
+ rewrite();
}
@@ -1006,10 +1004,8 @@ const MachineBasicBlock *SplitAnalysis::getBlockForInsideSplit() {
return usingBlocks_.begin()->first;
}
-/// splitInsideBlock - Split curli into multiple intervals inside MBB. Return
-/// true if curli has been completely replaced, false if curli is still
-/// intact, and needs to be spilled or split further.
-bool SplitEditor::splitInsideBlock(const MachineBasicBlock *MBB) {
+/// splitInsideBlock - Split curli into multiple intervals inside MBB.
+void SplitEditor::splitInsideBlock(const MachineBasicBlock *MBB) {
SmallVector<SlotIndex, 32> Uses;
Uses.reserve(sa_.usingInstrs_.size());
for (SplitAnalysis::InstrPtrSet::const_iterator I = sa_.usingInstrs_.begin(),
@@ -1058,5 +1054,5 @@ bool SplitEditor::splitInsideBlock(const MachineBasicBlock *MBB) {
closeIntv();
}
- return rewrite();
+ rewrite();
}
diff --git a/lib/CodeGen/SplitKit.h b/lib/CodeGen/SplitKit.h
index ebc783d79b..a3488f75f0 100644
--- a/lib/CodeGen/SplitKit.h
+++ b/lib/CodeGen/SplitKit.h
@@ -312,26 +312,20 @@ public:
/// rewrite - after all the new live ranges have been created, rewrite
/// instructions using curli to use the new intervals.
- /// Return true if curli has been completely replaced, false if curli is still
- /// intact, and needs to be spilled or split further.
- bool rewrite();
+ void rewrite();
// ===--- High level methods ---===
/// splitAroundLoop - Split curli into a separate live interval inside
- /// the loop. Return true if curli has been completely replaced, false if
- /// curli is still intact, and needs to be spilled or split further.
- bool splitAroundLoop(const MachineLoop*);
+ /// the loop.
+ void splitAroundLoop(const MachineLoop*);
/// splitSingleBlocks - Split curli into a separate live interval inside each
- /// basic block in Blocks. Return true if curli has been completely replaced,
- /// false if curli is still intact, and needs to be spilled or split further.
- bool splitSingleBlocks(const SplitAnalysis::BlockPtrSet &Blocks);
-
- /// splitInsideBlock - Split curli into multiple intervals inside MBB. Return
- /// true if curli has been completely replaced, false if curli is still
- /// intact, and needs to be spilled or split further.
- bool splitInsideBlock(const MachineBasicBlock *);
+ /// basic block in Blocks.
+ void splitSingleBlocks(const SplitAnalysis::BlockPtrSet &Blocks);
+
+ /// splitInsideBlock - Split curli into multiple intervals inside MBB.
+ void splitInsideBlock(const MachineBasicBlock *);
};
}