MLIR  20.0.0git
Classes | Namespaces | Macros | Typedefs | Functions
Inliner.cpp File Reference
#include "mlir/Transforms/Inliner.h"
#include "mlir/IR/Threading.h"
#include "mlir/Interfaces/CallInterfaces.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Support/DebugStringHelper.h"
#include "mlir/Transforms/InliningUtils.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/Debug.h"

Go to the source code of this file.

Classes

class  mlir::Inliner::Impl
 

Namespaces

 mlir
 Include the generated interface declarations.
 

Macros

#define DEBUG_TYPE   "inlining"
 

Typedefs

using ResolvedCall = Inliner::ResolvedCall
 

Functions

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, std::optional< size_t > inlineHistoryID, MutableArrayRef< std::pair< CallGraphNode *, std::optional< size_t >>> inlineHistory)
 Return true if the specified inlineHistoryID indicates an inline history that already includes node. More...
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "inlining"

Definition at line 28 of file Inliner.cpp.

Typedef Documentation

◆ ResolvedCall

Definition at line 32 of file Inliner.cpp.

Function Documentation

◆ collectCallOps()

static void collectCallOps ( iterator_range< Region::iterator blocks,
CallGraphNode sourceNode,
CallGraph cg,
SymbolTableCollection symbolTable,
SmallVectorImpl< ResolvedCall > &  calls,
bool  traverseNestedCGNodes 
)
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 304 of file Inliner.cpp.

References mlir::Operation::getRegions(), mlir::CallGraphNode::isExternal(), mlir::CallGraph::lookupNode(), and mlir::CallGraph::resolveCallable().

◆ getNodeName()

static std::string getNodeName ( CallOpInterface  op)
static

Definition at line 353 of file Inliner.cpp.

References mlir::debugString().

◆ inlineHistoryIncludes()

static bool inlineHistoryIncludes ( CallGraphNode node,
std::optional< size_t >  inlineHistoryID,
MutableArrayRef< std::pair< CallGraphNode *, std::optional< size_t >>>  inlineHistory 
)
static

Return true if the specified inlineHistoryID indicates an inline history that already includes node.

Definition at line 362 of file Inliner.cpp.

◆ runTransformOnCGSCCs()

static LogicalResult runTransformOnCGSCCs ( const CallGraph cg,
function_ref< LogicalResult(CallGraphSCC &)>  sccTransformer 
)
static

Run a given transformation over the SCCs of the callgraph in a bottom up traversal.

Definition at line 285 of file Inliner.cpp.

Referenced by mlir::Inliner::doInlining().

◆ walkReferencedSymbolNodes()

static void walkReferencedSymbolNodes ( Operation op,
CallGraph cg,
SymbolTableCollection symbolTable,
DenseMap< Attribute, CallGraphNode * > &  resolvedRefs,
function_ref< void(CallGraphNode *, Operation *)>  callback 
)
static

Walk all of the used symbol callgraph nodes referenced with the given op.

Definition at line 39 of file Inliner.cpp.

References mlir::Operation::getParentOp(), mlir::SymbolTable::getSymbolUses(), mlir::SymbolTableCollection::lookupNearestSymbolFrom(), and mlir::CallGraph::lookupNode().