[llvm-commits] [llvm] r110686 - in /llvm/trunk: include/llvm/CodeGen/CalcSpillWeights.h lib/CodeGen/SplitKit.cpp lib/CodeGen/SplitKit.h
Jakob Stoklund Olesen
stoklund at 2pi.dk
Tue Aug 10 10:07:22 PDT 2010
Author: stoklund
Date: Tue Aug 10 12:07:22 2010
New Revision: 110686
URL: http://llvm.org/viewvc/llvm-project?rev=110686&view=rev
Log:
Recalculate the spill weight and allocation hint for virtual registers created
during live range splitting.
Modified:
llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h
llvm/trunk/lib/CodeGen/SplitKit.cpp
llvm/trunk/lib/CodeGen/SplitKit.h
Modified: llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h?rev=110686&r1=110685&r2=110686&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h (original)
+++ llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h Tue Aug 10 12:07:22 2010
@@ -25,11 +25,11 @@
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.
Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=110686&r1=110685&r2=110686&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SplitKit.cpp (original)
+++ llvm/trunk/lib/CodeGen/SplitKit.cpp Tue Aug 10 12:07:22 2010
@@ -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 @@
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);
+ }
}
Modified: llvm/trunk/lib/CodeGen/SplitKit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=110686&r1=110685&r2=110686&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SplitKit.h (original)
+++ llvm/trunk/lib/CodeGen/SplitKit.h Tue Aug 10 12:07:22 2010
@@ -31,11 +31,13 @@
/// 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_;
More information about the llvm-commits
mailing list