MLIR 22.0.0git
mlir::InlinerInterface Class Reference

This interface provides the hooks into the inlining interface. More...

#include "mlir/Transforms/InliningUtils.h"

Inheritance diagram for mlir::InlinerInterface:

Public Types

using CloneCallbackSigTy
using CloneCallbackTy = std::function<CloneCallbackSigTy>
Public Types inherited from mlir::DialectInterfaceCollection< DialectInlinerInterface >
using Base
using iterator
 Iterator access to the held interfaces.

Public Member Functions

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 the hook on the handler for the dialect 'op' is registered to.
virtual bool isLegalToInline (Region *dest, Region *src, bool wouldBeCloned, IRMapping &valueMapping) const
virtual bool isLegalToInline (Operation *op, Region *dest, bool wouldBeCloned, IRMapping &valueMapping) const
virtual bool shouldAnalyzeRecursively (Operation *op) const
virtual void handleTerminator (Operation *op, Block *newDest) const
 Handle the given inlined terminator by replacing it with a new operation as necessary.
virtual void handleTerminator (Operation *op, ValueRange valuesToRepl) const
 Handle the given inlined terminator by replacing it with a new operation as necessary.
virtual Value handleArgument (OpBuilder &builder, Operation *call, Operation *callable, Value argument, DictionaryAttr argumentAttrs) const
virtual Value handleResult (OpBuilder &builder, Operation *call, Operation *callable, Value result, DictionaryAttr resultAttrs) const
virtual void processInlinedCallBlocks (Operation *call, iterator_range< Region::iterator > inlinedBlocks) const
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 block.
Public Member Functions inherited from mlir::DialectInterfaceCollection< DialectInlinerInterface >
 DialectInterfaceCollection (MLIRContext *ctx)
 Collect the registered dialect interfaces within the provided context.
const DialectInlinerInterfacegetInterfaceFor (Object *obj) const
 Get the interface for a given object, or null if one is not registered.
iterator begin () const
iterator end () const
Public Member Functions inherited from mlir::detail::DialectInterfaceCollectionBase
 DialectInterfaceCollectionBase (MLIRContext *ctx, TypeID interfaceKind, StringRef interfaceName)
virtual ~DialectInterfaceCollectionBase ()

Additional Inherited Members

Protected Member Functions inherited from mlir::detail::DialectInterfaceCollectionBase
const DialectInterfacegetInterfaceFor (Operation *op) const
 Get the interface for the dialect of given operation, or null if one is not registered.
const DialectInterfacegetInterfaceFor (Dialect *dialect) const
 Get the interface for the given dialect.
template<typename InterfaceT>
iterator< InterfaceT > interface_begin () const
 Iterator access to the held interfaces.
template<typename InterfaceT>
iterator< InterfaceT > interface_end () const

Detailed Description

This interface provides the hooks into the inlining interface.

Note: this class automatically collects 'DialectInlinerInterface' objects registered to each dialect within the given context.

Definition at line 191 of file InliningUtils.h.

Member Typedef Documentation

◆ CloneCallbackSigTy

Initial value:
void(OpBuilder &builder, Region *src,
Block *inlineBlock, Block *postInsertBlock,
IRMapping &mapper,
bool shouldCloneInlinedRegion)
Block represents an ordered list of Operations.
Definition Block.h:33
This is a utility class for mapping one set of IR entities to another.
Definition IRMapping.h:26
This class helps build Operations.
Definition Builders.h:207
This class contains a list of basic blocks and a link to the parent operation it is attached to.
Definition Region.h:26

Definition at line 194 of file InliningUtils.h.

◆ CloneCallbackTy

Definition at line 198 of file InliningUtils.h.

Member Function Documentation

◆ allowSingleBlockOptimization()

bool InlinerInterface::allowSingleBlockOptimization ( iterator_range< Region::iterator > inlinedBlocks) const
virtual

Returns true if the inliner can assume a fast path of not creating a new block, if there is only one block.

Definition at line 147 of file InliningUtils.cpp.

References mlir::DialectInterfaceCollection< DialectInlinerInterface >::getInterfaceFor().

◆ handleArgument()

Value InlinerInterface::handleArgument ( OpBuilder & builder,
Operation * call,
Operation * callable,
Value argument,
DictionaryAttr argumentAttrs ) const
virtual

◆ handleResult()

Value InlinerInterface::handleResult ( OpBuilder & builder,
Operation * call,
Operation * callable,
Value result,
DictionaryAttr resultAttrs ) const
virtual

◆ handleTerminator() [1/2]

void InlinerInterface::handleTerminator ( Operation * op,
Block * newDest ) const
virtual

Handle the given inlined terminator by replacing it with a new operation as necessary.

Definition at line 130 of file InliningUtils.cpp.

References mlir::DialectInterfaceCollection< DialectInlinerInterface >::getInterfaceFor().

◆ handleTerminator() [2/2]

void InlinerInterface::handleTerminator ( Operation * op,
ValueRange valuesToRepl ) const
virtual

Handle the given inlined terminator by replacing it with a new operation as necessary.

Definition at line 138 of file InliningUtils.cpp.

References mlir::DialectInterfaceCollection< DialectInlinerInterface >::getInterfaceFor().

◆ isLegalToInline() [1/3]

bool InlinerInterface::isLegalToInline ( Operation * call,
Operation * callable,
bool wouldBeCloned ) const
virtual

These hooks mirror the hooks for the DialectInlinerInterface, with default implementations that call the hook on the handler for the dialect 'op' is registered to.

Definition at line 100 of file InliningUtils.cpp.

References mlir::DialectInterfaceCollection< DialectInlinerInterface >::getInterfaceFor().

Referenced by mlir::inlineCall(), and isLegalToInline().

◆ isLegalToInline() [2/3]

bool InlinerInterface::isLegalToInline ( Operation * op,
Region * dest,
bool wouldBeCloned,
IRMapping & valueMapping ) const
virtual

◆ isLegalToInline() [3/3]

bool InlinerInterface::isLegalToInline ( Region * dest,
Region * src,
bool wouldBeCloned,
IRMapping & valueMapping ) const
virtual

◆ processInlinedBlocks()

virtual void mlir::InlinerInterface::processInlinedBlocks ( iterator_range< Region::iterator > inlinedBlocks)
inlinevirtual

Process a set of blocks that have been inlined.

This callback is invoked before inlined terminator operations have been processed.

Definition at line 205 of file InliningUtils.h.

◆ processInlinedCallBlocks()

void InlinerInterface::processInlinedCallBlocks ( Operation * call,
iterator_range< Region::iterator > inlinedBlocks ) const
virtual

◆ shouldAnalyzeRecursively()

bool InlinerInterface::shouldAnalyzeRecursively ( Operation * op) const
virtual

The documentation for this class was generated from the following files: