13#ifndef MLIR_TRANSFORMS_INLININGUTILS_H
14#define MLIR_TRANSFORMS_INLININGUTILS_H
27class CallableOpInterface;
35class DialectInlinerInterface;
46 bool shouldCloneInlinedRegion);
65 bool wouldBeCloned)
const;
81 DictionaryAttr argumentAttrs)
const;
84 DictionaryAttr resultAttrs)
const;
114 Region *src, Operation *inlinePoint, IRMapping &mapper,
116 std::optional<Location> inlineLoc = std::nullopt,
117 bool shouldCloneInlinedRegion =
true);
122 IRMapping &mapper,
ValueRange resultsToReplace,
124 std::optional<Location> inlineLoc = std::nullopt,
125 bool shouldCloneInlinedRegion =
true);
133 Region *src, Operation *inlinePoint,
ValueRange inlinedOperands,
135 std::optional<Location> inlineLoc = std::nullopt,
136 bool shouldCloneInlinedRegion =
true);
142 std::optional<Location> inlineLoc = std::nullopt,
143 bool shouldCloneInlinedRegion =
true);
154 CallOpInterface call, CallableOpInterface callable, Region *src,
155 bool shouldCloneInlinedRegion =
true);
159#include "mlir/Transforms/DialectInlinerInterface.h.inc"
Block represents an ordered list of Operations.
OpListType::iterator iterator
DialectInterfaceCollection< DialectInlinerInterface > Base
DialectInterfaceCollection(MLIRContext *ctx)
This is a utility class for mapping one set of IR entities to another.
This interface provides the hooks into the inlining interface.
virtual Value handleResult(OpBuilder &builder, Operation *call, Operation *callable, Value result, DictionaryAttr resultAttrs) const
virtual Value handleArgument(OpBuilder &builder, Operation *call, Operation *callable, Value argument, DictionaryAttr argumentAttrs) const
virtual bool shouldAnalyzeRecursively(Operation *op) const
std::function< CloneCallbackSigTy > CloneCallbackTy
void(OpBuilder &builder, Region *src, Block *inlineBlock, Block *postInsertBlock, IRMapping &mapper, bool shouldCloneInlinedRegion) CloneCallbackSigTy
virtual bool allowSingleBlockOptimization(iterator_range< Region::iterator > inlinedBlocks) const
Returns true if the inliner can assume a fast path of not creating a new block, if there is only one ...
virtual void handleTerminator(Operation *op, Block *newDest) const
Handle the given inlined terminator by replacing it with a new operation as necessary.
virtual void processInlinedCallBlocks(Operation *call, iterator_range< Region::iterator > inlinedBlocks) const
virtual void processInlinedBlocks(iterator_range< Region::iterator > inlinedBlocks)
Process a set of blocks that have been inlined.
virtual bool isLegalToInline(Operation *call, Operation *callable, bool wouldBeCloned) const
These hooks mirror the hooks for the DialectInlinerInterface, with default implementations that call ...
This class helps build Operations.
Operation is the basic unit of execution within MLIR.
This class contains a list of basic blocks and a link to the parent operation it is attached to.
This class provides an abstraction over the various different ranges of value types.
This class provides an abstraction over the different types of ranges over Values.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Include the generated interface declarations.
LogicalResult inlineCall(InlinerInterface &interface, function_ref< InlinerInterface::CloneCallbackSigTy > cloneCallback, CallOpInterface call, CallableOpInterface callable, Region *src, bool shouldCloneInlinedRegion=true)
This function inlines a given region, 'src', of a callable operation, 'callable', into the location d...
LogicalResult inlineRegion(InlinerInterface &interface, function_ref< InlinerInterface::CloneCallbackSigTy > cloneCallback, Region *src, Operation *inlinePoint, IRMapping &mapper, ValueRange resultsToReplace, TypeRange regionResultTypes, std::optional< Location > inlineLoc=std::nullopt, bool shouldCloneInlinedRegion=true)
This function inlines a region, 'src', into another.
llvm::function_ref< Fn > function_ref