MLIR 22.0.0git
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/Support/DebugStringHelper.h"
#include "mlir/Transforms/InliningUtils.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/DebugLog.h"

Go to the source code of this file.

Classes

class  mlir::Inliner::Impl

Namespaces

namespace  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.
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.
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.
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.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "inlining"

Definition at line 26 of file Inliner.cpp.

Typedef Documentation

◆ ResolvedCall

Definition at line 30 of file Inliner.cpp.

Function Documentation

◆ collectCallOps()

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 303 of file Inliner.cpp.

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

◆ getNodeName()

std::string getNodeName ( CallOpInterface op)
static

Definition at line 351 of file Inliner.cpp.

References mlir::debugString().

◆ inlineHistoryIncludes()

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 359 of file Inliner.cpp.

◆ runTransformOnCGSCCs()

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 284 of file Inliner.cpp.

References success().

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

◆ walkReferencedSymbolNodes()

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 37 of file Inliner.cpp.

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