MLIR
17.0.0git
|
Block
represents an ordered list of Operation
s.
More...
#include "mlir/IR/Block.h"
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 |
![]() | |
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 ()=default | |
~Block () | |
void | clear () |
Region * | getParent () const |
Provide a 'getParent' method for ilist_node_with_parent methods. More... | |
Operation * | getParentOp () |
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< BlockArgListType > | getArgumentTypes () |
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, Location loc) |
Add one value to the argument list. More... | |
BlockArgument | insertArgument (args_iterator it, Type type, Location loc) |
Insert one value to the position in the argument list indicated by the given iterator. More... | |
iterator_range< args_iterator > | addArguments (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, 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 (unsigned start, unsigned num) |
Erases 'num' arguments from the index 'start'. More... | |
void | eraseArguments (const 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) |
OpListType & | getOperations () |
iterator | begin () |
iterator | end () |
reverse_iterator | rbegin () |
reverse_iterator | rend () |
bool | empty () |
void | push_back (Operation *op) |
void | push_front (Operation *op) |
Operation & | back () |
Operation & | front () |
Operation * | findAncestorOpInBlock (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< iterator > | without_terminator () |
Return an iterator range over the operation within this block excluding the terminator operation at the end. More... | |
Operation * | getTerminator () |
Get the terminator operation of this block. More... | |
pred_iterator | pred_begin () |
pred_iterator | pred_end () |
iterator_range< pred_iterator > | getPredecessors () |
bool | hasNoPredecessors () |
Return true if this block has no predecessors. More... | |
bool | hasNoSuccessors () |
Returns true if this blocks has no successors. More... | |
Block * | getSinglePredecessor () |
If this block has exactly one predecessor, return it. More... | |
Block * | getUniquePredecessor () |
If this block has a unique predecessor, i.e., all incoming edges originate from one block, return it. More... | |
unsigned | getNumSuccessors () |
Block * | getSuccessor (unsigned i) |
succ_iterator | succ_begin () |
succ_iterator | succ_end () |
SuccessorRange | getSuccessors () |
template<WalkOrder Order = WalkOrder::PostOrder, typename Iterator = ForwardIterator, typename FnT , typename RetT = detail::walkResultType<FnT>> | |
RetT | walk (FnT &&callback) |
Walk the operations in this block. More... | |
template<WalkOrder Order = WalkOrder::PostOrder, typename Iterator = ForwardIterator, typename FnT , typename RetT = detail::walkResultType<FnT>> | |
std::enable_if_t< std::is_same< RetT, void >::value, RetT > | 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 Iterator = ForwardIterator, typename FnT , typename RetT = detail::walkResultType<FnT>> | |
std::enable_if_t< std::is_same< RetT, WalkResult >::value, RetT > | walk (Block::iterator begin, Block::iterator end, FnT &&callback) |
Walk the operations in the specified [begin, end) range of this block. More... | |
Block * | splitBlock (iterator splitBefore) |
Split the block into two blocks before the specified operation or iterator. More... | |
Block * | splitBlock (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) |
![]() | |
~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... | |
void | shuffleUseList (ArrayRef< unsigned > indices) |
Shuffle the use-list chain according to the provided indices vector, which need to represent a valid shuffle. 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 | |
![]() | |
IRObjectWithUseList ()=default | |
BlockOperand * | getFirstUse () const |
Return the first operand that is using this value, for use by custom use/def iterators. More... | |
using mlir::Block::args_iterator = BlockArgListType::iterator |
using mlir::Block::iterator = OpListType::iterator |
using mlir::Block::op_iterator = detail::op_iterator<OpT, iterator> |
using mlir::Block::OpListType = llvm::iplist<Operation> |
using mlir::Block::reverse_args_iterator = BlockArgListType::reverse_iterator |
using mlir::Block::reverse_iterator = OpListType::reverse_iterator |
using mlir::Block::succ_iterator = SuccessorRange::iterator |
|
explicitdefault |
Referenced by splitBlock().
Block::~Block | ( | ) |
Definition at line 19 of file Block.cpp.
References clear(), and verifyOpOrder().
BlockArgument Block::addArgument | ( | Type | type, |
Location | loc | ||
) |
Add one value to the argument list.
Definition at line 141 of file Block.cpp.
Referenced by mlir::Region::addArgument(), addBodyWithPayloadOp(), mlir::Region::cloneInto(), ensureDistinctSuccessors(), generateFusedElementwiseOpRegion(), and mlirBlockCreate().
Add one argument to the argument list for each type specified in the list.
locs
is required to have the same number of elements as types
.
Definition at line 148 of file Block.cpp.
Referenced by mlir::Region::addArguments(), and mlir::OpBuilder::createBlock().
|
inline |
Definition at line 83 of file Block.h.
References getArguments().
|
inline |
Definition at line 88 of file Block.h.
Referenced by collapseBranch().
|
inline |
Definition at line 84 of file Block.h.
References getArguments().
|
inline |
Definition at line 85 of file Block.h.
References getArguments().
|
inline |
Definition at line 86 of file Block.h.
References getArguments().
|
inline |
Definition at line 141 of file Block.h.
Referenced by addAtomicRMW(), createDecl(), ensureDistinctSuccessors(), mlir::impl::ensureRegionTerminator(), getNumSuccessors(), getTerminator(), hasOneBranchOpTo(), inlineConvertOmpRegions(), insertCopies(), matchSelectReduction(), matchSimpleReduction(), mlirBlockGetTerminator(), mlir::sortTopologically(), and mlir::SuccessorRange::SuccessorRange().
|
inline |
Definition at line 132 of file Block.h.
Referenced by mlir::OpBuilder::atBlockBegin(), mlir::ImplicitLocOpBuilder::atBlockBegin(), mlir::OpTrait::SingleBlock< ConcreteType >::begin(), buildUnresolvedTargetMaterialization(), collapseBranch(), convertOmpAtomicCapture(), convertOmpAtomicUpdate(), findHighestBlockForPlacement(), generateUnrolledLoop(), getMemoryFootprintBytes(), getOps(), mlir::affine::getPerfectlyNestedLoops(), getPerfectlyNestedLoopsImpl(), handleInlinedAllocas(), isMergeBlock(), matchSelectReduction(), matchSimpleReduction(), mlirBlockInsertOwnedOperationAfter(), op_begin(), mlir::OpBuilder::OpBuilder(), promoteIfBlock(), rewriteOneForallCommonImpl(), mlir::OpBuilder::setInsertionPointToStart(), mlir::detail::ConversionPatternRewriterImpl::undoBlockActions(), JamBlockGatherer::walk(), walk(), and without_terminator().
|
inline |
Definition at line 35 of file Block.h.
References dropAllReferences(), and empty().
Referenced by ~Block().
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 getArguments().
Referenced by mlir::Operation::dropAllDefinedValueUses().
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 clear(), and mlir::Region::dropAllReferences().
void Block::dump | ( | ) |
Definition at line 3748 of file AsmPrinter.cpp.
References print().
|
inline |
Definition at line 137 of file Block.h.
Referenced by clear(), ensureDistinctSuccessors(), mlir::impl::ensureRegionTerminator(), getNumSuccessors(), getTerminator(), insertArgument(), isMergeBlock(), matchSelectReduction(), matchSimpleReduction(), mlirBlockGetFirstOperation(), mlirBlockGetTerminator(), mlir::sortTopologically(), and mlir::SuccessorRange::SuccessorRange().
|
inline |
Definition at line 133 of file Block.h.
Referenced by mlir::OpBuilder::atBlockEnd(), mlir::ImplicitLocOpBuilder::atBlockEnd(), collapseBranch(), mlir::OpTrait::SingleBlock< ConcreteType >::end(), generateUnrolledLoop(), getOps(), mlir::affine::getPerfectlyNestedLoops(), getPerfectlyNestedLoopsImpl(), mlir::RewriterBase::inlineBlockBefore(), isMergeBlock(), matchSelectReduction(), matchSimpleReduction(), mlir::RewriterBase::mergeBlocks(), mlir::Operation::moveAfter(), op_begin(), op_end(), promoteIfBlock(), mlir::replaceLoopWithNewYields(), mlir::affine::separateFullTiles(), mlir::OpBuilder::setInsertionPointToEnd(), splitBlock(), JamBlockGatherer::walk(), walk(), and without_terminator().
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 mlir::RewriterBase::inlineBlockBefore().
void Block::eraseArgument | ( | unsigned | index | ) |
Erase the argument at 'index' and remove it from the argument list.
Definition at line 181 of file Block.cpp.
Referenced by mlir::Region::eraseArgument().
void Block::eraseArguments | ( | const BitVector & | eraseIndices | ) |
Erases the arguments that have their corresponding bit set in eraseIndices
and removes them from the argument list.
Definition at line 198 of file Block.cpp.
References eraseArguments(), and mlir::BlockArgument::getArgNumber().
void Block::eraseArguments | ( | function_ref< bool(BlockArgument)> | shouldEraseFn | ) |
void Block::eraseArguments | ( | unsigned | start, |
unsigned | num | ||
) |
Erases 'num' arguments from the index 'start'.
Definition at line 189 of file Block.cpp.
Referenced by eraseArguments(), and inlineIfCase().
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.
Referenced by mlir::bufferization::BufferPlacementAllocs::getStartOperation(), happensBefore(), hasReadAfterWriteInterference(), neededValuesDominateInsertionPoint(), and srcAppearsBeforeDstInAncestralBlock().
|
inline |
Definition at line 142 of file Block.h.
Referenced by mlir::linalg::collapseGenericOpIterationDims(), mlir::LLVM::ModuleTranslation::convertBlock(), mlir::lsp::MLIRServer::convertFromBytecode(), declareReduction(), generateFusedElementwiseOpRegion(), llvm::GraphTraits< Inverse< mlir::Region * > >::getEntryNode(), mlir::affine::getPerfectlyNestedLoops(), getPerfectlyNestedLoopsImpl(), isMergeBlock(), mlir::linalg::PadOpTransformationPattern::matchAndRewrite(), matchSelectReduction(), matchSimpleReduction(), mlirBlockGetFirstOperation(), modifyFuncOpToUseBarePtrCallingConv(), rewriteOneForallCommonImpl(), and setupCoroMachinery().
|
inline |
Definition at line 118 of file Block.h.
Referenced by addAtomicRMW(), buildSequenceBody(), convertOmpReductionOp(), createAsyncDispatchFunction(), createElementFPowIFunc(), createShiftDownFunc(), mlir::sparse_tensor::LoopEmitter::enterCoIterationOverTensorsAtLvls(), eraseTerminatorSuccessorOperands(), findPayloadOp(), mlir::detail::getBranchSuccessorArgument(), injectGpuIndexOperations(), isAddMul(), makeAtomicReductionGen(), makeReductionGen(), and outlineKernelFuncImpl().
|
inline |
Definition at line 76 of file Block.h.
Referenced by addBodyWithPayloadOp(), mlir::OneToNPatternRewriter::applySignatureConversion(), args_begin(), args_end(), args_rbegin(), args_rend(), buildGenericRegion(), buildSequenceBody(), mlir::Region::cloneInto(), collapseBranch(), mlir::linalg::collapseGenericOpIterationDims(), mlir::LLVM::ModuleTranslation::convertBlock(), createAsyncDispatchFunction(), createBinarySearchFunc(), createHeapSortFunc(), createPartitionFunc(), createQuickSortFunc(), createShiftDownFunc(), createSortStableFunc(), dropAllDefinedValueUses(), ensureDistinctSuccessors(), mlir::sparse_tensor::LoopEmitter::enterCoIterationOverTensorsAtLvls(), findPayloadOp(), mlir::sparse_tensor::FuncCallOrInlineGenerator< SubClass >::genCallOrInline(), generateFusedElementwiseOpRegion(), mlir::Region::getArguments(), mlir::RewriterBase::inlineBlockBefore(), inlineIfCase(), inlinePayload(), inlineWhileCase(), mlir::OperationEquivalence::isRegionEquivalentTo(), mlir::makeRegionIsolatedFromAbove(), matchSelectReduction(), matchSimpleReduction(), modifyFuncOpToUseBarePtrCallingConv(), mlir::outlineSingleBlockRegion(), printOperation(), and mlir::replaceLoopWithNewYields().
auto Block::getArgumentTypes | ( | ) |
Return a range containing the types of the arguments for this block.
Definition at line 137 of file Block.cpp.
Referenced by mlir::TypeConverter::convertBlockSignature(), mlir::TypeConverter::isLegal(), and mlir::makeRegionIsolatedFromAbove().
|
inline |
Definition at line 117 of file Block.h.
Referenced by mlir::TypeConverter::convertBlockSignature(), ensureDistinctSuccessors(), mlir::sparse_tensor::LoopEmitter::enterCoIterationOverTensorsAtLvls(), findPayloadOp(), mlir::RewriterBase::inlineBlockBefore(), mlir::ConversionPatternRewriter::inlineBlockBefore(), inlineIfCase(), isAddMul(), mlir::OperationEquivalence::isRegionEquivalentTo(), mlir::makeRegionIsolatedFromAbove(), matchSimpleReduction(), and mlir::outlineSingleBlockRegion().
unsigned Block::getNumSuccessors | ( | ) |
Definition at line 238 of file Block.cpp.
References back(), empty(), and mlir::Operation::getNumSuccessors().
Referenced by getSuccessor().
|
inline |
Definition at line 126 of file Block.h.
Referenced by mlir::affine::affineParallelize(), constructTiledLoopNest(), findPayloadOp(), hoistAffineIfOp(), mlir::RewriterBase::inlineBlockBefore(), mlirBlockInsertOwnedOperationAfter(), mlir::Operation::moveBefore(), processParallelLoop(), promoteIfBlock(), mlir::replaceLoopWithNewYields(), rewriteOneForallCommonImpl(), mlir::affine::separateFullTiles(), setupCoroMachinery(), splitBlock(), and mlir::detail::ConversionPatternRewriterImpl::undoBlockActions().
|
inline |
Return an iterator range over the operations within this block that are of 'OpT'.
Definition at line 182 of file Block.h.
References begin(), and end().
Referenced by generateCollapsedIndexingRegion(), generateFusedElementwiseOpRegion(), getBuiltinVariable(), getPushConstantVariable(), handleInlinedAllocas(), and updateExpandedGenericOpRegion().
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(), mlir::sparse_tensor::Merger::buildExp(), mlir::RewriterBase::cloneRegionBefore(), collectUnderlyingAddressValues(), mlir::OpBuilder::createBlock(), createElementFPowIFunc(), createElementIPowIFunc(), ensureDistinctSuccessors(), erase(), mlir::Region::findAncestorBlockInRegion(), mlir::detail::DominanceInfoBase< IsPostDom >::findNearestCommonDominator(), generateCopy(), getBlockNumber(), mlir::bufferization::getEnclosingRepetitiveRegion(), getInsertionRegion(), mlir::dataflow::CFGEdge::getLoc(), mlir::detail::DominanceInfoBase< IsPostDom >::getNode(), getParentOp(), mlir::Operation::getParentRegion(), handleInlinedAllocas(), mlir::detail::DominanceInfoBase< IsPostDom >::hasSSADominance(), mlir::ReductionNode::initialize(), mlir::RewriterBase::inlineRegionBefore(), insertBefore(), isEntryBlock(), mlir::detail::DominanceInfoBase< IsPostDom >::isReachableFromEntry(), mayBeValidWithoutTerminator(), mlirBlockDetach(), moveBefore(), mlir::detail::ConversionPatternRewriterImpl::notifyBlockIsBeingErased(), printBlock(), mlir::detail::DominanceInfoBase< IsPostDom >::properlyDominates(), mlir::PostDominanceInfo::properlyPostDominates(), llvm::ilist_traits<::mlir::Block >::removeNodeFromList(), splitBlock(), mlir::SuccessorRange::SuccessorRange(), and tryGetBlocksInSameRegion().
Operation * Block::getParentOp | ( | ) |
Returns the closest surrounding operation that contains this block.
Returns the closest surrounding operation that contains this block or nullptr if this block is unlinked.
Definition at line 30 of file Block.cpp.
References getParent(), and mlir::Region::getParentOp().
Referenced by mlir::affine::affineDataCopyGenerate(), buildPackingLoopNestImpl(), checkAndNestUnderRewriteOp(), mlir::sparse_tensor::createFuncCall(), mlir::LLVM::createGlobalString(), emitRemarkForBlock(), finalizeWhileOp(), mlir::Region::findAncestorBlockInRegion(), findHoistableMatchingExtractSlice(), findHoistableMatchingTransferRead(), forwardEmptyOperands(), mlir::transform::detail::forwardTerminatorOperands(), getAncestorBlock(), mlir::Operation::getParentOp(), getParentsOfType(), getPhiIncomingBlock(), hoistExtractInsertSlice(), hoistTransferReadWrite(), isFnEntryBlock(), removeBufferizationAttributes(), mlir::ConversionPatternRewriter::replaceUsesOfBlockArgument(), and tryToEnforceAlignment().
|
inline |
Definition at line 223 of file Block.h.
References pred_begin(), and pred_end().
Referenced by mlir::LLVM::ModuleTranslation::convertBlock(), and insertArgument().
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 253 of file Block.cpp.
References pred_begin(), and pred_end().
|
inlinestatic |
Block * Block::getSuccessor | ( | unsigned | i | ) |
Definition at line 242 of file Block.cpp.
References getNumSuccessors(), mlir::Operation::getSuccessor(), and getTerminator().
Referenced by ensureDistinctSuccessors(), and printOperation().
|
inline |
Definition at line 253 of file Block.h.
Referenced by mergeIdenticalBlocks(), mlir::Liveness::resolveLiveness(), succ_begin(), and succ_end().
Operation * Block::getTerminator | ( | ) |
Get the terminator operation of this block.
This function asserts that the block has a valid terminator operation.
Definition at line 232 of file Block.cpp.
References back(), and empty().
Referenced by mlir::OpBuilder::atBlockTerminator(), mlir::ImplicitLocOpBuilder::atBlockTerminator(), collapseBranch(), containsReturn(), convertOmpAtomicCapture(), convertOmpAtomicUpdate(), ensureDistinctSuccessors(), mlir::transform::detail::forwardTerminatorOperands(), generateUnrolledLoop(), getPHISourceValue(), mlir::bufferization::BufferPlacementAllocs::getStartOperation(), getSuccessor(), inlineIfCase(), inlineWhileCase(), mlir::sparse_tensor::insertYieldOp(), isAddMul(), mlir::linalg::PadOpTransformationPattern::matchAndRewrite(), mlir::outlineSingleBlockRegion(), and mlir::replaceLoopWithNewYields().
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 264 of file Block.cpp.
References pred_begin(), and pred_end().
|
inline |
Return true if this block has no predecessors.
Definition at line 228 of file Block.h.
References pred_begin(), and pred_end().
Referenced by mlir::RewriterBase::inlineBlockBefore().
|
inline |
Returns true if this blocks has no successors.
Definition at line 231 of file Block.h.
References succ_begin(), and succ_end().
Referenced by mlir::RewriterBase::inlineBlockBefore().
BlockArgument Block::insertArgument | ( | args_iterator | it, |
Type | type, | ||
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 175 of file Block.cpp.
References empty(), and getPredecessors().
Referenced by mlir::Region::insertArgument().
BlockArgument Block::insertArgument | ( | unsigned | index, |
Type | type, | ||
Location | loc | ||
) |
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().
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().
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 mlir::LocalAliasAnalysis::aliasImpl(), collectUnderlyingAddressValues(), getPhiIncomingBlock(), and isFnEntryBlock().
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().
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().
|
inline |
|
inline |
|
inline |
Definition at line 219 of file Block.h.
References mlir::IRObjectWithUseList< BlockOperand >::getFirstUse().
Referenced by ableToUpdatePredOperands(), buildBlockMapping(), llvm::GraphTraits< Inverse< mlir::Block * > >::child_begin(), collectUnderlyingAddressValues(), getPredecessors(), getSinglePredecessor(), getUniquePredecessor(), and hasNoPredecessors().
|
inline |
Definition at line 222 of file Block.h.
Referenced by ableToUpdatePredOperands(), buildBlockMapping(), llvm::GraphTraits< Inverse< mlir::Block * > >::child_end(), collectUnderlyingAddressValues(), getPredecessors(), getSinglePredecessor(), getUniquePredecessor(), and hasNoPredecessors().
void Block::print | ( | raw_ostream & | os | ) |
Definition at line 3731 of file AsmPrinter.cpp.
References mlir::Operation::getParentOp(), and print().
Referenced by mlir::operator<<(), mlir::dataflow::CFGEdge::print(), and printBlock().
void Block::print | ( | raw_ostream & | os, |
AsmState & | state | ||
) |
Definition at line 3744 of file AsmPrinter.cpp.
References mlir::AsmState::getImpl().
void Block::printAsOperand | ( | raw_ostream & | os, |
AsmState & | state | ||
) |
Definition at line 3760 of file AsmPrinter.cpp.
References mlir::AsmState::getImpl().
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 3751 of file AsmPrinter.cpp.
|
inline |
Definition at line 138 of file Block.h.
Referenced by ensureDistinctSuccessors().
|
inline |
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().
|
inline |
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 291 of file Block.cpp.
References Block(), end(), mlir::Region::getBlocks(), getOperations(), and getParent().
Referenced by setupCoroMachinery(), mlir::RewriterBase::splitBlock(), and splitBlock().
Definition at line 335 of file Block.h.
References splitBlock().
|
inline |
Definition at line 251 of file Block.h.
References getSuccessors().
Referenced by llvm::GraphTraits< mlir::Block * >::child_begin(), and hasNoSuccessors().
|
inline |
Definition at line 252 of file Block.h.
References getSuccessors().
Referenced by llvm::GraphTraits< mlir::Block * >::child_end(), and hasNoSuccessors().
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().
|
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. The order in which regions, blocks and operations at the same nesting level are visited (e.g., lexicographical or reverse lexicographical order) is determined by 'Iterator'. 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.
|
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. The order in which regions, blocks and operations at the same nesting level are visited (e.g., lexicographical or reverse lexicographical order) is determined by 'Iterator'. 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:
|
inline |
Walk the operations in this block.
The callback method is called for each nested region, block or operation, depending on the callback provided. The order in which regions, blocks and operations at the same nesting level are visited (e.g., lexicographical or reverse lexicographical order) is determined by 'Iterator'. 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:
Definition at line 273 of file Block.h.
References begin(), and end().
Referenced by mlir::affine::affineDataCopyGenerate(), mlir::ConversionPatternRewriter::cloneRegionBefore(), getMemoryFootprintBytes(), and getSingleOpOfType().
|
inline |
Return an iterator range over the operation within this block excluding the terminator operation at the end.
Definition at line 198 of file Block.h.
References begin(), and end().
Referenced by applySequenceBlock(), and mlir::sortTopologically().