MLIR
15.0.0git
|
#include "PassDetail.h"
#include "mlir/Analysis/CallGraph.h"
#include "mlir/IR/Threading.h"
#include "mlir/Interfaces/CallInterfaces.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Support/DebugStringHelper.h"
#include "mlir/Transforms/InliningUtils.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/Support/Debug.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "inlining" |
Functions | |
static void | defaultInlinerOptPipeline (OpPassManager &pm) |
This function implements the default inliner optimization pipeline. More... | |
static void | walkReferencedSymbolNodes (Operation *op, CallGraph &cg, SymbolTableCollection &symbolTable, DenseMap< Attribute, CallGraphNode *> &resolvedRefs, function_ref< void(CallGraphNode *, Operation *)> callback) |
Walk all of the used symbol callgraph nodes referenced with the given op. More... | |
static LogicalResult | runTransformOnCGSCCs (const CallGraph &cg, function_ref< LogicalResult(CallGraphSCC &)> sccTransformer) |
Run a given transformation over the SCCs of the callgraph in a bottom up traversal. More... | |
static void | collectCallOps (iterator_range< Region::iterator > blocks, CallGraphNode *sourceNode, CallGraph &cg, SymbolTableCollection &symbolTable, SmallVectorImpl< ResolvedCall > &calls, bool traverseNestedCGNodes) |
Collect all of the callable operations within the given range of blocks. More... | |
static std::string | getNodeName (CallOpInterface op) |
static bool | inlineHistoryIncludes (CallGraphNode *node, Optional< size_t > inlineHistoryID, MutableArrayRef< std::pair< CallGraphNode *, Optional< size_t >>> inlineHistory) |
Return true if the specified inlineHistoryID indicates an inline history that already includes node . More... | |
static bool | shouldInline (ResolvedCall &resolvedCall) |
Returns true if the given call should be inlined. More... | |
static LogicalResult | inlineCallsInSCC (Inliner &inliner, CGUseList &useList, CallGraphSCC ¤tSCC) |
Attempt to inline calls within the given scc. More... | |
#define DEBUG_TYPE "inlining" |
Definition at line 28 of file Inliner.cpp.
|
static |
Collect all of the callable operations within the given range of blocks.
If traverseNestedCGNodes
is true, this will also collect call operations inside of nested callgraph nodes.
Definition at line 321 of file Inliner.cpp.
References mlir::Operation::getRegions(), mlir::CallGraphNode::isExternal(), mlir::CallGraph::lookupNode(), and mlir::CallGraph::resolveCallable().
Referenced by inlineCallsInSCC(), and inlineHistoryIncludes().
|
static |
This function implements the default inliner optimization pipeline.
Definition at line 33 of file Inliner.cpp.
References mlir::OpPassManager::addPass(), and mlir::createCanonicalizerPass().
Referenced by mlir::createInlinerPass(), and inlineCallsInSCC().
|
static |
Definition at line 370 of file Inliner.cpp.
References mlir::debugString().
Referenced by inlineCallsInSCC().
|
static |
Attempt to inline calls within the given scc.
This function returns success if any calls were inlined, failure otherwise.
Definition at line 459 of file Inliner.cpp.
References collectCallOps(), defaultInlinerOptPipeline(), mlir::Operation::emitOpError(), mlir::failableParallelForEach(), mlir::failed(), mlir::failure(), mlir::CallGraphNode::getCallableRegion(), mlir::Operation::getName(), getNodeName(), mlir::MLIRContext::getNumThreads(), mlir::Region::getParentOp(), mlir::OperationName::getStringRef(), mlir::CallGraphNode::hasChildren(), mlir::Operation::hasTrait(), mlir::Pass::initializeOptions(), mlir::inlineCall(), inlineHistoryIncludes(), mlir::CallGraphNode::isExternal(), options, mlir::parsePassPipeline(), mlir::OpPassManager::printAsTextualPipeline(), runTransformOnCGSCCs(), shouldInline(), and mlir::success().
|
static |
Return true if the specified inlineHistoryID
indicates an inline history that already includes node
.
Definition at line 379 of file Inliner.cpp.
References collectCallOps(), mlir::Operation::erase(), mlir::CallGraphNode::getCallableRegion(), mlir::Region::getParentOp(), mlir::Region::getParentRegion(), and mlir::CallGraph::lookupNode().
Referenced by inlineCallsInSCC().
|
static |
Run a given transformation over the SCCs of the callgraph in a bottom up traversal.
Definition at line 288 of file Inliner.cpp.
References mlir::failed(), mlir::failure(), and mlir::success().
Referenced by inlineCallsInSCC().
|
static |
Returns true if the given call should be inlined.
Definition at line 441 of file Inliner.cpp.
Referenced by inlineCallsInSCC().
|
static |
Walk all of the used symbol callgraph nodes referenced with the given op.
Definition at line 42 of file Inliner.cpp.
References mlir::Operation::getParentOp(), mlir::SymbolTable::getSymbolUses(), mlir::SymbolTableCollection::lookupNearestSymbolFrom(), and mlir::CallGraph::lookupNode().