13 #ifndef MLIR_TRANSFORMS_INLINER_H
14 #define MLIR_TRANSFORMS_INLINER_H
21 #include "llvm/ADT/StringMap.h"
34 unsigned maxInliningIterations)
35 : defaultPipeline(std::move(defaultPipeline)),
36 maxInliningIterations(maxInliningIterations) {}
39 return defaultPipeline;
49 defaultPipeline = std::move(pipeline);
52 opPipelines = std::move(pipelines);
56 cloneCallback = std::move(callback);
59 canHandleMultipleBlocks = value;
74 unsigned maxInliningIterations{0};
77 [](OpBuilder &builder, Region *src, Block *inlineBlock,
78 Block *postInsertBlock, IRMapping &mapper,
79 bool shouldCloneInlinedRegion) {
83 Region *insertRegion = inlineBlock->getParent();
84 if (shouldCloneInlinedRegion)
85 src->cloneInto(insertRegion, postInsertBlock->getIterator(), mapper);
87 insertRegion->getBlocks().splice(postInsertBlock->getIterator(),
88 src->getBlocks(), src->begin(),
96 bool canHandleMultipleBlocks{
false};
130 : op(op), cg(cg), pass(pass), am(am),
131 runPipelineHelper(std::move(runPipelineHelper)),
config(
config),
132 isProfitableToInline(std::move(isProfitableToInline)) {}
static Value max(ImplicitLocOpBuilder &builder, Value value, Value bound)
This class represents an analysis manager for a particular operation instance.
This class represents a single callable in the callgraph.
void setMaxInliningIterations(unsigned max)
const DefaultPipelineTy & getDefaultPipeline() const
const OpPipelinesTy & getOpPipelines() const
void setCanHandleMultipleBlocks(bool value=true)
void setOpPipelines(OpPipelinesTy pipelines)
std::function< void(OpPassManager &)> DefaultPipelineTy
const InlinerInterface::CloneCallbackTy & getCloneCallback() const
void setCloneCallback(InlinerInterface::CloneCallbackTy callback)
InlinerConfig(DefaultPipelineTy defaultPipeline, unsigned maxInliningIterations)
bool getCanHandleMultipleBlocks() const
void setDefaultPipeline(DefaultPipelineTy pipeline)
unsigned getMaxInliningIterations() const
llvm::StringMap< OpPassManager > OpPipelinesTy
std::function< CloneCallbackSigTy > CloneCallbackTy
This is an implementation of the inliner that operates bottom up over the Strongly Connected Componen...
void operator=(const Inliner &)=delete
std::function< LogicalResult(Pass &pass, OpPassManager &pipeline, Operation *op)> RunPipelineHelperTy
Inliner(Operation *op, CallGraph &cg, Pass &pass, AnalysisManager am, RunPipelineHelperTy runPipelineHelper, const InlinerConfig &config, ProfitabilityCallbackTy isProfitableToInline)
LogicalResult doInlining()
Perform inlining on a OpTrait::SymbolTable operation.
std::function< bool(const ResolvedCall &)> ProfitabilityCallbackTy
Type of the callback answering if it is profitable to inline a callable operation at a call site.
Inliner(Inliner &)=delete
This class represents a pass manager that runs passes on either a specific operation type,...
Operation is the basic unit of execution within MLIR.
The abstract base pass class.
Include the generated interface declarations.
const FrozenRewritePatternSet GreedyRewriteConfig config
This struct represents a resolved call to a given callgraph node.
CallGraphNode * sourceNode
ResolvedCall(CallOpInterface call, CallGraphNode *sourceNode, CallGraphNode *targetNode)
CallGraphNode * targetNode