diff options
author | Arnaud A. de Grandmaison <arnaud.adegm@gmail.com> | 2013-11-11 19:56:14 +0000 |
---|---|---|
committer | Arnaud A. de Grandmaison <arnaud.adegm@gmail.com> | 2013-11-11 19:56:14 +0000 |
commit | d736763847cee94c40a7f4d106cad91445834b7c (patch) | |
tree | 38052fe71edc3b4051fe1ccb5df147d565c5de03 /include/llvm/CodeGen | |
parent | ef572e31e210a03c0669e3ed2ed7cf2d789f8599 (diff) | |
download | external_llvm-d736763847cee94c40a7f4d106cad91445834b7c.zip external_llvm-d736763847cee94c40a7f4d106cad91445834b7c.tar.gz external_llvm-d736763847cee94c40a7f4d106cad91445834b7c.tar.bz2 |
CalcSpillWeights: allow overidding the spill weight normalizing function
This will enable the PBQP register allocator to provide its own normalizing function.
No functionnal change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194417 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r-- | include/llvm/CodeGen/CalcSpillWeights.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/include/llvm/CodeGen/CalcSpillWeights.h b/include/llvm/CodeGen/CalcSpillWeights.h index 60be611..0d79b1d 100644 --- a/include/llvm/CodeGen/CalcSpillWeights.h +++ b/include/llvm/CodeGen/CalcSpillWeights.h @@ -43,16 +43,23 @@ namespace llvm { /// \brief Calculate auxiliary information for a virtual register such as its /// spill weight and allocation hint. class VirtRegAuxInfo { + public: + typedef float (*NormalizingFn)(float, unsigned); + + private: MachineFunction &MF; LiveIntervals &LIS; const MachineLoopInfo &Loops; const MachineBlockFrequencyInfo &MBFI; DenseMap<unsigned, float> Hint; + NormalizingFn normalize; + public: VirtRegAuxInfo(MachineFunction &mf, LiveIntervals &lis, const MachineLoopInfo &loops, - const MachineBlockFrequencyInfo &mbfi) - : MF(mf), LIS(lis), Loops(loops), MBFI(mbfi) {} + const MachineBlockFrequencyInfo &mbfi, + NormalizingFn norm = normalizeSpillWeight) + : MF(mf), LIS(lis), Loops(loops), MBFI(mbfi), normalize(norm) {} /// \brief (re)compute li's spill weight and allocation hint. void calculateSpillWeightAndHint(LiveInterval &li); @@ -62,7 +69,9 @@ namespace llvm { /// live intervals. void calculateSpillWeightsAndHints(LiveIntervals &LIS, MachineFunction &MF, const MachineLoopInfo &MLI, - const MachineBlockFrequencyInfo &MBFI); + const MachineBlockFrequencyInfo &MBFI, + VirtRegAuxInfo::NormalizingFn norm = + normalizeSpillWeight); } #endif // LLVM_CODEGEN_CALCSPILLWEIGHTS_H |