X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FIR%2FDominators.h;h=f306b0fccc72705ba53643f708f7bceff804f5d3;hb=1be7ea773a8396a50a70dbd43fd18dec42c9ea05;hp=27d989b0344c323ac8f744a694aeb5c522d69fe8;hpb=0ed5091742d9e6603b30e7270a8eab0350e962dd;p=oota-llvm.git diff --git a/include/llvm/IR/Dominators.h b/include/llvm/IR/Dominators.h index 27d989b0344..f306b0fccc7 100644 --- a/include/llvm/IR/Dominators.h +++ b/include/llvm/IR/Dominators.h @@ -69,6 +69,9 @@ public: typedef DominatorTreeBase Base; DominatorTree() : DominatorTreeBase(false) {} + explicit DominatorTree(Function &F) : DominatorTreeBase(false) { + recalculate(F); + } DominatorTree(DominatorTree &&Arg) : Base(std::move(static_cast(Arg))) {} @@ -122,31 +125,35 @@ public: // DominatorTree GraphTraits specializations so the DominatorTree can be // iterable by generic graph iterators. -template <> struct GraphTraits { - typedef DomTreeNode NodeType; - typedef NodeType::iterator ChildIteratorType; +template struct DomTreeGraphTraitsBase { + typedef Node NodeType; + typedef ChildIterator ChildIteratorType; + typedef df_iterator> nodes_iterator; - static NodeType *getEntryNode(NodeType *N) { - return N; - } + static NodeType *getEntryNode(NodeType *N) { return N; } static inline ChildIteratorType child_begin(NodeType *N) { return N->begin(); } - static inline ChildIteratorType child_end(NodeType *N) { - return N->end(); - } + static inline ChildIteratorType child_end(NodeType *N) { return N->end(); } - typedef df_iterator nodes_iterator; - - static nodes_iterator nodes_begin(DomTreeNode *N) { + static nodes_iterator nodes_begin(NodeType *N) { return df_begin(getEntryNode(N)); } - static nodes_iterator nodes_end(DomTreeNode *N) { + static nodes_iterator nodes_end(NodeType *N) { return df_end(getEntryNode(N)); } }; +template <> +struct GraphTraits + : public DomTreeGraphTraitsBase {}; + +template <> +struct GraphTraits + : public DomTreeGraphTraitsBase {}; + template <> struct GraphTraits : public GraphTraits { static NodeType *getEntryNode(DominatorTree *DT) {