diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-02-14 23:15:38 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-02-14 23:15:38 +0000 |
| commit | 1dd377d8c8f5ba6e2c26221f372843d4e1663c4d (patch) | |
| tree | f5f9cc9a3353c17ee6f854651332ac4378fe12b5 /llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | |
| parent | 30583986553220a2fa299913a16c3b057e32ec80 (diff) | |
| download | llvm-1dd377d8c8f5ba6e2c26221f372843d4e1663c4d.zip llvm-1dd377d8c8f5ba6e2c26221f372843d4e1663c4d.tar.gz llvm-1dd377d8c8f5ba6e2c26221f372843d4e1663c4d.tar.bz2 | |
Move more fragments of spill weight calculation into CalcSpillWeights.h
Simplify the spill weight calculation a bit by bypassing
getApproximateInstructionCount() and using LiveInterval::getSize() directly.
This changes the computed spill weights, but only by a constant factor in each
function. It should not affect how spill weights compare against each other, and
so it shouldn't affect code generation.
llvm-svn: 125530
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalAnalysis.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp index e821024..aef5b5f 100644 --- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -20,6 +20,7 @@ #include "VirtRegMap.h" #include "llvm/Value.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/CodeGen/CalcSpillWeights.h" #include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstr.h" @@ -1706,10 +1707,10 @@ LiveIntervals::getSpillWeight(bool isDef, bool isUse, unsigned loopDepth) { return (isDef + isUse) * lc; } -void -LiveIntervals::normalizeSpillWeights(std::vector<LiveInterval*> &NewLIs) { +static void normalizeSpillWeights(std::vector<LiveInterval*> &NewLIs) { for (unsigned i = 0, e = NewLIs.size(); i != e; ++i) - normalizeSpillWeight(*NewLIs[i]); + NewLIs[i]->weight = + normalizeSpillWeight(NewLIs[i]->weight, NewLIs[i]->getSize()); } std::vector<LiveInterval*> LiveIntervals:: |
