17#ifndef LLVM_ANALYSIS_DOMINANCEFRONTIERIMPL_H
18#define LLVM_ANALYSIS_DOMINANCEFRONTIERIMPL_H
22#include "llvm/Config/llvm-config.h"
31template <
class BlockT>
46template <
class BlockT,
bool IsPostDom>
49 OS <<
" DomFrontier for BB ";
51 I->first->printAsOperand(OS,
false);
53 OS <<
" <<exit node>>";
58 for (
const BlockT *BB : BBs) {
61 BB->printAsOperand(OS,
false);
63 OS <<
"<<exit node>>";
69#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
70template <
class BlockT,
bool IsPostDom>
76template <
class BlockT>
80 BlockT *BB =
Node->getBlock();
83 std::vector<DFCalculateWorkObject<BlockT>> workList;
89 assert(currentW &&
"Missing work object.");
92 BlockT *parentBB = currentW->
parentBB;
93 const DomTreeNodeT *currentNode = currentW->
Node;
94 const DomTreeNodeT *parentNode = currentW->
parentNode;
95 assert(currentBB &&
"Invalid work object. Missing current Basic Block");
96 assert(currentNode &&
"Invalid work object. Missing current Node");
100 if (visited.
insert(currentBB).second) {
104 if (DT[Succ]->getIDom() != currentNode)
112 bool visitChild =
false;
113 for (
typename DomTreeNodeT::const_iterator NI = currentNode->begin(),
114 NE = currentNode->end();
116 DomTreeNodeT *IDominee = *NI;
117 BlockT *childBB = IDominee->getBlock();
118 if (visited.
count(childBB) == 0) {
120 childBB, currentBB, IDominee, currentNode));
133 typename DomSetType::const_iterator CDFI = S.
begin(), CDFE = S.
end();
134 DomSetType &parentSet = this->Frontiers[parentBB];
135 for (; CDFI != CDFE; ++CDFI) {
137 parentSet.insert(*CDFI);
142 }
while (!workList.empty());
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file defines a set of templates that efficiently compute a dominator tree over a generic graph.
This file defines the SmallPtrSet class.
DFCalculateWorkObject(BlockT *B, BlockT *P, const DomTreeNodeT *N, const DomTreeNodeT *PN)
const DomTreeNodeT * parentNode
DomTreeNodeBase< BlockT > DomTreeNodeT
const DomTreeNodeT * Node
Base class for the actual dominator tree node.
void print(raw_ostream &OS) const
print - Convert to human readable form
void dump() const
dump - Dump the dominance frontier to dbgs().
SetVector< BasicBlock * > DomSetType
typename DomSetMapType::const_iterator const_iterator
bool properlyDominates(const DomTreeNodeBase< NodeT > *A, const DomTreeNodeBase< NodeT > *B) const
properlyDominates - Returns true iff A dominates B and A != B.
const DomSetType & calculate(const DomTreeT &DT, const DomTreeNodeT *Node)
typename DominanceFrontierBase< BlockT, false >::DomSetType DomSetType
DomTreeBase< BlockT > DomTreeT
DomTreeNodeBase< BlockT > DomTreeNodeT
A vector that has set insertion semantics.
iterator end()
Get an iterator to the end of the SetVector.
iterator begin()
Get an iterator to the beginning of the SetVector.
bool insert(const value_type &X)
Insert a new element into the SetVector.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
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.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
iterator_range< typename GraphTraits< GraphType >::ChildIteratorType > children(const typename GraphTraits< GraphType >::NodeRef &G)