MLIR  20.0.0git
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
mlir::detail::DominanceInfoBase< IsPostDom > Class Template Reference

#include "mlir/IR/Dominance.h"

+ Inheritance diagram for mlir::detail::DominanceInfoBase< IsPostDom >:

Public Member Functions

 DominanceInfoBase (Operation *op=nullptr)
 
 DominanceInfoBase (DominanceInfoBase &&)=default
 
DominanceInfoBaseoperator= (DominanceInfoBase &&)=default
 
 ~DominanceInfoBase ()
 
 DominanceInfoBase (const DominanceInfoBase &)=delete
 
DominanceInfoBaseoperator= (const DominanceInfoBase &)=delete
 
void invalidate ()
 Invalidate dominance info. More...
 
void invalidate (Region *region)
 
BlockfindNearestCommonDominator (Block *a, Block *b) const
 Finds the nearest common dominator block for the two given blocks a and b. More...
 
template<typename BlockRangeT >
BlockfindNearestCommonDominator (BlockRangeT &&blocks) const
 Finds the nearest common dominator block for the given range of blocks. More...
 
DominanceInfoNodegetRootNode (Region *region)
 Get the root dominance node of the given region. More...
 
DominanceInfoNodegetNode (Block *a)
 Return the dominance node from the Region containing block A. More...
 
bool isReachableFromEntry (Block *a) const
 Return true if the specified block is reachable from the entry block of its region. More...
 
bool hasSSADominance (Block *block) const
 Return true if operations in the specified block are known to obey SSA dominance requirements. More...
 
bool hasSSADominance (Region *region) const
 Return true if operations in the specified block are known to obey SSA dominance requirements. More...
 
DomTree & getDomTree (Region *region) const
 

Protected Types

using super = DominanceInfoBase< IsPostDom >
 

Protected Member Functions

llvm::PointerIntPair< DomTree *, 1, bool > getDominanceInfo (Region *region, bool needsDomTree) const
 Return the dom tree and "hasSSADominance" bit for the given region. More...
 
bool properlyDominatesImpl (Block *a, Block *b) const
 Return "true" if the specified block A properly (post)dominates block B. More...
 
bool properlyDominatesImpl (Operation *a, Operation *b, bool enclosingOpOk=true) const
 Return "true" if the specified op A properly (post)dominates op B. More...
 

Protected Attributes

DenseMap< Region *, llvm::PointerIntPair< DomTree *, 1, bool > > dominanceInfos
 A mapping of regions to their base dominator tree and a cached "hasSSADominance" bit. More...
 

Detailed Description

template<bool IsPostDom>
class mlir::detail::DominanceInfoBase< IsPostDom >

Definition at line 35 of file Dominance.h.

Member Typedef Documentation

◆ super

template<bool IsPostDom>
using mlir::detail::DominanceInfoBase< IsPostDom >::super = DominanceInfoBase<IsPostDom>
protected

Definition at line 108 of file Dominance.h.

Constructor & Destructor Documentation

◆ DominanceInfoBase() [1/3]

template<bool IsPostDom>
mlir::detail::DominanceInfoBase< IsPostDom >::DominanceInfoBase ( Operation op = nullptr)
inline

Definition at line 39 of file Dominance.h.

◆ DominanceInfoBase() [2/3]

template<bool IsPostDom>
mlir::detail::DominanceInfoBase< IsPostDom >::DominanceInfoBase ( DominanceInfoBase< IsPostDom > &&  )
default

◆ ~DominanceInfoBase()

template<bool IsPostDom>
DominanceInfoBase::~DominanceInfoBase

Definition at line 32 of file Dominance.cpp.

◆ DominanceInfoBase() [3/3]

template<bool IsPostDom>
mlir::detail::DominanceInfoBase< IsPostDom >::DominanceInfoBase ( const DominanceInfoBase< IsPostDom > &  )
delete

Member Function Documentation

◆ findNearestCommonDominator() [1/2]

template<bool IsPostDom>
Block * DominanceInfoBase::findNearestCommonDominator ( Block a,
Block b 
) const

Finds the nearest common dominator block for the two given blocks a and b.

If no common dominator can be found, this function will return nullptr.

Definition at line 192 of file Dominance.cpp.

References mlir::Block::getParent(), and tryGetBlocksInSameRegion().

◆ findNearestCommonDominator() [2/2]

template<bool IsPostDom>
template<typename BlockRangeT >
Block* mlir::detail::DominanceInfoBase< IsPostDom >::findNearestCommonDominator ( BlockRangeT &&  blocks) const
inline

Finds the nearest common dominator block for the given range of blocks.

If no common dominator can be found, this function will return nullptr.

Definition at line 60 of file Dominance.h.

References mlir::Block::begin().

◆ getDominanceInfo()

template<bool IsPostDom>
auto DominanceInfoBase::getDominanceInfo ( Region region,
bool  needsDomTree 
) const
protected

Return the dom tree and "hasSSADominance" bit for the given region.

The DomTree will be null for single-block regions. This lazily constructs the DomTree on demand when needsDomTree=true.

Definition at line 57 of file Dominance.cpp.

References mlir::Region::hasOneBlock().

◆ getDomTree()

template<bool IsPostDom>
DomTree& mlir::detail::DominanceInfoBase< IsPostDom >::getDomTree ( Region region) const
inline

Definition at line 101 of file Dominance.h.

References mlir::Region::hasOneBlock().

◆ getNode()

template<bool IsPostDom>
DominanceInfoNode* mlir::detail::DominanceInfoBase< IsPostDom >::getNode ( Block a)
inline

Return the dominance node from the Region containing block A.

This only works for multi-block regions.

Definition at line 82 of file Dominance.h.

References mlir::Block::getParent().

Referenced by transformToStructuredCFBranches().

◆ getRootNode()

template<bool IsPostDom>
DominanceInfoNode* mlir::detail::DominanceInfoBase< IsPostDom >::getRootNode ( Region region)
inline

Get the root dominance node of the given region.

Note that this operation is only defined for multi-block regions!

Definition at line 74 of file Dominance.h.

◆ hasSSADominance() [1/2]

template<bool IsPostDom>
bool mlir::detail::DominanceInfoBase< IsPostDom >::hasSSADominance ( Block block) const
inline

Return true if operations in the specified block are known to obey SSA dominance requirements.

False if the block is a graph region or unknown.

Definition at line 92 of file Dominance.h.

References mlir::Block::getParent().

◆ hasSSADominance() [2/2]

template<bool IsPostDom>
bool mlir::detail::DominanceInfoBase< IsPostDom >::hasSSADominance ( Region region) const
inline

Return true if operations in the specified block are known to obey SSA dominance requirements.

False if the block is a graph region or unknown.

Definition at line 97 of file Dominance.h.

◆ invalidate() [1/2]

template<bool IsPostDom>
void DominanceInfoBase::invalidate

Invalidate dominance info.

This can be used by clients that make major changes to the CFG and don't have a good way to update it.

Definition at line 38 of file Dominance.cpp.

Referenced by mlir::transformCFGToSCF(), and transformToStructuredCFBranches().

◆ invalidate() [2/2]

template<bool IsPostDom>
void DominanceInfoBase::invalidate ( Region region)

Definition at line 45 of file Dominance.cpp.

◆ isReachableFromEntry()

template<bool IsPostDom>
bool DominanceInfoBase::isReachableFromEntry ( Block a) const

Return true if the specified block is reachable from the entry block of its region.

Definition at line 295 of file Dominance.cpp.

References mlir::Region::front(), and mlir::Block::getParent().

◆ operator=() [1/2]

template<bool IsPostDom>
DominanceInfoBase& mlir::detail::DominanceInfoBase< IsPostDom >::operator= ( const DominanceInfoBase< IsPostDom > &  )
delete

◆ operator=() [2/2]

template<bool IsPostDom>
DominanceInfoBase& mlir::detail::DominanceInfoBase< IsPostDom >::operator= ( DominanceInfoBase< IsPostDom > &&  )
default

◆ properlyDominatesImpl() [1/2]

template<bool IsPostDom>
bool DominanceInfoBase::properlyDominatesImpl ( Block a,
Block b 
) const
protected

Return "true" if the specified block A properly (post)dominates block B.

Return true if the specified block A properly dominates block B.

Definition at line 218 of file Dominance.cpp.

References mlir::Region::findAncestorBlockInRegion(), and mlir::Block::getParent().

◆ properlyDominatesImpl() [2/2]

template<bool IsPostDom>
bool DominanceInfoBase::properlyDominatesImpl ( Operation a,
Operation b,
bool  enclosingOpOk = true 
) const
protected

Return "true" if the specified op A properly (post)dominates op B.

Definition at line 248 of file Dominance.cpp.

References mlir::Region::findAncestorOpInRegion(), mlir::Operation::getBlock(), mlir::Block::getParent(), and mlir::Operation::isBeforeInBlock().

Member Data Documentation

◆ dominanceInfos

template<bool IsPostDom>
DenseMap<Region *, llvm::PointerIntPair<DomTree *, 1, bool> > mlir::detail::DominanceInfoBase< IsPostDom >::dominanceInfos
mutableprotected

A mapping of regions to their base dominator tree and a cached "hasSSADominance" bit.

This map does not contain dominator trees for single block CFG regions, but we do want to cache the "hasSSADominance" bit for them. We may also not have computed the DomTree yet. In either case, the DomTree is just null.

Definition at line 130 of file Dominance.h.


The documentation for this class was generated from the following files: