MLIR  19.0.0git
Macros | Functions
InliningUtils.cpp File Reference
#include "mlir/Transforms/InliningUtils.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/Operation.h"
#include "mlir/Interfaces/CallInterfaces.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "inlining"
 

Functions

static void remapInlinedLocations (iterator_range< Region::iterator > inlinedBlocks, Location callerLoc)
 Remap locations from the inlined blocks with CallSiteLoc locations with the provided caller location. More...
 
static void remapInlinedOperands (iterator_range< Region::iterator > inlinedBlocks, IRMapping &mapper)
 
static bool isLegalToInline (InlinerInterface &interface, Region *src, Region *insertRegion, bool shouldCloneInlinedRegion, IRMapping &valueMapping)
 Utility to check that all of the operations within 'src' can be inlined. More...
 
static void handleArgumentImpl (InlinerInterface &interface, OpBuilder &builder, CallOpInterface call, CallableOpInterface callable, IRMapping &mapper)
 
static void handleResultImpl (InlinerInterface &interface, OpBuilder &builder, CallOpInterface call, CallableOpInterface callable, ValueRange results)
 
static LogicalResult inlineRegionImpl (InlinerInterface &interface, Region *src, Block *inlineBlock, Block::iterator inlinePoint, IRMapping &mapper, ValueRange resultsToReplace, TypeRange regionResultTypes, std::optional< Location > inlineLoc, bool shouldCloneInlinedRegion, CallOpInterface call={})
 
static LogicalResult inlineRegionImpl (InlinerInterface &interface, Region *src, Block *inlineBlock, Block::iterator inlinePoint, ValueRange inlinedOperands, ValueRange resultsToReplace, std::optional< Location > inlineLoc, bool shouldCloneInlinedRegion, CallOpInterface call={})
 
static Value materializeConversion (const DialectInlinerInterface *interface, SmallVectorImpl< Operation * > &castOps, OpBuilder &castBuilder, Value arg, Type type, Location conversionLoc)
 Utility function used to generate a cast operation from the given interface, or return nullptr if a cast could not be generated. More...
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "inlining"

Definition at line 24 of file InliningUtils.cpp.

Function Documentation

◆ handleArgumentImpl()

static void handleArgumentImpl ( InlinerInterface interface,
OpBuilder builder,
CallOpInterface  call,
CallableOpInterface  callable,
IRMapping mapper 
)
static

◆ handleResultImpl()

static void handleResultImpl ( InlinerInterface interface,
OpBuilder builder,
CallOpInterface  call,
CallableOpInterface  callable,
ValueRange  results 
)
static

◆ inlineRegionImpl() [1/2]

static LogicalResult inlineRegionImpl ( InlinerInterface interface,
Region src,
Block inlineBlock,
Block::iterator  inlinePoint,
IRMapping mapper,
ValueRange  resultsToReplace,
TypeRange  regionResultTypes,
std::optional< Location inlineLoc,
bool  shouldCloneInlinedRegion,
CallOpInterface  call = {} 
)
static

Handle the terminators for each of the new blocks.

Definition at line 221 of file InliningUtils.cpp.

Referenced by mlir::inlineRegion().

◆ inlineRegionImpl() [2/2]

static LogicalResult inlineRegionImpl ( InlinerInterface interface,
Region src,
Block inlineBlock,
Block::iterator  inlinePoint,
ValueRange  inlinedOperands,
ValueRange  resultsToReplace,
std::optional< Location inlineLoc,
bool  shouldCloneInlinedRegion,
CallOpInterface  call = {} 
)
static

Definition at line 327 of file InliningUtils.cpp.

◆ isLegalToInline()

static bool isLegalToInline ( InlinerInterface interface,
Region src,
Region insertRegion,
bool  shouldCloneInlinedRegion,
IRMapping valueMapping 
)
static

Utility to check that all of the operations within 'src' can be inlined.

Definition at line 131 of file InliningUtils.cpp.

◆ materializeConversion()

static Value materializeConversion ( const DialectInlinerInterface interface,
SmallVectorImpl< Operation * > &  castOps,
OpBuilder castBuilder,
Value  arg,
Type  type,
Location  conversionLoc 
)
static

Utility function used to generate a cast operation from the given interface, or return nullptr if a cast could not be generated.

Definition at line 402 of file InliningUtils.cpp.

References mlir::Operation::getNumOperands(), mlir::Operation::getNumResults(), mlir::Operation::getOperand(), mlir::Operation::getResult(), mlir::DialectInlinerInterface::materializeCallConversion(), and mlir::Operation::result_type_begin().

◆ remapInlinedLocations()

static void remapInlinedLocations ( iterator_range< Region::iterator inlinedBlocks,
Location  callerLoc 
)
static

Remap locations from the inlined blocks with CallSiteLoc locations with the provided caller location.

Definition at line 31 of file InliningUtils.cpp.

◆ remapInlinedOperands()

static void remapInlinedOperands ( iterator_range< Region::iterator inlinedBlocks,
IRMapping mapper 
)
static

Definition at line 46 of file InliningUtils.cpp.