MLIR
17.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... | |
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) |
![]() | |
Builder (MLIRContext *context) | |
Builder (Operation *op) | |
MLIRContext * | getContext () const |
Location | getUnknownLoc () |
Location | getFusedLoc (ArrayRef< Location > locs, Attribute metadata=Attribute()) |
FloatType | getFloat8E5M2Type () |
FloatType | getFloat8E4M3FNType () |
FloatType | getBF16Type () |
FloatType | getF16Type () |
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) |
Attribute | getZeroAttr (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) |
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... | |
Additional Inherited Members | |
![]() | |
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 199 of file Builders.h.
|
inlineexplicit |
Create a builder with the given context.
Definition at line 204 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 208 of file Builders.h.
References mlir::Block::begin(), mlir::Region::empty(), mlir::Region::front(), and setInsertionPoint().
Definition at line 213 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 218 of file Builders.h.
References setInsertionPoint().
|
inline |
Definition at line 223 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 231 of file Builders.h.
References mlir::Block::begin(), and OpBuilder().
Referenced by mlir::collapseParallelLoops(), getOrInsertPushConstantVariable(), mlir::normalizeAffineParallel(), and normalizeLoop().
|
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 237 of file Builders.h.
References mlir::Block::end(), and OpBuilder().
|
inlinestatic |
Create a builder and set the insertion point to before the block terminator.
Definition at line 243 of file Builders.h.
References mlir::Block::getTerminator(), and OpBuilder().
Referenced by createFullTiles(), generatePointWiseCopy(), generateShiftedLoop(), generateUnrolledLoop(), and stripmineSink().
|
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 332 of file Builders.h.
Referenced by restoreInsertionPoint().
Definition at line 525 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 510 of file Builders.cpp.
References mlir::Operation::clone(), mlir::Operation::getRegions(), insert(), and mlir::OpBuilder::Listener::notifyOperationInserted().
Referenced by clone(), cloneAndFuseFirstUse(), mlir::async::cloneConstantsIntoTheRegion(), createFullPartialVectorTransferRead(), createFullPartialVectorTransferWrite(), createFullTiles(), createParallelComputeFunction(), fuseIfLegal(), mlir::fuseLoops(), generateCleanupLoopForUnroll(), generateFusedElementwiseOpRegion(), genForeachOnSparseConstant(), hoistAffineIfOp(), mlir::linalg::hoistPaddingOnTensors(), inlinePayload(), inlineRegionAndEmitStore(), mlir::insertBackwardComputationSlice(), mlir::loopUnrollByFactor(), mlir::loopUnrollJamByFactor(), CanonicalizeContractAdd< AddOpType >::matchAndRewrite(), AllocaScopeHoister::matchAndRewrite(), mlir::outlineSingleBlockRegion(), peelForLoop(), mlir::sinkOperationsIntoLaunchOp(), mlir::vector::splitFullAndPartialTransfer(), mlir::linalg::splitReduction(), tileAndFuseFirstExtractUseThroughContainingOpBlockArgument(), tileLinalgOpImpl(), tilePadOp(), mlir::linalg::tileReductionUsingForeachThread(), tileToForeachThreadOpImpl(), and vectorizeOneOp().
Definition at line 530 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 527 of file Builders.h.
References mlir::Operation::cloneWithoutRegions(), and insert().
Referenced by cloneWithoutRegions(), and wrapInExecuteRegion().
|
inline |
Definition at line 534 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 422 of file Builders.cpp.
References mlir::Operation::create(), and insert().
Referenced by mlir::ArithBuilder::_and(), mlir::ArithBuilder::add(), addAtomicRMW(), addBodyWithPayloadOp(), adjustAccessChainForBitwidth(), mlir::affineParallelize(), mlir::UnrankedMemRefDescriptor::alignedPtr(), mlir::sparse_tensor::allocaBuffer(), mlir::AllocationOpLLVMLowering::allocateBufferAutoAlign(), mlir::AllocationOpLLVMLowering::allocateBufferManuallyAlign(), mlir::UnrankedMemRefDescriptor::allocatedPtr(), mlir::bufferization::allocateTensorForShapedValue(), mlir::sparse_tensor::allocDenseTensor(), alterGpuLaunch(), appendX1Dim(), applyPad(), broadcast(), mlir::tensor::bubbleUpPadSlice(), mlir::bufferization::func_ext::CallOpInterface::bufferize(), mlir::bufferization::func_ext::FuncOpInterface::bufferize(), mlir::bufferization::BufferizeTypeConverter::BufferizeTypeConverter(), buildAffineLoopFromConstants(), buildAffineLoopFromValues(), buildAffineLoopNestImpl(), mlir::sparse_tensor::Merger::buildExp(), buildIdentityRegion(), mlir::scf::buildLoopNest(), buildMinMaxReductionSeq(), buildMultiDimReduce(), mlir::scf::buildTerminatedBody(), mlir::vector::buildTerminatedBody(), buildUnresolvedMaterialization(), buildVectorComparison(), buildVectorWrite(), calculateExpandedAccessIndices(), calculateGatherOffset(), castBoolToIntN(), castDataPtr(), castIntNToBool(), mlir::bufferization::castOrReallocMemRefValue(), ceilDivPositive(), checkAndNestUnderRewriteOp(), mlir::tosa::checkHasDynamicBatchDims(), mlir::tosa::clampFloatHelper(), mlir::tosa::clampIntHelper(), mlir::clone(), cloneOpWithOperandsAndTypes(), mlir::cloneWithoutRegions(), mlir::coalesceLoops(), mlir::linalg::collapseGenericOpIterationDims(), mlir::collapseParallelLoops(), mlir::spirv::combine(), mlir::UnrankedMemRefDescriptor::computeSizes(), concatSizesFromInputs(), mlir::sparse_tensor::constantI1(), mlir::sparse_tensor::constantI16(), mlir::sparse_tensor::constantI32(), mlir::sparse_tensor::constantI8(), mlir::sparse_tensor::constantIndex(), mlir::sparse_tensor::constantOne(), mlir::sparse_tensor::constantZero(), mlir::detail::constructContainerOpForParserIfNecessary(), constructTiledLoopNest(), convertBroadcastOp(), convertConstantOp(), convertConstantOpMmaSync(), convertContractOp(), convertContractOpToMmaSync(), convertCtlzOp(), convertElementwiseOp(), convertExtractStridedSlice(), convertIntrinsicResult(), mlir::convertScalarToDtype(), convertTanhOp(), convertToLaunchFuncOp(), convertTransferReadOp(), convertTransferWriteOp(), convertTransferWriteToStores(), convertYieldOp(), copy(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), create(), mlir::OperationFolder::create(), createAdd(), mlir::createAffineComputationSlice(), mlir::AllocationOpLLVMLowering::createAligned(), mlir::bufferization::BufferizationOptions::createAlloc(), createAsyncDispatchFunction(), createBinarySearchFunc(), mlir::createCanonicalizedAffineForOp(), createCompareFuncImplementation(), createConst(), createConstantAllBitsSet(), createConstFromIntAttribute(), createContractArithOp(), mlir::bufferization::BufferizationOptions::createDealloc(), createDecl(), mlir::tensor::createDynamicDimValues(), createEqCompare(), mlir::linalg::GeneralizePadOpPattern::createFillOrGenerateOp(), createFoldedSLE(), createForAllDimensions(), createFPConstant(), createFullPartialLinalgCopy(), createFullPartialVectorTransferRead(), createFullPartialVectorTransferWrite(), mlir::sparse_tensor::createFuncCall(), mlir::LLVM::createGlobalString(), createGlobalVarForEntryPointArgument(), createGpuLaunch(), createGroupReduceOpImpl(), createI32ConstantOf(), createInBoundsCond(), mlir::ConvertToLLVMPattern::createIndexAttrConstant(), createIndexAttrConstant(), createIndexCast(), mlir::AllocationOpLLVMLowering::createIndexConstant(), createInserts(), createLessThanCompare(), createLinalgBodyCalculationForElementwiseOp(), createLinalgBodyCalculationForReduceOp(), mlir::bufferization::BufferizationOptions::createMemCpy(), createMul(), createNewDynamicSizes(), createNonLdMatrixLoads(), createOrFold(), mlir::tensor::createPadHighOp(), createPartitionFunc(), createPrintMsg(), createPrivateMemRef(), createScalarOrSplatConstant(), createScanLoop(), createSeparationCondition(), createSortNonstableFunc(), createSortStableFunc(), createSplitPart(), createSubViewIntersection(), createSwap(), createSwitchOp(), createTypeCanonicalizedMemRefOperands(), creatLdMatrixCompatibleLoads(), mlir::sparse_tensor::deallocDenseTensor(), defaultDeallocBufferCallBack(), deriveStaticUpperBound(), doSequentialDispatch(), doubleBuffer(), mlir::bufferization::dropEquivalentBufferResults(), dropRefIfNoUses(), dropTrailingX1Dim(), elementwiseMatchAndRewriteHelper(), mlir::tensor::ExtractSliceFromCollapseHelper::emitLoopNestBody(), emitScalarImplementation(), emulateSignedRemainder(), endIf(), ensureDistinctSuccessors(), mlir::sparse_tensor::LoopEmitter::enterCoIterationOverTensorsAtDims(), mlir::sparse_tensor::LoopEmitter::enterFilterLoopOverTensorAtDim(), mlir::sparse_tensor::LoopEmitter::enterLoopOverTensorAtDim(), extendVectorRank(), mlir::extractFixedOuterLoops(), extractLastDimSlice(), extractOne(), mlir::StructBuilder::extractPtr(), finalizeWhileOp(), forEachIJPairInXs(), mlir::sparse_tensor::foreachInSparseConstant(), mlir::linalg::fuseElementwiseOps(), mlir::linalg::TileLoopNest::fuseProducer(), mlir::linalg::fuseProducerOfTensor(), fuseWithReshapeByExpansion(), mlir::sparse_tensor::LoopEmitter::genAffine(), mlir::sparse_tensor::genAlloca(), mlir::sparse_tensor::genAllocaScalar(), genBuffers(), mlir::linalg::generalizeNamedOp(), generateCollapsedIndexingRegion(), generateCopy(), generateFusedElementwiseOpRegion(), generateGpuBlockIds(), mlir::linalg::generateParallelLoopNest(), generatePointWiseCopy(), generateShiftedLoop(), generateTileLoopNest(), genExpand(), genIf(), genIndexAndValueForSparse(), genIndexLoad(), genInsertionLoad(), genInsertionLoadReduce(), genInsertionStore(), mlir::sparse_tensor::genIsNonzero(), mlir::sparse_tensor::genReshapeDstShape(), genSplitSparseConstant(), genTensorLoad(), genTensorStore(), mlir::sparse_tensor::genToIndices(), mlir::sparse_tensor::genToPointers(), mlir::sparse_tensor::genToValues(), mlir::sparse_tensor::genTuple(), mlir::sparse_tensor::genValueForDense(), getAsValue(), mlir::bufferization::getBuffer(), getCleanupLoopLowerBound(), getCollapsedOpOperand(), getConvOutputDim(), getExpandedOutputDimFromInputShape(), mlir::sparse_tensor::getFunc(), mlir::bufferization::getGlobalFor(), mlir::arith::getIdentityValue(), mlir::sparse_tensor::SparseTensorDescriptor::getIdxMemRefOrView(), getIndexedPtrs(), getIndicesForAccess(), mlir::sparse_tensor::SparseTensorSpecifier::getInitValue(), getLibraryCallSymbolRef(), getLocationToWriteFullVec(), getMangledSortHelperFunc(), mlir::ConvertToLLVMPattern::getMemRefDescriptorSizes(), mlir::memref::getMixedSizes(), mlir::tensor::getMixedSizes(), mlir::ConvertToLLVMPattern::getNumElements(), getOffsetForBitwidth(), mlir::spirv::getOpenCLElementPtr(), mlir::tensor::getOrCreateDestination(), getOrCreateOperandsMatchingResultTypes(), mlir::getOrCreateRanges(), getOrCreateStep(), getOrCreateValue(), getOrDefineFunction(), getOrInsertBuiltinVariable(), getOrInsertPushConstantVariable(), mlir::spirv::getPushConstantValue(), mlir::arith::getReductionOp(), getScalarOrVectorI32Constant(), getShapeDimSize(), mlir::ConvertToLLVMPattern::getSizeInBytes(), mlir::sparse_tensor::SparseTensorSpecifier::getSpecifierField(), mlir::getValueOrCreateCastToIndexLike(), mlir::getValueOrCreateConstantIndexOp(), mlir::vector::getVectorReductionOp(), mlir::spirv::getVulkanElementPtr(), getZero(), mlir::LLVM::detail::handleMultidimensionalVectors(), hoistAffineIfOp(), inferDynamicDimsForConv(), mlir::sparse_tensor::LoopEmitter::initializeLoopEmit(), inlineIfCase(), inlinePayload(), inlineRegionAndEmitStore(), inlineWhileCase(), insertCasts(), insertLastDimSlice(), insertOne(), insertSliceIntoTensor(), insertSliceLikeAnchoredEmptyTensorEliminationStep(), mlir::linalg::insertSlicesBack(), mlir::sparse_tensor::insertYieldOp(), invertCollapseShapeIndexing(), mlir::spirv::linearizeIndex(), mlir::LLVMTypeConverter::LLVMTypeConverter(), mlir::LLVM::lookupOrCreateFn(), mlir::loopUnrollByFactor(), mlir::loopUnrollJamByFactor(), lowerAsEntryFunction(), lowerEntryPointABIAttr(), mlir::scf::lowerToLoopsUsingSCFForOp(), makeCanonicalAffineApplies(), mlir::makeComposedAffineApply(), mlir::linalg::makeMemRefCopyOp(), mlir::linalg::makeTransposeOp(), mlir::transform::gpu::mapForeachToBlocksImpl(), mlir::mapLoopToProcessorIds(), matchAndReplaceDepthwiseConv(), SelectI1Simplify::matchAndRewrite(), SelectToExtUI::matchAndRewrite(), YieldOpLowering::matchAndRewrite(), AssertOpLowering::matchAndRewrite(), CmpFIntToFPConst::matchAndRewrite(), CollapseShapeOpMemRefCastFolder::matchAndRewrite(), MaterializeTransferMask< ConcreteOp >::matchAndRewrite(), FoldTensorCastProducerOp::matchAndRewrite(), MultiBlockExecuteInliner::matchAndRewrite(), Convert1DExtractStridedSliceIntoExtractInsertChain::matchAndRewrite(), DecomposeNDExtractStridedSlice::matchAndRewrite(), mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::GPUPrintfOpToLLVMCallLowering::matchAndRewrite(), mlir::GPUPrintfOpToVPrintfLowering::matchAndRewrite(), DecomposeDifferentRankInsertStridedSlice::matchAndRewrite(), ConvertSameRankInsertStridedSliceIntoShuffle::matchAndRewrite(), FoldLaunchArguments::matchAndRewrite(), mlir::GPUIndexIntrinsicOpLowering< Op, XOp, YOp, ZOp >::matchAndRewrite(), mlir::OpWithOffsetSizesAndStridesConstantArgumentFolder< OpType, ResultTypeFunc, CastOpFunc >::matchAndRewrite(), mlir::OpToFuncCallLowering< SourceOp >::matchAndRewrite(), ConvertAccessChain::matchAndRewrite(), ConvertLoad::matchAndRewrite(), ConvertStore::matchAndRewrite(), SwapExtractSliceOfFill::matchAndRewrite(), mlir::linalg::GeneralizeOuterUnitDimsPackOpPattern::matchAndRewrite(), mlir::linalg::PadOpTransformationPattern::matchAndRewrite(), mlir::linalg::GeneralizePadOpPattern::matchAndRewrite(), mlir::linalg::GeneralizeOuterUnitDimsUnPackOpPattern::matchAndRewrite(), MaterializePadValue::matchAndRewrite(), ConsolidateTransposeOptimization::matchAndRewrite(), BubbleUpBitCastForStridedSliceInsert::matchAndRewrite(), mlir::nvgpu::PrepareContractToGPUMMASync::matchAndRewrite(), mlir::vector::ContractionOpToMatmulOpLowering::matchAndRewrite(), mlir::vector::ContractionOpToDotLowering::matchAndRewrite(), BubbleDownVectorBitCastForExtract::matchAndRewrite(), BubbleDownBitCastForStridedSliceExtract::matchAndRewrite(), VectorLoadToMemrefLoadLowering::matchAndRewrite(), InnerOuterDimReductionConversion::matchAndRewrite(), ReduceMultiDimReductionRank::matchAndRewrite(), TwoDimMultiReductionToElementWise::matchAndRewrite(), TwoDimMultiReductionToReduction::matchAndRewrite(), OneDimMultiReductionToTwoDim::matchAndRewrite(), VectorStoreToMemrefStoreLowering::matchAndRewrite(), TransferReadPermutationLowering::matchAndRewrite(), TransferOpReduceRank::matchAndRewrite(), TransferReadToVectorLoadLowering::matchAndRewrite(), mlir::linalg::LinalgCopyVTRForwardingPattern::matchAndRewrite(), TransferWritePermutationLowering::matchAndRewrite(), mlir::linalg::LinalgCopyVTWForwardingPattern::matchAndRewrite(), matchAndRewriteSortOp(), mlir::linalg::materializeTiledShape(), materializeToTensor(), mfmaConcatIfNeeded(), moveConstantAllocasToEntryBlock(), moveRegionToNewWarpOpAndReplaceReturns(), mlir::ArithBuilder::mul(), mlir::memref::multiBuffer(), mlir::normalizeAffineFor(), normalizeLoop(), mlir::normalizeMemRef(), mlir::MemRefDescriptor::offset(), mlir::UnrankedMemRefDescriptor::offset(), ofrToIndexValues(), mlir::LLVM::detail::oneToOneRewrite(), SliceCanonicalizer::operator()(), optionallyTruncateOrExtend(), outlineKernelFuncImpl(), mlir::outlineSingleBlockRegion(), mlir::linalg::pack(), padOperandToSmallestStaticBoundingBox(), permuteVectorOffset(), mlir::bufferization::populateDynamicDimSizes(), mlir::LLVM::ModuleImport::processFunction(), processParallelLoop(), mlir::promoteIfSingleIteration(), mlir::LLVMTypeConverter::promoteOneMemRefDescriptor(), mlir::linalg::promoteSubviewAsNewBuffer(), reduceMatchAndRewriteHelper(), mlir::replaceAllMemRefUsesWith(), replaceConstantUsesOf(), replaceForOpWithNewSignature(), mlir::replaceForOpWithNewYields(), mlir::replaceLoopWithNewYields(), mlir::bufferization::replaceOpWithBufferizedValues(), mlir::bufferization::replaceOpWithNewBufferizedOp(), replaceSCFOutputValue(), replaceUsesAndPropagateType(), reshapeLoad(), reshapeLowerToHigher(), reshapeStore(), mlir::sparse_tensor::reshapeValuesToLevels(), resolveSourceIndicesCollapseShape(), resolveSourceIndicesExpandShape(), resolveSourceIndicesSubView(), resolveUsesInRepetitiveRegions(), mlir::linalg::DownscaleSizeOneWindowed2DConvolution< Conv2DOp, Conv1DOp >::returningMatchAndRewrite(), mlir::linalg::DownscaleDepthwiseConv2DNhwcHwcOp::returningMatchAndRewrite(), mlir::linalg::rewriteAsPaddedOp(), rewriteOneForeachThreadToGpuThreads(), 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::scf::SCFTilingOptions::setTileSizes(), mlir::ArithBuilder::sgt(), shiftValue(), mlir::tensor::simplifyCollapseShapeWithRankReducingExtractSlice(), mlir::UnrankedMemRefDescriptor::size(), mlir::MemRefDescriptor::size(), mlir::UnrankedMemRefDescriptor::sizeBasePtr(), sizesForTensor(), sliceTransferIndices(), mlir::ArithBuilder::slt(), sourceMaterializationCallback(), specializeForLoopForUnrolling(), specializeParallelLoopForUnrolling(), mlir::vector::splitFullAndPartialTransfer(), mlir::linalg::splitReduction(), mlir::linalg::splitReductionByScaling(), mlir::sparse_tensor::storeIndices(), mlir::UnrankedMemRefDescriptor::stride(), mlir::MemRefDescriptor::stride(), mlir::UnrankedMemRefDescriptor::strideBasePtr(), stripmineSink(), mlir::ArithBuilder::sub(), mlir::scf::tileParallelLoop(), mlir::linalg::tileReductionUsingForeachThread(), mlir::scf::tileReductionUsingScf(), tileToForeachThreadOpImpl(), mlir::scf::tileUsingSCFForOp(), mlir::sparse_tensor::translateIndicesArray(), transposeOneLinalgOperandAndReplace(), GenericPadOpVectorizationPattern::tryVectorizeCopy(), mlir::DataDescriptor::undef(), mlir::MemRefDescriptor::undef(), mlir::UnrankedMemRefDescriptor::undef(), mlir::ComplexStructBuilder::undef(), unpackOperandVector(), updateCalls(), updateExpandedGenericOpRegion(), updateReturnOps(), vectorizeAsLinalgGeneric(), mlir::linalg::vectorizeCopy(), vectorizeLinalgIndex(), vectorizeOneOp(), vectorizeTensorExtract(), mlir::LLVM::detail::vectorOneToOneRewrite(), wrapExternalFunction(), wrapForExternalCallers(), wrapInExecuteRegion(), and yieldTiledValues().
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 427 of file Builders.cpp.
|
inline |
Create an operation of specific op type at the current insertion point.
Definition at line 459 of file Builders.h.
References create(), and mlir::Location::getContext().
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 414 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 395 of file Builders.cpp.
References mlir::Block::addArguments(), mlir::Region::end(), mlir::Region::getBlocks(), mlir::OpBuilder::Listener::notifyBlockCreated(), and setInsertionPointToEnd().
Referenced by addAtomicRMW(), buildGenericRegion(), checkAndNestUnderRewriteOp(), createAsyncDispatchFunction(), createBinarySearchFunc(), createBlock(), createDecl(), createElementIPowIFunc(), createParallelComputeFunction(), createPartitionFunc(), createScanLoop(), ensureDistinctSuccessors(), mlir::impl::ensureRegionTerminator(), mlir::sparse_tensor::LoopEmitter::enterCoIterationOverTensorsAtDims(), fillStructuredOpRegion(), mlirLinalgFillBuiltinNamedOpRegion(), mlir::outlineSingleBlockRegion(), and mlir::LLVM::ModuleImport::processFunction().
|
inline |
Overload to create or fold a single result operation.
Definition at line 492 of file Builders.h.
|
inline |
Overload to create or fold a zero result operation.
Definition at line 501 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 after folding the operation.
Definition at line 473 of file Builders.h.
References mlir::Operation::create(), mlir::Operation::destroy(), mlir::Location::getContext(), insert(), mlir::succeeded(), and tryFold().
Referenced by broadcastIfNeeded(), mlir::tensor::bubbleUpPadSlice(), buildLoopIterationCount(), mlir::bufferization::castOrReallocMemRefValue(), convertIntrinsicResult(), mlir::tensor::createCanonicalRankReducingExtractSliceOp(), mlir::tensor::createCanonicalRankReducingInsertSliceOp(), mlir::memref::createCanonicalRankReducingSubViewOp(), mlir::tensor::createDimValues(), createFoldedComposedAffineApply(), createI32Constant(), mlir::vector::createOrFoldDimOp(), createOrFoldDimOp(), mlir::linalg::createOrFoldDimOp(), mlir::tensor::createPadHighOp(), doubleBuffer(), getCollapsedOutputDimFromInputShape(), getShapeDimSize(), mlir::makeComposedAffineMin(), mlir::linalg::GeneralizePadOpPattern::matchAndRewrite(), mlir::linalg::GeneralizeOuterUnitDimsUnPackOpPattern::matchAndRewrite(), mfmaConcatIfNeeded(), peelForLoop(), permuteVectorOffset(), mlir::linalg::promoteSubviewAsNewBuffer(), reifyResultShapesImpl(), and mlir::scf::tileReductionUsingScf().
|
inline |
Returns the current block of the builder.
Definition at line 401 of file Builders.h.
Referenced by 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 395 of file Builders.h.
Referenced by mlir::affineParallelize(), buildUnresolvedArgumentMaterialization(), checkAndNestUnderRewriteOp(), mlir::LLVM::createGlobalString(), finalizeWhileOp(), mlir::OperationFolder::getOrCreateConstant(), and saveInsertionPoint().
|
inline |
Returns the current insertion point of the builder.
Definition at line 398 of file Builders.h.
Referenced by mlir::affineParallelize(), broadcastIfNeeded(), buildUnresolvedArgumentMaterialization(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), materializeConstant(), and saveInsertionPoint().
|
inline |
Returns the current listener of this builder, or nullptr if this builder doesn't have a listener.
Definition at line 273 of file Builders.h.
Referenced by createAsyncDispatchFunction(), mlir::LLVM::createGlobalString(), createOrFold(), createParallelComputeFunction(), getOrInsertPushConstantVariable(), and materializeConstants().
Insert the given operation at the current insertion point and return it.
Definition at line 386 of file Builders.cpp.
References mlir::Block::getOperations(), and mlir::OpBuilder::Listener::notifyOperationInserted().
Referenced by clone(), cloneWithoutRegions(), mlir::spirv::combine(), create(), mlir::OperationFolder::create(), createOrFold(), mlir::impl::ensureRegionTerminator(), and tryFold().
|
inline |
Restore the insert point to a previously saved point.
Definition at line 343 of file Builders.h.
References clearInsertionPoint(), mlir::OpBuilder::InsertPoint::getBlock(), mlir::OpBuilder::InsertPoint::getPoint(), mlir::OpBuilder::InsertPoint::isSet(), and setInsertionPoint().
Referenced by createPrintMsg(), and mlir::OpBuilder::InsertionGuard::~InsertionGuard().
|
inline |
Return a saved insertion point.
Definition at line 338 of file Builders.h.
References getInsertionBlock(), and getInsertionPoint().
Referenced by createPrintMsg().
|
inline |
Set the insertion point to the specified location.
Definition at line 351 of file Builders.h.
Referenced by applyTilingToAll(), mlir::bufferization::func_ext::FuncOpInterface::bufferize(), canonicalizeMinMaxOp(), cloneAndFuseFirstUse(), mlir::linalg::collapseGenericOpIterationDims(), createDecl(), createGlobalVarForEntryPointArgument(), declareReduction(), mlir::bufferization::dropEquivalentBufferResults(), mlir::bufferization::eliminateEmptyTensors(), mlir::linalg::fuseProducerOfBuffer(), mlir::linalg::fuseProducerOfTensor(), fuseWithReshapeByExpansion(), generateGpuBlockIds(), generateTileLoopNest(), getGenericOpLoopRange(), getLibraryCallSymbolRef(), getMangledSortHelperFunc(), mlir::OperationFolder::getOrCreateConstant(), mlir::tensor::getOrCreateDestination(), mlir::linalg::hoistPaddingOnTensors(), VectorizationState::initState(), inlineIfCase(), inlineWhileCase(), mlir::bufferization::insertTensorCopies(), mlir::linalg::interchangeGenericOp(), legalizeUnresolvedMaterialization(), mlir::loopUnrollByFactor(), mlir::scf::lowerToLoopsUsingSCFForOp(), mlir::transform::gpu::mapNestedForeachToThreadsImpl(), AllocaScopeHoister::matchAndRewrite(), MultiBlockExecuteInliner::matchAndRewrite(), mlir::PatternApplicator::matchAndRewrite(), InnerOuterDimReductionConversion::matchAndRewrite(), ReduceMultiDimReductionRank::matchAndRewrite(), TwoDimMultiReductionToReduction::matchAndRewrite(), moveRegionToNewWarpOpAndReplaceReturns(), mlir::memref::multiBuffer(), OpBuilder(), mlir::nvgpu::optimizeSharedMemoryReadsAndWrites(), mlir::outlineSingleBlockRegion(), mlir::linalg::packTranspose(), peelForLoop(), mlir::LLVM::ModuleImport::processFunction(), processParallelLoop(), replaceForOpWithNewSignature(), mlir::replaceForOpWithNewYields(), mlir::replaceLoopWithNewYields(), replaceSCFOutputValue(), replaceUnitDimIndexOps(), replaceUsesAndPropagateType(), resolveUsesInRepetitiveRegions(), restoreInsertionPoint(), rewrite(), PadOpVectorizationWithInsertSlicePattern::rewriteUser(), PadOpVectorizationWithTransferWritePattern::rewriteUser(), setInsertionPoint(), setInsertionPointAfter(), setInsertionPointToEnd(), setInsertionPointToStart(), mlir::vector::splitFullAndPartialTransfer(), mlir::linalg::splitReduction(), mlir::linalg::splitReductionByScaling(), tileAndFuseFirstExtractUse(), tileAndFuseFirstExtractUseThroughContainingOpBlockArgument(), mlir::scf::tileAndFuseProducerOfSlice(), tileLinalgOpImpl(), tilePadOp(), mlir::linalg::tileReductionUsingForeachThread(), mlir::scf::tileReductionUsingScf(), tileToForeachThreadOpImpl(), mlir::transform::tileToForeachThreadOpImpl(), mlir::scf::tileUsingSCFForOp(), tryApply(), and wrapInExecuteRegion().
|
inline |
Sets the insertion point to the specified operation, which will cause subsequent insertions to go right before it.
Definition at line 359 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 365 of file Builders.h.
References mlir::Operation::getBlock(), and setInsertionPoint().
Referenced by convertAffineApply(), convertCtlzOp(), createAsyncDispatchFunction(), createBinarySearchFunc(), createCompareFuncImplementation(), createLessThanCompare(), createPartitionFunc(), createScanLoop(), createSortNonstableFunc(), createSortStableFunc(), doubleBuffer(), dropRefIfNoUses(), finalizeWhileOp(), mlir::linalg::TileLoopNest::fuseProducer(), genInsertionStore(), genTensorStore(), getTiledProducer(), hoistAffineIfOp(), mlir::inlineCall(), mlir::loopUnrollJamByFactor(), mlir::linalg::offsetIndices(), peelForLoop(), promoteSubViews(), mlir::bufferization::replaceOpWithBufferizedValues(), replaceSCFOutputValue(), mlir::scf::ForLoopPipeliningPattern::returningMatchAndRewrite(), mlir::linalg::rewriteAsPaddedOp(), setInsertionPointAfter(), setInsertionPointAfterValue(), mlir::linalg::tileReductionUsingForeachThread(), mlir::scf::tileReductionUsingScf(), mlir::scf::tileUsingSCFForOp(), 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 374 of file Builders.h.
References mlir::Value::cast(), mlir::Value::getDefiningOp(), setInsertionPointAfter(), and setInsertionPointToStart().
Referenced by alterGpuLaunch(), and legalizeUnresolvedMaterialization().
|
inline |
Sets the insertion point to the end of the specified block.
Definition at line 389 of file Builders.h.
References mlir::Block::end(), and setInsertionPoint().
Referenced by addAtomicRMW(), mlir::scf::buildLoopNest(), mlir::LLVM::ModuleImport::convertMetadata(), createAsyncDispatchFunction(), createBinarySearchFunc(), createBlock(), createDecl(), createElementIPowIFunc(), createGpuLaunch(), createParallelComputeFunction(), createPartitionFunc(), createScanLoop(), mlir::impl::ensureRegionTerminator(), finalizeWhileOp(), mlir::linalg::hoistPaddingOnTensors(), lowerEntryPointABIAttr(), mlir::linalg::makeTransposeOp(), AssertOpLowering::matchAndRewrite(), MultiBlockExecuteInliner::matchAndRewrite(), outlineKernelFuncImpl(), mlir::outlineSingleBlockRegion(), mlir::replaceLoopWithNewYields(), mlir::linalg::tileReductionUsingForeachThread(), and tileToForeachThreadOpImpl().
|
inline |
Sets the insertion point to the start of the specified block.
Definition at line 384 of file Builders.h.
References mlir::Block::begin(), and setInsertionPoint().
Referenced by addBodyWithPayloadOp(), mlir::bufferization::func_ext::FuncOpInterface::bufferize(), buildAffineLoopNestImpl(), mlir::scf::buildLoopNest(), calculateTileOffsetsAndSizes(), mlir::async::cloneConstantsIntoTheRegion(), mlir::coalesceLoops(), mlir::spirv::combine(), createBinarySearchFunc(), createCompareFuncImplementation(), createEqCompare(), createLessThanCompare(), createPartitionFunc(), createPrintMsg(), createSortNonstableFunc(), createSortStableFunc(), dropRefIfNoUses(), endIf(), mlir::sparse_tensor::LoopEmitter::enterCoIterationOverTensorsAtDims(), mlir::sparse_tensor::LoopEmitter::enterFilterLoopOverTensorAtDim(), mlir::sparse_tensor::LoopEmitter::enterLoopOverTensorAtDim(), fillStructuredOpRegion(), fuseIfLegal(), generateCollapsedIndexingRegion(), generateFusedElementwiseOpRegion(), genIf(), genInsertionStore(), genTensorStore(), mlir::sparse_tensor::genValueForDense(), getOrDefineFunction(), getOrInsertBuiltinVariable(), mlir::linalg::hoistPaddingOnTensors(), injectGpuIndexOperations(), mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::GPUPrintfOpToLLVMCallLowering::matchAndRewrite(), mlir::GPUPrintfOpToVPrintfLowering::matchAndRewrite(), FoldLaunchArguments::matchAndRewrite(), mlirLinalgFillBuiltinNamedOpRegion(), mlir::LLVM::ModuleImport::ModuleImport(), mlir::normalizeAffineFor(), mlir::outlineSingleBlockRegion(), processParallelLoop(), rewrite(), setInsertionPointAfter(), setInsertionPointAfterValue(), mlir::linalg::LinalgTilingOptions::setTileSizes(), mlir::scf::SCFTilingOptions::setTileSizes(), mlir::vector::splitFullAndPartialTransfer(), mlir::scf::tileParallelLoop(), wrapExternalFunction(), wrapForExternalCallers(), and wrapInExecuteRegion().
|
inline |
Sets the listener of this builder to the one provided.
Definition at line 269 of file Builders.h.
Referenced by createOrFold(), materializeConstants(), and mlir::RewriterBase::RewriterBase().
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. Note: This function does not erase the operation on a successful fold.
Definition at line 440 of file Builders.cpp.
References mlir::Builder::context, mlir::Operation::erase(), mlir::failed(), mlir::failure(), mlir::Operation::fold(), mlir::Operation::getDialect(), mlir::Operation::getLoc(), mlir::Operation::getNumOperands(), mlir::Operation::getOperand(), mlir::Operation::getResults(), mlir::ResultRange::getTypes(), insert(), mlir::m_Constant(), mlir::matchPattern(), mlir::Dialect::materializeConstant(), and mlir::success().
Referenced by createOrFold().