MLIR
17.0.0git
|
Operation is the basic unit of execution within MLIR. More...
#include "mlir/IR/Operation.h"
Classes | |
class | CloneOptions |
Class encompassing various options related to cloning an operation. More... | |
class | dialect_attr_iterator |
A utility iterator that filters out non-dialect attributes. More... | |
Public Types | |
using | operand_range = OperandRange |
using | operand_iterator = operand_range::iterator |
using | operand_type_iterator = operand_range::type_iterator |
using | operand_type_range = operand_range::type_range |
using | result_range = ResultRange |
Support result iteration. More... | |
using | result_iterator = result_range::iterator |
using | result_type_iterator = result_range::type_iterator |
Support result type iteration. More... | |
using | result_type_range = result_range::type_range |
using | dialect_attr_range = iterator_range< dialect_attr_iterator > |
using | succ_iterator = SuccessorRange::iterator |
using | use_iterator = result_range::use_iterator |
using | use_range = result_range::use_range |
using | user_iterator = ValueUserIterator< use_iterator, OpOperand > |
using | user_range = iterator_range< user_iterator > |
Public Member Functions | |
OperationName | getName () |
The name of an operation is the key identifier for it. More... | |
std::optional< RegisteredOperationName > | getRegisteredInfo () |
If this operation has a registered operation description, return it. More... | |
bool | isRegistered () |
Returns true if this operation has a registered operation description, otherwise false. More... | |
void | erase () |
Remove this operation from its parent block and delete it. More... | |
void | remove () |
Remove the operation from its parent block, but don't delete it. More... | |
Operation * | clone (IRMapping &mapper, CloneOptions options=CloneOptions::all()) |
Create a deep copy of this operation, remapping any operands that use values outside of the operation using the map that is provided (leaving them alone if no entry is present). More... | |
Operation * | clone (CloneOptions options=CloneOptions::all()) |
Operation * | cloneWithoutRegions (IRMapping &mapper) |
Create a partial copy of this operation without traversing into attached regions. More... | |
Operation * | cloneWithoutRegions () |
Create a partial copy of this operation without traversing into attached regions. More... | |
Block * | getBlock () |
Returns the operation block that contains this operation. More... | |
MLIRContext * | getContext () |
Return the context this operation is associated with. More... | |
Dialect * | getDialect () |
Return the dialect this operation is associated with, or nullptr if the associated dialect is not loaded. More... | |
Location | getLoc () |
The source location the operation was defined or derived from. More... | |
void | setLoc (Location loc) |
Set the source location the operation was defined or derived from. More... | |
Region * | getParentRegion () |
Returns the region to which the instruction belongs. More... | |
Operation * | getParentOp () |
Returns the closest surrounding operation that contains this operation or nullptr if this is a top-level operation. More... | |
template<typename OpTy > | |
OpTy | getParentOfType () |
Return the closest surrounding parent operation that is of type 'OpTy'. More... | |
template<template< typename T > class Trait> | |
Operation * | getParentWithTrait () |
Returns the closest surrounding parent operation with trait Trait . More... | |
bool | isProperAncestor (Operation *other) |
Return true if this operation is a proper ancestor of the other operation. More... | |
bool | isAncestor (Operation *other) |
Return true if this operation is an ancestor of the other operation. More... | |
void | replaceUsesOfWith (Value from, Value to) |
Replace any uses of 'from' with 'to' within this operation. More... | |
template<typename ValuesT > | |
void | replaceAllUsesWith (ValuesT &&values) |
Replace all uses of results of this operation with the provided 'values'. More... | |
void | destroy () |
Destroys this operation and its subclass data. More... | |
void | dropAllReferences () |
This drops all operand uses from this operation, which is an essential step in breaking cyclic dependences between references when they are to be deleted. More... | |
void | dropAllDefinedValueUses () |
Drop uses of all values defined by this operation or its nested regions. More... | |
void | moveBefore (Operation *existingOp) |
Unlink this operation from its current block and insert it right before existingOp which may be in the same or another block in the same function. More... | |
void | moveBefore (Block *block, llvm::iplist< Operation >::iterator iterator) |
Unlink this operation from its current block and insert it right before iterator in the specified block. More... | |
void | moveAfter (Operation *existingOp) |
Unlink this operation from its current block and insert it right after existingOp which may be in the same or another block in the same function. More... | |
void | moveAfter (Block *block, llvm::iplist< Operation >::iterator iterator) |
Unlink this operation from its current block and insert it right after iterator in the specified block. More... | |
bool | isBeforeInBlock (Operation *other) |
Given an operation 'other' that is within the same parent block, return whether the current operation is before 'other' in the operation list of the parent block. More... | |
void | print (raw_ostream &os, const OpPrintingFlags &flags=std::nullopt) |
void | print (raw_ostream &os, AsmState &state) |
void | dump () |
void | setOperands (ValueRange operands) |
Replace the current operands of this operation with the ones provided in 'operands'. More... | |
void | setOperands (unsigned start, unsigned length, ValueRange operands) |
Replace the operands beginning at 'start' and ending at 'start' + 'length' with the ones provided in 'operands'. More... | |
void | insertOperands (unsigned index, ValueRange operands) |
Insert the given operands into the operand list at the given 'index'. More... | |
unsigned | getNumOperands () |
Value | getOperand (unsigned idx) |
void | setOperand (unsigned idx, Value value) |
void | eraseOperand (unsigned idx) |
Erase the operand at position idx . More... | |
void | eraseOperands (unsigned idx, unsigned length=1) |
Erase the operands starting at position idx and ending at position 'idx'+'length'. More... | |
void | eraseOperands (const BitVector &eraseIndices) |
Erases the operands that have their corresponding bit set in eraseIndices and removes them from the operand list. More... | |
operand_iterator | operand_begin () |
operand_iterator | operand_end () |
operand_range | getOperands () |
Returns an iterator on the underlying Value's. More... | |
MutableArrayRef< OpOperand > | getOpOperands () |
OpOperand & | getOpOperand (unsigned idx) |
operand_type_iterator | operand_type_begin () |
operand_type_iterator | operand_type_end () |
operand_type_range | getOperandTypes () |
unsigned | getNumResults () |
Return the number of results held by this operation. More... | |
OpResult | getResult (unsigned idx) |
Get the 'idx'th result of this operation. More... | |
result_iterator | result_begin () |
result_iterator | result_end () |
result_range | getResults () |
result_range | getOpResults () |
OpResult | getOpResult (unsigned idx) |
result_type_iterator | result_type_begin () |
result_type_iterator | result_type_end () |
result_type_range | getResultTypes () |
ArrayRef< NamedAttribute > | getAttrs () |
Return all of the attributes on this operation. More... | |
DictionaryAttr | getAttrDictionary () |
Return all of the attributes on this operation as a DictionaryAttr. More... | |
void | setAttrs (DictionaryAttr newAttrs) |
Set the attribute dictionary on this operation. More... | |
void | setAttrs (ArrayRef< NamedAttribute > newAttrs) |
Attribute | getAttr (StringAttr name) |
Return the specified attribute if present, null otherwise. More... | |
Attribute | getAttr (StringRef name) |
template<typename AttrClass > | |
AttrClass | getAttrOfType (StringAttr name) |
template<typename AttrClass > | |
AttrClass | getAttrOfType (StringRef name) |
bool | hasAttr (StringAttr name) |
Return true if the operation has an attribute with the provided name, false otherwise. More... | |
bool | hasAttr (StringRef name) |
template<typename AttrClass , typename NameT > | |
bool | hasAttrOfType (NameT &&name) |
void | setAttr (StringAttr name, Attribute value) |
If the an attribute exists with the specified name, change it to the new value. More... | |
void | setAttr (StringRef name, Attribute value) |
Attribute | removeAttr (StringAttr name) |
Remove the attribute with the specified name if it exists. More... | |
Attribute | removeAttr (StringRef name) |
dialect_attr_range | getDialectAttrs () |
Return a range corresponding to the dialect attributes for this operation. More... | |
dialect_attr_iterator | dialect_attr_begin () |
dialect_attr_iterator | dialect_attr_end () |
template<typename DialectAttrT > | |
void | setDialectAttrs (DialectAttrT &&dialectAttrs) |
Set the dialect attributes for this operation, and preserve all dependent. More... | |
void | populateDefaultAttrs () |
Sets default attributes on unset attributes. More... | |
unsigned | getNumRegions () |
Returns the number of regions held by this operation. More... | |
MutableArrayRef< Region > | getRegions () |
Returns the regions held by this operation. More... | |
Region & | getRegion (unsigned index) |
Returns the region held by this operation at position 'index'. More... | |
MutableArrayRef< BlockOperand > | getBlockOperands () |
succ_iterator | successor_begin () |
succ_iterator | successor_end () |
SuccessorRange | getSuccessors () |
bool | hasSuccessors () |
unsigned | getNumSuccessors () |
Block * | getSuccessor (unsigned index) |
void | setSuccessor (Block *block, unsigned index) |
LogicalResult | fold (ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results) |
Attempt to fold this operation with the specified constant operand values. More... | |
template<template< typename T > class Trait> | |
bool | hasTrait () |
Returns true if the operation was registered with a particular trait, e.g. More... | |
template<template< typename T > class Trait> | |
bool | mightHaveTrait () |
Returns true if the operation might have the provided trait. More... | |
template<WalkOrder Order = WalkOrder::PostOrder, typename FnT , typename RetT = detail::walkResultType<FnT>> | |
std::enable_if_t< llvm::function_traits< std::decay_t< FnT > >::num_args==1, RetT > | walk (FnT &&callback) |
Walk the operation by calling the callback for each nested operation (including this one), block or region, depending on the callback provided. More... | |
template<typename FnT , typename RetT = detail::walkResultType<FnT>> | |
std::enable_if_t< llvm::function_traits< std::decay_t< FnT > >::num_args==2, RetT > | walk (FnT &&callback) |
Generic walker with a stage aware callback. More... | |
void | dropAllUses () |
Drop all uses of results of this operation. More... | |
use_iterator | use_begin () |
use_iterator | use_end () |
use_range | getUses () |
Returns a range of all uses, which is useful for iterating over all uses. More... | |
bool | hasOneUse () |
Returns true if this operation has exactly one use. More... | |
bool | use_empty () |
Returns true if this operation has no uses. More... | |
bool | isUsedOutsideOfBlock (Block *block) |
Returns true if the results of this operation are used outside of the given block. More... | |
user_iterator | user_begin () |
user_iterator | user_end () |
user_range | getUsers () |
Returns a range of all users. More... | |
InFlightDiagnostic | emitOpError (const Twine &message={}) |
Emit an error with the op name prefixed, like "'dim' op " which is convenient for verifiers. More... | |
InFlightDiagnostic | emitError (const Twine &message={}) |
Emit an error about fatal conditions with this operation, reporting up to any diagnostic handlers that may be listening. More... | |
InFlightDiagnostic | emitWarning (const Twine &message={}) |
Emit a warning about this operation, reporting up to any diagnostic handlers that may be listening. More... | |
InFlightDiagnostic | emitRemark (const Twine &message={}) |
Emit a remark about this operation, reporting up to any diagnostic handlers that may be listening. More... | |
Static Public Member Functions | |
static Operation * | create (Location location, OperationName name, TypeRange resultTypes, ValueRange operands, NamedAttrList &&attributes, BlockRange successors, unsigned numRegions) |
Create a new Operation with the specific fields. More... | |
static Operation * | create (const OperationState &state) |
Create a new Operation from the fields stored in state . More... | |
static Operation * | create (Location location, OperationName name, TypeRange resultTypes, ValueRange operands, NamedAttrList &&attributes, BlockRange successors={}, RegionRange regions={}) |
Create a new Operation with the specific fields. More... | |
Friends | |
struct | llvm::ilist_traits< Operation > |
class | Block |
class | Value |
class | llvm::ilist_node_with_parent< Operation, Block > |
Operation is the basic unit of execution within MLIR.
The following documentation are recommended to understand this class:
An Operation is defined first by its name, which is a unique string. The name is interpreted so that if it contains a '.' character, the part before is the dialect name this operation belongs to, and everything that follows is this operation name within the dialect.
An Operation defines zero or more SSA Value
that we refer to as the Operation results. This array of Value is actually stored in memory before the Operation itself in reverse order. That is for an Operation with 3 results we allocate the following memory layout:
[Result2, Result1, Result0, Operation] ^ this is where Operation*
pointer points to.
A consequence of this is that this class must be heap allocated, which is handled by the various create
methods. Each result contains:
OpOperand
)ValueImpl
, and more precisely as the only two subclasses of OpResultImpl
: InlineOpResult
and OutOfLineOpResult
. The former is used for the first 5 results and the latter for the subsequent ones. They differ in how they store their index: the first 5 results only need 3 bits and thus are packed with the Type pointer, while the subsequent one have an extra unsigned
value and thus need more space.An Operation also has zero or more operands: these are uses of SSA Value, which can be the results of other operations or Block arguments. Each of these uses is an instance of OpOperand
. This optional array is initially tail allocated with the operation class itself, but can be dynamically moved out-of-line in a dynamic allocation as needed.
An Operation may contain optionally one or multiple Regions, stored in a tail allocated array. Each Region
is a list of Blocks. Each Block
is itself a list of Operations. This structure is effectively forming a tree.
Some operations like branches also refer to other Block, in which case they would have an array of BlockOperand
.
Finally an Operation also contain an optional DictionaryAttr
, a Location, and a pointer to its parent Block (if any).
Definition at line 72 of file Operation.h.
Definition at line 479 of file Operation.h.
using mlir::Operation::operand_iterator = operand_range::iterator |
Definition at line 333 of file Operation.h.
Definition at line 332 of file Operation.h.
Definition at line 354 of file Operation.h.
Definition at line 355 of file Operation.h.
using mlir::Operation::result_iterator = result_range::iterator |
Definition at line 372 of file Operation.h.
Support result iteration.
Definition at line 371 of file Operation.h.
Support result type iteration.
Definition at line 385 of file Operation.h.
Definition at line 386 of file Operation.h.
using mlir::Operation::succ_iterator = SuccessorRange::iterator |
Definition at line 546 of file Operation.h.
Definition at line 662 of file Operation.h.
Definition at line 663 of file Operation.h.
Definition at line 689 of file Operation.h.
Definition at line 690 of file Operation.h.
Operation * Operation::clone | ( | CloneOptions | options = CloneOptions::all() | ) |
Definition at line 590 of file Operation.cpp.
Operation * Operation::clone | ( | IRMapping & | mapper, |
CloneOptions | options = CloneOptions::all() |
||
) |
Create a deep copy of this operation, remapping any operands that use values outside of the operation using the map that is provided (leaving them alone if no entry is present).
Replaces references to cloned sub-operations to the corresponding operation that is copied, and adds those mappings to the map. Optionally, one may configure what parts of the operation to clone using the options parameter.
Calling this method from multiple threads is generally safe if through the process of cloning no new uses of 'Value's from outside the operation are created. Cloning an isolated-from-above operation with no operands, such as top level function operations, is therefore always safe. Using the mapper, it is possible to avoid adding uses to outside operands by remapping them to 'Value's owned by the caller thread.
Replaces references to cloned sub-operations to the corresponding operation that is copied, and adds those mappings to the map.
Definition at line 556 of file Operation.cpp.
References mlir::Region::cloneInto(), create(), getLoc(), getName(), getNumOperands(), getNumRegions(), getNumResults(), getNumSuccessors(), getOperands(), getRegion(), getResult(), getResultTypes(), getSuccessors(), mlir::IRMapping::lookupOrDefault(), mlir::IRMapping::map(), and options.
Referenced by clone(), mlir::OpBuilder::clone(), cloneWithoutRegions(), generateUnrolledLoop(), specializeForLoopForUnrolling(), specializeParallelLoopForUnrolling(), and mlir::linalg::splitReductionByScaling().
Operation * Operation::cloneWithoutRegions | ( | ) |
Create a partial copy of this operation without traversing into attached regions.
The new operation will have the same number of regions as the original one, but they will be left empty.
Definition at line 546 of file Operation.cpp.
Create a partial copy of this operation without traversing into attached regions.
Create a deep copy of this operation but keep the operation regions empty.
The new operation will have the same number of regions as the original one, but they will be left empty. Operands are remapped using mapper
(if present), and mapper
is updated to contain the results.
Operands are remapped using mapper
(if present), and mapper
is updated to contain the results. The mapResults
flag specifies whether the results of the cloned operation should be added to the map.
Definition at line 542 of file Operation.cpp.
References mlir::Operation::CloneOptions::all(), and clone().
Referenced by mlir::OpBuilder::cloneWithoutRegions().
|
static |
Create a new Operation from the fields stored in state
.
Create a new Operation from operation state.
Definition at line 27 of file Operation.cpp.
References mlir::OperationState::attributes, create(), mlir::OperationState::getContext(), mlir::NamedAttrList::getDictionary(), mlir::OperationState::location, mlir::OperationState::name, mlir::OperationState::operands, mlir::OperationState::regions, mlir::OperationState::successors, and mlir::OperationState::types.
|
static |
Create a new Operation with the specific fields.
Overload of create that takes an existing DictionaryAttr to avoid unnecessarily uniquing a list of attributes.
Definition at line 49 of file Operation.cpp.
References getBlockOperands(), mlir::Location::getContext(), getRegion(), mlir::OperationName::hasTrait(), mightHaveTrait(), and mlir::OperationName::populateDefaultAttrs().
Referenced by clone(), mlir::OpBuilder::create(), create(), mlir::OperationFolder::create(), mlir::OpBuilder::createOrFold(), mlir::spirv::Deserializer::processOp< spirv::GenericCastToPtrExplicitOp >(), mlirOperationCreate(), and updateReturnOps().
|
static |
Create a new Operation with the specific fields.
Definition at line 34 of file Operation.cpp.
References create(), getRegion(), and mlir::Region::takeBody().
void Operation::destroy | ( | ) |
Destroys this operation and its subclass data.
Destroy this operation or one of its subclasses.
Definition at line 164 of file Operation.cpp.
Referenced by mlir::OperationFolder::create(), mlir::OpBuilder::createOrFold(), llvm::ilist_traits<::mlir::Operation >::deleteNode(), and erase().
|
inline |
Definition at line 487 of file Operation.h.
References getAttrs().
|
inline |
Definition at line 491 of file Operation.h.
References getAttrs().
void Operation::dropAllDefinedValueUses | ( | ) |
Drop uses of all values defined by this operation or its nested regions.
This drops all uses of any values defined by this operation or its nested regions, wherever they are located.
Definition at line 475 of file Operation.cpp.
References mlir::Block::dropAllDefinedValueUses(), dropAllUses(), and getRegions().
void Operation::dropAllReferences | ( | ) |
This drops all operand uses from this operation, which is an essential step in breaking cyclic dependences between references when they are to be deleted.
Definition at line 462 of file Operation.cpp.
References getBlockOperands(), getOpOperands(), and getRegions().
Referenced by mlir::Block::dropAllReferences().
|
inline |
Drop all uses of results of this operation.
Definition at line 657 of file Operation.h.
References getOpResults().
Referenced by detachNestedAndErase(), and dropAllDefinedValueUses().
void Operation::dump | ( | ) |
Definition at line 3673 of file AsmPrinter.cpp.
References print().
Referenced by mlir::checkMemrefAccessDependence(), checkTilingLegalityImpl(), mlir::OpState::dump(), and logSucessfulPatternApplication().
InFlightDiagnostic Operation::emitError | ( | const Twine & | message = {} | ) |
Emit an error about fatal conditions with this operation, reporting up to any diagnostic handlers that may be listening.
Definition at line 224 of file Operation.cpp.
References diag(), mlir::emitError(), getContext(), and getLoc().
Referenced by mlir::affineDataCopyGenerate(), mlir::bufferization::allocateTensorForShapedValue(), applyTilingToAll(), assertNoAllocsReturned(), mlir::bufferization::bufferizeOp(), checkAffineLoopNestMappableImpl(), checkAndUpdateCapabilityRequirements(), checkAndUpdateExtensionRequirements(), commonVerifierPackAndUnPackOp(), mlir::MemRefRegion::compute(), convertOmpAtomicCapture(), convertOmpAtomicUpdate(), convertOmpThreadprivate(), mlir::convertVectorToNVVMCompatibleMMASync(), mlir::bufferization::deallocateBuffers(), mlir::bufferization::detail::defaultGetBufferType(), diagnoseInvalidOperandDominance(), emitOpError(), findOpWithTag(), findTopLevelTransform(), generateLocationsFromIR(), mlir::bufferization::getBufferType(), getMemoryFootprintBytes(), mlir::spirv::getPushConstantValue(), mlir::nvgpu::getWarpMatrixInfo(), mlir::insertBackwardComputationSlice(), printOperation(), mlir::detail::verifyBranchSuccessorOperands(), mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(), mlir::linalg::detail::verifyContractionInterface(), mlir::linalg::detail::verifyConvolutionInterface(), mlir::detail::verifyDataLayoutOp(), mlir::linalg::detail::verifyFillInterface(), verifyFuncOpInterfaceStructAttr(), verifyIntegerDotProduct(), mlir::verifyListOfOperandsOrIntegers(), verifyMemorySemantics(), verifyMmaSyncOp(), mlir::detail::verifyParallelCombiningOpInterface(), verifyPointerAndCoopMatrixType(), verifyPointerAndJointMatrixType(), mlir::detail::verifyShapedDimOpInterface(), verifyShiftOp(), verifySparsifierGetterSetter(), mlir::detail::verifySymbolTable(), verifyTerminatorSuccessors(), mlir::transform::TransformEachOpTrait< OpTy >::verifyTrait(), mlir::transform::FunctionalStyleTransformOpTrait< OpTy >::verifyTrait(), mlir::transform::NavigationTransformOpTrait< OpTy >::verifyTrait(), mlir::transform::detail::verifyTransformOpInterface(), and walkReferenceCountedValues().
InFlightDiagnostic Operation::emitOpError | ( | const Twine & | message = {} | ) |
Emit an error with the op name prefixed, like "'dim' op " which is convenient for verifiers.
Definition at line 510 of file Operation.cpp.
References emitError(), and getName().
Referenced by printOperation(), processOperands(), verifyAlignedClause(), verifyAndGetTerminator(), mlir::OpTrait::impl::verifyAtLeastNOperands(), mlir::OpTrait::impl::verifyAtLeastNRegions(), mlir::OpTrait::impl::verifyAtLeastNResults(), mlir::OpTrait::impl::verifyAtLeastNSuccessors(), verifyAtomicUpdateOp(), verifyAttributions(), mlir::impl::verifyCastInterfaceOp(), verifyCastOp(), verifyCollapsedShape(), mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(), mlir::detail::verifyDestinationStyleOpInterface(), mlir::OpTrait::impl::verifyElementwise(), verifyGatherOrScatterDims(), verifyGroupNonUniformArithmeticOp(), verifyHasBindingUse(), verifyIntegerDotProduct(), mlir::OpTrait::impl::verifyIsTerminator(), verifyMemoryOpIndexing(), verifyMmaSyncOp(), verifyMultShape(), verifyNontemporalClause(), mlir::OpTrait::impl::verifyNOperands(), mlir::OpTrait::impl::verifyNoRegionArguments(), mlir::OpTrait::impl::verifyNRegions(), mlir::OpTrait::impl::verifyNResults(), mlir::OpTrait::impl::verifyNSuccessors(), mlir::OpTrait::impl::verifyOneOperand(), mlir::OpTrait::impl::verifyOneRegion(), mlir::OpTrait::impl::verifyOneResult(), mlir::OpTrait::impl::verifyOneSuccessor(), verifyOpaquePtr(), mlir::OpTrait::impl::verifyOperandsAreFloatLike(), mlir::OpTrait::impl::verifyOperandsAreSignlessIntegerLike(), verifyOpMetadata(), mlir::transform::detail::verifyParamProducerTransformOpTrait(), mlir::transform::detail::verifyPossibleTopLevelTransformOpTrait(), verifyReductionVarList(), mlir::OpTrait::SingleBlockImplicitTerminator< TerminatorOpType >::Impl< ConcreteType >::verifyRegionTrait(), mlir::OpTrait::impl::verifyResultsAreBoolLike(), mlir::OpTrait::impl::verifyResultsAreFloatLike(), mlir::OpTrait::impl::verifyResultsAreSignlessIntegerLike(), mlir::OpTrait::impl::verifySameOperandsAndResultElementType(), mlir::OpTrait::impl::verifySameOperandsAndResultShape(), mlir::OpTrait::impl::verifySameOperandsAndResultType(), mlir::OpTrait::impl::verifySameOperandsElementType(), mlir::OpTrait::impl::verifySameOperandsShape(), mlir::OpTrait::impl::verifySameTypeOperands(), verifyShapeOrExtentTensorOp(), verifySizeOrIndexOp(), mlir::linalg::detail::verifyStructuredOpInterface(), mlir::detail::verifySymbol(), verifySymbolAttribute(), verifySymbolAttrUse(), mlir::detail::verifySymbolTable(), verifySynchronizationHint(), verifyTileSize(), mlir::OpTrait::SingleBlock< ConcreteType >::verifyTrait(), mlir::OpTrait::HasParent< ParentOpTypes >::Impl< ConcreteType >::verifyTrait(), verifyTypesAlongAllEdges(), mlir::detail::verifyTypesAlongControlFlowEdges(), mlir::OpTrait::impl::verifyValueSizeAttr(), verifyVectorMemoryOp(), mlir::OpTrait::impl::verifyZeroOperands(), mlir::OpTrait::impl::verifyZeroRegions(), mlir::OpTrait::impl::verifyZeroResults(), and mlir::OpTrait::impl::verifyZeroSuccessors().
InFlightDiagnostic Operation::emitRemark | ( | const Twine & | message = {} | ) |
Emit a remark about this operation, reporting up to any diagnostic handlers that may be listening.
Definition at line 245 of file Operation.cpp.
References diag(), mlir::emitRemark(), getContext(), and getLoc().
Referenced by emitRemarkForBlock().
InFlightDiagnostic Operation::emitWarning | ( | const Twine & | message = {} | ) |
Emit a warning about this operation, reporting up to any diagnostic handlers that may be listening.
Definition at line 236 of file Operation.cpp.
References diag(), mlir::emitWarning(), getContext(), and getLoc().
Referenced by mlir::affineDataCopyGenerate(), getMemoryFootprintBytes(), and mlir::LLVM::ModuleTranslation::setTBAAMetadata().
void Operation::erase | ( | ) |
Remove this operation from its parent block and delete it.
Remove this operation (and its descendants) from its Block and delete all of them.
Definition at line 417 of file Operation.cpp.
References destroy(), and getBlock().
Referenced by mlir::affineScalarReplace(), mlir::collapseParallelLoops(), convertTransferWriteOp(), convertTransferWriteToStores(), convertYieldOp(), createMask(), detachNestedAndErase(), mlir::OpState::erase(), mlir::SymbolTable::erase(), mlir::RewriterBase::eraseOp(), fuseIfLegal(), mlir::OperationFolder::insertKnownConstant(), mlir::normalizeMemRef(), outlineKernelFuncImpl(), mlir::replaceAllMemRefUsesWith(), replaceForOpWithNewSignature(), mlir::replaceForOpWithNewYields(), mlir::RewriterBase::replaceOp(), specializeForLoopForUnrolling(), specializeParallelLoopForUnrolling(), mlir::OpBuilder::tryFold(), mlir::OperationFolder::tryToFold(), updateReturnOps(), and mlir::detail::RecoveryReproducerContext::~RecoveryReproducerContext().
|
inline |
Erase the operand at position idx
.
Definition at line 317 of file Operation.h.
References eraseOperands().
|
inline |
Erases the operands that have their corresponding bit set in eraseIndices
and removes them from the operand list.
Definition at line 327 of file Operation.h.
References mlir::detail::OperandStorage::eraseOperands().
|
inline |
Erase the operands starting at position idx
and ending at position 'idx'+'length'.
Definition at line 321 of file Operation.h.
References mlir::detail::OperandStorage::eraseOperands().
Referenced by mlir::MutableOperandRange::clear(), mlir::MutableOperandRange::erase(), and eraseOperand().
LogicalResult Operation::fold | ( | ArrayRef< Attribute > | operands, |
SmallVectorImpl< OpFoldResult > & | results | ||
) |
Attempt to fold this operation with the specified constant operand values.
Attempt to fold this operation using the Op's registered foldHook.
results
vector. If not, results
is unspecified. Definition at line 489 of file Operation.cpp.
References mlir::failure(), mlir::OperationName::foldHook(), getDialect(), mlir::succeeded(), and mlir::success().
Referenced by mlir::detail::constant_op_binder< AttrT >::match(), mlir::OpBuilder::tryFold(), and mlir::dataflow::SparseConstantPropagation::visitOperation().
|
inline |
Return the specified attribute if present, null otherwise.
Definition at line 415 of file Operation.h.
Referenced by createConstFromIntAttribute(), createLinalgBodyCalculationForElementwiseOp(), mlir::LLVM::detail::DebugTranslation::DebugTranslation(), getAttrOfType(), getIntegerDotProductCapabilities(), lookupSymbolInImpl(), prepareLLVMModule(), setInPlaceOpOperand(), mlir::bufferization::shouldDeallocateOpResult(), verifyIntegerDotProduct(), mlir::detail::verifySymbol(), and verifySymbolAttribute().
|
inline |
Definition at line 416 of file Operation.h.
|
inline |
Return all of the attributes on this operation as a DictionaryAttr.
Definition at line 403 of file Operation.h.
Referenced by mlir::OperationEquivalence::computeHash(), mlir::OperationEquivalence::isEquivalentTo(), mlir::OperationFingerPrint::OperationFingerPrint(), populateDefaultAttrs(), mlir::AttrTypeReplacer::replaceElementsIn(), mlir::detail::verifyInferredResultTypes(), mlir::dataflow::SparseConstantPropagation::visitOperation(), and walkSymbolRefs().
|
inline |
Definition at line 419 of file Operation.h.
References mlir::Attribute::dyn_cast_or_null(), and getAttr().
Referenced by mlir::bufferization::allocationDoesNotEscape(), convertOperationImpl(), executeGetOperandsResults(), mlir::impl::getDataLayoutSpec(), getNameIfSymbol(), mlir::SymbolTable::getSymbolVisibility(), mlir::spirv::lookupEntryPointABI(), mlir::spirv::lookupTargetEnv(), printAtomicUpdateOp(), printGroupNonUniformArithmeticOp(), printIR(), printVariableDecorations(), mlir::LLVM::ModuleTranslation::setAccessGroupsMetadata(), mlir::LLVM::ModuleTranslation::setAliasScopeMetadata(), mlir::LLVM::ModuleTranslation::setLoopMetadata(), mlir::LLVM::ModuleTranslation::setTBAAMetadata(), verifyAtomicUpdateOp(), verifyGroupNonUniformArithmeticOp(), mlir::detail::verifySymbol(), mlir::detail::verifySymbolTable(), and mlir::OpTrait::impl::verifyValueSizeAttr().
|
inline |
Definition at line 423 of file Operation.h.
References mlir::Attribute::dyn_cast_or_null(), and getAttr().
|
inline |
Return all of the attributes on this operation.
Definition at line 400 of file Operation.h.
Referenced by mlir::clone(), cloneOpWithOperandsAndTypes(), mlir::cloneWithoutRegions(), dialect_attr_begin(), dialect_attr_end(), getDialectAttrs(), isLegalOp(), mlirLinalgFillBuiltinNamedOpRegion(), printArithmeticExtendedBinaryOp(), mlir::function_interface_impl::printFunctionAttributes(), printNamedStructuredOp(), printOneResultOp(), printShortForm(), printVariableDecorations(), mlir::replaceAllMemRefUsesWith(), mlir::impl::scalarizeVectorOp(), setDialectAttrs(), vectorizeOneOp(), verifyIntegerDotProduct(), and widenOp().
|
inline |
Returns the operation block that contains this operation.
Definition at line 188 of file Operation.h.
Referenced by llvm::ilist_traits<::mlir::Operation >::addNodeToList(), mlir::detail::ConversionPatternRewriterImpl::applyRewrites(), constructTiledLoopNest(), diagnoseInvalidOperandDominance(), erase(), mlir::Region::findAncestorBlockInRegion(), findInstPosition(), mlir::generateCopyForMemRegion(), getCommonBlock(), mlir::bufferization::getEnclosingRepetitiveRegion(), getPhiIncomingBlock(), mlir::bufferization::BufferPlacementAllocs::getStartOperation(), mlir::hasNoInterveningEffect(), hoistAffineIfOp(), mlir::inlineRegion(), mlir::OperationFolder::insertKnownConstant(), mlir::sparse_tensor::isAdmissibleBranchExp(), mlir::Liveness::isDeadAfter(), mlir::isLegalForBranchOpInterfaceTypeConversionPattern(), mlir::isNotBranchOpInterfaceOrReturnLikeOp(), isRegionOrCallableReturn(), mlir::Value::isUsedOutsideOfBlock(), lastNonTerminatorInRegion(), mlir::linalg::PadOpTransformationPattern::matchAndRewrite(), mayExistInterleavedUses(), mlir::RewriterBase::mergeBlockBefore(), moveAfter(), moveBefore(), mlir::OperationFolder::notifyRemoval(), printIR(), mlir::dataflow::AbstractDenseDataFlowAnalysis::processOperation(), mlir::DominanceInfo::properlyDominates(), mlir::PostDominanceInfo::properlyPostDominates(), remove(), mlir::OpBuilder::setInsertionPoint(), mlir::OpBuilder::setInsertionPointAfter(), mlir::OperationFolder::tryToFold(), mlir::OpTrait::impl::verifyIsTerminator(), verifyResultTypesAreInferrable(), and mlir::dataflow::DeadCodeAnalysis::visit().
|
inline |
Definition at line 541 of file Operation.h.
Referenced by create(), dropAllReferences(), getSuccessor(), setSuccessor(), and mlir::SuccessorRange::SuccessorRange().
|
inline |
Return the context this operation is associated with.
Definition at line 191 of file Operation.h.
References mlir::Attribute::getContext().
Referenced by mlir::gpu::addAsyncDependency(), annotateConflict(), mlir::bufferization::func_ext::FuncOpInterface::bufferize(), mlir::bufferization::bufferizeOp(), collectValidReferencesFor(), convertOperationImpl(), diagnoseInvalidOperandDominance(), emitError(), emitRemark(), emitWarning(), generateLocationsFromIR(), mlir::getComputationSliceState(), mlir::OpState::getContext(), mlir::Region::getContext(), mlir::Pass::getContext(), mlir::LLVM::ModuleTranslation::getContext(), getElementalFuncTypeForOp(), getLibraryCallSymbolRef(), mlir::linalg::getNeutralElement(), mlir::detail::PassCrashReproducerGenerator::initialize(), mlir::SymbolTable::insert(), mlir::bufferization::insertTensorCopies(), mlir::SymbolTable::lookup(), mlir::SymbolTable::lookupSymbolIn(), mlir::spirv::lookupTargetEnvOrDefault(), mlirLinalgFillBuiltinNamedOpRegion(), mlir::nvgpu::optimizeSharedMemoryReadsAndWrites(), performOptionalDebugActions(), populateDefaultAttrs(), prepareLLVMModule(), removeAttr(), resolveUsesInRepetitiveRegions(), setAccessGroupAttr(), setAttr(), setAttrs(), setDialectAttrs(), mlir::SymbolTable::setSymbolName(), mlir::SymbolTable::setSymbolVisibility(), setTBAAAttr(), mlir::simplifyConstrainedMinMaxOp(), mlir::SymbolTable::SymbolTable(), tryApply(), mlir::detail::verifyInferredResultTypes(), and verifyOpAndAdjustFlags().
|
inline |
Return the dialect this operation is associated with, or nullptr if the associated dialect is not loaded.
Definition at line 195 of file Operation.h.
References mlir::OperationName::getDialect(), and getName().
Referenced by fold(), mlir::detail::DialectInterfaceCollectionBase::getInterfaceFor(), mlir::Dialect::getOperationPrinter(), mlir::OperationFolder::insertKnownConstant(), mlir::bufferization::BufferizationOptions::isOpAllowed(), isPotentiallyUnknownSymbolTable(), mlir::OpState::print(), mlir::OpBuilder::tryFold(), and mlir::dataflow::SparseConstantPropagation::visitOperation().
|
inline |
Return a range corresponding to the dialect attributes for this operation.
Definition at line 482 of file Operation.h.
References getAttrs().
|
inline |
The source location the operation was defined or derived from.
Definition at line 198 of file Operation.h.
Referenced by mlir::affineDataCopyGenerate(), mlir::transform::TransformState::applyTransform(), buildMultiDimReduce(), buildVectorComparison(), mlir::transform::detail::checkApplyToOne(), checkDoubleConsume(), clone(), mlir::clone(), cloneAndFuseFirstUse(), mlir::cloneWithoutRegions(), computeMemoryOpIndices(), mlir::LLVM::ModuleTranslation::convertBlock(), convertElementwiseOp(), mlir::createAffineComputationSlice(), createConstFromIntAttribute(), createLinalgBodyCalculationForElementwiseOp(), createLinalgBodyCalculationForReduceOp(), createPrivateMemRef(), createSourceLocationInfo(), diagnoseInvalidOperandDominance(), elementwiseMatchAndRewriteHelper(), emitError(), emitRemark(), emitWarning(), mlir::detail::PassCrashReproducerGenerator::finalize(), findOpWithTag(), fuse(), generateErrorMessage(), getLibraryCallSymbolRef(), mlir::OpState::getLoc(), mlir::Region::getLoc(), getMemoryFootprintBytes(), getOrCreateOperandsMatchingResultTypes(), mlir::spirv::getPushConstantValue(), getTypeConversionFailure(), mlir::LLVM::detail::handleMultidimensionalVectors(), inlinePayload(), insertCasts(), mlir::transform::detail::interpreterBaseRunOnOperationImpl(), interruptIfValidLocation(), mlir::OperationEquivalence::isEquivalentTo(), isFusionProfitable(), legalizeUnresolvedMaterialization(), mlir::transform::detail::mapPossibleTopLevelTransformOpBlockArguments(), matchAndReplaceDepthwiseConv(), mlir::ConversionPattern::matchAndRewrite(), InnerOuterDimReductionConversion::matchAndRewrite(), ReduceMultiDimReductionRank::matchAndRewrite(), TwoDimMultiReductionToReduction::matchAndRewrite(), mlirLinalgFillBuiltinNamedOpRegion(), mlir::RewriterBase::notifyMatchFailure(), mlir::LLVM::detail::oneToOneRewrite(), mlir::OperationFingerPrint::OperationFingerPrint(), mlir::nvgpu::optimizeSharedMemoryReadsAndWrites(), prepareLLVMModule(), printConstantOp(), printOperation(), reduceMatchAndRewriteHelper(), ReifyExpandOrCollapseShapeOp< OpTy >::reifyResultShapes(), mlir::replaceAllMemRefUsesWith(), mlir::AttrTypeReplacer::replaceElementsIn(), mlir::bufferization::replaceOpWithNewBufferizedOp(), mlir::RewriterBase::replaceOpWithNewOp(), mlir::PassManager::run(), mlir::impl::scalarizeVectorOp(), mlir::vector::splitFullAndPartialTransfer(), tileAndFuseFirstExtractUse(), tileAndFuseFirstExtractUseThroughContainingOpBlockArgument(), mlir::OpBuilder::tryFold(), unpackSingleIndexResultPDLOperations(), vectorizeOneOp(), mlir::LLVM::detail::vectorOneToOneRewrite(), verifyAndGetTerminator(), mlir::detail::verifyDataLayoutOp(), mlir::detail::verifyInferredResultTypes(), mlir::OpTrait::impl::verifyIsIsolatedFromAbove(), mlir::detail::verifySymbolTable(), widenOp(), and wrapInExecuteRegion().
|
inline |
The name of an operation is the key identifier for it.
Definition at line 94 of file Operation.h.
Referenced by AncestorKey::AncestorKey(), mlir::bufferization::bufferizeOp(), checkAndUpdateCapabilityRequirements(), checkAndUpdateExtensionRequirements(), mlir::transform::detail::checkApplyToOne(), mlir::Op< ConcreteType, Traits >::classof(), clone(), mlir::clone(), cloneOpWithOperandsAndTypes(), mlir::cloneWithoutRegions(), mlir::OperationEquivalence::computeHash(), emitOpError(), mlir::ConversionPatternRewriter::eraseOp(), mlir::OpTrait::impl::foldIdempotent(), mlir::OpTrait::impl::foldInvolution(), mlir::detail::RecoveryReproducerContext::generate(), mlir::linalg::generateLibraryCallName(), getDialect(), getElementPtrType(), mlir::OpInterface< ConcreteType, Traits >::getInterfaceFor(), getRegisteredInfo(), mlir::AsmParserState::initialize(), mlir::OperationEquivalence::isEquivalentTo(), mlir::ConversionTarget::isIllegal(), mlir::ConversionTarget::isLegal(), isRegistered(), mlir::PatternApplicator::matchAndRewrite(), mlirLinalgFillBuiltinNamedOpRegion(), mlir::ConversionPatternRewriter::notifyOperationInserted(), performOptionalDebugActions(), mlir::detail::PassCrashReproducerGenerator::prepareReproducerFor(), mlir::CallGraph::print(), printIR(), mlir::OpState::printOpName(), printShortForm(), mlir::spirv::Serializer::printValueIDMap(), mlir::replaceAllMemRefUsesWith(), mlir::ConversionPatternRewriter::replaceOp(), mlir::ConversionPatternRewriter::replaceUsesOfBlockArgument(), mlir::PassManager::run(), saveReproToTempFile(), mlir::impl::scalarizeVectorOp(), vectorizeOneOp(), verifyMmaSyncOp(), verifyOpAndAdjustFlags(), mlir::transform::detail::verifyParamProducerTransformOpTrait(), mlir::OpTrait::SingleBlockImplicitTerminator< TerminatorOpType >::Impl< ConcreteType >::verifyRegionTrait(), mlir::transform::TransformEachOpTrait< OpTy >::verifyTrait(), mlir::transform::FunctionalStyleTransformOpTrait< OpTy >::verifyTrait(), mlir::transform::NavigationTransformOpTrait< OpTy >::verifyTrait(), and widenOp().
|
inline |
Definition at line 307 of file Operation.h.
References mlir::detail::OperandStorage::size().
Referenced by addExecuteResults(), clone(), mlir::Region::cloneInto(), convertOmpAtomicCapture(), convertOmpAtomicUpdate(), convertOmpOpRegions(), mlir::createAffineComputationSlice(), elementwiseMatchAndRewriteHelper(), extractOperandTypes(), findPayloadOp(), mlir::OpTrait::impl::foldIdempotent(), getElementalFuncTypeForOp(), mlir::OpTrait::detail::MultiOperandTraitBase< ConcreteType, TraitType >::getNumOperands(), getOperandValuesImpl(), isAddMul(), mlir::sparse_tensor::isAdmissibleBranchExp(), isChainOfUnaryOpsFrom(), mlir::OperationEquivalence::isEquivalentTo(), isOpLoopInvariant(), mlir::transform::detail::mapPossibleTopLevelTransformOpBlockArguments(), mlir::detail::RecursivePatternMatcher< OpType, OperandMatchers >::match(), mlir::matchReduction(), materializeConversion(), mlir::MutableOperandRange::MutableOperandRange(), printGroupNonUniformArithmeticOp(), printOperation(), mlir::replaceAllMemRefUsesWith(), setInPlaceOpOperand(), setOperands(), mlir::OpBuilder::tryFold(), vectorizeAffineYieldOp(), mlir::OpTrait::impl::verifyAtLeastNOperands(), verifyAtomicUpdateOp(), verifyGroupNonUniformArithmeticOp(), verifyIntegerDotProduct(), mlir::OpTrait::impl::verifyNOperands(), mlir::OpTrait::impl::verifyOneOperand(), mlir::OpTrait::impl::verifyOperandSizeAttr(), mlir::transform::detail::verifyPossibleTopLevelTransformOpTrait(), mlir::OpTrait::impl::verifySameTypeOperands(), mlir::OpTrait::impl::verifyZeroOperands(), and mlir::dataflow::SparseConstantPropagation::visitOperation().
|
inline |
Returns the number of regions held by this operation.
Definition at line 519 of file Operation.h.
Referenced by canBeHoisted(), clone(), mlir::cloneWithoutRegions(), collectUnderlyingAddressValues(), getBackwardSliceImpl(), mlir::OpTrait::detail::MultiRegionTraitBase< ConcreteType, TraitType >::getNumRegions(), hoistOpsBetween(), mlir::OperationEquivalence::isEquivalentTo(), isOpLoopInvariant(), isPotentiallyUnknownSymbolTable(), isRegionReachable(), isVectorizableLoopBodyWithOpCond(), mlir::detail::ConversionPatternRewriterImpl::markNestedOpsIgnored(), mlirLinalgFillBuiltinNamedOpRegion(), mlirOperationGetFirstRegion(), mlirRegionGetNextInOperation(), mlir::impl::scalarizeVectorOp(), mlir::vector::splitFullAndPartialTransfer(), mlir::SymbolTable::SymbolTable(), vectorizeOneOperation(), mlir::OpTrait::impl::verifyAtLeastNRegions(), mlir::OpTrait::impl::verifyNoRegionArguments(), mlir::OpTrait::impl::verifyNRegions(), mlir::OpTrait::impl::verifyOneRegion(), mlir::detail::verifyParallelCombiningOpInterface(), mlir::transform::detail::verifyPossibleTopLevelTransformOpTrait(), mlir::OpTrait::SingleBlockImplicitTerminator< TerminatorOpType >::Impl< ConcreteType >::verifyRegionTrait(), mlir::detail::verifySymbolTable(), mlir::OpTrait::SingleBlock< ConcreteType >::verifyTrait(), mlir::detail::verifyTypesAlongControlFlowEdges(), mlir::OpTrait::impl::verifyZeroRegions(), mlir::dataflow::DeadCodeAnalysis::visit(), mlir::dataflow::SparseConstantPropagation::visitOperation(), and wrapInExecuteRegion().
|
inline |
Return the number of results held by this operation.
Definition at line 365 of file Operation.h.
Referenced by mlir::transform::detail::checkApplyToOne(), clone(), convertOperationImpl(), elementwiseMatchAndRewriteHelper(), mlir::ConversionPatternRewriter::eraseOp(), getElementalFuncTypeForOp(), getLibraryCallSymbolRef(), mlir::OpTrait::detail::MultiResultTraitBase< ConcreteType, TraitType >::getNumResults(), getTypeConversionFailure(), mlir::OperationEquivalence::isEquivalentTo(), FoldTensorCastProducerOp::matchAndRewrite(), VectorizeConvolution::matchAndRewrite(), mlir::matchReduction(), materializeConversion(), mlir::detail::ConversionPatternRewriterImpl::notifyOpReplaced(), mlir::LLVM::detail::oneToOneRewrite(), mlir::OpAsmPrinter::printFunctionalType(), printNVVMIntrinsicOp(), printOneResultOp(), printOperation(), mlir::replaceAllMemRefUsesWith(), mlir::RewriterBase::replaceOp(), mlir::bufferization::replaceOpWithBufferizedValues(), mlir::RewriterBase::replaceOpWithIf(), mlir::impl::scalarizeVectorOp(), unpackSingleIndexResultPDLOperations(), mlir::OpTrait::impl::verifyAtLeastNResults(), mlir::detail::verifyDestinationStyleOpInterface(), mlir::OpTrait::impl::verifyElementwise(), verifyIntegerDotProduct(), mlir::OpTrait::impl::verifyNResults(), mlir::OpTrait::impl::verifyOneResult(), mlir::OpTrait::impl::verifyResultSizeAttr(), mlir::detail::verifyShapedDimOpInterface(), verifyShapeOrExtentTensorOp(), verifySizeOrIndexOp(), mlir::OpTrait::impl::verifyZeroResults(), mlir::dataflow::SparseConstantPropagation::visitOperation(), and walkReferenceCountedValues().
|
inline |
Definition at line 552 of file Operation.h.
Referenced by clone(), collectUnderlyingAddressValues(), eraseTerminatorSuccessorOperands(), mlir::Block::getNumSuccessors(), mlir::OpTrait::detail::MultiSuccessorTraitBase< ConcreteType, TraitType >::getNumSuccessors(), getPHISourceValue(), getSuccessor(), mlir::OperationEquivalence::isEquivalentTo(), isRegionOrCallableReturn(), mlir::OperationFingerPrint::OperationFingerPrint(), propagateTerminatorLiveness(), mlir::impl::scalarizeVectorOp(), setSuccessor(), mlir::SuccessorRange::SuccessorRange(), mlir::OpTrait::impl::verifyAtLeastNSuccessors(), mlir::OpTrait::impl::verifyNSuccessors(), mlir::OpTrait::impl::verifyOneSuccessor(), mlir::OpTrait::impl::verifyZeroSuccessors(), and mlir::dataflow::DeadCodeAnalysis::visit().
|
inline |
Definition at line 311 of file Operation.h.
References mlir::IROperand< DerivedT, IRValueT >::get(), and getOpOperand().
Referenced by adjustAccessChainForBitwidth(), mlir::affineParallelize(), mlir::sparse_tensor::Merger::buildTensorExpFromLinalg(), convertOmpAtomicCapture(), convertOmpAtomicUpdate(), convertOmpOpRegions(), createLinalgBodyCalculationForElementwiseOp(), diagnoseInvalidOperandDominance(), foldExtractFromBroadcast(), mlir::OpTrait::impl::foldIdempotent(), mlir::OpTrait::impl::foldInvolution(), getIntegerDotProductCapabilities(), mlir::OpTrait::OneOperand< ConcreteType >::getOperand(), mlir::OpTrait::detail::MultiOperandTraitBase< ConcreteType, TraitType >::getOperand(), getPHISourceValue(), isAddMul(), mlir::sparse_tensor::isAdmissibleBranch(), mlir::sparse_tensor::isAdmissibleBranchExp(), isChainOfUnaryOpsFrom(), isOpLoopInvariant(), mlir::transform::detail::mapPossibleTopLevelTransformOpBlockArguments(), mlir::detail::matchOperandOrValueAtIndex(), mlir::matchReduction(), materializeConversion(), printAtomicUpdateOp(), printGroupNonUniformArithmeticOp(), printOperation(), reduceMatchAndRewriteHelper(), mlir::OpBuilder::tryFold(), verifyAtomicUpdateOp(), verifyCastOp(), verifyGroupNonUniformArithmeticOp(), verifyIntegerDotProduct(), mlir::transform::detail::verifyPossibleTopLevelTransformOpTrait(), mlir::OpTrait::impl::verifySameOperandsElementType(), mlir::OpTrait::impl::verifySameTypeOperands(), and verifyShiftOp().
|
inline |
Returns an iterator on the underlying Value's.
Definition at line 339 of file Operation.h.
References getOpOperands().
Referenced by canBeHoisted(), mlir::scf::canonicalizeMinMaxOpInLoop(), clone(), mlir::Region::cloneInto(), mlir::OperationEquivalence::computeHash(), convertElementwiseOp(), convertOmpAtomicCapture(), convertOmpAtomicUpdate(), mlir::createAffineComputationSlice(), defaultIsSmallAlloc(), dependsOnCarriedVals(), elementwiseMatchAndRewriteHelper(), extractBeneficiaryOps(), findPayloadOp(), mlir::impl::foldCastInterfaceOp(), forwardTerminatorOperands(), getBackwardSliceImpl(), mlir::OpTrait::detail::MultiOperandTraitBase< ConcreteType, TraitType >::getOperands(), getOperandTypes(), getOperandValuesImpl(), getOrCreateOperandsMatchingResultTypes(), getOutermostInvariantForOp(), mlir::transform::detail::getParamProducerTransformOpTraitEffects(), mlir::linalg::getUpperBoundForIndex(), hasNonAffineUsersOnThePath(), inlineConvertOmpRegions(), inlinePayload(), insertCasts(), mlir::OperationEquivalence::isEquivalentTo(), isOpReady(), mlir::transform::detail::mapPossibleTopLevelTransformOpBlockArguments(), AllocaScopeInliner::matchAndRewrite(), AllocaScopeHoister::matchAndRewrite(), mlir::ConversionPattern::matchAndRewrite(), SortCommutativeOperands::matchAndRewrite(), matchSimpleReduction(), operand_begin(), operand_end(), mlir::OperationFingerPrint::OperationFingerPrint(), mlir::MutableOperandRange::operator OperandRange(), mlir::outlineSingleBlockRegion(), CommutativeOperand::popFrontAndPushAdjacentUnvisitedAncestors(), printArithmeticExtendedBinaryOp(), printAtomicUpdateOp(), mlir::OpAsmPrinter::printFunctionalType(), printNVVMIntrinsicOp(), printOneResultOp(), printOperation(), mlir::replaceAllMemRefUsesWith(), mlir::sparse_tensor::SparsificationAndBufferizationPass::runDenseBufferization(), mlir::simplifyConstrainedMinMaxOp(), staticallyNonNegative(), mlir::scf::tileConsumerAndFuseProducerGreedilyUsingSCFForOp(), vectorizeOneOp(), mlir::detail::verifyInferredResultTypes(), mlir::OpTrait::impl::verifySameOperandsAndResultElementType(), mlir::OpTrait::impl::verifySameOperandsElementType(), mlir::dataflow::IntegerRangeAnalysis::visitNonControlFlowArguments(), mlir::dataflow::SparseConstantPropagation::visitOperation(), and widenOp().
|
inline |
Definition at line 358 of file Operation.h.
References getOperands(), and mlir::OperandRange::getTypes().
Referenced by checkSourceOpTypes(), extractOperandTypes(), mlir::linalg::generateLibraryCallName(), mlir::OpTrait::detail::MultiOperandTraitBase< ConcreteType, TraitType >::getOperandTypes(), getOpToConvert(), hasTensorSemantics(), insertCasts(), isElementwiseMappableOpOnRankedTensors(), mlir::TypeConverter::isLegal(), isLegalOp(), mlir::outlineSingleBlockRegion(), printOneResultOp(), mlir::impl::verifyCastInterfaceOp(), mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(), mlir::OpTrait::impl::verifyElementwise(), mlir::OpTrait::impl::verifyOperandsAreFloatLike(), mlir::OpTrait::impl::verifyOperandsAreSignlessIntegerLike(), mlir::OpTrait::impl::verifySameOperandsAndResultShape(), mlir::OpTrait::impl::verifySameOperandsAndResultType(), mlir::OpTrait::impl::verifySameOperandsShape(), mlir::OpTrait::impl::verifySameTypeOperands(), verifyShapeOrExtentTensorOp(), and verifySizeOrIndexOp().
|
inline |
Definition at line 349 of file Operation.h.
References mlir::detail::OperandStorage::getOperands().
Referenced by getOperand(), and setOperand().
|
inline |
Definition at line 344 of file Operation.h.
References mlir::detail::OperandStorage::getOperands().
Referenced by annotateOpsWithBufferizationMarkers(), assertNoAllocsReturned(), checkAliasInfoConsistency(), mlir::bufferization::detail::defaultGetAliasingOpOperands(), dropAllReferences(), mlir::bufferization::eliminateEmptyTensors(), mlir::memref::foldMemRefCast(), mlir::tensor::foldTensorCast(), mlir::bufferization::OneShotAnalysisState::gatherYieldedTensors(), getOperands(), inlineRegionAndEmitStore(), replaceUsesOfWith(), setInPlaceOpOperand(), mlir::bufferization::detail::unknownGetAliasingOpOperands(), mlir::transform::detail::verifyTransformOpInterface(), and mlir::visitUsedValuesDefinedAbove().
|
inline |
Definition at line 382 of file Operation.h.
References getResult().
Referenced by applyTilingToAll().
|
inline |
Definition at line 381 of file Operation.h.
References getResults().
Referenced by cloneAndFuseFirstUse(), dropAllUses(), forwardEmptyOperands(), forwardTerminatorOperands(), mlir::bufferization::OneShotAnalysisState::gatherUndefinedTensorUses(), isUsedOutsideOfBlock(), mlir::bufferization::replaceOpWithBufferizedValues(), and mlir::bufferization::detail::unknownGetAliasingOpResults().
|
inline |
Return the closest surrounding parent operation that is of type 'OpTy'.
Definition at line 213 of file Operation.h.
Referenced by mlir::AllocationOpLLVMLowering::allocateBufferAutoAlign(), mlir::AllocationOpLLVMLowering::allocateBufferManuallyAlign(), mlir::sparse_tensor::createFuncCall(), mlir::LLVM::createGlobalString(), createSourceLocationInfo(), getAllocEffectFor(), getLibraryCallSymbolRef(), mlir::scf::insideMutuallyExclusiveBranches(), mlir::insideMutuallyExclusiveRegions(), mlir::replaceAllMemRefUsesWith(), mlir::bufferization::runOneShotModuleBufferize(), and validateSupportedControlFlow().
|
inline |
Returns the closest surrounding operation that contains this operation or nullptr if this is a top-level operation.
Definition at line 209 of file Operation.h.
References mlir::Block::getParentOp().
Referenced by mlir::DataLayout::closest(), collectParentLayouts(), collectSymbolScopes(), collectValidReferencesFor(), mlir::DataLayoutAnalysis::DataLayoutAnalysis(), declareReduction(), mlir::Block::findAncestorOpInBlock(), mlir::Region::findAncestorOpInRegion(), findAncestorOpInRegion(), mlir::DataLayoutAnalysis::getAbove(), mlir::LLVM::ModuleTranslation::getAccessGroup(), mlir::getAffineForIVs(), getAffineIVs(), mlir::LLVM::ModuleTranslation::getAliasScope(), getAllocEffectFor(), getAtMostNEnclosingLoops(), getAutomaticAllocationScope(), mlir::AnalysisManager::getCachedChildAnalysis(), mlir::Pass::getCachedParentAnalysis(), mlir::getEnclosingAffineOps(), mlir::SymbolTable::getNearestSymbolTable(), mlir::getNestingDepth(), getParentWithTrait(), mlir::spirv::getPushConstantValue(), getRootOperation(), mlir::sparse_tensor::getTop(), happensBefore(), mlir::hasNoInterveningEffect(), mlir::SymbolTable::insert(), isNestedInFunctionOpInterface(), mlir::isNotBranchOpInterfaceOrReturnLikeOp(), mlir::detail::ConversionPatternRewriterImpl::isOpIgnored(), isOpReady(), isProperAncestor(), isRegionOrCallableReturn(), mlir::isTopLevelValue(), mlir::spirv::lookupEntryPointABI(), mlir::spirv::lookupTargetEnv(), AllocaScopeHoister::matchAndRewrite(), mlir::matchReduction(), mlir::AnalysisManager::nest(), parentLLVMModule(), mlir::detail::PassCrashReproducerGenerator::prepareReproducerFor(), mlir::Block::print(), mlir::CallGraph::print(), print(), printOperation(), mlir::SymbolTable::remove(), mlir::SymbolUserMap::replaceAllUsesWith(), vectorizeConstant(), verifyHasBindingUse(), verifySymbolAttribute(), mlir::OpTrait::HasParent< ParentOpTypes >::Impl< ConcreteType >::verifyTrait(), visit(), mlir::dataflow::DeadCodeAnalysis::visit(), and walkReferencedSymbolNodes().
|
inline |
Returns the region to which the instruction belongs.
Returns nullptr if the instruction is unlinked.
Definition at line 205 of file Operation.h.
References mlir::Block::getParent().
Referenced by createPrivateMemRef(), mlir::Region::findAncestorOpInRegion(), findAncestorOpInRegion(), mlir::getAffineScope(), mlir::bufferization::getEnclosingRepetitiveRegion(), mlir::getEnclosingRepetitiveRegion(), mlir::Region::getParentRegion(), mlir::hasNoInterveningEffect(), mlir::isTopLevelValue(), mlir::isValidSymbol(), lastNonTerminatorInRegion(), mlir::moveLoopInvariantCode(), and verifyTerminatorSuccessors().
|
inline |
Returns the closest surrounding parent operation with trait Trait
.
Definition at line 223 of file Operation.h.
References getParentOp(), and hasTrait().
Referenced by getAllocEffectFor(), getDumpRootOp(), and mlir::transform::detail::verifyPossibleTopLevelTransformOpTrait().
|
inline |
Returns the region held by this operation at position 'index'.
Definition at line 532 of file Operation.h.
References getRegions().
Referenced by mlir::affineParallelize(), mlir::sparse_tensor::Merger::buildTensorExpFromLinalg(), clone(), collectSymbolScopes(), collectUnderlyingAddressValues(), convertOmpSections(), create(), mlir::ExecutionEngine::create(), createDecl(), getBackwardSliceImpl(), mlir::OpTrait::SingleBlock< ConcreteType >::getBody(), mlir::transform::PossibleTopLevelTransformOpTrait< OpTy >::getBodyBlock(), mlir::OpTrait::SingleBlock< ConcreteType >::getBodyRegion(), mlir::bufferization::getGlobalFor(), getModuleBody(), mlir::spirv::getPushConstantValue(), mlir::OpTrait::OneRegion< ConcreteType >::getRegion(), mlir::OpTrait::detail::MultiRegionTraitBase< ConcreteType, TraitType >::getRegion(), mlir::SymbolTable::insert(), mlir::SymbolTable::lookupSymbolIn(), mlirLinalgFillBuiltinNamedOpRegion(), mlirOperationGetFirstRegion(), mlirRegionGetNextInOperation(), mlir::linalg::pack(), mlir::vector::splitFullAndPartialTransfer(), mlir::SymbolTable::SymbolTable(), mlir::SymbolUserMap::SymbolUserMap(), transposeOneLinalgOperandAndReplace(), mlir::linalg::vectorizeLinalgOpPrecondition(), mlir::detail::verifyParallelCombiningOpInterface(), mlir::transform::detail::verifyPossibleTopLevelTransformOpTrait(), mlir::OpTrait::SingleBlockImplicitTerminator< TerminatorOpType >::Impl< ConcreteType >::verifyRegionTrait(), mlir::detail::verifySymbolTable(), mlir::OpTrait::SingleBlock< ConcreteType >::verifyTrait(), and mlir::detail::verifyTypesAlongControlFlowEdges().
|
inline |
Returns the regions held by this operation.
Definition at line 522 of file Operation.h.
Referenced by mlir::applyPatternsAndFoldGreedily(), mlir::bufferization::BufferizationAliasInfo::BufferizationAliasInfo(), mlir::clone(), mlir::OpBuilder::clone(), mlir::Region::cloneInto(), collectCallOps(), computeCallGraph(), detachNestedAndErase(), dfsPostorder(), dropAllDefinedValueUses(), dropAllReferences(), mlir::LLVM::ensureDistinctSuccessors(), getForwardSliceImpl(), mlir::getInnermostParallelLoops(), getInstAtPosition(), getRegion(), mlir::Region::getRegionNumber(), mlir::OpTrait::detail::MultiRegionTraitBase< ConcreteType, TraitType >::getRegions(), mlir::dataflow::DeadCodeAnalysis::initialize(), mlir::dataflow::AbstractDenseDataFlowAnalysis::initialize(), mlir::dataflow::AbstractSparseDataFlowAnalysis::initialize(), mlir::bytecode::detail::IRNumberingState::IRNumberingState(), mlir::OperationEquivalence::isEquivalentTo(), mlir::isMemoryEffectFree(), mlir::isSpeculatable(), mlir::detail::ConversionPatternRewriterImpl::markNestedOpsIgnored(), AllocaScopeHoister::matchAndRewrite(), mergeIdenticalBlocks(), mlir::OperationFingerPrint::OperationFingerPrint(), propagateLiveness(), mlir::AttrTypeReplacer::replaceElementsIn(), validateSupportedControlFlow(), mlir::detail::verifyInferredResultTypes(), mlir::OpTrait::impl::verifyIsIsolatedFromAbove(), mlir::OpTrait::impl::verifyNoRegionArguments(), mlir::detail::verifySymbolTable(), JamBlockGatherer::walk(), mlir::detail::walk(), walkSymbolTable(), mlir::SymbolTable::walkSymbolTables(), walkSymbolUses(), wouldOpBeTriviallyDeadImpl(), and wrapInExecuteRegion().
|
inline |
If this operation has a registered operation description, return it.
Otherwise return std::nullopt.
Definition at line 98 of file Operation.h.
References getName(), and mlir::OperationName::getRegisteredInfo().
Referenced by mlir::Op< ConcreteType, Traits >::classof().
|
inline |
Get the 'idx'th result of this operation.
Definition at line 368 of file Operation.h.
Referenced by mlir::affineParallelize(), mlir::bufferization::func_ext::CallOpInterface::bufferize(), buildVectorWrite(), clone(), convertElementwiseOp(), convertOmpThreadprivate(), convertOperationImpl(), createLinalgBodyCalculationForElementwiseOp(), mlir::spirv::Deserializer::processOp< spirv::GenericCastToPtrExplicitOp >(), elementwiseMatchAndRewriteHelper(), mlir::op_definition_impl::foldTrait(), mlir::linalg::TileLoopNest::fuseProducer(), getCollapsedOpOperand(), mlir::AllocationOpLLVMLowering::getMemRefResultType(), mlir::linalg::getNeutralElement(), getOpResult(), mlir::OperationFolder::getOrCreateConstant(), mlir::OpTrait::OneTypedResult< ResultType >::Impl< ConcreteType >::getResult(), mlir::OpTrait::detail::MultiResultTraitBase< ConcreteType, TraitType >::getResult(), mlir::nvgpu::getWarpMatrixInfo(), mlir::LLVM::detail::handleMultidimensionalVectors(), insertSliceLikeAnchoredEmptyTensorEliminationStep(), mlir::LLVMTypeConverter::LLVMTypeConverter(), mlir::detail::constant_float_op_binder::match(), mlir::detail::constant_int_op_binder::match(), matchAndReplaceDepthwiseConv(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), VectorizeConvolution::matchAndRewrite(), InnerOuterDimReductionConversion::matchAndRewrite(), ReduceMultiDimReductionRank::matchAndRewrite(), TransferReadToVectorLoadLowering::matchAndRewrite(), materializeConversion(), mlir::normalizeAffineFor(), mlir::OperationFolder::notifyRemoval(), mlir::LLVM::detail::oneToOneRewrite(), mlir::outlineSingleBlockRegion(), printConstantOp(), mlir::OpAsmPrinter::printFunctionalType(), printGroupNonUniformArithmeticOp(), printOneResultOp(), printOperation(), reduceMatchAndRewriteHelper(), mlir::OpTrait::OneResult< ConcreteType >::replaceAllUsesWith(), mlir::impl::scalarizeVectorOp(), mlir::linalg::splitReduction(), mlir::linalg::splitReductionByScaling(), tileAndFuseFirstExtractUse(), tileAndFuseFirstExtractUseThroughContainingOpBlockArgument(), mlir::scf::tileReductionUsingScf(), mlir::OperationFolder::tryToFold(), unpackSingleIndexResultPDLOperations(), vectorizeAsLinalgGeneric(), vectorizeOperand(), verifyCastOp(), mlir::OpTrait::impl::verifySameOperandsAndResultElementType(), mlir::OpTrait::impl::verifySameOperandsAndResultType(), mlir::detail::verifyShapedDimOpInterface(), verifyShiftOp(), and walkReferenceCountedValues().
|
inline |
Definition at line 376 of file Operation.h.
Referenced by addBodyWithPayloadOp(), mlir::bufferization::BufferizationAliasInfo::BufferizationAliasInfo(), buildVectorWrite(), mlir::transform::detail::checkApplyToOne(), mlir::async::cloneConstantsIntoTheRegion(), mlir::OperationEquivalence::computeHash(), elementwiseMatchAndRewriteHelper(), extractBeneficiaryOps(), mlir::impl::foldCastInterfaceOp(), getForwardSliceImpl(), getLastDependentOpInRange(), getOpResults(), mlir::tensor::getOrCreateDestinations(), mlir::transform::detail::getParamProducerTransformOpTraitEffects(), mlir::OpTrait::detail::MultiResultTraitBase< ConcreteType, TraitType >::getResults(), getResultTypes(), mlir::linalg::getUpperBoundForIndex(), getUses(), invertCollapseShapeIndexing(), mlir::OperationEquivalence::isEquivalentTo(), isGuaranteedAutomaticAllocation(), isOpItselfPotentialAutomaticAllocation(), VectorizationState::maskOperation(), FoldTensorCastProducerOp::matchAndRewrite(), mlir::linalg::ExtractSliceOfPadTensorSwapPattern::matchAndRewrite(), mlir::detail::ConversionPatternRewriterImpl::notifyOpReplaced(), mlir::linalg::peelLoop(), mlir::Liveness::print(), mlir::OpAsmPrinter::printFunctionalType(), printOperation(), propagateLiveness(), reduceMatchAndRewriteHelper(), mlir::replaceAllMemRefUsesWith(), mlir::ResultRange::replaceAllUsesWith(), replaceAllUsesWith(), mlir::AttrTypeReplacer::replaceElementsIn(), mlir::RewriterBase::replaceOpWithIf(), mlir::bufferization::replaceOpWithNewBufferizedOp(), result_begin(), result_end(), mlir::sparse_tensor::SparsificationAndBufferizationPass::runDenseBufferization(), mlir::transform::detail::setApplyToOneResults(), mlir::sinkOperationsIntoLaunchOp(), staticallyNonNegative(), tileLinalgOpImpl(), mlir::linalg::tileReductionUsingForeachThread(), mlir::scf::tileReductionUsingScf(), mlir::OpBuilder::tryFold(), use_begin(), use_empty(), use_end(), validateSupportedControlFlow(), vectorizeAsLinalgGeneric(), mlir::linalg::vectorizeCopy(), mlir::transform::detail::verifyParamProducerTransformOpTrait(), mlir::OpTrait::impl::verifySameOperandsAndResultElementType(), mlir::transform::detail::verifyTransformOpInterface(), mlir::dataflow::IntegerRangeAnalysis::visitOperation(), widenOp(), wrapInExecuteRegion(), and yieldTiledValues().
|
inline |
Definition at line 389 of file Operation.h.
References getResults(), and mlir::ResultRange::getTypes().
Referenced by checkSourceOpTypes(), clone(), mlir::OperationEquivalence::computeHash(), equivalenceAnalysis(), getOpToConvert(), getOrCreateOperandsMatchingResultTypes(), mlir::OpTrait::detail::MultiResultTraitBase< ConcreteType, TraitType >::getResultTypes(), getTypeConversionFailure(), hasTensorSemantics(), insertCasts(), mlir::TypeConverter::isLegal(), isLegalOp(), mlir::LLVM::detail::oneToOneRewrite(), mlir::outlineSingleBlockRegion(), printArithmeticExtendedBinaryOp(), printNamedStructuredOp(), printNVVMIntrinsicOp(), result_type_begin(), result_type_end(), vectorizeOneOp(), mlir::impl::verifyCastInterfaceOp(), mlir::OpTrait::impl::verifyCompatibleOperandBroadcast(), mlir::OpTrait::impl::verifyElementwise(), mlir::detail::verifyInferredResultTypes(), verifyIntegerDotProduct(), mlir::OpTrait::impl::verifyResultsAreBoolLike(), mlir::OpTrait::impl::verifyResultsAreFloatLike(), mlir::OpTrait::impl::verifyResultsAreSignlessIntegerLike(), mlir::OpTrait::impl::verifySameOperandsAndResultShape(), mlir::OpTrait::impl::verifySameOperandsAndResultType(), verifyShapeOrExtentTensorOp(), verifySizeOrIndexOp(), walkReferenceCountedValues(), and wrapInExecuteRegion().
|
inline |
Definition at line 554 of file Operation.h.
References getBlockOperands(), and getNumSuccessors().
Referenced by eraseTerminatorSuccessorOperands(), getPHISourceValue(), mlir::OpTrait::OneSuccessor< ConcreteType >::getSuccessor(), mlir::Block::getSuccessor(), mlir::OpTrait::detail::MultiSuccessorTraitBase< ConcreteType, TraitType >::getSuccessor(), mlir::OperationFingerPrint::OperationFingerPrint(), propagateTerminatorLiveness(), and mlir::detail::verifyBranchSuccessorOperands().
|
inline |
Definition at line 549 of file Operation.h.
Referenced by clone(), mlir::OpTrait::detail::MultiSuccessorTraitBase< ConcreteType, TraitType >::getSuccessors(), isRegionEquivalentTo(), propagateTerminatorLiveness(), successor_begin(), successor_end(), verifyTerminatorSuccessors(), and mlir::dataflow::DeadCodeAnalysis::visit().
|
inline |
Returns a range of all users.
Definition at line 696 of file Operation.h.
References user_begin(), and user_end().
Referenced by collapseBranch(), dfsPostorder(), mlir::bufferization::BufferPlacementTransformationBase::findCommonDominator(), findMatchingTransferRead(), findUnusedStore(), getForwardSliceImpl(), getLastDependentOpInRange(), mlir::nvgpu::getUserContract(), hasBindingUse(), hasLifetimeMarkers(), inferFragType(), insertionPointDominatesUses(), mlir::matchReduction(), mlir::moveLoopInvariantCode(), mlir::memref::multiBuffer(), and visit().
|
inline |
Returns a range of all uses, which is useful for iterating over all uses.
Definition at line 669 of file Operation.h.
References getResults(), and mlir::ResultRange::getUses().
Referenced by mlir::bufferization::bufferizeOp(), hasOneUse(), and replaceUsesAndPropagateType().
|
inline |
Return true if the operation has an attribute with the provided name, false otherwise.
Definition at line 429 of file Operation.h.
Referenced by mlir::bufferization::allocationDoesNotEscape(), mlir::bufferization::insertTensorCopies(), mlir::bufferization::shouldDeallocateOpResult(), and verifyIntegerDotProduct().
|
inline |
Definition at line 430 of file Operation.h.
|
inline |
Definition at line 432 of file Operation.h.
|
inline |
Returns true if this operation has exactly one use.
Definition at line 672 of file Operation.h.
References getUses().
Referenced by mlir::matchReduction().
|
inline |
Definition at line 551 of file Operation.h.
|
inline |
Returns true if the operation was registered with a particular trait, e.g.
hasTrait<OperandsAreSignlessIntegerLike>().
Definition at line 574 of file Operation.h.
References mlir::OperationName::hasTrait().
Referenced by AncestorKey::AncestorKey(), mlir::applyPatternsAndFoldGreedily(), canBeHoisted(), mlir::async::cloneConstantsIntoTheRegion(), collectSymbolScopes(), collectValidReferencesFor(), mlir::OperationEquivalence::computeHash(), mlir::impl::ensureRegionTerminator(), executeGetOperandsResults(), mlir::op_definition_impl::foldTrait(), getBackwardSliceImpl(), getCommonBlock(), mlir::LocalAliasAnalysis::getModRef(), mlir::getMutableRegionBranchSuccessorOperands(), mlir::SymbolTable::getNearestSymbolTable(), getParentWithTrait(), mlir::OpTrait::hasElementwiseMappableTraits(), mlir::transform::detail::interpreterBaseRunOnOperationImpl(), mlir::bytecode::detail::IRNumberingState::IRNumberingState(), isDirectInModuleLikeOp(), mlir::OperationEquivalence::isEquivalentTo(), mlir::isLegalForReturnOpTypeConversionPattern(), mlir::isMemoryEffectFree(), isMemRefNormalizable(), isNestedInFunctionOpInterface(), isOpItselfPotentialAutomaticAllocation(), mlir::isRegionReturnLike(), mlir::isTopLevelValue(), isUseSpeciallyKnownDead(), mlir::isValidSymbol(), mlir::SymbolTable::lookupSymbolIn(), lookupSymbolInImpl(), mlir::detail::constant_op_matcher::match(), mlir::detail::constant_op_binder< AttrT >::match(), AllocaScopeHoister::matchAndRewrite(), SortCommutativeOperands::matchAndRewrite(), mlirBlockGetTerminator(), mlir::RewritePattern::Pattern(), print(), propagateLiveness(), mlir::LLVM::satisfiesLLVMModule(), mlir::sortTopologically(), mlir::SymbolTable::SymbolTable(), mlir::OpTrait::impl::verifyIsIsolatedFromAbove(), walkSymbolTable(), mlir::SymbolTable::walkSymbolTables(), walkSymbolUses(), and wouldOpBeTriviallyDeadImpl().
void Operation::insertOperands | ( | unsigned | index, |
ValueRange | operands | ||
) |
Insert the given operands into the operand list at the given 'index'.
Definition at line 212 of file Operation.cpp.
References setOperands().
Referenced by mlir::gpu::addAsyncDependency(), addExecuteResults(), and mlir::MutableOperandRange::append().
|
inline |
Return true if this operation is an ancestor of the other
operation.
An operation is considered as its own ancestor, use isProperAncestor
to avoid this.
Definition at line 238 of file Operation.h.
References isProperAncestor().
Referenced by canBeHoisted(), canUseOpDominance(), collectValidReferencesFor(), mlir::bufferization::detail::defaultResultBufferizesToMemoryWrite(), dependsOnCarriedVals(), mlir::hasNoInterveningEffect(), and printModuleForRepro().
bool Operation::isBeforeInBlock | ( | Operation * | other | ) |
Given an operation 'other' that is within the same parent block, return whether the current operation is before 'other' in the operation list of the parent block.
Note: This function has an average complexity of O(1), but worst case may take O(N) where N is the number of operations within the parent block.
Definition at line 264 of file Operation.cpp.
References mlir::Block::isOpOrderValid(), and mlir::Block::recomputeOpOrder().
Referenced by mlir::detail::ConversionPatternRewriterImpl::applyRewrites(), mlir::LivenessBlockInfo::currentlyLiveValues(), mlir::LivenessBlockInfo::getEndOperation(), getFusedLoopNestInsertionPoint(), hasNonAffineUsersOnThePath(), mlir::Liveness::isDeadAfter(), mayExistInterleavedUses(), mlir::PostDominanceInfo::properlyPostDominates(), and verifyResultTypesAreInferrable().
bool Operation::isProperAncestor | ( | Operation * | other | ) |
Return true if this operation is a proper ancestor of the other
operation.
Definition at line 175 of file Operation.cpp.
References getParentOp().
Referenced by mlir::LocalAliasAnalysis::aliasImpl(), cloneAndFuseFirstUse(), happensBefore(), isAncestor(), isLocallyDefined(), mlir::AnalysisManager::nest(), and mlir::replaceLoopWithNewYields().
|
inline |
Returns true if this operation has a registered operation description, otherwise false.
Definition at line 104 of file Operation.h.
References getName(), and mlir::OperationName::isRegistered().
|
inline |
Returns true if the results of this operation are used outside of the given block.
Definition at line 679 of file Operation.h.
References getOpResults(), and mlir::Value::isUsedOutsideOfBlock().
|
inline |
Returns true if the operation might have the provided trait.
This means that either the operation is unregistered, or it was registered with the provide trait.
Definition at line 582 of file Operation.h.
References mlir::OperationName::mightHaveTrait().
Referenced by create(), ensureDistinctSuccessors(), mlir::isNotBranchOpInterfaceOrReturnLikeOp(), isTerminator(), mlir::matchReduction(), mayBeValidWithoutTerminator(), and mlir::wouldOpBeTriviallyDead().
Unlink this operation from its current block and insert it right after iterator
in the specified block.
Definition at line 453 of file Operation.cpp.
References mlir::Block::end(), and moveBefore().
void Operation::moveAfter | ( | Operation * | existingOp | ) |
Unlink this operation from its current block and insert it right after existingOp
which may be in the same or another block in the same function.
Definition at line 447 of file Operation.cpp.
References getBlock().
Referenced by moveConstantAllocasToEntryBlock().
Unlink this operation from its current block and insert it right before iterator
in the specified block.
Unlink this operation from its current basic block and insert it right before iterator
in the specified basic block.
Definition at line 439 of file Operation.cpp.
References getBlock(), and mlir::Block::getOperations().
void Operation::moveBefore | ( | Operation * | existingOp | ) |
Unlink this operation from its current block and insert it right before existingOp
which may be in the same or another block in the same function.
Definition at line 433 of file Operation.cpp.
References getBlock().
Referenced by hoistOpsBetween(), mlir::OperationFolder::insertKnownConstant(), moveAfter(), mlir::sortTopologically(), and mlir::OperationFolder::tryToFold().
|
inline |
Definition at line 335 of file Operation.h.
References getOperands().
Referenced by mlir::OpTrait::detail::MultiOperandTraitBase< ConcreteType, TraitType >::operand_begin(), operand_type_begin(), and mlir::replaceAllMemRefUsesWith().
|
inline |
Definition at line 336 of file Operation.h.
References getOperands().
Referenced by mlir::OpTrait::detail::MultiOperandTraitBase< ConcreteType, TraitType >::operand_end(), operand_type_end(), and mlir::replaceAllMemRefUsesWith().
|
inline |
Definition at line 356 of file Operation.h.
References operand_begin().
Referenced by getElementalFuncTypeForOp(), and mlir::OpTrait::detail::MultiOperandTraitBase< ConcreteType, TraitType >::operand_type_begin().
|
inline |
Definition at line 357 of file Operation.h.
References operand_end().
Referenced by getElementalFuncTypeForOp(), and mlir::OpTrait::detail::MultiOperandTraitBase< ConcreteType, TraitType >::operand_type_end().
|
inline |
Sets default attributes on unset attributes.
Definition at line 508 of file Operation.h.
References getAttrDictionary(), getContext(), mlir::NamedAttrList::getDictionary(), mlir::OperationName::populateDefaultAttrs(), and setAttrs().
void Operation::print | ( | raw_ostream & | os, |
AsmState & | state | ||
) |
Definition at line 3663 of file AsmPrinter.cpp.
References mlir::AsmState::getImpl(), mlir::AsmState::getPrinterFlags(), mlir::detail::AsmStateImpl::initializeAliases(), and mlir::OpPrintingFlags::shouldUseLocalScope().
void Operation::print | ( | raw_ostream & | os, |
const OpPrintingFlags & | flags = std::nullopt |
||
) |
Definition at line 3643 of file AsmPrinter.cpp.
References getParentOp(), hasTrait(), print(), and mlir::OpPrintingFlags::shouldUseLocalScope().
Referenced by mlir::Diagnostic::appendOp(), mlir::detail::RecoveryReproducerContext::generate(), generateErrorMessage(), generateLocationsFromIR(), mlir::Value::print(), mlir::OpState::print(), printIR(), and printModuleForRepro().
void Operation::remove | ( | ) |
Remove the operation from its parent block, but don't delete it.
Definition at line 425 of file Operation.cpp.
References getBlock().
Referenced by mlir::lsp::MLIRServer::convertFromBytecode().
|
inline |
Remove the attribute with the specified name if it exists.
Return the attribute that was erased, or nullptr if there was no attribute with such name.
Definition at line 451 of file Operation.h.
References mlir::NamedAttrList::erase(), getContext(), and mlir::NamedAttrList::getDictionary().
Referenced by removeAttr(), and mlir::SymbolTable::setSymbolVisibility().
|
inline |
Definition at line 458 of file Operation.h.
References getContext(), and removeAttr().
|
inline |
Replace all uses of results of this operation with the provided 'values'.
Definition at line 247 of file Operation.h.
References getResults(), and mlir::ResultRange::replaceAllUsesWith().
Referenced by convertToLaunchFuncOp(), mlir::OperationFolder::insertKnownConstant(), mlir::promoteIfSingleIteration(), mlir::replaceAllMemRefUsesWith(), mlir::OpTrait::OneResult< ConcreteType >::replaceAllUsesWith(), mlir::OpTrait::detail::MultiResultTraitBase< ConcreteType, TraitType >::replaceAllUsesWith(), mlir::RewriterBase::replaceOp(), and updateCalls().
Replace any uses of 'from' with 'to' within this operation.
Definition at line 183 of file Operation.cpp.
References getOpOperands().
Referenced by mlir::inlineCall(), and replaceConstantUsesOf().
|
inline |
Definition at line 374 of file Operation.h.
References getResults().
Referenced by mlir::OperationFolder::create(), and mlir::OpTrait::detail::MultiResultTraitBase< ConcreteType, TraitType >::result_begin().
|
inline |
Definition at line 375 of file Operation.h.
References getResults().
Referenced by mlir::OperationFolder::create(), and mlir::OpTrait::detail::MultiResultTraitBase< ConcreteType, TraitType >::result_end().
|
inline |
Definition at line 387 of file Operation.h.
References getResultTypes().
Referenced by getElementalFuncTypeForOp(), mlir::OperationFolder::insertKnownConstant(), materializeConversion(), and mlir::OpTrait::detail::MultiResultTraitBase< ConcreteType, TraitType >::result_type_begin().
|
inline |
Definition at line 388 of file Operation.h.
References getResultTypes().
Referenced by getElementalFuncTypeForOp(), and mlir::OpTrait::detail::MultiResultTraitBase< ConcreteType, TraitType >::result_type_end().
|
inline |
If the an attribute exists with the specified name, change it to the new value.
Otherwise, add a new attribute with the specified name/value.
Definition at line 439 of file Operation.h.
References getContext(), mlir::NamedAttrList::getDictionary(), and mlir::NamedAttrList::set().
Referenced by mlir::gpu::addAsyncDependency(), mlir::bufferization::allocateTensorForShapedValue(), annotateConflict(), annotateNonWritableTensor(), mlir::sparse_tensor::getFunc(), getLibraryCallSymbolRef(), mlir::bufferization::insertTensorCopies(), lowerAsEntryFunction(), matchAndReplaceDepthwiseConv(), mlir::GPUIndexIntrinsicOpLowering< Op, XOp, YOp, ZOp >::matchAndRewrite(), outlineKernelFuncImpl(), performOptionalDebugActions(), setAccessGroupAttr(), setAttr(), setInPlaceOpOperand(), mlir::SymbolTable::setSymbolName(), mlir::SymbolTable::setSymbolVisibility(), setTBAAAttr(), and mlir::vector::splitFullAndPartialTransfer().
|
inline |
Definition at line 444 of file Operation.h.
References getContext(), and setAttr().
|
inline |
Definition at line 410 of file Operation.h.
References getContext(), and setAttrs().
|
inline |
Set the attribute dictionary on this operation.
Definition at line 406 of file Operation.h.
Referenced by mlir::bufferization::func_ext::CallOpInterface::bufferize(), populateDefaultAttrs(), mlir::AttrTypeReplacer::replaceElementsIn(), setAttrs(), setDialectAttrs(), and mlir::dataflow::SparseConstantPropagation::visitOperation().
|
inline |
Set the dialect attributes for this operation, and preserve all dependent.
Definition at line 498 of file Operation.h.
References mlir::NamedAttrList::append(), getAttrs(), getContext(), mlir::NamedAttrList::getDictionary(), mlir::NamedAttrList::push_back(), and setAttrs().
|
inline |
Set the source location the operation was defined or derived from.
Definition at line 201 of file Operation.h.
Referenced by generateLocationsFromIR(), and mlir::AttrTypeReplacer::replaceElementsIn().
|
inline |
Definition at line 312 of file Operation.h.
References getOpOperand(), and mlir::IROperand< DerivedT, IRValueT >::set().
Referenced by mlir::MutableOperandRange::assign(), mlir::createAffineComputationSlice(), mlir::replaceAllMemRefUsesWith(), mlir::OpTrait::detail::MultiOperandTraitBase< ConcreteType, TraitType >::setOperand(), mlir::OpTrait::OneOperand< ConcreteType >::setOperand(), mlir::linalg::splitReduction(), mlir::linalg::splitReductionByScaling(), and tileAndFuseFirstExtractUseThroughContainingOpBlockArgument().
void Operation::setOperands | ( | unsigned | start, |
unsigned | length, | ||
ValueRange | operands | ||
) |
Replace the operands beginning at 'start' and ending at 'start' + 'length' with the ones provided in 'operands'.
'operands' may be smaller or larger than the range pointed to by 'start'+'length'.
Definition at line 202 of file Operation.cpp.
References getNumOperands(), and mlir::detail::OperandStorage::setOperands().
void Operation::setOperands | ( | ValueRange | operands | ) |
Replace the current operands of this operation with the ones provided in 'operands'.
Definition at line 193 of file Operation.cpp.
References mlir::detail::OperandStorage::setOperands().
Referenced by mlir::affineParallelize(), mlir::MutableOperandRange::assign(), mlir::Region::cloneInto(), generateUnrolledLoop(), insertOperands(), SortCommutativeOperands::matchAndRewrite(), and mlir::dataflow::SparseConstantPropagation::visitOperation().
void Operation::setSuccessor | ( | Block * | block, |
unsigned | index | ||
) |
Definition at line 483 of file Operation.cpp.
References getBlockOperands(), and getNumSuccessors().
Referenced by mlir::OpTrait::detail::MultiSuccessorTraitBase< ConcreteType, TraitType >::setSuccessor(), and mlir::OpTrait::OneSuccessor< ConcreteType >::setSuccessor().
|
inline |
Definition at line 547 of file Operation.h.
References getSuccessors().
|
inline |
Definition at line 548 of file Operation.h.
References getSuccessors().
|
inline |
Definition at line 665 of file Operation.h.
References getResults(), and mlir::ResultRange::use_begin().
Referenced by user_begin().
|
inline |
Returns true if this operation has no uses.
Definition at line 675 of file Operation.h.
References getResults(), and mlir::ResultRange::use_empty().
Referenced by mlir::RewriterBase::eraseBlock(), mlir::RewriterBase::eraseOp(), mlir::isOpTriviallyDead(), isResultValueDead(), and mlir::OpState::use_empty().
|
inline |
Definition at line 666 of file Operation.h.
References getResults(), and mlir::ResultRange::use_end().
Referenced by user_end().
|
inline |
|
inline |
|
inline |
Walk the operation by calling the callback for each nested operation (including this one), block or region, 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 callback method can take any of the following forms: void(Operation*) : Walk all operations opaquely.
Definition at line 620 of file Operation.h.
Referenced by mlir::bufferization::analyzeOp(), annotateOpsWithBufferizationMarkers(), assertNoAllocsReturned(), mlir::bufferization::BufferizationAliasInfo::BufferizationAliasInfo(), mlir::bufferization::bufferizeOp(), buildBlockMapping(), canBeHoisted(), checkAliasInfoConsistency(), mlir::DataLayoutAnalysis::DataLayoutAnalysis(), mlir::bufferization::deallocateBuffers(), mlir::LLVM::detail::DebugTranslation::DebugTranslation(), mlir::bufferization::eliminateEmptyTensors(), mlir::LLVM::ensureDistinctSuccessors(), equivalenceAnalysis(), mlir::finalizeParallelLoopToGPUConversion(), findOpWithTag(), mlir::transform::gpu::findTopLevelForeachThreadOp(), findTopLevelTransform(), mlir::bufferization::OneShotAnalysisState::gatherUndefinedTensorUses(), mlir::bufferization::OneShotAnalysisState::gatherYieldedTensors(), generateLocationsFromIR(), getFirstDependentOpInRange(), getLastDependentOpInRange(), getLoadAndStoreMemRefAccesses(), getOpToConvert(), getShmReadAndWriteOps(), hasNonAffineUsersOnThePath(), inPlaceAnalysis(), mlir::bufferization::insertTensorCopies(), isOpReady(), mlir::transform::gpu::mapNestedForeachToThreadsImpl(), mlir::detail::ConversionPatternRewriterImpl::markNestedOpsIgnored(), mlir::NestedPattern::match(), mlir::bufferization::OneShotAnalysisState::OneShotAnalysisState(), mlir::OperationFingerPrint::OperationFingerPrint(), mlir::nvgpu::optimizeSharedMemoryReadsAndWrites(), outlineKernelFuncImpl(), mlir::Liveness::print(), mlir::AttrTypeReplacer::recursivelyReplaceElementsIn(), resolveUsesInRepetitiveRegions(), mlir::vector::transferOpflowOpt(), validateSupportedControlFlow(), mlir::OpState::walk(), and walkReferenceCountedValues().
|
inline |
Generic walker with a stage aware callback.
Walk the operation by calling the callback for each nested operation (including this one) N+1 times, where N is the number of regions attached to that operation.
The callback method can take any of the following forms: void(Operation *, const WalkStage &) : Walk all operation opaquely
Definition at line 648 of file Operation.h.
References mlir::detail::walk().
Definition at line 843 of file Operation.h.
Definition at line 846 of file Operation.h.
Definition at line 837 of file Operation.h.
Definition at line 846 of file Operation.h.