llvm.org GIT mirror llvm / 96fa396
Add GraphTraits specializations for machine dominators. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45333 91177308-0d34-0410-b5e6-96231b3b80d8 Owen Anderson 12 years ago
1 changed file(s) with 27 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
2020 #include "llvm/CodeGen/MachineInstr.h"
2121 #include "llvm/Analysis/Dominators.h"
2222 #include "llvm/Analysis/DominatorInternals.h"
23 #include "llvm/ADT/GraphTraits.h"
2324
2425 namespace llvm {
2526
181182 }
182183 };
183184
185 //===-------------------------------------
186 /// DominatorTree GraphTraits specialization so the DominatorTree can be
187 /// iterable by generic graph iterators.
188 ///
189 template <> struct GraphTraits {
190 typedef MachineDomTreeNode NodeType;
191 typedef NodeType::iterator ChildIteratorType;
192
193 static NodeType *getEntryNode(NodeType *N) {
194 return N;
195 }
196 static inline ChildIteratorType child_begin(NodeType* N) {
197 return N->begin();
198 }
199 static inline ChildIteratorType child_end(NodeType* N) {
200 return N->end();
201 }
202 };
203
204 template <> struct GraphTraits
205 : public GraphTraits {
206 static NodeType *getEntryNode(MachineDominatorTree *DT) {
207 return DT->getRootNode();
208 }
209 };
210
184211 }
185212
186213 #endif