aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/LoopIterator.h
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2011-08-10 22:55:39 +0000
committerAndrew Trick <atrick@apple.com>2011-08-10 22:55:39 +0000
commitd8a2f3ab91e90a1e1da2061410bb08b18650c9ee (patch)
treea98533b8c89a22c7ec83e3a660c5eb996867fb2f /include/llvm/Analysis/LoopIterator.h
parentde2f526c7cb2acd0447b59f3def40d35c8bc80f7 (diff)
Cleanup. Remove an extraneous GraphTraits specialization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137264 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/LoopIterator.h')
-rw-r--r--include/llvm/Analysis/LoopIterator.h24
1 files changed, 5 insertions, 19 deletions
diff --git a/include/llvm/Analysis/LoopIterator.h b/include/llvm/Analysis/LoopIterator.h
index a8221f48a3..269ac80740 100644
--- a/include/llvm/Analysis/LoopIterator.h
+++ b/include/llvm/Analysis/LoopIterator.h
@@ -109,27 +109,11 @@ public:
}
};
-/// Define a graph of blocks within a loop. Allows LoopBlocksTraversal to
-/// use the generic po_iterator with specialized GraphTraits.
-struct LoopBlocksGraph {
- Loop *L;
-
- LoopBlocksGraph(Loop *Container) : L(Container) {}
-};
-
-template<> struct GraphTraits<LoopBlocksGraph> :
- public GraphTraits<BasicBlock*> {
-
- static BasicBlock *getEntryNode(LoopBlocksGraph G) {
- return G.L->getHeader();
- }
-};
-
/// Traverse the blocks in a loop using a depth-first search.
class LoopBlocksTraversal {
public:
/// Graph traversal iterator.
- typedef po_iterator<LoopBlocksGraph, LoopBlocksTraversal, true> POTIterator;
+ typedef po_iterator<BasicBlock*, LoopBlocksTraversal, true> POTIterator;
private:
LoopBlocksDFS &DFS;
@@ -144,10 +128,12 @@ public:
/// finishPostorder to record the DFS result.
POTIterator begin() {
assert(DFS.PostBlocks.empty() && "Need clear DFS result before traversing");
- return po_ext_begin(LoopBlocksGraph(DFS.L), *this);
+ assert(DFS.L->getNumBlocks() && "po_iterator cannot handle an empty graph");
+ return po_ext_begin(DFS.L->getHeader(), *this);
}
POTIterator end() {
- return po_ext_end(LoopBlocksGraph(DFS.L), *this);
+ // po_ext_end interface requires a basic block, but ignores its value.
+ return po_ext_end(DFS.L->getHeader(), *this);
}
/// Called by po_iterator upon reaching a block via a CFG edge. If this block