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 | f2fbca68f868122d6df0bfc9952b4e4c3dfb60b7 (patch) | |
| tree | 197e4d100a9d1fe7658b502eb4e24c0d987877b3 /include | |
| parent | e6e1384c57e8c4ca99d881c35ebe6af01c177bcb (diff) | |
Refactor some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44010 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
| -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 dacec8ea96..35585e368c 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; |
