20 template <
class NodeTy>
24 if (DomLevels.empty()) {
25 for (
auto DFI =
df_begin(DT.getRootNode()), DFE =
df_end(DT.getRootNode());
27 DomLevels[*DFI] = DFI.getPathLength() - 1;
33 typedef std::pair<DomTreeNode *, unsigned> DomTreeNodePair;
34 typedef std::priority_queue<DomTreeNodePair, SmallVector<DomTreeNodePair, 32>,
40 PQ.push(std::make_pair(Node, DomLevels.lookup(Node)));
48 DomTreeNodePair RootPair = PQ.top();
51 unsigned RootLevel = RootPair.second;
60 VisitedWorklist.
insert(Root);
62 while (!Worklist.
empty()) {
69 SuccIter !=
End; ++SuccIter) {
75 if (SuccNode->
getIDom() == Node)
78 unsigned SuccLevel = DomLevels.lookup(SuccNode);
79 if (SuccLevel > RootLevel)
82 if (!VisitedPQ.
insert(SuccNode).second)
86 if (useLiveIn && !LiveInBlocks->count(SuccBB))
90 if (!DefBlocks->count(SuccBB))
91 PQ.push(std::make_pair(SuccNode, SuccLevel));
94 for (
auto DomChild : *Node) {
95 if (VisitedWorklist.
insert(DomChild).second)
void push_back(const T &Elt)
Function object to check whether the second component of a std::pair compares less than the second co...
void calculate(SmallVectorImpl< BasicBlock * > &IDFBlocks)
Calculate iterated dominance frontiers.
DomTreeNodeBase< NodeT > * getIDom() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
LLVM_NODISCARD bool empty() const
Base class for the actual dominator tree node.
LLVM Basic Block Representation.
df_iterator< T > df_end(const T &G)
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
static const unsigned End
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...
LLVM_NODISCARD T pop_back_val()
df_iterator< T > df_begin(const T &G)
void emplace_back(ArgTypes &&...Args)
Determine the iterated dominance frontier, given a set of defining blocks, and optionally, a set of live-in blocks.