MLIR
20.0.0git
|
This class helps build Operations. More...
#include "mlir/IR/Builders.h"
Classes | |
class | InsertionGuard |
RAII guard to reset the insertion point of the builder when destroyed. More... | |
class | InsertPoint |
This class represents a saved insertion point. More... | |
struct | Listener |
This class represents a listener that may be used to hook into various actions within an OpBuilder. More... | |
struct | ListenerBase |
Base class for listeners. More... | |
Public Member Functions | |
OpBuilder (MLIRContext *ctx, Listener *listener=nullptr) | |
Create a builder with the given context. More... | |
OpBuilder (Region *region, Listener *listener=nullptr) | |
Create a builder and set the insertion point to the start of the region. More... | |
OpBuilder (Region ®ion, Listener *listener=nullptr) | |
OpBuilder (Operation *op, Listener *listener=nullptr) | |
Create a builder and set insertion point to the given operation, which will cause subsequent insertions to go right before it. More... | |
OpBuilder (Block *block, Block::iterator insertPoint, Listener *listener=nullptr) | |
void | setListener (Listener *newListener) |
Sets the listener of this builder to the one provided. More... | |
Listener * | getListener () const |
Returns the current listener of this builder, or nullptr if this builder doesn't have a listener. More... | |
void | clearInsertionPoint () |
Reset the insertion point to no location. More... | |
InsertPoint | saveInsertionPoint () const |
Return a saved insertion point. More... | |
void | restoreInsertionPoint (InsertPoint ip) |
Restore the insert point to a previously saved point. More... | |
void | setInsertionPoint (Block *block, Block::iterator insertPoint) |
Set the insertion point to the specified location. More... | |
void | setInsertionPoint (Operation *op) |
Sets the insertion point to the specified operation, which will cause subsequent insertions to go right before it. More... | |
void | setInsertionPointAfter (Operation *op) |
Sets the insertion point to the node after the specified operation, which will cause subsequent insertions to go right after it. More... | |
void | setInsertionPointAfterValue (Value val) |
Sets the insertion point to the node after the specified value. More... | |
void | setInsertionPointToStart (Block *block) |
Sets the insertion point to the start of the specified block. More... | |
void | setInsertionPointToEnd (Block *block) |
Sets the insertion point to the end of the specified block. More... | |
Block * | getInsertionBlock () const |
Return the block the current insertion point belongs to. More... | |
Block::iterator | getInsertionPoint () const |
Returns the current insertion point of the builder. More... | |
Block * | getBlock () const |
Returns the current block of the builder. More... | |
Block * | createBlock (Region *parent, Region::iterator insertPt={}, TypeRange argTypes=std::nullopt, ArrayRef< Location > locs=std::nullopt) |
Add new block with 'argTypes' arguments and set the insertion point to the end of it. More... | |
Block * | createBlock (Block *insertBefore, TypeRange argTypes=std::nullopt, ArrayRef< Location > locs=std::nullopt) |
Add new block with 'argTypes' arguments and set the insertion point to the end of it. More... | |
Operation * | insert (Operation *op) |
Insert the given operation at the current insertion point and return it. More... | |
Operation * | create (const OperationState &state) |
Creates an operation given the fields represented as an OperationState. More... | |
Operation * | create (Location loc, StringAttr opName, ValueRange operands, TypeRange types={}, ArrayRef< NamedAttribute > attributes={}, BlockRange successors={}, MutableArrayRef< std::unique_ptr< Region >> regions={}) |
Creates an operation with the given fields. More... | |
template<typename OpTy , typename... Args> | |
OpTy | create (Location location, Args &&...args) |
Create an operation of specific op type at the current insertion point. More... | |
template<typename OpTy , typename... Args> | |
void | createOrFold (SmallVectorImpl< Value > &results, Location location, Args &&...args) |
Create an operation of specific op type at the current insertion point, and immediately try to fold it. More... | |
template<typename OpTy , typename... Args> | |
std::enable_if_t< OpTy::template hasTrait< OpTrait::OneResult >), Value > | createOrFold (Location location, Args &&...args) |
Overload to create or fold a single result operation. More... | |
template<typename OpTy , typename... Args> | |
std::enable_if_t< OpTy::template hasTrait< OpTrait::ZeroResults >), OpTy > | createOrFold (Location location, Args &&...args) |
Overload to create or fold a zero result operation. More... | |
LogicalResult | tryFold (Operation *op, SmallVectorImpl< Value > &results) |
Attempts to fold the given operation and places new results within results . More... | |
Operation * | clone (Operation &op, IRMapping &mapper) |
Creates a deep copy of the specified 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 (Operation &op) |
Operation * | cloneWithoutRegions (Operation &op, IRMapping &mapper) |
Creates a deep copy of this operation but keep the operation regions empty. More... | |
Operation * | cloneWithoutRegions (Operation &op) |
template<typename OpT > | |
OpT | cloneWithoutRegions (OpT op) |
void | cloneRegionBefore (Region ®ion, Region &parent, Region::iterator before, IRMapping &mapping) |
Clone the blocks that belong to "region" before the given position in another region "parent". More... | |
void | cloneRegionBefore (Region ®ion, Region &parent, Region::iterator before) |
void | cloneRegionBefore (Region ®ion, Block *before) |
Public Member Functions inherited from mlir::Builder | |
Builder (MLIRContext *context) | |
Builder (Operation *op) | |
MLIRContext * | getContext () const |
Location | getUnknownLoc () |
Location | getFusedLoc (ArrayRef< Location > locs, Attribute metadata=Attribute()) |
FloatType | getFloat4E2M1FNType () |
FloatType | getFloat6E2M3FNType () |
FloatType | getFloat6E3M2FNType () |
FloatType | getFloat8E5M2Type () |
FloatType | getFloat8E4M3Type () |
FloatType | getFloat8E4M3FNType () |
FloatType | getFloat8E5M2FNUZType () |
FloatType | getFloat8E4M3FNUZType () |
FloatType | getFloat8E4M3B11FNUZType () |
FloatType | getFloat8E3M4Type () |
FloatType | getFloat8E8M0FNUType () |
FloatType | getBF16Type () |
FloatType | getF16Type () |
FloatType | getTF32Type () |
FloatType | getF32Type () |
FloatType | getF64Type () |
FloatType | getF80Type () |
FloatType | getF128Type () |
IndexType | getIndexType () |
IntegerType | getI1Type () |
IntegerType | getI2Type () |
IntegerType | getI4Type () |
IntegerType | getI8Type () |
IntegerType | getI16Type () |
IntegerType | getI32Type () |
IntegerType | getI64Type () |
IntegerType | getIntegerType (unsigned width) |
IntegerType | getIntegerType (unsigned width, bool isSigned) |
FunctionType | getFunctionType (TypeRange inputs, TypeRange results) |
TupleType | getTupleType (TypeRange elementTypes) |
NoneType | getNoneType () |
template<typename Ty , typename... Args> | |
Ty | getType (Args &&...args) |
Get or construct an instance of the type Ty with provided arguments. More... | |
template<typename Attr , typename... Args> | |
Attr | getAttr (Args &&...args) |
Get or construct an instance of the attribute Attr with provided arguments. More... | |
NamedAttribute | getNamedAttr (StringRef name, Attribute val) |
UnitAttr | getUnitAttr () |
BoolAttr | getBoolAttr (bool value) |
DictionaryAttr | getDictionaryAttr (ArrayRef< NamedAttribute > value) |
IntegerAttr | getIntegerAttr (Type type, int64_t value) |
IntegerAttr | getIntegerAttr (Type type, const APInt &value) |
FloatAttr | getFloatAttr (Type type, double value) |
FloatAttr | getFloatAttr (Type type, const APFloat &value) |
StringAttr | getStringAttr (const Twine &bytes) |
ArrayAttr | getArrayAttr (ArrayRef< Attribute > value) |
TypedAttr | getZeroAttr (Type type) |
TypedAttr | getOneAttr (Type type) |
FloatAttr | getF16FloatAttr (float value) |
FloatAttr | getF32FloatAttr (float value) |
FloatAttr | getF64FloatAttr (double value) |
IntegerAttr | getI8IntegerAttr (int8_t value) |
IntegerAttr | getI16IntegerAttr (int16_t value) |
IntegerAttr | getI32IntegerAttr (int32_t value) |
IntegerAttr | getI64IntegerAttr (int64_t value) |
IntegerAttr | getIndexAttr (int64_t value) |
IntegerAttr | getSI32IntegerAttr (int32_t value) |
Signed and unsigned integer attribute getters. More... | |
IntegerAttr | getUI32IntegerAttr (uint32_t value) |
DenseIntElementsAttr | getBoolVectorAttr (ArrayRef< bool > values) |
Vector-typed DenseIntElementsAttr getters. values must not be empty. More... | |
DenseIntElementsAttr | getI32VectorAttr (ArrayRef< int32_t > values) |
DenseIntElementsAttr | getI64VectorAttr (ArrayRef< int64_t > values) |
DenseIntElementsAttr | getIndexVectorAttr (ArrayRef< int64_t > values) |
DenseFPElementsAttr | getF32VectorAttr (ArrayRef< float > values) |
DenseFPElementsAttr | getF64VectorAttr (ArrayRef< double > values) |
DenseIntElementsAttr | getI32TensorAttr (ArrayRef< int32_t > values) |
Tensor-typed DenseIntElementsAttr getters. More... | |
DenseIntElementsAttr | getI64TensorAttr (ArrayRef< int64_t > values) |
DenseIntElementsAttr | getIndexTensorAttr (ArrayRef< int64_t > values) |
DenseBoolArrayAttr | getDenseBoolArrayAttr (ArrayRef< bool > values) |
Tensor-typed DenseArrayAttr getters. More... | |
DenseI8ArrayAttr | getDenseI8ArrayAttr (ArrayRef< int8_t > values) |
DenseI16ArrayAttr | getDenseI16ArrayAttr (ArrayRef< int16_t > values) |
DenseI32ArrayAttr | getDenseI32ArrayAttr (ArrayRef< int32_t > values) |
DenseI64ArrayAttr | getDenseI64ArrayAttr (ArrayRef< int64_t > values) |
DenseF32ArrayAttr | getDenseF32ArrayAttr (ArrayRef< float > values) |
DenseF64ArrayAttr | getDenseF64ArrayAttr (ArrayRef< double > values) |
ArrayAttr | getAffineMapArrayAttr (ArrayRef< AffineMap > values) |
ArrayAttr | getBoolArrayAttr (ArrayRef< bool > values) |
ArrayAttr | getI32ArrayAttr (ArrayRef< int32_t > values) |
ArrayAttr | getI64ArrayAttr (ArrayRef< int64_t > values) |
ArrayAttr | getIndexArrayAttr (ArrayRef< int64_t > values) |
ArrayAttr | getF32ArrayAttr (ArrayRef< float > values) |
ArrayAttr | getF64ArrayAttr (ArrayRef< double > values) |
ArrayAttr | getStrArrayAttr (ArrayRef< StringRef > values) |
ArrayAttr | getTypeArrayAttr (TypeRange values) |
AffineExpr | getAffineDimExpr (unsigned position) |
AffineExpr | getAffineSymbolExpr (unsigned position) |
AffineExpr | getAffineConstantExpr (int64_t constant) |
AffineMap | getEmptyAffineMap () |
Returns a zero result affine map with no dimensions or symbols: () -> (). More... | |
AffineMap | getConstantAffineMap (int64_t val) |
Returns a single constant result affine map with 0 dimensions and 0 symbols. More... | |
AffineMap | getDimIdentityMap () |
AffineMap | getMultiDimIdentityMap (unsigned rank) |
AffineMap | getSymbolIdentityMap () |
AffineMap | getSingleDimShiftAffineMap (int64_t shift) |
Returns a map that shifts its (single) input dimension by 'shift'. More... | |
AffineMap | getShiftedAffineMap (AffineMap map, int64_t shift) |
Returns an affine map that is a translation (shift) of all result expressions in 'map' by 'shift'. More... | |
Static Public Member Functions | |
static OpBuilder | atBlockBegin (Block *block, Listener *listener=nullptr) |
Create a builder and set the insertion point to before the first operation in the block but still inside the block. More... | |
static OpBuilder | atBlockEnd (Block *block, Listener *listener=nullptr) |
Create a builder and set the insertion point to after the last operation in the block but still inside the block. More... | |
static OpBuilder | atBlockTerminator (Block *block, Listener *listener=nullptr) |
Create a builder and set the insertion point to before the block terminator. More... | |
Protected Attributes | |
Listener * | listener |
The optional listener for events of this builder. More... | |
Protected Attributes inherited from mlir::Builder | |
MLIRContext * | context |
This class helps build Operations.
Operations that are created are automatically inserted at an insertion point. The builder is copyable.
Definition at line 215 of file Builders.h.
|
inlineexplicit |
Create a builder with the given context.
Definition at line 221 of file Builders.h.
Referenced by atBlockBegin(), atBlockEnd(), and atBlockTerminator().
Create a builder and set the insertion point to the start of the region.
Definition at line 225 of file Builders.h.
References mlir::Region::empty(), mlir::Region::front(), and setInsertionPointToStart().
Definition at line 230 of file Builders.h.
Create a builder and set insertion point to the given operation, which will cause subsequent insertions to go right before it.
Definition at line 235 of file Builders.h.
References setInsertionPoint().
|
inline |
Definition at line 240 of file Builders.h.
References setInsertionPoint().
|
inlinestatic |
Create a builder and set the insertion point to before the first operation in the block but still inside the block.
Definition at line 248 of file Builders.h.
References mlir::Block::begin(), listener, and OpBuilder().
Referenced by createSingleEntryBlock(), createSingleExitingLatch(), legalizeBlockArguments(), mlir::affine::normalizeAffineParallel(), mlir::transformCFGToSCF(), and transformCyclesToSCFLoops().
|
inlinestatic |
Create a builder and set the insertion point to after the last operation in the block but still inside the block.
Definition at line 254 of file Builders.h.
References mlir::Block::end(), listener, and OpBuilder().
Referenced by mlir::FunctionCallBuilder::create(), and transformToStructuredCFBranches().
|
inlinestatic |
Create a builder and set the insertion point to before the block terminator.
Definition at line 260 of file Builders.h.
References mlir::Block::getTerminator(), listener, and OpBuilder().
Referenced by createFullTiles(), generatePointWiseCopy(), generateShiftedLoop(), generateUnrolledLoop(), stripmineSink(), and transformToStructuredCFBranches().
|
inline |
Reset the insertion point to no location.
Creating an operation without a set insertion point is an error, but this can still be useful when the current insertion point a builder refers to is being removed.
Definition at line 387 of file Builders.h.
Referenced by mlir::bufferization::buildDeallocationLibraryFunction(), and restoreInsertionPoint().
Definition at line 610 of file Builders.cpp.
References clone().
Creates a deep copy of the specified 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.
Definition at line 588 of file Builders.cpp.
References mlir::Operation::clone(), mlir::Operation::getRegions(), insert(), listener, notifyBlockInsertions(), mlir::OpBuilder::Listener::notifyOperationInserted(), and mlir::PreOrder.
Referenced by mlir::sparse_tensor::Merger::buildExp(), buildPackingLoopNestImpl(), clone(), cloneAndFuseFirstUse(), mlir::async::cloneConstantsIntoTheRegion(), cloneOpAndUpdateDestinationArgs(), createFullPartialVectorTransferRead(), createFullPartialVectorTransferWrite(), createFullTiles(), createParallelComputeFunction(), mlir::fuseIndependentSiblingForallLoops(), mlir::fuseIndependentSiblingForLoops(), mlir::affine::fuseLoops(), generateCleanupLoopForUnroll(), generateFusedElementwiseOpRegion(), genForeachOnSparseConstant(), hoistAffineIfOp(), inlinePayload(), inlineRegionAndEmitStore(), mlir::affine::insertBackwardComputationSlice(), mlir::loopUnrollByFactor(), mlir::affine::loopUnrollJamByFactor(), mlir::loopUnrollJamByFactor(), mlir::makeRegionIsolatedFromAbove(), CanonicalizeContractAdd< AddOpType >::matchAndRewrite(), mlir::detail::CreateAlgebraicOpForEndomorphismSimplification::operator()(), mlir::outlineSingleBlockRegion(), peelForLoop(), mlir::sinkOperationsIntoLaunchOp(), mlir::vector::splitFullAndPartialTransfer(), mlir::linalg::splitReduction(), mlir::mesh::spmdizeFullyReplicatedOperation(), mlir::mesh::spmdizeTriviallyShardableOperation(), mlir::scf::tileAndFuseConsumerOfSlice(), tileAndFuseFirstExtractUseThroughContainingOpBlockArgument(), tileLinalgOpImpl(), and mlir::linalg::tileReductionUsingForall().
Definition at line 641 of file Builders.cpp.
References cloneRegionBefore(), and mlir::Block::getParent().
void OpBuilder::cloneRegionBefore | ( | Region & | region, |
Region & | parent, | ||
Region::iterator | before | ||
) |
Definition at line 635 of file Builders.cpp.
References cloneRegionBefore().
void OpBuilder::cloneRegionBefore | ( | Region & | region, |
Region & | parent, | ||
Region::iterator | before, | ||
IRMapping & | mapping | ||
) |
Clone the blocks that belong to "region" before the given position in another region "parent".
The two regions must be different. The caller is responsible for creating or updating the operation transferring flow of control to the region and passing it the correct block arguments.
Definition at line 615 of file Builders.cpp.
References mlir::Region::cloneInto(), mlir::Region::front(), listener, mlir::IRMapping::lookup(), mlir::OpBuilder::Listener::notifyBlockInserted(), notifyBlockInsertions(), mlir::OpBuilder::Listener::notifyOperationInserted(), and mlir::PreOrder.
Referenced by cloneRegionBefore(), genCoIterateBranchNest(), inlineIfCase(), and inlineWhileCase().
Definition at line 595 of file Builders.h.
References mlir::Operation::cloneWithoutRegions(), and insert().
Creates a deep copy of this operation but keep the operation regions empty.
Operands are remapped using mapper
(if present), and mapper
is updated to contain the results.
Definition at line 592 of file Builders.h.
References mlir::Operation::cloneWithoutRegions(), and insert().
Referenced by cloneWithoutRegions(), and wrapInExecuteRegion().
|
inline |
Definition at line 599 of file Builders.h.
References cloneWithoutRegions().
Operation * OpBuilder::create | ( | const OperationState & | state | ) |
Creates an operation given the fields represented as an OperationState.
Create an operation given the fields represented as an OperationState.
Definition at line 497 of file Builders.cpp.
Referenced by mlir::ArithBuilder::_and(), mlir::ArithBuilder::add(), addAtomicRMW(), addBodyWithPayloadOp(), addComdat(), addInitOperandsToLoopNest(), adjustAccessChainForBitwidth(), mlir::affine::affineParallelize(), mlir::UnrankedMemRefDescriptor::alignedPtr(), mlir::sparse_tensor::allocaBuffer(), mlir::AllocationOpLLVMLowering::allocateBufferAutoAlign(), mlir::AllocationOpLLVMLowering::allocateBufferManuallyAlign(), mlir::UnrankedMemRefDescriptor::allocatedPtr(), allocateSubviewGPUMemoryInAddressSpace(), mlir::bufferization::allocateTensorForShapedValue(), mlir::sparse_tensor::allocDenseTensor(), allocSchemeForRank(), mlir::transform::gpu::alterGpuLaunch(), appendX1Dim(), applyPad(), bitAndAddrspaceCast(), broadcast(), broadcastDynamicDimension(), mlir::tensor::bubbleUpPadSlice(), mlir::bufferization::func_ext::CallOpInterface::bufferize(), mlir::bufferization::func_ext::FuncOpInterface::bufferize(), mlir::bufferization::bufferizeBlockSignature(), mlir::linalg::bufferizeToAllocation(), mlir::bufferization::BufferizeTypeConverter::BufferizeTypeConverter(), mlir::MemRefDescriptor::bufferPtr(), mlir::NVVM::PtxBuilder::build(), buildAffineLoopFromConstants(), buildAffineLoopFromValues(), buildAffineLoopNestImpl(), HopperBuilder::buildAndInitBarrierInSharedMemory(), buildArithValue(), HopperBuilder::buildBarrierArriveTx(), buildBoolValue(), mlir::bufferization::buildDeallocationLibraryFunction(), buildDivOp(), mlir::sparse_tensor::Merger::buildExp(), HopperBuilder::buildGlobalMemRefDescriptor(), buildIdentityRegion(), mlir::tensor::buildIndependentOp(), buildLinearId(), mlir::scf::buildLoopNest(), buildMinMaxReductionSeq(), buildMultiDimReduce(), buildNumReadElements(), buildPackingLoopNestImpl(), HopperBuilder::buildPredicateLoadsOnThread0(), mlir::sparse_tensor::buildRelu(), buildSubAndExpOp(), mlir::emitc::buildTerminatedBody(), mlir::scf::buildTerminatedBody(), mlir::vector::buildTerminatedBody(), HopperBuilder::buildTmaAsyncLoad(), HopperBuilder::buildTryWaitParity(), buildUnrealizedCast(), mlir::detail::ConversionPatternRewriterImpl::buildUnresolvedMaterialization(), castAllocFuncResult(), mlir::vector::castAwayContractionLeadingOneDim(), castF32To(), mlir::bufferization::castOrReallocMemRefValue(), castToCompatibleMemRefType(), castToF32(), ceilDivPositive(), checkAndNestUnderRewriteOp(), mlir::tosa::checkHasDynamicBatchDims(), mlir::tosa::clampFloatHelper(), clampInput(), mlir::tosa::clampIntHelper(), cloneOpWithOperandsAndTypes(), cloneToCollapsedOp< GenericOp >(), mlir::affine::coalesceLoops(), collapseInnerDims(), mlir::linalg::collapseOpIterationDims(), mlir::collapseParallelLoops(), collapseValue(), mlir::spirv::combine(), common3DIdBuilderFn(), mlir::UnrankedMemRefDescriptor::computeSizes(), computeTargetSize(), concatSizesFromInputs(), mlir::sparse_tensor::constantI1(), mlir::sparse_tensor::constantI16(), mlir::sparse_tensor::constantI32(), mlir::sparse_tensor::constantI64(), mlir::sparse_tensor::constantI8(), mlir::sparse_tensor::constantIndex(), mlir::sparse_tensor::constantOne(), mlir::sparse_tensor::constantZero(), mlir::detail::constructContainerOpForParserIfNecessary(), constructTiledLoopNest(), convertBroadcastOp(), convertConstantOp(), convertConstantOpMmaSync(), convertContractOp(), convertCtlzOp(), convertElementwiseOp(), convertExtractStridedSlice(), convertFPowIOp(), mlir::convertFuncOpToLLVMFuncOp(), convertIntrinsicResult(), mlir::LLVM::ModuleImport::convertLinkerOptionsMetadata(), convertMFMAVectorOperand(), mlir::convertOpResultTypes(), convertRsqrtOp(), convertTanhOp(), convertToLaunchFuncOp(), convertTransferReadOp(), convertTransferWriteOp(), convertTransferWriteToStores(), convertYieldOp(), convVals(), copy(), mlir::linalg::copyToGPUPrivateMemory(), mlir::linalg::copyToWorkgroupMemory(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), mlir::FunctionCallBuilder::create(), createAdd(), mlir::linalg::createAdd(), mlir::affine::createAffineComputationSlice(), mlir::AllocationOpLLVMLowering::createAligned(), mlir::bufferization::BufferizationOptions::createAlloc(), createAllocation(), createAllocFields(), createAsyncDispatchFunction(), mlir::nvgpu::createAsyncGroups(), createBinarySearchFunc(), mlir::affine::createCanonicalizedAffineForOp(), mlir::ControlFlowToSCFTransformation::createCFGSwitchOp(), createChoosePivot(), createCompareThenSwap(), createConst(), createConstantAllBitsSet(), createConstFromIntAttribute(), createContractArithOp(), createCtlzFunc(), createDecl(), mlir::tensor::createDynamicDimValues(), createEqCompare(), mlir::emitc::createExpression(), createExtractAndCast(), mlir::linalg::GeneralizePadOpPattern::createFillOrGenerateOp(), createFloatConst(), createFor(), createForAllDimensions(), createFPConstant(), createFullPartialLinalgCopy(), createFullPartialVectorTransferRead(), createFullPartialVectorTransferWrite(), mlir::sparse_tensor::createFuncCall(), mlir::LLVM::createGlobalString(), createGlobalVarForEntryPointArgument(), mlir::transform::gpu::createGpuLaunch(), createGroupReduceOpImpl(), createHeapSortFunc(), createI1Constant(), createI32Constant(), createI32ConstantOf(), createInBoundsCond(), createIndex(), createIndexAttrConstant(), createInlinedCompareImplementation(), createInsertAndCast(), createInserts(), createIntConst(), createLessThanCompare(), createLinalgBodyCalculationForElementwiseOp(), createLinalgBodyCalculationForReduceOp(), mlir::arm_sme::createLoopOverTileSlices(), createMaskDropNonScalableUnitDims(), mlir::bufferization::BufferizationOptions::createMemCpy(), createMemcpy(), createMul(), mlir::linalg::createMul(), createNewAliasScopesFromNoAliasParameter(), createNewDynamicSizes(), createNonLdMatrixLoads(), mlir::sparse_tensor::createOrFoldSliceOffsetOp(), mlir::sparse_tensor::createOrFoldSliceStrideOp(), mlir::tensor::createPadHighOp(), createPartitionFunc(), mlir::LLVM::createPrintStrCall(), createPrivateMemRef(), mlir::arith::createProduct(), createPushback(), createQuickSort(), createQuickSortFunc(), mlir::vector::createReadOrMaskedRead(), mlir::createScalarOrSplatConstant(), createScanLoop(), createSeparationCondition(), createShiftDownFunc(), createSortStableFunc(), createSPIRVBuiltinCall(), createSplitPart(), mlir::ControlFlowToSCFTransformation::createStructuredBranchRegionOp(), mlir::ControlFlowToSCFTransformation::createStructuredBranchRegionTerminatorOp(), mlir::ControlFlowToSCFTransformation::createStructuredDoWhileLoopOp(), createSubTwoDividedByTwo(), createSubViewIntersection(), createSwap(), createSwitchOp(), createTypeCanonicalizedMemRefOperands(), mlir::ControlFlowToSCFTransformation::createUnreachableTerminator(), createWriteOrMaskedWrite(), creatLdMatrixCompatibleLoads(), mlir::sparse_tensor::deallocDenseTensor(), defaultDeallocBufferCallBack(), delinearizeInductionVariable(), mlir::denormalizeInductionVariable(), mlir::sparse_tensor::SparseIterator::deref(), deriveStaticUpperBound(), doSequentialDispatch(), doubleBuffer(), mlir::bufferization::dropEquivalentBufferResults(), dropRefIfNoUses(), dropTrailingX1Dim(), mlir::linalg::dropUnitDims(), dumpIndexMemRef(), dynamicallyExtractSubVector(), dynamicallyInsertSubVector(), emitElementwiseComputation(), mlir::tensor::ExtractSliceFromCollapseHelper::emitLoopNestBody(), emitScalarImplementation(), emulatedVectorLoad(), endIf(), ensureDistinctSuccessors(), mlir::sparse_tensor::LoopEmitter::enterCoIterationOverTensorsAtLvls(), mlir::sparse_tensor::LoopEmitter::exitCurrentLoop(), expandRank(), expandValue(), extendMaskRank(), extendVectorRank(), extractConvFilterSlices(), extractConvInputSlices(), extractConvResultSlices(), mlir::extractFixedOuterLoops(), extractLastDimSlice(), extractOne(), mlir::StructBuilder::extractPtr(), finalizeWhileOp(), flattenVecToBits(), forEachIJPairInXs(), mlir::sparse_tensor::SparseIterator::forward(), mlir::sparse_tensor::SparseIterator::forwardIf(), mlir::linalg::fuseElementwiseOps(), fuseIfLegal(), mlir::fuseIndependentSiblingForallLoops(), mlir::fuseIndependentSiblingForLoops(), mlir::linalg::fuseProducerOfTensor(), mlir::sparse_tensor::genAlloca(), mlir::sparse_tensor::genAllocaScalar(), genBuffers(), mlir::sparse_tensor::FuncCallOrInlineGenerator< SubClass >::genCallOrInline(), mlir::sparse_tensor::genCast(), genCoIterateBranchNest(), mlir::sparse_tensor::genCoIteration(), genCompressed(), genConditionalInsert(), genConstFloat32From(), genConstInt32From(), genDemap(), genEndInsert(), mlir::linalg::generalizeNamedOp(), generateCollapsedIndexingRegion(), generateCopy(), generateFusedElementwiseOpRegion(), generateLoopNestUsingForallOp(), generateLoopNestUsingForOp(), mlir::linalg::generateParallelLoopNest(), generatePointWiseCopy(), generateShiftedLoop(), genIf(), mlir::sparse_tensor::genIndexLoad(), mlir::sparse_tensor::SparseIterator::genInit(), genInsertionLoad(), genInsertionLoadReduce(), genInsertionStore(), mlir::sparse_tensor::genIsNonzero(), genLoad(), genLoopWithIterator(), mlir::sparse_tensor::genMapBuffers(), mlir::sparse_tensor::SparseIterator::genNotEnd(), mlir::sparse_tensor::genReader(), genRemap(), mlir::sparse_tensor::genReshapeDstShape(), mlir::sparse_tensor::genScalarToTensor(), genSliceToSize(), genStmt(), genStore(), genTensorLoad(), genTensorStore(), mlir::sparse_tensor::genToMemref(), mlir::sparse_tensor::genTuple(), mlir::sparse_tensor::genValFromAttr(), genWhenInBound(), getAsLLVMValue(), mlir::vector::getAsValues(), mlir::bufferization::getBuffer(), mlir::ControlFlowToSCFTransformation::getCFGSwitchValue(), getCleanupLoopLowerBound(), getCollapsedIndices(), getCollapsedOpOperand(), getCompressedMaskOp(), getConvOrPoolOutputDim(), mlir::sparse_tensor::SparseTensorDescriptor::getCrdMemRefOrView(), getDynamicSharedMemorySymbol(), getExpandedOutputDimFromInputShape(), getFlatMemref(), getFlatOffsetAndStrides(), mlir::sparse_tensor::getFunc(), mlir::bufferization::getGlobalFor(), mlir::arith::getIdentityValue(), getIndexedPtrs(), mlir::AllocationOpLLVMLowering::getIndexType(), mlir::sparse_tensor::SparseTensorSpecifier::getInitValue(), getLaneId(), getLibraryCallSymbolRef(), getLinearizedSrcIndices(), getLocationToWriteFullVec(), getMangledSortHelperFunc(), mlir::ConvertToLLVMPattern::getMemRefDescriptorSizes(), mlir::bufferization::DeallocationState::getMemrefsAndConditionsToDeallocate(), mlir::bufferization::DeallocationState::getMemrefWithUniqueOwnership(), mlir::ConvertToLLVMPattern::getNumElements(), getOffsetForBitwidth(), mlir::spirv::getOpenCLElementPtr(), mlir::tensor::getOrCreateDestination(), getOrCreateFormatStringConstant(), getOrCreateOperandsMatchingResultTypes(), mlir::getOrCreateRanges(), getOrCreateStep(), getOrDefineFunction(), getProductOfIntsOrIndexes(), mlir::spirv::getPushConstantValue(), mlir::arith::getReductionOp(), getScalarOrVectorConstInt(), getScalarOrVectorI32Constant(), mlir::ConvertToLLVMPattern::getSizeInBytes(), getSlice(), mlir::sparse_tensor::SparseTensorSpecifier::getSpecifierField(), getSubByteWriteMask(), getTensorDim(), mlir::ControlFlowToSCFTransformation::getUndefValue(), mlir::getValueOrCreateCastToIndexLike(), mlir::getValueOrCreateConstantIndexOp(), mlir::getValueOrCreateConstantIntOp(), mlir::vector::getVectorReductionOp(), mlir::spirv::getVulkanElementPtr(), getZero(), handleByValArgumentInit(), handleInlinedAllocas(), mlir::LLVM::detail::handleMultidimensionalVectors(), mlir::mesh::handlePartialAxesDuringResharding(), hoistAffineIfOp(), mlir::linalg::hoistPaddingOnTensors(), inferDynamicDimsForConv(), mlir::inferExpandShapeOutputShape(), mlir::sparse_tensor::LoopEmitter::initializeLoopEmit(), inlineIfCase(), inlinePayload(), inlineRegionAndEmitStore(), inlineWhileCase(), insertCasts(), insertConvResultSlices(), insertLastDimSlice(), insertOne(), mlir::linalg::insertSlicesBack(), mlir::NVVM::PtxBuilder::insertValue(), mlir::sparse_tensor::insertYieldOp(), invertCollapseShapeIndexing(), linalgBroadcastAndMaybeExtSI(), linalgIntBroadcastExtSIAdd(), mlir::LLVMTypeConverter::LLVMTypeConverter(), mlir::sparse_tensor::loadAll(), mlir::sparse_tensor::SparseIterator::locate(), mlir::LLVM::lookupOrCreateFn(), lookupOrCreateSPIRVFn(), mlir::loopUnrollByFactor(), mlir::affine::loopUnrollJamByFactor(), lowerAsEntryFunction(), lowerEntryPointABIAttr(), mlir::linalg::lowerPack(), mlir::scf::lowerToLoopsUsingSCFForOp(), mlir::linalg::lowerUnPack(), makeCanonicalAffineApplies(), mlir::affine::makeComposedAffineApply(), makeComposedMinMax(), mlir::linalg::makeMemRefCopyOp(), mlir::sparse_tensor::makeSparseTensorLevel(), mlir::vector::makeVscaleConstantBuilder(), mlir::transform::gpu::mapForallToBlocksImpl(), mlir::affine::mapLoopToProcessorIds(), mlir::transform::gpu::mapNestedForallToThreadsImpl(), mlir::transform::gpu::mapOneForallToThreadsImpl(), matchAndReplaceDepthwiseConv(), SelectToExtUI::matchAndRewrite(), YieldOpLowering::matchAndRewrite(), AssertOpLowering::matchAndRewrite(), CmpFIntToFPConst::matchAndRewrite(), CollapseShapeOpMemRefCastFolder::matchAndRewrite(), FoldTensorCastProducerOp::matchAndRewrite(), MultiBlockExecuteInliner::matchAndRewrite(), Convert1DExtractStridedSliceIntoExtractInsertChain::matchAndRewrite(), DecomposeNDExtractStridedSlice::matchAndRewrite(), ConvertTypesInSCFForOp::matchAndRewrite(), mlir::GPUDynamicSharedMemoryOpLowering::matchAndRewrite(), mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::GPUPrintfOpToLLVMCallLowering::matchAndRewrite(), mlir::GPUPrintfOpToVPrintfLowering::matchAndRewrite(), mlir::GPUReturnOpLowering::matchAndRewrite(), ConvertTypesInSCFIfOp::matchAndRewrite(), IndexSwitchOpLowering::matchAndRewrite(), DecomposeDifferentRankInsertStridedSlice::matchAndRewrite(), ConvertSameRankInsertStridedSliceIntoShuffle::matchAndRewrite(), FoldLaunchArguments::matchAndRewrite(), SwapTransposeWithBroadcast::matchAndRewrite(), MulExtendedFold< MulOp, IsSigned >::matchAndRewrite(), mlir::gpu::index_lowering::OpLowering< Op, XOp, YOp, ZOp >::matchAndRewrite(), mlir::OpWithOffsetSizesAndStridesConstantArgumentFolder< OpType, ResultTypeFn, CastOpFunc >::matchAndRewrite(), FoldTensorCastPackOp::matchAndRewrite(), mlir::OpToFuncCallLowering< SourceOp >::matchAndRewrite(), ConvertAccessChain::matchAndRewrite(), IAddCarryFold::matchAndRewrite(), ConvertLoad::matchAndRewrite(), ConvertStore::matchAndRewrite(), SwapExtractSliceOfFill::matchAndRewrite(), InsertSliceVectorizePattern::matchAndRewrite(), mlir::linalg::GeneralizeOuterUnitDimsPackOpPattern::matchAndRewrite(), mlir::linalg::GeneralizePadOpPattern::matchAndRewrite(), mlir::linalg::GeneralizeOuterUnitDimsUnPackOpPattern::matchAndRewrite(), MaterializePadValue::matchAndRewrite(), ConcatSliceOptimization::matchAndRewrite(), ConsolidateTransposeOptimization::matchAndRewrite(), mlir::linalg::LinalgCopyVTRForwardingPattern::matchAndRewrite(), mlir::linalg::LinalgCopyVTWForwardingPattern::matchAndRewrite(), ConvertTypesInSCFWhileOp::matchAndRewrite(), matchAndRewriteSortOp(), mlir::affine::materializeComputedBound(), mlir::linalg::materializeTiledShape(), materializeToTensor(), mlir::mesh::maybeInsertSourceShardingAnnotation(), mlir::mesh::maybeInsertTargetShardingAnnotation(), memcpyGetStored(), memcpyRemoveBlockingUses(), memcpyRewire(), memsetGetStored(), movePaddingToFillOrGenericOp(), moveRegionToNewWarpOpAndReplaceReturns(), mlir::ArithBuilder::mul(), mlir::memref::multiBuffer(), mlir::affine::normalizeAffineFor(), normalizeForallLoopOp(), mlir::normalizeForallOp(), mlir::affine::normalizeMemRef(), mlir::MemRefDescriptor::offset(), mlir::UnrankedMemRefDescriptor::offset(), mlir::UnrankedMemRefDescriptor::offsetBasePtr(), mlir::LLVM::detail::oneToOneRewrite(), SliceCanonicalizer::operator()(), optionallyTruncateOrExtend(), outlineKernelFuncImpl(), mlir::outlineSingleBlockRegion(), mlir::linalg::pack(), padOperandToSmallestStaticBoundingBox(), padThroughLoopIterArg(), mlir::bufferization::populateDynamicDimSizes(), mlir::arith::populateEmulateUnsupportedFloatsConversions(), mlir::math::populateExtendToSupportedTypesTypeConverter(), mlir::tosa::populateTosaTypeConversion(), mlir::vector::populateVectorLinearizeTypeConversionsAndLegality(), mlir::LLVM::ModuleImport::processFunction(), processParallelLoop(), mlir::scf::promote(), mlir::bufferization::promoteBufferResultsToOutParams(), mlir::affine::promoteIfSingleIteration(), mlir::LLVMTypeConverter::promoteOneMemRefDescriptor(), mlir::linalg::promoteSubviewAsNewBuffer(), propagateSubViewOp(), rankReducingSubviewDroppingUnitDims(), reduce(), reduceMatchAndRewriteHelper(), reifyOrComputeDynamicSizes(), mlir::arith::reifyValueBound(), relinkBranch(), mlir::affine::replaceAllMemRefUsesWith(), mlir::scf::replaceAndCastForOpIterArg(), replaceAndPropagateMemRefType(), replaceByPackingResult(), replaceConstantUsesOf(), replaceForAllWithNewSignature(), replaceForOpWithNewSignature(), mlir::bufferization::replaceOpWithBufferizedValues(), mlir::bufferization::replaceOpWithNewBufferizedOp(), replaceOpWithPredicatedOp(), replaceUsesAndPropagateType(), replaceWithDifferentYield(), mlir::sparse_tensor::reshapeCvs(), reshapeLoad(), reshapeStore(), resolveSourceIndicesExpandShape(), restoreByValRefArgumentType(), mlir::linalg::DownscaleSizeOneWindowed2DConvolution< Conv2DOp, Conv1DOp >::returningMatchAndRewrite(), mlir::linalg::DownscaleConv2DOp::returningMatchAndRewrite(), mlir::linalg::DownscaleDepthwiseConv2DNhwcHwcOp::returningMatchAndRewrite(), mlir::linalg::rewriteAsPaddedOp(), rewriteI4ToI8SignedExt(), rewriteI4ToI8UnsignedExt(), rewriteI8ToI4Trunc(), mlir::linalg::rewriteInDestinationPassingStyle(), mlir::linalg::rewriteInIm2Col(), rewriteOneForallCommonImpl(), PadOpVectorizationWithInsertSlicePattern::rewriteUser(), mlir::impl::scalarizeVectorOp(), mlir::ArithBuilder::select(), mlir::UnrankedMemRefDescriptor::setAlignedPtr(), mlir::UnrankedMemRefDescriptor::setAllocatedPtr(), mlir::UnrankedMemRefDescriptor::setOffset(), mlir::MemRefDescriptor::setOffset(), mlir::StructBuilder::setPtr(), mlir::UnrankedMemRefDescriptor::setSize(), mlir::MemRefDescriptor::setSize(), mlir::sparse_tensor::SparseTensorSpecifier::setSpecifierField(), mlir::UnrankedMemRefDescriptor::setStride(), mlir::MemRefDescriptor::setStride(), mlir::linalg::LinalgTilingOptions::setTileSizes(), mlir::ArithBuilder::sgt(), shiftValue(), mlir::tensor::simplifyCollapseShapeWithRankReducingExtractSlice(), mlir::UnrankedMemRefDescriptor::size(), mlir::MemRefDescriptor::size(), mlir::UnrankedMemRefDescriptor::sizeBasePtr(), sizesForTensor(), sliceTransferIndices(), mlir::ArithBuilder::slt(), sourceMaterializationCallback(), mlir::SparseIterationTypeConverter::SparseIterationTypeConverter(), specializeForLoopForUnrolling(), specializeParallelLoopForUnrolling(), mlir::SPIRVTypeConverter::SPIRVTypeConverter(), mlir::vector::splitFullAndPartialTransfer(), mlir::linalg::splitReduction(), mlir::linalg::splitReductionByScaling(), staticallyExtractSubvector(), staticallyInsertSubvector(), mlir::sparse_tensor::storeAll(), mlir::UnrankedMemRefDescriptor::stride(), mlir::MemRefDescriptor::stride(), mlir::UnrankedMemRefDescriptor::strideBasePtr(), stripmineSink(), mlir::ArithBuilder::sub(), mlir::scf::tileAndFuseConsumerOfSlice(), mlir::linalg::tileReductionUsingForall(), transformMemRefLoadWithReducedRank(), mlir::linalg::transposeBatchMatmul(), mlir::linalg::transposeMatmul(), transposeOneLinalgOperandAndReplace(), mlir::MemRefDescriptor::undef(), mlir::UnrankedMemRefDescriptor::undef(), mlir::ComplexStructBuilder::undef(), mlir::linalg::unrollIndex(), updateCalls(), updateExpandedGenericOpRegion(), updateReturnOps(), vectorizeAsTensorPackOp(), vectorizeAsTensorUnpackOp(), mlir::linalg::vectorizeCopy(), mlir::LLVM::detail::vectorOneToOneRewrite(), wmmaPushInputOperand(), wmmaPushOutputOperand(), wrapExternalFunction(), wrapForExternalCallers(), wrapInExecuteRegion(), and mlir::scf::yieldReplacementForFusedProducer().
Operation * OpBuilder::create | ( | Location | loc, |
StringAttr | opName, | ||
ValueRange | operands, | ||
TypeRange | types = {} , |
||
ArrayRef< NamedAttribute > | attributes = {} , |
||
BlockRange | successors = {} , |
||
MutableArrayRef< std::unique_ptr< Region >> | regions = {} |
||
) |
Creates an operation with the given fields.
Definition at line 502 of file Builders.cpp.
|
inline |
Create an operation of specific op type at the current insertion point.
Definition at line 514 of file Builders.h.
Block * OpBuilder::createBlock | ( | Block * | insertBefore, |
TypeRange | argTypes = std::nullopt , |
||
ArrayRef< Location > | locs = std::nullopt |
||
) |
Add new block with 'argTypes' arguments and set the insertion point to the end of it.
The block is placed before 'insertBefore'. locs
contains the locations of the inserted arguments, and should match the size of argTypes
.
The block is placed before 'insertBefore'.
Definition at line 489 of file Builders.cpp.
References createBlock(), and mlir::Block::getParent().
Block * OpBuilder::createBlock | ( | Region * | parent, |
Region::iterator | insertPt = {} , |
||
TypeRange | argTypes = std::nullopt , |
||
ArrayRef< Location > | locs = std::nullopt |
||
) |
Add new block with 'argTypes' arguments and set the insertion point to the end of it.
The block is inserted at the provided insertion point of 'parent'. locs
contains the locations of the inserted arguments, and should match the size of argTypes
.
Definition at line 470 of file Builders.cpp.
References mlir::Block::addArguments(), mlir::Region::end(), mlir::Region::getBlocks(), listener, mlir::OpBuilder::Listener::notifyBlockInserted(), and setInsertionPointToEnd().
Referenced by addAtomicRMW(), mlir::detail::ConversionPatternRewriterImpl::applySignatureConversion(), buildGenericRegion(), checkAndNestUnderRewriteOp(), createAsyncDispatchFunction(), createBinarySearchFunc(), createBlock(), createDecl(), createElementFPowIFunc(), createElementIPowIFunc(), createParallelComputeFunction(), createPartitionFunc(), createQuickSortFunc(), createScanLoop(), mlir::ControlFlowToSCFTransformation::createStructuredDoWhileLoopOp(), ensureDistinctSuccessors(), mlir::impl::ensureRegionTerminator(), fillStructuredOpRegion(), mlir::sparse_tensor::genCoIteration(), generateFusedElementwiseOpRegion(), genLoopWithIterator(), mlir::makeRegionIsolatedFromAbove(), mlirLinalgFillBuiltinNamedOpRegion(), movePaddingToFillOrGenericOp(), mlir::outlineSingleBlockRegion(), mlir::LLVM::ModuleImport::processFunction(), mlir::linalg::rewriteInDestinationPassingStyle(), mlir::RewriterBase::splitBlock(), and mlir::mesh::spmdizeBlock().
|
inline |
Overload to create or fold a single result operation.
Definition at line 556 of file Builders.h.
|
inline |
Overload to create or fold a zero result operation.
Definition at line 565 of file Builders.h.
References tryFold().
|
inline |
Create an operation of specific op type at the current insertion point, and immediately try to fold it.
This functions populates 'results' with the results of the operation.
Definition at line 528 of file Builders.h.
Referenced by adjustAccessChainForBitwidth(), broadcastDynamicDimension(), broadcastIfNeeded(), buildLoopIterationCount(), canonicalizeAssociativeCommutativeBinaryOp(), mlir::vector::castAwayContractionLeadingOneDim(), castBoolToIntN(), castIntNToBool(), castIntValueToSameSizedType(), castSameSizedTypes(), castToSameSizedInt(), clampInput(), mlir::linalg::computeContinuousTileSizes(), convertIntrinsicResult(), mlir::tensor::createCanonicalRankReducingExtractSliceOp(), mlir::tensor::createCanonicalRankReducingInsertSliceOp(), mlir::memref::createCanonicalRankReducingSubViewOp(), createExtractAndCast(), createInsertAndCast(), mlir::vector::createOrFoldDimOp(), mlir::linalg::createOrFoldDimOp(), mlir::createScalarOrSplatConstant(), doubleBuffer(), emitElementwiseComputation(), mlir::emitNormalizedLoopBounds(), expandValue(), getCollapsedOutputDimFromInputShape(), mlir::memref::getMixedSize(), mlir::tensor::getMixedSize(), getOffsetForBitwidth(), mlir::inferExpandShapeOutputShape(), mlir::spirv::linearizeIndex(), mlir::loopUnrollJamByFactor(), mlir::linalg::GeneralizePadOpPattern::matchAndRewrite(), peelForLoop(), mlir::linalg::promoteSubviewAsNewBuffer(), shiftValue(), and wmmaPushInputOperand().
|
inline |
Returns the current block of the builder.
Definition at line 456 of file Builders.h.
Referenced by mlir::sparse_tensor::Merger::buildExp(), mlir::FunctionCallBuilder::create(), and mlir::sparse_tensor::createFuncCall().
|
inline |
Return the block the current insertion point belongs to.
Note that the insertion point is not necessarily the end of the block.
Definition at line 450 of file Builders.h.
Referenced by mlir::affine::affineParallelize(), checkAndNestUnderRewriteOp(), mlir::LLVM::createGlobalString(), mlir::sparse_tensor::LoopEmitter::enterCoIterationOverTensorsAtLvls(), finalizeWhileOp(), mlir::affine::makeComposedFoldedAffineApply(), makeComposedFoldedMinMax(), replaceWithConstant(), and saveInsertionPoint().
|
inline |
Returns the current insertion point of the builder.
Definition at line 453 of file Builders.h.
Referenced by mlir::affine::affineParallelize(), broadcastIfNeeded(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), mlir::affine::makeComposedFoldedAffineApply(), makeComposedFoldedMinMax(), materializeConstant(), rewriteOneForallCommonImpl(), saveInsertionPoint(), mlir::scf::tileAndFuseConsumerOfSlice(), and mlir::scf::yieldReplacementForFusedProducer().
|
inline |
Returns the current listener of this builder, or nullptr if this builder doesn't have a listener.
Definition at line 328 of file Builders.h.
References listener.
Referenced by createAsyncDispatchFunction(), mlir::LLVM::createGlobalString(), createParallelComputeFunction(), mlir::affine::makeComposedFoldedAffineApply(), makeComposedFoldedMinMax(), mlir::OneToNConversionPattern::matchAndRewrite(), and mlir::OperationFolder::tryToFold().
Insert the given operation at the current insertion point and return it.
Definition at line 461 of file Builders.cpp.
References mlir::Block::getOperations(), listener, and mlir::OpBuilder::Listener::notifyOperationInserted().
Referenced by clone(), cloneWithoutRegions(), mlir::spirv::combine(), mlir::impl::ensureRegionTerminator(), and tryFold().
|
inline |
Restore the insert point to a previously saved point.
Definition at line 398 of file Builders.h.
References clearInsertionPoint(), mlir::OpBuilder::InsertPoint::getBlock(), mlir::OpBuilder::InsertPoint::getPoint(), mlir::OpBuilder::InsertPoint::isSet(), and setInsertionPoint().
Referenced by mlir::LLVM::createPrintStrCall(), mlir::OneToNConversionPattern::matchAndRewrite(), and mlir::OpBuilder::InsertionGuard::~InsertionGuard().
|
inline |
Return a saved insertion point.
Definition at line 393 of file Builders.h.
References getInsertionBlock(), and getInsertionPoint().
Referenced by mlir::LLVM::createPrintStrCall(), and mlir::OneToNConversionPattern::matchAndRewrite().
|
inline |
Set the insertion point to the specified location.
Definition at line 406 of file Builders.h.
Referenced by addInitOperandsToLoopNest(), mlir::memref::allocToAlloca(), mlir::applyPartialOneToNConversion(), applyTilingToAll(), mlir::bufferization::func_ext::FuncOpInterface::bufferize(), mlir::linalg::bufferizeToAllocation(), HopperBuilder::buildGlobalMemRefDescriptor(), mlir::tensor::buildIndependentOp(), buildPackingLoopNestImpl(), mlir::detail::ConversionPatternRewriterImpl::buildUnresolvedMaterialization(), canonicalizeMinMaxOp(), cloneAndFuseFirstUse(), mlir::coalesceLoops(), mlir::linalg::collapseOpIterationDims(), mlir::collapseParallelLoops(), convertAffineApply(), convertBroadcastOp(), convertConstantOp(), convertConstantOpMmaSync(), convertContractOp(), convertContractOpToMmaSync(), convertElementwiseOp(), convertExtractStridedSlice(), convertForOp(), convertTransferReadOp(), convertTransferReadToLoads(), convertTransferWriteOp(), convertTransferWriteToStores(), convertYieldOp(), mlir::nvgpu::createAsyncGroups(), createDecl(), createGlobalVarForEntryPointArgument(), createNonLdMatrixLoads(), creatLdMatrixCompatibleLoads(), declareReduction(), mlir::bufferization::dropEquivalentBufferResults(), mlir::sparse_tensor::LoopEmitter::exitCurrentLoop(), fuseIfLegal(), mlir::linalg::fuseProducerOfTensor(), mlir::sparse_tensor::FuncCallOrInlineGenerator< SubClass >::genCallOrInline(), generateLoopNestUsingForallOp(), getGenericOpLoopRange(), getLibraryCallSymbolRef(), getMangledSortHelperFunc(), mlir::tensor::getOrCreateDestination(), handleInlinedAllocas(), VectorizationState::initState(), inlineIfCase(), inlineWhileCase(), legalizeUnresolvedMaterialization(), mlir::loopUnrollJamByFactor(), mlir::linalg::lowerPack(), mlir::scf::lowerToLoopsUsingSCFForOp(), mlir::linalg::lowerUnPack(), mlir::affine::makeComposedFoldedAffineApply(), makeComposedFoldedMinMax(), MultiBlockExecuteInliner::matchAndRewrite(), mlir::GPUDynamicSharedMemoryOpLowering::matchAndRewrite(), mlir::PatternApplicator::matchAndRewrite(), InsertSliceOfInsertSliceFolder< OpTy >::matchAndRewrite(), mlir::mesh::maybeInsertSourceShardingAnnotation(), moveRegionToNewWarpOpAndReplaceReturns(), mlir::memref::multiBuffer(), OpBuilder(), mlir::nvgpu::optimizeSharedMemoryReadsAndWrites(), mlir::outlineSingleBlockRegion(), mlir::linalg::packTranspose(), peelForLoop(), pipelineForSharedCopies(), processParallelLoop(), propagateSubViewOp(), relinkBranch(), mlir::scf::replaceAndCastForOpIterArg(), replaceByPackingResult(), replaceForAllWithNewSignature(), replaceForOpWithNewSignature(), replaceUnitDimIndexOps(), replaceUsesAndPropagateType(), replaceWithDifferentYield(), restoreInsertionPoint(), CopyBuilder::rewrite(), rewrite(), rewriteOneForallCommonImpl(), PadOpVectorizationWithInsertSlicePattern::rewriteUser(), PadOpVectorizationWithTransferWritePattern::rewriteUser(), setInsertionPoint(), setInsertionPointAfter(), setInsertionPointToEnd(), setInsertionPointToStart(), mlir::vector::splitFullAndPartialTransfer(), mlir::linalg::splitReduction(), mlir::linalg::splitReductionByScaling(), mlir::scf::tileAndFuseConsumerOfSlice(), tileAndFuseFirstExtractUse(), tileAndFuseFirstExtractUseThroughContainingOpBlockArgument(), mlir::scf::tileAndFuseProducerOfSlice(), tileLinalgOpImpl(), mlir::linalg::tileReductionUsingForall(), vectorizeAsTensorPackOp(), vectorizeAsTensorPadOp(), vectorizeAsTensorUnpackOp(), wrapInExecuteRegion(), and mlir::scf::yieldReplacementForFusedProducer().
|
inline |
Sets the insertion point to the specified operation, which will cause subsequent insertions to go right before it.
Definition at line 414 of file Builders.h.
References mlir::Operation::getBlock(), and setInsertionPoint().
|
inline |
Sets the insertion point to the node after the specified operation, which will cause subsequent insertions to go right after it.
Definition at line 420 of file Builders.h.
References mlir::Operation::getBlock(), and setInsertionPoint().
Referenced by mlir::linalg::blockPackMatmul(), createAsyncDispatchFunction(), createBinarySearchFunc(), createChoosePivot(), mlir::emitc::createExpression(), createHeapSortFunc(), createInlinedCompareImplementation(), createInsert3rd(), createPartitionFunc(), createQuickSort(), createQuickSortFunc(), createScanLoop(), createSort3(), createSort5(), createSortStableFunc(), destructureSlot(), doubleBuffer(), dropRefIfNoUses(), mlir::sparse_tensor::LoopEmitter::exitCurrentLoop(), finalizeWhileOp(), mlir::sparse_tensor::SparseIterator::forwardIf(), mlir::fuseIndependentSiblingForallLoops(), mlir::fuseIndependentSiblingForLoops(), genCoIterateBranchNest(), genCompressed(), genConditionalInsert(), genEndInsert(), genInsertionStore(), genTensorStore(), genWhenInBound(), hoistAffineIfOp(), mlir::linalg::hoistPaddingOnTensors(), mlir::inlineCall(), mlir::loopUnrollByFactor(), mlir::affine::loopUnrollJamByFactor(), mlir::transform::gpu::mapOneForallToThreadsImpl(), IndexSwitchOpLowering::matchAndRewrite(), mlir::linalg::offsetIndices(), padThroughLoopIterArg(), peelForLoop(), mlir::scf::pipelineForLoop(), mlir::scf::promote(), promoteSubViews(), mlir::scf::replaceAndCastForOpIterArg(), replaceAndPropagateMemRefType(), mlir::bufferization::replaceOpWithBufferizedValues(), mlir::linalg::rewriteAsPaddedOp(), mlir::linalg::rewriteInDestinationPassingStyle(), setInsertionPointAfter(), setInsertionPointAfterValue(), setInsertionPointToStart(), mlir::linalg::tileReductionUsingForall(), mlir::scf::tileUsingSCF(), and updateExpandedGenericOpRegion().
|
inline |
Sets the insertion point to the node after the specified value.
If value has a defining operation, sets the insertion point to the node after such defining operation. This will cause subsequent insertions to go right after it. Otherwise, value is a BlockArgument. Sets the insertion point to the start of its block.
Definition at line 429 of file Builders.h.
References mlir::Value::getDefiningOp(), setInsertionPointAfter(), and setInsertionPointToStart().
Referenced by mlir::transform::gpu::alterGpuLaunch(), mlir::bufferization::bufferizeBlockSignature(), createInlinedCompareImplementation(), mlir::mesh::handlePartialAxesDuringResharding(), mlir::mesh::maybeInsertTargetShardingAnnotation(), mlir::mesh::moveLastSplitAxisInResharding(), and mlir::mesh::unsplitLastAxisInResharding().
|
inline |
Sets the insertion point to the end of the specified block.
Definition at line 444 of file Builders.h.
References mlir::Block::end(), and setInsertionPoint().
Referenced by addAtomicRMW(), mlir::scf::buildLoopNest(), buildPackingLoopNestImpl(), mlir::LLVM::ModuleImport::convertMetadata(), createAsyncDispatchFunction(), createBinarySearchFunc(), createBlock(), createDecl(), mlir::linalg::createDestinationPassingStyleInitOperand(), createElementFPowIFunc(), createElementIPowIFunc(), mlir::emitc::createExpression(), mlir::transform::gpu::createGpuLaunch(), createParallelComputeFunction(), createPartitionFunc(), createQuickSortFunc(), createScanLoop(), mlir::ControlFlowToSCFTransformation::createStructuredDoWhileLoopOp(), mlir::impl::ensureRegionTerminator(), mlir::sparse_tensor::LoopEmitter::exitCurrentLoop(), fuseIfLegal(), genCoIterateBranchNest(), generateLoopNestUsingForallOp(), generateLoopNestUsingForOp(), genLoopWithIterator(), lowerEntryPointABIAttr(), AssertOpLowering::matchAndRewrite(), MultiBlockExecuteInliner::matchAndRewrite(), mlir::outlineSingleBlockRegion(), mlir::LLVM::ModuleImport::processFunction(), mlir::mesh::spmdizeBlock(), and mlir::linalg::tileReductionUsingForall().
|
inline |
Sets the insertion point to the start of the specified block.
Definition at line 439 of file Builders.h.
References mlir::Block::begin(), and setInsertionPoint().
Referenced by addBodyWithPayloadOp(), addComdat(), allocateSubviewGPUMemoryInAddressSpace(), mlir::bufferization::bufferizeBlockSignature(), buildAffineLoopNestImpl(), mlir::bufferization::buildDeallocationLibraryFunction(), mlir::scf::buildLoopNest(), buildPackingLoopNestImpl(), calculateTileOffsetsAndSizes(), mlir::async::cloneConstantsIntoTheRegion(), mlir::affine::coalesceLoops(), mlir::coalesceLoops(), mlir::collapseParallelLoops(), mlir::spirv::combine(), createBinarySearchFunc(), createChoosePivot(), createCompareThenSwap(), createCtlzFunc(), createEqCompare(), createFor(), createHeapSortFunc(), createLessThanCompare(), mlir::arm_sme::createLoopOverTileSlices(), createPartitionFunc(), mlir::LLVM::createPrintStrCall(), createQuickSort(), createQuickSortFunc(), createShiftDownFunc(), createSortStableFunc(), destructureSlot(), dropRefIfNoUses(), mlir::vector::eliminateVectorMasks(), endIf(), mlir::sparse_tensor::LoopEmitter::enterCoIterationOverTensorsAtLvls(), mlir::sparse_tensor::LoopEmitter::enterCurrentCoIterationCase(), fillStructuredOpRegion(), mlir::sparse_tensor::SparseIterator::forwardIf(), mlir::fuseIndependentSiblingForallLoops(), mlir::fuseIndependentSiblingForLoops(), mlir::sparse_tensor::FuncCallOrInlineGenerator< SubClass >::genCallOrInline(), genCoIterateBranchNest(), mlir::sparse_tensor::genCoIteration(), genCompressed(), genConditionalInsert(), genEndInsert(), generateCollapsedIndexingRegion(), genIf(), genInsertionStore(), genLoopWithIterator(), genTensorStore(), genWhenInBound(), getDynamicSharedMemorySymbol(), mlir::OperationFolder::getOrCreateConstant(), getOrCreateFormatStringConstant(), getOrDefineFunction(), handleByValArgumentInit(), handleInlinedAllocas(), injectGpuIndexOperations(), mlir::makeRegionIsolatedFromAbove(), mlir::transform::gpu::mapForallToBlocksImpl(), mlir::GPUFuncOpLowering::matchAndRewrite(), FoldLaunchArguments::matchAndRewrite(), mlirLinalgFillBuiltinNamedOpRegion(), mlir::LLVM::ModuleImport::ModuleImport(), movePaddingToFillOrGenericOp(), mlir::memref::multiBuffer(), mlir::affine::normalizeAffineFor(), normalizeForallLoopOp(), OpBuilder(), mlir::outlineSingleBlockRegion(), processParallelLoop(), mlir::scf::replaceAndCastForOpIterArg(), restoreByValRefArgumentType(), rewrite(), mlir::linalg::rewriteInDestinationPassingStyle(), setInsertionPointAfter(), setInsertionPointAfterValue(), setInsertionPointToStart(), mlir::linalg::LinalgTilingOptions::setTileSizes(), mlir::vector::splitFullAndPartialTransfer(), wrapExternalFunction(), wrapForExternalCallers(), and wrapInExecuteRegion().
|
inline |
Sets the listener of this builder to the one provided.
Definition at line 324 of file Builders.h.
References listener.
Referenced by mlir::transform::TransformRewriter::TransformRewriter(), and mlir::walkAndApplyPatterns().
LogicalResult OpBuilder::tryFold | ( | Operation * | op, |
SmallVectorImpl< Value > & | results | ||
) |
Attempts to fold the given operation and places new results within results
.
Returns success if the operation was folded, failure otherwise. If the fold was in-place, results
will not be filled. Note: This function does not erase the operation on a successful fold.
Definition at line 512 of file Builders.cpp.
References mlir::Builder::context, mlir::Operation::erase(), mlir::Operation::fold(), mlir::Operation::getDialect(), mlir::Operation::getLoc(), mlir::Operation::getResults(), mlir::ResultRange::getTypes(), insert(), mlir::m_Constant(), mlir::matchPattern(), and mlir::Dialect::materializeConstant().
Referenced by createOrFold().
|
protected |
The optional listener for events of this builder.
Definition at line 615 of file Builders.h.
Referenced by atBlockBegin(), mlir::ImplicitLocOpBuilder::atBlockBegin(), atBlockEnd(), mlir::ImplicitLocOpBuilder::atBlockEnd(), atBlockTerminator(), mlir::ImplicitLocOpBuilder::atBlockTerminator(), clone(), cloneRegionBefore(), createBlock(), mlir::RewriterBase::eraseBlock(), mlir::RewriterBase::eraseOp(), mlir::RewriterBase::finalizeOpModification(), getListener(), mlir::RewriterBase::inlineBlockBefore(), mlir::RewriterBase::inlineRegionBefore(), insert(), mlir::RewriterBase::moveBlockBefore(), mlir::RewriterBase::moveOpBefore(), mlir::RewriterBase::notifyMatchFailure(), mlir::RewriterBase::replaceAllOpUsesWith(), setListener(), and mlir::RewriterBase::splitBlock().