diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-11-12 06:35:08 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-11-12 06:35:08 +0000 |
commit | 9b741600db1ab399d114224a54e6a4c2ce22aecb (patch) | |
tree | 197e4d100a9d1fe7658b502eb4e24c0d987877b3 /include/llvm/CodeGen/LiveIntervalAnalysis.h | |
parent | 43ce156cb86743b4f1906f1e95a78411d72cfc87 (diff) | |
download | external_llvm-9b741600db1ab399d114224a54e6a4c2ce22aecb.zip external_llvm-9b741600db1ab399d114224a54e6a4c2ce22aecb.tar.gz external_llvm-9b741600db1ab399d114224a54e6a4c2ce22aecb.tar.bz2 |
Refactor some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44010 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/LiveIntervalAnalysis.h')
-rw-r--r-- | include/llvm/CodeGen/LiveIntervalAnalysis.h | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h index dacec8e..35585e3 100644 --- a/include/llvm/CodeGen/LiveIntervalAnalysis.h +++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h @@ -32,6 +32,7 @@ namespace llvm { class LiveVariables; class MRegisterInfo; + class SSARegMap; class TargetInstrInfo; class TargetRegisterClass; class VirtRegMap; @@ -102,6 +103,10 @@ namespace llvm { return getBaseIndex(index) + InstrSlots::STORE; } + static float getSpillWeight(const MachineOperand &mop, unsigned loopDepth) { + return (mop.isUse()+mop.isDef()) * powf(10.0F, (float)loopDepth); + } + typedef Reg2IntervalMap::iterator iterator; typedef Reg2IntervalMap::const_iterator const_iterator; const_iterator begin() const { return r2iMap_.begin(); } @@ -182,9 +187,6 @@ namespace llvm { return I->second; } - std::vector<LiveInterval*> addIntervalsForSpills(const LiveInterval& i, - VirtRegMap& vrm, unsigned reg); - // Interval removal void removeInterval(unsigned Reg) { @@ -223,6 +225,11 @@ namespace llvm { if (O) print(*O, M); } + /// addIntervalsForSpills - Create new intervals for spilled defs / uses of + /// the given interval. + std::vector<LiveInterval*> + addIntervalsForSpills(const LiveInterval& i, VirtRegMap& vrm); + private: /// computeIntervals - Compute live intervals. void computeIntervals(); @@ -267,6 +274,23 @@ namespace llvm { MachineInstr *DefMI, unsigned index, unsigned i, bool isSS, int slot, unsigned reg); + /// rewriteInstructionForSpills, rewriteInstructionsForSpills - Helper functions + /// for addIntervalsForSpills to rewrite uses / defs for the given live range. + void rewriteInstructionForSpills(const LiveInterval &li, + unsigned id, unsigned index, unsigned end, MachineInstr *MI, + MachineInstr *OrigDefMI, MachineInstr *DefMI, unsigned Slot, int LdSlot, + bool isLoad, bool isLoadSS, bool DefIsReMat, bool CanDelete, + VirtRegMap &vrm, SSARegMap *RegMap, const TargetRegisterClass* rc, + SmallVector<int, 4> &ReMatIds, + std::vector<LiveInterval*> &NewLIs); + void rewriteInstructionsForSpills(const LiveInterval &li, + LiveInterval::Ranges::const_iterator &I, + MachineInstr *OrigDefMI, MachineInstr *DefMI, unsigned Slot, int LdSlot, + bool isLoad, bool isLoadSS, bool DefIsReMat, bool CanDelete, + VirtRegMap &vrm, SSARegMap *RegMap, const TargetRegisterClass* rc, + SmallVector<int, 4> &ReMatIds, + std::vector<LiveInterval*> &NewLIs); + static LiveInterval createInterval(unsigned Reg); void printRegName(unsigned reg) const; |