20 template <
class NodeTy,
bool IsPostDom>
25 typedef std::pair<DomTreeNode *, unsigned> DomTreeNodePair;
26 typedef std::priority_queue<DomTreeNodePair, SmallVector<DomTreeNodePair, 32>,
32 PQ.push({Node, Node->getLevel()});
40 DomTreeNodePair RootPair = PQ.top();
43 unsigned RootLevel = RootPair.second;
51 Worklist.push_back(Root);
52 VisitedWorklist.insert(Root);
54 while (!Worklist.empty()) {
59 for (
auto *Succ : children<NodeTy>(BB)) {
64 if (SuccNode->
getIDom() == Node)
67 const unsigned SuccLevel = SuccNode->
getLevel();
68 if (SuccLevel > RootLevel)
71 if (!VisitedPQ.insert(SuccNode).second)
75 if (useLiveIn && !LiveInBlocks->count(SuccBB))
78 PHIBlocks.emplace_back(SuccBB);
79 if (!DefBlocks->count(SuccBB))
80 PQ.push(std::make_pair(SuccNode, SuccLevel));
83 for (
auto DomChild : *Node) {
84 if (VisitedWorklist.insert(DomChild).second)
85 Worklist.push_back(DomChild);
91 template class IDFCalculator<BasicBlock *, false>;
92 template class IDFCalculator<Inverse<BasicBlock *>,
true>;
Function object to check whether the second component of a std::pair compares less than the second co...
unsigned getLevel() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void calculate(SmallVectorImpl< BasicBlock * > &IDFBlocks)
Calculate iterated dominance frontiers.
DomTreeNodeBase * getIDom() const
Base class for the actual dominator tree node.
LLVM Basic Block Representation.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...