diff options
Diffstat (limited to 'include/llvm/Analysis/LoopInfo.h')
-rw-r--r-- | include/llvm/Analysis/LoopInfo.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 2294e53..060286f 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -93,12 +93,28 @@ public: BlockT *getHeader() const { return Blocks.front(); } LoopT *getParentLoop() const { return ParentLoop; } - /// contains - Return true if the specified basic block is in this loop + /// contains - Return true if the specified loop is contained within in + /// this loop. + /// + bool contains(const LoopT *L) const { + if (L == this) return true; + if (L == 0) return false; + return contains(L->getParentLoop()); + } + + /// contains - Return true if the specified basic block is in this loop. /// bool contains(const BlockT *BB) const { return std::find(block_begin(), block_end(), BB) != block_end(); } + /// contains - Return true if the specified instruction is in this loop. + /// + template<class InstT> + bool contains(const InstT *Inst) const { + return contains(Inst->getParent()); + } + /// iterator/begin/end - Return the loops contained entirely within this loop. /// const std::vector<LoopT *> &getSubLoops() const { return SubLoops; } @@ -463,10 +479,6 @@ public: (*I)->print(OS, Depth+2); } - void dump() const { - print(errs()); - } - protected: friend class LoopInfoBase<BlockT, LoopT>; explicit LoopBase(BlockT *BB) : ParentLoop(0) { |