diff options
Diffstat (limited to 'include/llvm/Analysis/RegionInfo.h')
-rw-r--r-- | include/llvm/Analysis/RegionInfo.h | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/include/llvm/Analysis/RegionInfo.h b/include/llvm/Analysis/RegionInfo.h index e873195..4d55408 100644 --- a/include/llvm/Analysis/RegionInfo.h +++ b/include/llvm/Analysis/RegionInfo.h @@ -28,6 +28,7 @@ #define LLVM_ANALYSIS_REGIONINFO_H #include "llvm/ADT/PointerIntPair.h" +#include "llvm/ADT/iterator_range.h" #include "llvm/Analysis/DominanceFrontier.h" #include "llvm/Analysis/PostDominators.h" #include "llvm/Support/Allocator.h" @@ -312,11 +313,11 @@ public: /// The toplevel region represents the whole function. bool isTopLevelRegion() const { return exit == NULL; } - /// @brief Return a new (non canonical) region, that is obtained by joining + /// @brief Return a new (non-canonical) region, that is obtained by joining /// this region with its predecessors. /// /// @return A region also starting at getEntry(), but reaching to the next - /// basic block that forms with getEntry() a (non canonical) region. + /// basic block that forms with getEntry() a (non-canonical) region. /// NULL if such a basic block does not exist. Region *getExpandedRegion() const; @@ -495,13 +496,11 @@ public: //@{ template <bool IsConst> class block_iterator_wrapper - : public df_iterator<typename conditional<IsConst, - const BasicBlock, - BasicBlock>::type*> { - typedef df_iterator<typename conditional<IsConst, - const BasicBlock, - BasicBlock>::type*> - super; + : public df_iterator<typename std::conditional<IsConst, const BasicBlock, + BasicBlock>::type *> { + typedef df_iterator<typename std::conditional<IsConst, const BasicBlock, + BasicBlock>::type *> super; + public: typedef block_iterator_wrapper<IsConst> Self; typedef typename super::pointer pointer; @@ -545,6 +544,21 @@ public: const_block_iterator block_end() const { return const_block_iterator(); } + + typedef iterator_range<block_iterator> block_range; + typedef iterator_range<const_block_iterator> const_block_range; + + /// @brief Returns a range view of the basic blocks in the region. + inline block_range blocks() { + return block_range(block_begin(), block_end()); + } + + /// @brief Returns a range view of the basic blocks in the region. + /// + /// This is the 'const' version of the range view. + inline const_block_range blocks() const { + return const_block_range(block_begin(), block_end()); + } //@} /// @name Element Iterators @@ -632,7 +646,7 @@ class RegionInfo : public FunctionPass { // Calculate - detecte all regions in function and build the region tree. void Calculate(Function& F); - void releaseMemory(); + void releaseMemory() override; // updateStatistics - Update statistic about created regions. void updateStatistics(Region *R); @@ -649,10 +663,10 @@ public: /// @name FunctionPass interface //@{ - virtual bool runOnFunction(Function &F); - virtual void getAnalysisUsage(AnalysisUsage &AU) const; - virtual void print(raw_ostream &OS, const Module *) const; - virtual void verifyAnalysis() const; + bool runOnFunction(Function &F) override; + void getAnalysisUsage(AnalysisUsage &AU) const override; + void print(raw_ostream &OS, const Module *) const override; + void verifyAnalysis() const override; //@} /// @brief Get the smallest region that contains a BasicBlock. |