aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-08-10 17:07:22 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-08-10 17:07:22 +0000
commit08e93b14c37277ab40b835de340f89ba357d3332 (patch)
tree438fa9e4f4541291daa751832e65c002a96e27ac
parentdc0830947a0787006cd4dc858ad163c39ecefc90 (diff)
Recalculate the spill weight and allocation hint for virtual registers created
during live range splitting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110686 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/CodeGen/CalcSpillWeights.h4
-rw-r--r--lib/CodeGen/SplitKit.cpp9
-rw-r--r--lib/CodeGen/SplitKit.h2
3 files changed, 11 insertions, 4 deletions
diff --git a/include/llvm/CodeGen/CalcSpillWeights.h b/include/llvm/CodeGen/CalcSpillWeights.h
index 99703a1c10..a47d847739 100644
--- a/include/llvm/CodeGen/CalcSpillWeights.h
+++ b/include/llvm/CodeGen/CalcSpillWeights.h
@@ -25,11 +25,11 @@ namespace llvm {
class VirtRegAuxInfo {
MachineFunction &mf_;
LiveIntervals &lis_;
- MachineLoopInfo &loops_;
+ const MachineLoopInfo &loops_;
DenseMap<unsigned, float> hint_;
public:
VirtRegAuxInfo(MachineFunction &mf, LiveIntervals &lis,
- MachineLoopInfo &loops) :
+ const MachineLoopInfo &loops) :
mf_(mf), lis_(lis), loops_(loops) {}
/// CalculateRegClass - recompute the register class for li from its uses.
diff --git a/lib/CodeGen/SplitKit.cpp b/lib/CodeGen/SplitKit.cpp
index e6a7b70c7d..b7af73f627 100644
--- a/lib/CodeGen/SplitKit.cpp
+++ b/lib/CodeGen/SplitKit.cpp
@@ -15,6 +15,7 @@
#define DEBUG_TYPE "splitter"
#include "SplitKit.h"
#include "VirtRegMap.h"
+#include "llvm/CodeGen/CalcSpillWeights.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
@@ -566,8 +567,12 @@ void SplitEditor::rewrite() {
intervals_.push_back(dupli_);
}
- // FIXME: *Calculate spill weights, allocation hints, and register classes for
- // firstInterval..
+ // Calculate spill weight and allocation hints for new intervals.
+ VirtRegAuxInfo vrai(vrm_.getMachineFunction(), lis_, sa_.loops_);
+ for (unsigned i = firstInterval, e = intervals_.size(); i != e; ++i) {
+ LiveInterval &li = *intervals_[i];
+ vrai.CalculateWeightAndHint(li);
+ }
}
diff --git a/lib/CodeGen/SplitKit.h b/lib/CodeGen/SplitKit.h
index d5136877de..d125a45343 100644
--- a/lib/CodeGen/SplitKit.h
+++ b/lib/CodeGen/SplitKit.h
@@ -31,11 +31,13 @@ class VNInfo;
/// SplitAnalysis - Analyze a LiveInterval, looking for live range splitting
/// opportunities.
class SplitAnalysis {
+public:
const MachineFunction &mf_;
const LiveIntervals &lis_;
const MachineLoopInfo &loops_;
const TargetInstrInfo &tii_;
+private:
// Current live interval.
const LiveInterval *curli_;