summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-07-22 22:46:49 +0000
committerOwen Anderson <resistor@mac.com>2008-07-22 22:46:49 +0000
commita1566f2e12ce87a5bca30bc0189a0cdbb40136a4 (patch)
treefecdd6cd2ded8963a4015584d9de5f7f4329a765 /lib/CodeGen/LiveIntervalAnalysis.cpp
parent38bcec13e89b33fd6b0553ec47667744c54fbb7b (diff)
downloadllvm-a1566f2e12ce87a5bca30bc0189a0cdbb40136a4.tar.gz
llvm-a1566f2e12ce87a5bca30bc0189a0cdbb40136a4.tar.bz2
llvm-a1566f2e12ce87a5bca30bc0189a0cdbb40136a4.tar.xz
Change the heuristics used in the coalescer, register allocator, and within
live intervals itself to use an instruction count approximation that is not affected by inserting empty indices. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53937 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index f57cd2b7d1..295a1615b6 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -87,6 +87,8 @@ void LiveIntervals::computeNumbering() {
mi2iMap_.clear();
i2miMap_.clear();
+ FunctionSize = 0;
+
// Number MachineInstrs and MachineBasicBlocks.
// Initialize MBB indexes to a sentinal.
MBB2IdxMap.resize(mf_->getNumBlockIDs(), std::make_pair(~0U,~0U));
@@ -102,6 +104,8 @@ void LiveIntervals::computeNumbering() {
assert(inserted && "multiple MachineInstr -> index mappings");
i2miMap_.push_back(I);
MIIndex += InstrSlots::NUM;
+
+ FunctionSize++;
}
if (StartIdx == MIIndex) {
@@ -1789,7 +1793,7 @@ addIntervalsForSpills(const LiveInterval &li,
for (unsigned i = 0, e = NewLIs.size(); i != e; ++i) {
LiveInterval *LI = NewLIs[i];
if (!LI->empty()) {
- LI->weight /= LI->getSize();
+ LI->weight /= getApproximateInstructionCount(*LI);
if (!AddedKill.count(LI)) {
LiveRange *LR = &LI->ranges[LI->ranges.size()-1];
unsigned LastUseIdx = getBaseIndex(LR->end);