MLIR  21.0.0git
Functions
Dominance.cpp File Reference
#include "mlir/IR/Dominance.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/RegionKindInterface.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/GenericDomTreeConstruction.h"

Go to the source code of this file.

Functions

static BlockgetAncestorBlock (Block *block)
 Return the ancestor block enclosing the specified block. More...
 
template<typename FuncT >
static BlocktraverseAncestors (Block *block, const FuncT &func)
 Walks up the list of containers of the given block and calls the user-defined traversal function for every pair of a region and block that could be found during traversal. More...
 
static bool tryGetBlocksInSameRegion (Block *&a, Block *&b)
 Tries to update the given block references to live in the same region by exploring the relationship of both blocks with respect to their regions. More...
 
static std::pair< Block *, Block::iteratorfindAncestorIteratorInRegion (Region *r, Block *b, Block::iterator it)
 Returns the given block iterator if it lies within the region region. More...
 
static bool isBeforeInBlock (Block *block, Block::iterator a, Block::iterator b)
 Given two iterators into the same block, return "true" if a is before `b. More...
 

Function Documentation

◆ findAncestorIteratorInRegion()

static std::pair<Block *, Block::iterator> findAncestorIteratorInRegion ( Region r,
Block b,
Block::iterator  it 
)
static

Returns the given block iterator if it lies within the region region.

Otherwise, otherwise finds the ancestor of the given block iterator that lies within the given region. Returns and "empty" iterator if the latter fails.

Note: This is a variant of Region::findAncestorOpInRegion that operates on block iterators instead of ops.

Definition at line 224 of file Dominance.cpp.

Referenced by mlir::detail::DominanceInfoBase< IsPostDom >::properlyDominatesImpl().

◆ getAncestorBlock()

static Block* getAncestorBlock ( Block block)
static

Return the ancestor block enclosing the specified block.

This returns null if we reach the top of the hierarchy.

Definition at line 104 of file Dominance.cpp.

References mlir::Block::getParentOp().

Referenced by tryGetBlocksInSameRegion().

◆ isBeforeInBlock()

static bool isBeforeInBlock ( Block block,
Block::iterator  a,
Block::iterator  b 
)
static

Given two iterators into the same block, return "true" if a is before `b.

Note: This is a variant of Operation::isBeforeInBlock that operates on block iterators instead of ops.

Definition at line 242 of file Dominance.cpp.

References mlir::Block::end().

Referenced by mlir::detail::DominanceInfoBase< IsPostDom >::properlyDominatesImpl().

◆ traverseAncestors()

template<typename FuncT >
static Block* traverseAncestors ( Block block,
const FuncT &  func 
)
static

Walks up the list of containers of the given block and calls the user-defined traversal function for every pair of a region and block that could be found during traversal.

If the user-defined function returns true for a given pair, traverseAncestors will return the current block. Nullptr otherwise.

Definition at line 116 of file Dominance.cpp.

Referenced by tryGetBlocksInSameRegion().

◆ tryGetBlocksInSameRegion()

static bool tryGetBlocksInSameRegion ( Block *&  a,
Block *&  b 
)
static

Tries to update the given block references to live in the same region by exploring the relationship of both blocks with respect to their regions.

Definition at line 127 of file Dominance.cpp.

References getAncestorBlock(), mlir::Block::getParent(), and traverseAncestors().

Referenced by mlir::detail::DominanceInfoBase< IsPostDom >::findNearestCommonDominator().