aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorArnaud A. de Grandmaison <arnaud.adegm@gmail.com>2013-11-08 18:19:19 +0000
committerArnaud A. de Grandmaison <arnaud.adegm@gmail.com>2013-11-08 18:19:19 +0000
commitd241fa7a61682a15b753c52afee07dfbf1b3bd1f (patch)
tree3a02ba592c3ced07b33ea470e3ef5f236f691ce4 /include
parentf0c6ab6f00861fd97ad593cfc6d841082e4b4bd1 (diff)
downloadexternal_llvm-d241fa7a61682a15b753c52afee07dfbf1b3bd1f.zip
external_llvm-d241fa7a61682a15b753c52afee07dfbf1b3bd1f.tar.gz
external_llvm-d241fa7a61682a15b753c52afee07dfbf1b3bd1f.tar.bz2
Revert "CalculateSpillWeights does not need to be a pass"
Temporarily revert my previous commit until I understand why it breaks 3 target tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194272 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/CalcSpillWeights.h33
-rw-r--r--include/llvm/InitializePasses.h1
2 files changed, 23 insertions, 11 deletions
diff --git a/include/llvm/CodeGen/CalcSpillWeights.h b/include/llvm/CodeGen/CalcSpillWeights.h
index 00d9c6a..c8ec764 100644
--- a/include/llvm/CodeGen/CalcSpillWeights.h
+++ b/include/llvm/CodeGen/CalcSpillWeights.h
@@ -21,9 +21,7 @@ namespace llvm {
class MachineBlockFrequencyInfo;
class MachineLoopInfo;
- /// \brief Normalize the spill weight of a live interval
- ///
- /// The spill weight of a live interval is computed as:
+ /// normalizeSpillWeight - The spill weight of a live interval is computed as:
///
/// (sum(use freq) + sum(def freq)) / (K + size)
///
@@ -40,8 +38,8 @@ namespace llvm {
return UseDefFreq / (Size + 25*SlotIndex::InstrDist);
}
- /// \brief Calculate auxiliary information for a virtual register such as its
- /// spill weight and allocation hint.
+ /// VirtRegAuxInfo - Calculate auxiliary information for a virtual
+ /// register such as its spill weight and allocation hint.
class VirtRegAuxInfo {
MachineFunction &MF;
LiveIntervals &LIS;
@@ -54,16 +52,29 @@ namespace llvm {
const MachineBlockFrequencyInfo &mbfi)
: MF(mf), LIS(lis), Loops(loops), MBFI(mbfi) {}
- /// \brief (re)compute li's spill weight and allocation hint.
+ /// CalculateWeightAndHint - (re)compute li's spill weight and allocation
+ /// hint.
void CalculateWeightAndHint(LiveInterval &li);
};
- /// \brief Compute spill weights and allocation hints for all virtual register
+ /// CalculateSpillWeights - Compute spill weights for all virtual register
/// live intervals.
- void calculateSpillWeights(LiveIntervals &LIS,
- MachineFunction &MF,
- const MachineLoopInfo &MLI,
- const MachineBlockFrequencyInfo &MBFI);
+ class CalculateSpillWeights : public MachineFunctionPass {
+ public:
+ static char ID;
+
+ CalculateSpillWeights() : MachineFunctionPass(ID) {
+ initializeCalculateSpillWeightsPass(*PassRegistry::getPassRegistry());
+ }
+
+ virtual void getAnalysisUsage(AnalysisUsage &au) const;
+
+ virtual bool runOnMachineFunction(MachineFunction &fn);
+
+ private:
+ /// Returns true if the given live interval is zero length.
+ bool isZeroLengthInterval(LiveInterval *li) const;
+ };
}
diff --git a/include/llvm/InitializePasses.h b/include/llvm/InitializePasses.h
index 68825a3..fe26c23 100644
--- a/include/llvm/InitializePasses.h
+++ b/include/llvm/InitializePasses.h
@@ -89,6 +89,7 @@ void initializeCFGSimplifyPassPass(PassRegistry&);
void initializeFlattenCFGPassPass(PassRegistry&);
void initializeStructurizeCFGPass(PassRegistry&);
void initializeCFGViewerPass(PassRegistry&);
+void initializeCalculateSpillWeightsPass(PassRegistry&);
void initializeCodeGenPreparePass(PassRegistry&);
void initializeConstantMergePass(PassRegistry&);
void initializeConstantPropagationPass(PassRegistry&);