mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[block-freq] Add a method to loop info for returning all loop latches for a specific loop.
We already have a method for returning one loop latch but for some reason no one has committed one for returning loop latches in the case where there are multiple latches. llvm-svn: 195410
This commit is contained in:
parent
a50f9e81f3
commit
0af557806f
@ -228,6 +228,18 @@ public:
|
|||||||
/// A latch block is a block that contains a branch back to the header.
|
/// A latch block is a block that contains a branch back to the header.
|
||||||
BlockT *getLoopLatch() const;
|
BlockT *getLoopLatch() const;
|
||||||
|
|
||||||
|
/// getLoopLatches - Return all loop latch blocks of this loop. A latch block
|
||||||
|
/// is a block that contains a branch back to the header.
|
||||||
|
void getLoopLatches(SmallVectorImpl<BlockT *> &LoopLatches) const {
|
||||||
|
BlockT *H = getHeader();
|
||||||
|
typedef GraphTraits<Inverse<BlockT*> > InvBlockTraits;
|
||||||
|
for (typename InvBlockTraits::ChildIteratorType I =
|
||||||
|
InvBlockTraits::child_begin(H),
|
||||||
|
E = InvBlockTraits::child_end(H); I != E; ++I)
|
||||||
|
if (contains(*I))
|
||||||
|
LoopLatches.push_back(*I);
|
||||||
|
}
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
// APIs for updating loop information after changing the CFG
|
// APIs for updating loop information after changing the CFG
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user