Index: llvm/trunk/include/llvm/Support/GenericDomTree.h =================================================================== --- llvm/trunk/include/llvm/Support/GenericDomTree.h +++ llvm/trunk/include/llvm/Support/GenericDomTree.h @@ -637,6 +637,29 @@ friend void Calculate(DominatorTreeBase::NodeType> &DT, FuncT &F); + + DomTreeNodeBase *getNodeForBlock(NodeT *BB) { + if (DomTreeNodeBase *Node = getNode(BB)) + return Node; + + // Haven't calculated this node yet? Get or calculate the node for the + // immediate dominator. + NodeT *IDom = getIDom(BB); + + assert(IDom || this->DomTreeNodes[nullptr]); + DomTreeNodeBase *IDomNode = getNodeForBlock(IDom); + + // Add a new tree node for this NodeT, and link it as a child of + // IDomNode + return (this->DomTreeNodes[BB] = IDomNode->addChild( + llvm::make_unique>(BB, IDomNode))).get(); + } + + NodeT *getIDom(NodeT *BB) const { return IDoms.lookup(BB); } + + void addRoot(NodeT *BB) { this->Roots.push_back(BB); } + +public: /// updateDFSNumbers - Assign In and Out numbers to the nodes while walking /// dominator tree in dfs order. void updateDFSNumbers() const { @@ -682,28 +705,6 @@ DFSInfoValid = true; } - DomTreeNodeBase *getNodeForBlock(NodeT *BB) { - if (DomTreeNodeBase *Node = getNode(BB)) - return Node; - - // Haven't calculated this node yet? Get or calculate the node for the - // immediate dominator. - NodeT *IDom = getIDom(BB); - - assert(IDom || this->DomTreeNodes[nullptr]); - DomTreeNodeBase *IDomNode = getNodeForBlock(IDom); - - // Add a new tree node for this NodeT, and link it as a child of - // IDomNode - return (this->DomTreeNodes[BB] = IDomNode->addChild( - llvm::make_unique>(BB, IDomNode))).get(); - } - - NodeT *getIDom(NodeT *BB) const { return IDoms.lookup(BB); } - - void addRoot(NodeT *BB) { this->Roots.push_back(BB); } - -public: /// recalculate - compute a dominator tree for the given function template void recalculate(FT &F) { typedef GraphTraits TraitsTy;