19 #ifndef MLIR_IR_DOMINANCE_H 20 #define MLIR_IR_DOMINANCE_H 23 #include "llvm/Support/GenericDomTree.h" 25 extern template class llvm::DominatorTreeBase<mlir::Block, false>;
26 extern template class llvm::DominatorTreeBase<mlir::Block, true>;
33 template <
bool IsPostDom>
35 using DomTree = llvm::DominatorTreeBase<Block, IsPostDom>;
59 auto domInfo = getDominanceInfo(region,
true).getPointer();
60 assert(domInfo &&
"Region isn't multiblock");
61 return domInfo->getRootNode();
67 return getDomTree(a->
getParent()).getNode(a);
72 bool isReachableFromEntry(
Block *a)
const;
77 return hasSSADominance(block->
getParent());
82 return getDominanceInfo(region,
false).getInt();
87 "Can't get DomTree for single block regions");
88 return *getDominanceInfo(region,
true).getPointer();
97 llvm::PointerIntPair<DomTree *, 1, bool>
98 getDominanceInfo(
Region *region,
bool needsDomTree)
const;
101 bool properlyDominates(
Block *a,
Block *b)
const;
131 bool enclosingOpOk =
true)
const {
132 return properlyDominatesImpl(a, b, enclosingOpOk);
138 return a == b || properlyDominates(a, b);
154 return a == b || properlyDominates(a, b);
164 return super::properlyDominates(a, b);
172 bool enclosingOpOk)
const;
185 return a == b || properlyPostDominates(a, b);
190 return super::properlyDominates(a, b);
195 return a == b || properlyPostDominates(a, b);
bool properlyDominates(Operation *a, Operation *b, bool enclosingOpOk=true) const
Return true if operation A properly dominates operation B, i.e.
static ChildIteratorType child_end(NodeRef N)
Include the generated interface declarations.
This class contains a list of basic blocks and a link to the parent operation it is attached to...
static NodeRef getEntryNode(NodeRef N)
mlir::DominanceInfoNode::const_iterator ChildIteratorType
bool dominates(Value a, Operation *b) const
Return true if the a value dominates operation b.
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Operation is a basic unit of execution within MLIR.
Block represents an ordered list of Operations.
DomTree & getDomTree(Region *region) const
bool dominates(Block *a, Block *b) const
Return true if the specified block A dominates block B, i.e.
A class for computing basic dominance information.
const mlir::DominanceInfoNode * NodeRef
DominanceInfoBase(Operation *op=nullptr)
bool properlyPostDominates(Block *a, Block *b)
Return true if the specified block A properly postdominates block B.
bool properlyDominates(Block *a, Block *b) const
Return true if the specified block A properly dominates block B, i.e.
Region * getParent() const
Provide a 'getParent' method for ilist_node_with_parent methods.
bool hasOneBlock()
Return true if this region has exactly one block.
bool hasSSADominance(Region *region) const
Return true if operations in the specified block are known to obey SSA dominance requirements.
static ChildIteratorType child_begin(NodeRef N)
mlir::DominanceInfoNode::const_iterator ChildIteratorType
void invalidate()
Invalidate dominance info.
static NodeRef getEntryNode(NodeRef N)
bool hasSSADominance(Block *block) const
Return true if operations in the specified block are known to obey SSA dominance requirements.
DominanceInfoNode * getRootNode(Region *region)
Get the root dominance node of the given region.
DominanceInfoNode * getNode(Block *a)
Return the dominance node from the Region containing block A.
DenseMap< Region *, llvm::PointerIntPair< DomTree *, 1, bool > > dominanceInfos
A mapping of regions to their base dominator tree and a cached "hasSSADominance" bit.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
bool postDominates(Block *a, Block *b)
Return true if the specified block A postdominates block B.
mlir::DominanceInfoNode * NodeRef
Operation * getDefiningOp() const
If this value is the result of an operation, return the operation that defines it.
bool dominates(Operation *a, Operation *b) const
Return true if operation A dominates operation B, i.e.
void invalidate(Region *region)
bool postDominates(Operation *a, Operation *b)
Return true if operation A postdominates operation B.
static ChildIteratorType child_begin(NodeRef N)
static ChildIteratorType child_end(NodeRef N)
A class for computing basic postdominance information.
llvm::DomTreeNodeBase< Block > DominanceInfoNode