diff options
Diffstat (limited to 'llvm/lib/CodeGen/SplitKit.h')
-rw-r--r-- | llvm/lib/CodeGen/SplitKit.h | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/SplitKit.h b/llvm/lib/CodeGen/SplitKit.h index af97e4f8a9c..749019baeab 100644 --- a/llvm/lib/CodeGen/SplitKit.h +++ b/llvm/lib/CodeGen/SplitKit.h @@ -44,34 +44,32 @@ class LLVM_LIBRARY_VISIBILITY InsertPointAnalysis { private: const LiveIntervals &LIS; - /// Current LiveInterval for which to insert split or spill. - const LiveInterval *CurLI; - /// Last legal insert point in each basic block in the current function. /// The first entry is the first terminator, the second entry is the /// last valid point to insert a split or spill for a variable that is /// live into a landing pad successor. SmallVector<std::pair<SlotIndex, SlotIndex>, 8> LastInsertPoint; - SlotIndex computeLastInsertPoint(const MachineBasicBlock &MBB); + SlotIndex computeLastInsertPoint(const LiveInterval &CurLI, + const MachineBasicBlock &MBB); public: InsertPointAnalysis(const LiveIntervals &lis, unsigned BBNum); - void setInterval(const LiveInterval *LI) { CurLI = LI; } - - /// Return the base index of the last valid insert point in \pMBB. - SlotIndex getLastInsertPoint(const MachineBasicBlock &MBB) { + /// Return the base index of the last valid insert point for \pCurLI in \pMBB. + SlotIndex getLastInsertPoint(const LiveInterval &CurLI, + const MachineBasicBlock &MBB) { unsigned Num = MBB.getNumber(); // Inline the common simple case. if (LastInsertPoint[Num].first.isValid() && !LastInsertPoint[Num].second.isValid()) return LastInsertPoint[Num].first; - return computeLastInsertPoint(MBB); + return computeLastInsertPoint(CurLI, MBB); } - /// Returns the last insert point as an iterator. - MachineBasicBlock::iterator getLastInsertPointIter(MachineBasicBlock &); + /// Returns the last insert point as an iterator for \pCurLI in \pMBB. + MachineBasicBlock::iterator getLastInsertPointIter(const LiveInterval &CurLI, + MachineBasicBlock &MBB); }; /// SplitAnalysis - Analyze a LiveInterval, looking for live range splitting @@ -215,11 +213,11 @@ public: bool shouldSplitSingleBlock(const BlockInfo &BI, bool SingleInstrs) const; SlotIndex getLastSplitPoint(unsigned Num) { - return IPA.getLastInsertPoint(*MF.getBlockNumbered(Num)); + return IPA.getLastInsertPoint(*CurLI, *MF.getBlockNumbered(Num)); } MachineBasicBlock::iterator getLastSplitPointIter(MachineBasicBlock *BB) { - return IPA.getLastInsertPointIter(*BB); + return IPA.getLastInsertPointIter(*CurLI, *BB); } }; |