MLIR  14.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
mlir::Block Class Reference

Block represents an ordered list of Operations. More...

#include "mlir/IR/Block.h"

Inheritance diagram for mlir::Block:
Inheritance graph
[legend]
Collaboration diagram for mlir::Block:
Collaboration graph
[legend]

Public Types

using BlockArgListType = MutableArrayRef< BlockArgument >
 
using args_iterator = BlockArgListType::iterator
 
using reverse_args_iterator = BlockArgListType::reverse_iterator
 
using OpListType = llvm::iplist< Operation >
 This is the list of operations in the block. More...
 
using iterator = OpListType::iterator
 
using reverse_iterator = OpListType::reverse_iterator
 
template<typename OpT >
using op_iterator = detail::op_iterator< OpT, iterator >
 This class provides iteration over the held operations of a block for a specific operation type. More...
 
using pred_iterator = PredecessorIterator
 
using succ_iterator = SuccessorRange::iterator
 
- Public Types inherited from mlir::IRObjectWithUseList< BlockOperand >
using use_iterator = ValueUseIterator< BlockOperand >
 
using use_range = iterator_range< use_iterator >
 
using user_iterator = ValueUserIterator< use_iterator, BlockOperand >
 
using user_range = iterator_range< user_iterator >
 

Public Member Functions

 Block ()
 
 ~Block ()
 
void clear ()
 
RegiongetParent () const
 Provide a 'getParent' method for ilist_node_with_parent methods. More...
 
OperationgetParentOp ()
 Returns the closest surrounding operation that contains this block. More...
 
bool isEntryBlock ()
 Return if this block is the entry block in the parent region. More...
 
void insertBefore (Block *block)
 Insert this block (which must not already be in a region) right before the specified block. More...
 
void moveBefore (Block *block)
 Unlink this block from its current region and insert it right before the specific block. More...
 
void erase ()
 Unlink this Block from its parent region and delete it. More...
 
BlockArgListType getArguments ()
 
ValueTypeRange< BlockArgListTypegetArgumentTypes ()
 Return a range containing the types of the arguments for this block. More...
 
args_iterator args_begin ()
 
args_iterator args_end ()
 
reverse_args_iterator args_rbegin ()
 
reverse_args_iterator args_rend ()
 
bool args_empty ()
 
BlockArgument addArgument (Type type, Optional< Location > loc={})
 Add one value to the argument list. More...
 
BlockArgument insertArgument (args_iterator it, Type type, Optional< Location > loc={})
 Insert one value to the position in the argument list indicated by the given iterator. More...
 
iterator_range< args_iteratoraddArguments (TypeRange types, ArrayRef< Location > locs={})
 Add one argument to the argument list for each type specified in the list. More...
 
BlockArgument insertArgument (unsigned index, Type type, Optional< Location > loc={})
 Add one value to the argument list at the specified position. More...
 
void eraseArgument (unsigned index)
 Erase the argument at 'index' and remove it from the argument list. More...
 
void eraseArguments (ArrayRef< unsigned > argIndices)
 Erases the arguments listed in argIndices and removes them from the argument list. More...
 
void eraseArguments (const llvm::BitVector &eraseIndices)
 Erases the arguments that have their corresponding bit set in eraseIndices and removes them from the argument list. More...
 
void eraseArguments (function_ref< bool(BlockArgument)> shouldEraseFn)
 Erases arguments using the given predicate. More...
 
unsigned getNumArguments ()
 
BlockArgument getArgument (unsigned i)
 
OpListTypegetOperations ()
 
iterator begin ()
 
iterator end ()
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
bool empty ()
 
void push_back (Operation *op)
 
void push_front (Operation *op)
 
Operationback ()
 
Operationfront ()
 
OperationfindAncestorOpInBlock (Operation &op)
 Returns 'op' if 'op' lies in this block, or otherwise finds the ancestor operation of 'op' that lies in this block. More...
 
void dropAllReferences ()
 This drops all operand uses from operations within this block, which is an essential step in breaking cyclic dependences between references when they are to be deleted. More...
 
void dropAllDefinedValueUses ()
 This drops all uses of values defined in this block or in the blocks of nested regions wherever the uses are located. More...
 
bool isOpOrderValid ()
 Returns true if the ordering of the child operations is valid, false otherwise. More...
 
void invalidateOpOrder ()
 Invalidates the current ordering of operations. More...
 
bool verifyOpOrder ()
 Verifies the current ordering of child operations matches the validOpOrder flag. More...
 
void recomputeOpOrder ()
 Recomputes the ordering of child operations within the block. More...
 
template<typename OpT >
iterator_range< op_iterator< OpT > > getOps ()
 Return an iterator range over the operations within this block that are of 'OpT'. More...
 
template<typename OpT >
op_iterator< OpT > op_begin ()
 
template<typename OpT >
op_iterator< OpT > op_end ()
 
iterator_range< iteratorwithout_terminator ()
 Return an iterator range over the operation within this block excluding the terminator operation at the end. More...
 
OperationgetTerminator ()
 Get the terminator operation of this block. More...
 
pred_iterator pred_begin ()
 
pred_iterator pred_end ()
 
iterator_range< pred_iteratorgetPredecessors ()
 
bool hasNoPredecessors ()
 Return true if this block has no predecessors. More...
 
bool hasNoSuccessors ()
 Returns true if this blocks has no successors. More...
 
BlockgetSinglePredecessor ()
 If this block has exactly one predecessor, return it. More...
 
BlockgetUniquePredecessor ()
 If this block has a unique predecessor, i.e., all incoming edges originate from one block, return it. More...
 
unsigned getNumSuccessors ()
 
BlockgetSuccessor (unsigned i)
 
succ_iterator succ_begin ()
 
succ_iterator succ_end ()
 
SuccessorRange getSuccessors ()
 
template<WalkOrder Order = WalkOrder::PostOrder, typename FnT , typename RetT = detail::walkResultType<FnT>>
RetT walk (FnT &&callback)
 Walk the operations in this block. More...
 
template<WalkOrder Order = WalkOrder::PostOrder, typename FnT , typename RetT = detail::walkResultType<FnT>>
std::enable_if< std::is_same< RetT, void >::value, RetT >::type walk (Block::iterator begin, Block::iterator end, FnT &&callback)
 Walk the operations in the specified [begin, end) range of this block. More...
 
template<WalkOrder Order = WalkOrder::PostOrder, typename FnT , typename RetT = detail::walkResultType<FnT>>
std::enable_if< std::is_same< RetT, WalkResult >::value, RetT >::type walk (Block::iterator begin, Block::iterator end, FnT &&callback)
 Walk the operations in the specified [begin, end) range of this block. More...
 
BlocksplitBlock (iterator splitBefore)
 Split the block into two blocks before the specified operation or iterator. More...
 
BlocksplitBlock (Operation *splitBeforeOp)
 
void print (raw_ostream &os)
 
void print (raw_ostream &os, AsmState &state)
 
void dump ()
 
void printAsOperand (raw_ostream &os, bool printType=true)
 Print out the name of the block without printing its body. More...
 
void printAsOperand (raw_ostream &os, AsmState &state)
 
- Public Member Functions inherited from mlir::IRObjectWithUseList< BlockOperand >
 ~IRObjectWithUseList ()
 
void dropAllUses ()
 Drop all uses of this object from their respective owners. More...
 
void replaceAllUsesWith (ValueT &&newValue)
 Replace all uses of 'this' value with the new value, updating anything in the IR that uses 'this' to use the other value instead. More...
 
use_iterator use_begin () const
 
use_iterator use_end () const
 
use_range getUses () const
 Returns a range of all uses, which is useful for iterating over all uses. More...
 
bool hasOneUse () const
 Returns true if this value has exactly one use. More...
 
bool use_empty () const
 Returns true if this value has no uses. More...
 
user_iterator user_begin () const
 
user_iterator user_end () const
 
user_range getUsers () const
 Returns a range of all users. More...
 

Static Public Member Functions

static OpListType Block::* getSublistAccess (Operation *)
 Returns pointer to member of operation list. More...
 

Friends

struct llvm::ilist_traits< Block >
 

Additional Inherited Members

- Protected Member Functions inherited from mlir::IRObjectWithUseList< BlockOperand >
 IRObjectWithUseList ()=default
 
BlockOperandgetFirstUse () const
 Return the first operand that is using this value, for use by custom use/def iterators. More...
 

Detailed Description

Block represents an ordered list of Operations.

Definition at line 29 of file Block.h.

Member Typedef Documentation

◆ args_iterator

using mlir::Block::args_iterator = BlockArgListType::iterator

Definition at line 81 of file Block.h.

◆ BlockArgListType

Definition at line 74 of file Block.h.

◆ iterator

using mlir::Block::iterator = OpListType::iterator

Definition at line 132 of file Block.h.

◆ op_iterator

template<typename OpT >
using mlir::Block::op_iterator = detail::op_iterator<OpT, iterator>

This class provides iteration over the held operations of a block for a specific operation type.

Definition at line 180 of file Block.h.

◆ OpListType

using mlir::Block::OpListType = llvm::iplist<Operation>

This is the list of operations in the block.

Definition at line 128 of file Block.h.

◆ pred_iterator

Definition at line 221 of file Block.h.

◆ reverse_args_iterator

using mlir::Block::reverse_args_iterator = BlockArgListType::reverse_iterator

Definition at line 82 of file Block.h.

◆ reverse_iterator

using mlir::Block::reverse_iterator = OpListType::reverse_iterator

Definition at line 133 of file Block.h.

◆ succ_iterator

using mlir::Block::succ_iterator = SuccessorRange::iterator

Definition at line 253 of file Block.h.

Constructor & Destructor Documentation

◆ Block()

mlir::Block::Block ( )
inlineexplicit

Definition at line 32 of file Block.h.

Referenced by splitBlock().

◆ ~Block()

Block::~Block ( )

Definition at line 19 of file Block.cpp.

References clear(), and verifyOpOrder().

Member Function Documentation

◆ addArgument()

BlockArgument Block::addArgument ( Type  type,
Optional< Location loc = {} 
)

◆ addArguments()

auto Block::addArguments ( TypeRange  types,
ArrayRef< Location locs = {} 
)

Add one argument to the argument list for each type specified in the list.

Definition at line 157 of file Block.cpp.

References addArgument().

Referenced by mlir::Region::addArguments(), mlir::gpu::addAsyncDependency(), buildUnresolvedTargetMaterialization(), mlir::OpBuilder::createBlock(), ensureDistinctSuccessors(), and printLaunchFuncOperands().

◆ args_begin()

args_iterator mlir::Block::args_begin ( )
inline

Definition at line 83 of file Block.h.

◆ args_empty()

bool mlir::Block::args_empty ( )
inline

Definition at line 88 of file Block.h.

Referenced by collapseBranch(), and mlir::AsmPrinter::Impl::printIntegerSet().

◆ args_end()

args_iterator mlir::Block::args_end ( )
inline

Definition at line 84 of file Block.h.

◆ args_rbegin()

reverse_args_iterator mlir::Block::args_rbegin ( )
inline

Definition at line 85 of file Block.h.

◆ args_rend()

reverse_args_iterator mlir::Block::args_rend ( )
inline

Definition at line 86 of file Block.h.

◆ back()

Operation& mlir::Block::back ( )
inline

◆ begin()

iterator mlir::Block::begin ( )
inline

◆ clear()

void mlir::Block::clear ( )
inline

Definition at line 35 of file Block.h.

Referenced by mlir::outlineIfOp(), and ~Block().

◆ dropAllDefinedValueUses()

void Block::dropAllDefinedValueUses ( )

This drops all uses of values defined in this block or in the blocks of nested regions wherever the uses are located.

Definition at line 82 of file Block.cpp.

References mlir::IRObjectWithUseList< BlockOperand >::dropAllUses(), and getArguments().

Referenced by detachNestedAndErase(), and mlir::Operation::dropAllDefinedValueUses().

◆ dropAllReferences()

void Block::dropAllReferences ( )

This drops all operand uses from operations within this block, which is an essential step in breaking cyclic dependences between references when they are to be deleted.

Definition at line 77 of file Block.cpp.

References mlir::Operation::dropAllReferences().

Referenced by mlir::Region::dropAllReferences().

◆ dump()

void Block::dump ( )

Definition at line 2874 of file AsmPrinter.cpp.

References print().

◆ empty()

bool mlir::Block::empty ( )
inline

◆ end()

iterator mlir::Block::end ( )
inline

◆ erase()

void Block::erase ( )

Unlink this Block from its parent region and delete it.

Unlink this Block from its parent Region and delete it.

Definition at line 54 of file Block.cpp.

References mlir::Region::getBlocks(), and getParent().

Referenced by buildUnresolvedTargetMaterialization(), mlir::RewriterBase::eraseBlock(), inlineRegionImpl(), and mlir::RewriterBase::mergeBlocks().

◆ eraseArgument()

void Block::eraseArgument ( unsigned  index)

Erase the argument at 'index' and remove it from the argument list.

Definition at line 208 of file Block.cpp.

Referenced by bufferizeFuncOpBoundary(), mlir::Region::eraseArgument(), foldMemRefCastInTiledLoopOp(), and verify().

◆ eraseArguments() [1/3]

void Block::eraseArguments ( ArrayRef< unsigned argIndices)

Erases the arguments listed in argIndices and removes them from the argument list.

argIndices is allowed to have duplicates and can be in any order.

Definition at line 216 of file Block.cpp.

References getNumArguments().

Referenced by eraseArguments(), mlir::function_like_impl::eraseFunctionArguments(), inlineIfCase(), and mlir::scf::tileParallelLoop().

◆ eraseArguments() [2/3]

void Block::eraseArguments ( const llvm::BitVector &  eraseIndices)

Erases the arguments that have their corresponding bit set in eraseIndices and removes them from the argument list.

Definition at line 223 of file Block.cpp.

References eraseArguments(), and mlir::BlockArgument::getArgNumber().

◆ eraseArguments() [3/3]

void Block::eraseArguments ( function_ref< bool(BlockArgument)>  shouldEraseFn)

Erases arguments using the given predicate.

If the predicate returns true, that argument is erased.

Definition at line 228 of file Block.cpp.

◆ findAncestorOpInBlock()

Operation * Block::findAncestorOpInBlock ( Operation op)

Returns 'op' if 'op' lies in this block, or otherwise finds the ancestor operation of 'op' that lies in this block.

Returns nullptr if the latter fails. TODO: This is very specific functionality that should live somewhere else, probably in Dominance.cpp.

Returns nullptr if the latter fails.

Definition at line 62 of file Block.cpp.

References mlir::Operation::getParentOp().

Referenced by mlir::BufferPlacementAllocs::getStartOperation(), and walkReferenceCountedValues().

◆ front()

Operation& mlir::Block::front ( )
inline

◆ getArgument()

BlockArgument mlir::Block::getArgument ( unsigned  i)
inline

◆ getArguments()

BlockArgListType mlir::Block::getArguments ( )
inline

◆ getArgumentTypes()

auto Block::getArgumentTypes ( )

Return a range containing the types of the arguments for this block.

Definition at line 137 of file Block.cpp.

References getArguments().

Referenced by mlir::TypeConverter::convertBlockSignature(), mlir::TypeConverter::isLegal(), mlir::runRegionDCE(), verify(), and verifyReductionDeclareOp().

◆ getNumArguments()

unsigned mlir::Block::getNumArguments ( )
inline

◆ getNumSuccessors()

unsigned Block::getNumSuccessors ( )

◆ getOperations()

OpListType& mlir::Block::getOperations ( )
inline

◆ getOps()

template<typename OpT >
iterator_range<op_iterator<OpT> > mlir::Block::getOps ( )
inline

Return an iterator range over the operations within this block that are of 'OpT'.

Definition at line 185 of file Block.h.

Referenced by castBoolToIntN(), getBuiltinVariable(), getPushConstantVariable(), updateExpandedGenericOpRegion(), and verify().

◆ getParent()

Region * Block::getParent ( ) const

Provide a 'getParent' method for ilist_node_with_parent methods.

We mark it as a const function because ilist_node_with_parent specifically requires a 'getParent() const' method. Once ilist_node removes this constraint, we should drop the const to fit the rest of the MLIR const model.

Definition at line 26 of file Block.cpp.

Referenced by llvm::ilist_traits<::mlir::Block >::addNodeToList(), buildUnresolvedTargetMaterialization(), mlir::RewriterBase::cloneRegionBefore(), collectUnderlyingAddressValues(), mlir::OpBuilder::createBlock(), createSwitchOp(), diagnoseInvalidOperandDominance(), ensureDistinctSuccessors(), erase(), mlir::Region::findAncestorBlockInRegion(), mlir::detail::DominanceInfoBase< true >::findNearestCommonDominator(), generateCopy(), getBlockNumber(), mlir::getForInductionVarOwner(), getInsertionRegion(), mlir::detail::DominanceInfoBase< true >::getNode(), getParentOp(), mlir::Operation::getParentRegion(), mlir::detail::DominanceInfoBase< true >::hasSSADominance(), mlir::RewriterBase::inlineRegionBefore(), inlineRegionImpl(), insertBefore(), mlir::scf::insideMutuallyExclusiveBranches(), isEntryBlock(), mlir::detail::DominanceInfoBase< true >::isReachableFromEntry(), mayBeValidWithoutTerminator(), moveBefore(), mlir::detail::ConversionPatternRewriterImpl::notifyBlockIsBeingErased(), mlir::AsmPrinter::Impl::printIntegerSet(), mlir::detail::DominanceInfoBase< true >::properlyDominates(), llvm::ilist_traits<::mlir::Block >::removeNodeFromList(), splitBlock(), mlir::SuccessorRange::SuccessorRange(), tryGetBlocksInSameRegion(), validateSupportedControlFlow(), and walkReferenceCountedValues().

◆ getParentOp()

Operation * Block::getParentOp ( )

◆ getPredecessors()

iterator_range<pred_iterator> mlir::Block::getPredecessors ( )
inline

◆ getSinglePredecessor()

Block * Block::getSinglePredecessor ( )

If this block has exactly one predecessor, return it.

Otherwise, return null.

Note that if a block has duplicate predecessors from a single block (e.g. if you have a conditional branch with the same block as the true/false destinations) is not considered to be a single predecessor.

Otherwise, return null.

Note that multiple edges from a single block (e.g. if you have a cond branch with the same block as the true/false destinations) is not considered to be a single predecessor.

Definition at line 278 of file Block.cpp.

References pred_begin(), and pred_end().

Referenced by getI1SameShape(), mlir::AsmPrinter::Impl::printIntegerSet(), simplifySwitchFromDefaultSwitchOnSameCondition(), and simplifySwitchFromSwitchOnSameCondition().

◆ getSublistAccess()

static OpListType Block::* mlir::Block::getSublistAccess ( Operation )
inlinestatic

Returns pointer to member of operation list.

Definition at line 337 of file Block.h.

References print(), and mlir::LLVM::detail::printType().

Referenced by llvm::ilist_traits<::mlir::Operation >::deleteNode().

◆ getSuccessor()

Block * Block::getSuccessor ( unsigned  i)

◆ getSuccessors()

SuccessorRange mlir::Block::getSuccessors ( )
inline

◆ getTerminator()

Operation * Block::getTerminator ( )

◆ getUniquePredecessor()

Block * Block::getUniquePredecessor ( )

If this block has a unique predecessor, i.e., all incoming edges originate from one block, return it.

Otherwise, return null.

Definition at line 289 of file Block.cpp.

References pred_begin(), and pred_end().

Referenced by getI1SameShape().

◆ hasNoPredecessors()

bool mlir::Block::hasNoPredecessors ( )
inline

Return true if this block has no predecessors.

Definition at line 231 of file Block.h.

Referenced by getLspDiagnoticFromDiag(), mlir::RewriterBase::mergeBlockBefore(), and mlir::AsmPrinter::Impl::printIntegerSet().

◆ hasNoSuccessors()

bool mlir::Block::hasNoSuccessors ( )
inline

Returns true if this blocks has no successors.

Definition at line 234 of file Block.h.

Referenced by getLspDiagnoticFromDiag(), and mlir::RewriterBase::mergeBlockBefore().

◆ insertArgument() [1/2]

BlockArgument Block::insertArgument ( args_iterator  it,
Type  type,
Optional< Location loc = {} 
)

Insert one value to the position in the argument list indicated by the given iterator.

Insert one value to the given position of the argument list.

The existing arguments are shifted. The block is expected not to have predecessors.

Definition at line 201 of file Block.cpp.

References getPredecessors().

Referenced by foldMemRefCastInTiledLoopOp(), mlir::Region::insertArgument(), and mlir::function_like_impl::insertFunctionArguments().

◆ insertArgument() [2/2]

BlockArgument Block::insertArgument ( unsigned  index,
Type  type,
Optional< Location loc = {} 
)

Add one value to the argument list at the specified position.

Definition at line 177 of file Block.cpp.

References mlir::Type::getContext(), and getParentOp().

◆ insertBefore()

void Block::insertBefore ( Block block)

Insert this block (which must not already be in a region) right before the specified block.

Definition at line 39 of file Block.cpp.

References mlir::Region::getBlocks(), and getParent().

◆ invalidateOpOrder()

void Block::invalidateOpOrder ( )

Invalidates the current ordering of operations.

Definition at line 95 of file Block.cpp.

References verifyOpOrder().

Referenced by llvm::ilist_traits<::mlir::Operation >::transferNodesFromList().

◆ isEntryBlock()

bool Block::isEntryBlock ( )

Return if this block is the entry block in the parent region.

Definition at line 35 of file Block.cpp.

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

Referenced by collectUnderlyingAddressValues(), getPhiIncomingBlock(), hasAllocationScope(), and isFnEntryBlock().

◆ isOpOrderValid()

bool Block::isOpOrderValid ( )

Returns true if the ordering of the child operations is valid, false otherwise.

Definition at line 92 of file Block.cpp.

Referenced by mlir::Operation::isBeforeInBlock(), and verifyOpOrder().

◆ moveBefore()

void Block::moveBefore ( Block block)

Unlink this block from its current region and insert it right before the specific block.

Definition at line 47 of file Block.cpp.

References mlir::Region::getBlocks(), and getParent().

Referenced by buildUnresolvedTargetMaterialization(), and walkReferenceCountedValues().

◆ op_begin()

template<typename OpT >
op_iterator<OpT> mlir::Block::op_begin ( )
inline

Definition at line 191 of file Block.h.

◆ op_end()

template<typename OpT >
op_iterator<OpT> mlir::Block::op_end ( )
inline

Definition at line 195 of file Block.h.

◆ pred_begin()

pred_iterator mlir::Block::pred_begin ( )
inline

◆ pred_end()

pred_iterator mlir::Block::pred_end ( )
inline

◆ print() [1/2]

void Block::print ( raw_ostream &  os)

Definition at line 2857 of file AsmPrinter.cpp.

References mlir::Operation::getParentOp(), and print().

Referenced by mlir::spirv::Deserializer::collect().

◆ print() [2/2]

void Block::print ( raw_ostream &  os,
AsmState state 
)

Definition at line 2870 of file AsmPrinter.cpp.

References mlir::AsmState::getImpl(), and print().

◆ printAsOperand() [1/2]

void Block::printAsOperand ( raw_ostream &  os,
bool  printType = true 
)

Print out the name of the block without printing its body.

NOTE: The printType argument is ignored. We keep it for compatibility with LLVM dominator machinery that expects it to exist.

Definition at line 2877 of file AsmPrinter.cpp.

◆ printAsOperand() [2/2]

void Block::printAsOperand ( raw_ostream &  os,
AsmState state 
)

Definition at line 2886 of file AsmPrinter.cpp.

References mlir::AsmState::getImpl().

◆ push_back()

void mlir::Block::push_back ( Operation op)
inline

◆ push_front()

void mlir::Block::push_front ( Operation op)
inline

Definition at line 142 of file Block.h.

◆ rbegin()

reverse_iterator mlir::Block::rbegin ( )
inline

Definition at line 137 of file Block.h.

◆ recomputeOpOrder()

void Block::recomputeOpOrder ( )

Recomputes the ordering of child operations within the block.

Definition at line 124 of file Block.cpp.

Referenced by mlir::Operation::isBeforeInBlock().

◆ rend()

reverse_iterator mlir::Block::rend ( )
inline

Definition at line 138 of file Block.h.

◆ splitBlock() [1/2]

Block * Block::splitBlock ( iterator  splitBefore)

Split the block into two blocks before the specified operation or iterator.

Note that all operations BEFORE the specified iterator stay as part of the original basic block, and the rest of the operations in the original block are moved to the new block, including the old terminator. The original block is left without a terminator.

The newly formed Block is returned, and the specified iterator is invalidated.

Definition at line 316 of file Block.cpp.

References Block(), end(), mlir::Operation::getBlock(), mlir::Region::getBlocks(), getOperations(), mlir::detail::IROperandBase::getOwner(), getParent(), and value.

Referenced by buildUnresolvedTargetMaterialization(), mlir::spirv::Deserializer::collect(), inlineRegionImpl(), setupCoroMachinery(), sourceMaterializationCallback(), and mlir::RewriterBase::splitBlock().

◆ splitBlock() [2/2]

Block* mlir::Block::splitBlock ( Operation splitBeforeOp)
inline

Definition at line 332 of file Block.h.

◆ succ_begin()

succ_iterator mlir::Block::succ_begin ( )
inline

◆ succ_end()

succ_iterator mlir::Block::succ_end ( )
inline

◆ verifyOpOrder()

bool Block::verifyOpOrder ( )

Verifies the current ordering of child operations matches the validOpOrder flag.

Verifies the current ordering of child operations.

Returns false if the order is valid, true otherwise.

Definition at line 103 of file Block.cpp.

References isOpOrderValid().

Referenced by invalidateOpOrder(), and ~Block().

◆ walk() [1/3]

template<WalkOrder Order = WalkOrder::PostOrder, typename FnT , typename RetT = detail::walkResultType<FnT>>
RetT mlir::Block::walk ( FnT &&  callback)
inline

Walk the operations in this block.

The callback method is called for each nested region, block or operation, depending on the callback provided. Regions, blocks and operations at the same nesting level are visited in lexicographical order. The walk order for enclosing regions, blocks and operations with respect to their nested ones is specified by 'Order' (post-order by default). A callback on a block or operation is allowed to erase that block or operation if either:

  • the walk is in post-order, or
  • the walk is in pre-order and the walk is skipped after the erasure. See Operation::walk for more details.

Definition at line 274 of file Block.h.

References value.

Referenced by getMemoryFootprintBytes(), and mlir::Region::walk().

◆ walk() [2/3]

template<WalkOrder Order = WalkOrder::PostOrder, typename FnT , typename RetT = detail::walkResultType<FnT>>
std::enable_if<std::is_same<RetT, void>::value, RetT>::type mlir::Block::walk ( Block::iterator  begin,
Block::iterator  end,
FnT &&  callback 
)
inline

Walk the operations in the specified [begin, end) range of this block.

The callback method is called for each nested region, block or operation, depending on the callback provided. Regions, blocks and operations at the same nesting level are visited in lexicographical order. The walk order for enclosing regions, blocks and operations with respect to their nested ones is specified by 'Order' (post-order by default). This method is invoked for void-returning callbacks. A callback on a block or operation is allowed to erase that block or operation only if the walk is in post-order. See non-void method for pre-order erasure. See Operation::walk for more details.

Definition at line 291 of file Block.h.

References value.

◆ walk() [3/3]

template<WalkOrder Order = WalkOrder::PostOrder, typename FnT , typename RetT = detail::walkResultType<FnT>>
std::enable_if<std::is_same<RetT, WalkResult>::value, RetT>::type mlir::Block::walk ( Block::iterator  begin,
Block::iterator  end,
FnT &&  callback 
)
inline

Walk the operations in the specified [begin, end) range of this block.

The callback method is called for each nested region, block or operation, depending on the callback provided. Regions, blocks and operations at the same nesting level are visited in lexicographical order. The walk order for enclosing regions, blocks and operations with respect to their nested ones is specified by 'Order' (post-order by default). This method is invoked for skippable or interruptible callbacks. A callback on a block or operation is allowed to erase that block or operation if either:

  • the walk is in post-order, or
  • the walk is in pre-order and the walk is skipped after the erasure. See Operation::walk for more details.

Definition at line 310 of file Block.h.

◆ without_terminator()

iterator_range<iterator> mlir::Block::without_terminator ( )
inline

Return an iterator range over the operation within this block excluding the terminator operation at the end.

Definition at line 201 of file Block.h.

Referenced by mlir::scf::getParallelForInductionVarOwner(), mlir::linalg::RegionMatcher::matchAsScalarBinaryOp(), matchSimpleAtomicOp(), mlir::outlineIfOp(), processParallelLoop(), and verify().

Friends And Related Function Documentation

◆ llvm::ilist_traits< Block >

friend struct llvm::ilist_traits< Block >
friend

Definition at line 365 of file Block.h.


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