llvm.org GIT mirror llvm / f77b570
Expose API to graph library to allow iteration over all nodes, even unreachable ones git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4111 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 17 years ago
1 changed file(s) with 10 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
99
1010 #include "Support/GraphTraits.h"
1111 #include "llvm/Function.h"
12 #include "llvm/BasicBlock.h"
1312 #include "llvm/InstrTypes.h"
1413 #include "Support/iterator"
1514
219218 //
220219 template <> struct GraphTraits : public GraphTraits {
221220 static NodeType *getEntryNode(Function *F) { return &F->getEntryNode(); }
221
222 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
223 typedef Function::iterator nodes_iterator;
224 static nodes_iterator nodes_begin(Function *F) { return F->begin(); }
225 static nodes_iterator nodes_end (Function *F) { return F->end(); }
222226 };
223227 template <> struct GraphTraits :
224228 public GraphTraits {
225229 static NodeType *getEntryNode(const Function *F) { return &F->getEntryNode();}
230
231 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
232 typedef Function::const_iterator nodes_iterator;
233 static nodes_iterator nodes_begin(const Function *F) { return F->begin(); }
234 static nodes_iterator nodes_end (const Function *F) { return F->end(); }
226235 };
227236
228237