19#ifndef MLIR_IR_DOMINANCE_H
20#define MLIR_IR_DOMINANCE_H
23#include "llvm/Support/GenericDomTree.h"
25extern template class llvm::DominatorTreeBase<mlir::Block, false>;
26extern template class llvm::DominatorTreeBase<mlir::Block, true>;
27extern template class llvm::DomTreeNodeBase<mlir::Block>;
34template <
bool IsPostDom>
36 using DomTree = llvm::DominatorTreeBase<Block, IsPostDom>;
59 template <
typename BlockRangeT>
61 if (blocks.begin() == blocks.end())
64 for (
auto it = ++blocks.begin(); it != blocks.end(); ++it) {
76 assert(domInfo &&
"Region isn't multiblock");
77 return domInfo->getRootNode();
103 "Can't get DomTree for single block regions");
113 llvm::PointerIntPair<DomTree *, 1, bool>
121 bool enclosingOk =
true)
const;
154 bool enclosingOpOk =
true)
const;
198 return (aBlock == bBlock && aIt == bIt) ||
210 bool enclosingOpOk =
true)
const;
218 bool properlyPostDominates(
Block *a,
Block *
b)
const;
227 bool enclosingOk =
true)
const {
233 return (aBlock == bBlock && aIt == bIt) ||
245struct GraphTraits<
mlir::DominanceInfoNode *> {
255struct GraphTraits<const
mlir::DominanceInfoNode *> {
Block represents an ordered list of Operations.
OpListType::iterator iterator
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 properlyDominates(Block *aBlock, Block::iterator aIt, Block *bBlock, Block::iterator bIt, bool enclosingOk=true) const
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 dominates(Operation *a, Operation *b) const
Return true if operation A dominates operation B, i.e.
bool dominates(Block *aBlock, Block::iterator aIt, Block *bBlock, Block::iterator bIt, bool enclosingOk=true) const
Operation is the basic unit of execution within MLIR.
A class for computing basic postdominance information.
bool properlyPostDominates(Operation *a, Operation *b, bool enclosingOpOk=true) const
Return true if operation A properly postdominates operation B.
bool postDominates(Block *aBlock, Block::iterator aIt, Block *bBlock, Block::iterator bIt, bool enclosingOk=true) const
bool properlyPostDominates(Block *aBlock, Block::iterator aIt, Block *bBlock, Block::iterator bIt, bool enclosingOk=true) const
bool postDominates(Operation *a, Operation *b) const
Return true if operation A postdominates operation B.
bool postDominates(Block *a, Block *b) const
Return true if the specified block A postdominates block 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.
llvm::PointerIntPair< DomTree *, 1, bool > getDominanceInfo(Region *region, bool needsDomTree) const
Return the dom tree and "hasSSADominance" bit for the given region.
DominanceInfoBase & operator=(const DominanceInfoBase &)=delete
DenseMap< Region *, llvm::PointerIntPair< DomTree *, 1, bool > > dominanceInfos
A mapping of regions to their base dominator tree and a cached "hasSSADominance" bit.
DominanceInfoBase< IsPostDom > super
DominanceInfoNode * getRootNode(Region *region)
Get the root dominance node of the given region.
bool hasSSADominance(Region *region) const
Return true if operations in the specified block are known to obey SSA dominance requirements.
DominanceInfoBase(const DominanceInfoBase &)=delete
DominanceInfoBase & operator=(DominanceInfoBase &&)=default
DomTree & getDomTree(Region *region) const
DominanceInfoBase(DominanceInfoBase &&)=default
DominanceInfoNode * getNode(Block *a)
Return the dominance node from the Region containing block A.
bool isReachableFromEntry(Block *a) const
Return true if the specified block is reachable from the entry block of its region.
Block * findNearestCommonDominator(BlockRangeT &&blocks) const
Finds the nearest common dominator block for the given range of blocks.
DominanceInfoBase(Operation *op=nullptr)
bool properlyDominatesImpl(Block *aBlock, Block::iterator aIt, Block *bBlock, Block::iterator bIt, bool enclosingOk=true) const
Return "true" if block iterator A properly (post)dominates block iterator B.
Block * findNearestCommonDominator(Block *a, Block *b) const
Finds the nearest common dominator block for the two given blocks a and b.
bool hasSSADominance(Block *block) const
Return true if operations in the specified block are known to obey SSA dominance requirements.
void invalidate()
Invalidate dominance info.
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Include the generated interface declarations.
llvm::DomTreeNodeBase< Block > DominanceInfoNode
llvm::DenseMap< KeyT, ValueT, KeyInfoT, BucketT > DenseMap
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