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>;
27 extern template class llvm::DomTreeNodeBase<mlir::Block>;
34 template <
bool IsPostDom>
36 using DomTree = llvm::DominatorTreeBase<Block, IsPostDom>;
50 void invalidate(
Region *region);
60 auto domInfo = getDominanceInfo(region,
true).getPointer();
61 assert(domInfo &&
"Region isn't multiblock");
62 return domInfo->getRootNode();
68 return getDomTree(a->
getParent()).getNode(a);
73 bool isReachableFromEntry(
Block *a)
const;
78 return hasSSADominance(block->
getParent());
83 return getDominanceInfo(region,
false).getInt();
88 "Can't get DomTree for single block regions");
89 return *getDominanceInfo(region,
true).getPointer();
98 llvm::PointerIntPair<DomTree *, 1, bool>
99 getDominanceInfo(
Region *region,
bool needsDomTree)
const;
102 bool properlyDominates(
Block *a,
Block *b)
const;
135 bool enclosingOpOk =
true)
const {
136 return properlyDominatesImpl(a, b, enclosingOpOk);
142 return a == b || properlyDominates(a, b);
158 return a == b || properlyDominates(a, b);
168 return super::properlyDominates(a, b);
176 bool enclosingOpOk)
const;
189 return a == b || properlyPostDominates(a, b);
194 return super::properlyDominates(a, b);
199 return a == b || properlyPostDominates(a, b);
Block represents an ordered list of Operations.
Region * getParent() const
Provide a 'getParent' method for ilist_node_with_parent methods.
A class for computing basic dominance information.
bool dominates(Block *a, Block *b) const
Return true if the specified block A dominates block B, i.e.
bool dominates(Value a, Operation *b) const
Return true if the a value dominates operation b.
bool properlyDominates(Operation *a, Operation *b, bool enclosingOpOk=true) const
Return true if operation A properly dominates operation B, i.e.
bool properlyDominates(Block *a, Block *b) const
Return true if the specified block A properly dominates block B, i.e.
bool dominates(Operation *a, Operation *b) const
Return true if operation A dominates operation B, i.e.
Operation is the basic unit of execution within MLIR.
A class for computing basic postdominance information.
bool properlyPostDominates(Block *a, Block *b)
Return true if the specified block A properly postdominates block B.
bool postDominates(Block *a, Block *b)
Return true if the specified block A postdominates block B.
bool postDominates(Operation *a, Operation *b)
Return true if operation A postdominates operation B.
This class contains a list of basic blocks and a link to the parent operation it is attached to.
bool hasOneBlock()
Return true if this region has exactly one block.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Operation * getDefiningOp() const
If this value is the result of an operation, return the operation that defines it.
DenseMap< Region *, llvm::PointerIntPair< DomTree *, 1, bool > > dominanceInfos
A mapping of regions to their base dominator tree and a cached "hasSSADominance" bit.
bool hasSSADominance(Region *region) const
Return true if operations in the specified block are known to obey SSA dominance requirements.
DominanceInfoNode * getNode(Block *a)
Return the dominance node from the Region containing block A.
DominanceInfoBase(const DominanceInfoBase &)=delete
DominanceInfoBase & operator=(DominanceInfoBase &&)=default
DominanceInfoBase(DominanceInfoBase &&)=default
DominanceInfoBase & operator=(const DominanceInfoBase &)=delete
DominanceInfoBase(Operation *op=nullptr)
DominanceInfoNode * getRootNode(Region *region)
Get the root dominance node of the given region.
bool hasSSADominance(Block *block) const
Return true if operations in the specified block are known to obey SSA dominance requirements.
DomTree & getDomTree(Region *region) const
Include the generated interface declarations.
This header declares functions that assist transformations in the MemRef dialect.
llvm::DomTreeNodeBase< Block > DominanceInfoNode
const mlir::DominanceInfoNode * NodeRef
static NodeRef getEntryNode(NodeRef N)
mlir::DominanceInfoNode::const_iterator ChildIteratorType
static ChildIteratorType child_end(NodeRef N)
static ChildIteratorType child_begin(NodeRef N)
static ChildIteratorType child_end(NodeRef N)
static ChildIteratorType child_begin(NodeRef N)
mlir::DominanceInfoNode::const_iterator ChildIteratorType
static NodeRef getEntryNode(NodeRef N)
mlir::DominanceInfoNode * NodeRef