17#ifndef LLVM_ANALYSIS_DOMINANCEFRONTIERIMPL_H
18#define LLVM_ANALYSIS_DOMINANCEFRONTIERIMPL_H
22#include "llvm/Config/llvm-config.h"
33template <
class BlockT>
48template <
class BlockT,
bool IsPostDom>
51 OS <<
" DomFrontier for BB ";
53 I->first->printAsOperand(
OS,
false);
55 OS <<
" <<exit node>>";
60 for (
const BlockT *BB : BBs) {
63 BB->printAsOperand(
OS,
false);
65 OS <<
"<<exit node>>";
71#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
72template <
class BlockT,
bool IsPostDom>
78template <
class BlockT>
82 BlockT *BB =
Node->getBlock();
85 std::vector<DFCalculateWorkObject<BlockT>> workList;
91 assert(currentW &&
"Missing work object.");
95 const DomTreeNodeT *currentNode = currentW->
Node;
96 const DomTreeNodeT *parentNode = currentW->
parentNode;
97 assert(currentBB &&
"Invalid work object. Missing current Basic Block");
98 assert(currentNode &&
"Invalid work object. Missing current Node");
102 if (visited.
insert(currentBB).second) {
104 for (
const auto Succ : children<BlockT *>(currentBB)) {
106 if (DT[Succ]->getIDom() != currentNode)
114 bool visitChild =
false;
115 for (
typename DomTreeNodeT::const_iterator NI = currentNode->begin(),
116 NE = currentNode->end();
118 DomTreeNodeT *IDominee = *NI;
119 BlockT *childBB = IDominee->getBlock();
122 childBB, currentBB, IDominee, currentNode));
135 typename DomSetType::const_iterator CDFI = S.
begin(), CDFE = S.
end();
136 DomSetType &parentSet = this->Frontiers[parentBB];
137 for (; CDFI != CDFE; ++CDFI) {
139 parentSet.insert(*CDFI);
144 }
while (!workList.empty());
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines a set of templates that efficiently compute a dominator tree over a generic graph.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallPtrSet class.
DFCalculateWorkObject(BlockT *B, BlockT *P, const DomTreeNodeT *N, const DomTreeNodeT *PN)
const DomTreeNodeT * parentNode
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().
typename DomSetMapType::const_iterator const_iterator
Core dominator tree base class.
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
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)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.