20 template <
class NodeTy,
bool IsPostDom>
27 typedef std::pair<DomTreeNode *, std::pair<unsigned, unsigned>>
29 typedef std::priority_queue<DomTreeNodePair, SmallVector<DomTreeNodePair, 32>,
33 DT.updateDFSNumbers();
37 PQ.push({Node, std::make_pair(Node->getLevel(), Node->getDFSNumIn())});
45 DomTreeNodePair RootPair = PQ.top();
48 unsigned RootLevel = RootPair.second.first;
57 VisitedWorklist.
insert(Root);
59 while (!Worklist.
empty()) {
64 for (
auto *Succ : children<NodeTy>(BB)) {
69 if (SuccNode->
getIDom() == Node)
72 const unsigned SuccLevel = SuccNode->
getLevel();
73 if (SuccLevel > RootLevel)
76 if (!VisitedPQ.
insert(SuccNode).second)
80 if (useLiveIn && !LiveInBlocks->count(SuccBB))
84 if (!DefBlocks->count(SuccBB))
85 PQ.push(std::make_pair(
86 SuccNode, std::make_pair(SuccLevel, SuccNode->
getDFSNumIn())));
89 for (
auto DomChild : *Node) {
90 if (VisitedWorklist.
insert(DomChild).second)
void push_back(const T &Elt)
Compute iterated dominance frontiers using a linear time algorithm.
Function object to check whether the second component of a std::pair compares less than the second co...
unsigned getDFSNumIn() const
getDFSNumIn/getDFSNumOut - These return the DFS visitation order for nodes in the dominator tree...
LLVM Basic Block Representation.
DomTreeNodeBase * getIDom() const
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
void calculate(SmallVectorImpl< BasicBlock *> &IDFBlocks)
Calculate iterated dominance frontiers.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
LLVM_NODISCARD T pop_back_val()
void emplace_back(ArgTypes &&... Args)
LLVM_NODISCARD bool empty() const
Determine the iterated dominance frontier, given a set of defining blocks, and optionally, a set of live-in blocks.
unsigned getLevel() const