diff options
author | Lang Hames <lhames@gmail.com> | 2010-07-17 07:34:01 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2010-07-17 07:34:01 +0000 |
commit | 60f422f894ae9aff2f508f34733be36f5a0ed20a (patch) | |
tree | e30db27e10d3cd897b0048dcf819a014b310a095 /include/llvm | |
parent | 7e3012c34509a5c1e7c891bcadb5caaed462deb1 (diff) | |
download | external_llvm-60f422f894ae9aff2f508f34733be36f5a0ed20a.zip external_llvm-60f422f894ae9aff2f508f34733be36f5a0ed20a.tar.gz external_llvm-60f422f894ae9aff2f508f34733be36f5a0ed20a.tar.bz2 |
LoopSplitter - intended to split live intervals over loop boundaries.
Still very much under development. Comments and fixes will be forthcoming.
(This commit includes some small tweaks to LiveIntervals & LoopInfo to support the splitter)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108615 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Analysis/LoopInfo.h | 9 | ||||
-rw-r--r-- | include/llvm/CodeGen/LiveIntervalAnalysis.h | 24 |
2 files changed, 30 insertions, 3 deletions
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 9455fd8..2d93909 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -229,9 +229,12 @@ public: return 0; } + /// Edge type. + typedef std::pair<BlockT*, BlockT*> Edge; + /// getExitEdges - Return all pairs of (_inside_block_,_outside_block_). - typedef std::pair<const BlockT*,const BlockT*> Edge; - void getExitEdges(SmallVectorImpl<Edge> &ExitEdges) const { + template <typename EdgeT> + void getExitEdges(SmallVectorImpl<EdgeT> &ExitEdges) const { // Sort the blocks vector so that we can use binary search to do quick // lookups. SmallVector<BlockT*, 128> LoopBBs(block_begin(), block_end()); @@ -244,7 +247,7 @@ public: I != E; ++I) if (!std::binary_search(LoopBBs.begin(), LoopBBs.end(), *I)) // Not in current loop? It must be an exit block. - ExitEdges.push_back(std::make_pair(*BI, *I)); + ExitEdges.push_back(EdgeT(*BI, *I)); } /// getLoopPreheader - If there is a preheader for this loop, return it. A diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h index c136048..8a59bf1 100644 --- a/include/llvm/CodeGen/LiveIntervalAnalysis.h +++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h @@ -197,6 +197,26 @@ namespace llvm { return indexes_->getMBBEndIdx(mbb); } + bool isLiveInToMBB(const LiveInterval &li, + const MachineBasicBlock *mbb) const { + return li.liveAt(getMBBStartIdx(mbb)); + } + + LiveRange* findEnteringRange(LiveInterval &li, + const MachineBasicBlock *mbb) { + return li.getLiveRangeContaining(getMBBStartIdx(mbb)); + } + + bool isLiveOutOfMBB(const LiveInterval &li, + const MachineBasicBlock *mbb) const { + return li.liveAt(getMBBEndIdx(mbb).getPrevSlot()); + } + + LiveRange* findExitingRange(LiveInterval &li, + const MachineBasicBlock *mbb) { + return li.getLiveRangeContaining(getMBBEndIdx(mbb).getPrevSlot()); + } + MachineBasicBlock* getMBBFromIndex(SlotIndex index) const { return indexes_->getMBBFromIndex(index); } @@ -217,6 +237,10 @@ namespace llvm { indexes_->replaceMachineInstrInMaps(MI, NewMI); } + void InsertMBBInMaps(MachineBasicBlock *MBB) { + indexes_->insertMBBInMaps(MBB); + } + bool findLiveInMBBs(SlotIndex Start, SlotIndex End, SmallVectorImpl<MachineBasicBlock*> &MBBs) const { return indexes_->findLiveInMBBs(Start, End, MBBs); |