MLIR  15.0.0git
Macros | Functions
InliningUtils.cpp File Reference
#include "mlir/Transforms/InliningUtils.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.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 dependency graph for InliningUtils.cpp:

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, BlockAndValueMapping &mapper)
 
static bool isLegalToInline (InlinerInterface &interface, Region *src, Region *insertRegion, bool shouldCloneInlinedRegion, BlockAndValueMapping &valueMapping)
 Utility to check that all of the operations within 'src' can be inlined. More...
 
static LogicalResult inlineRegionImpl (InlinerInterface &interface, Region *src, Block *inlineBlock, Block::iterator inlinePoint, BlockAndValueMapping &mapper, ValueRange resultsToReplace, TypeRange regionResultTypes, Optional< Location > inlineLoc, bool shouldCloneInlinedRegion, Operation *call=nullptr)
 
static LogicalResult inlineRegionImpl (InlinerInterface &interface, Region *src, Block *inlineBlock, Block::iterator inlinePoint, ValueRange inlinedOperands, ValueRange resultsToReplace, Optional< Location > inlineLoc, bool shouldCloneInlinedRegion, Operation *call=nullptr)
 
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 23 of file InliningUtils.cpp.

Function Documentation

◆ inlineRegionImpl() [1/2]

static LogicalResult inlineRegionImpl ( InlinerInterface interface,
Region src,
Block inlineBlock,
Block::iterator  inlinePoint,
BlockAndValueMapping mapper,
ValueRange  resultsToReplace,
TypeRange  regionResultTypes,
Optional< Location inlineLoc,
bool  shouldCloneInlinedRegion,
Operation call = nullptr 
)
static

◆ inlineRegionImpl() [2/2]

static LogicalResult inlineRegionImpl ( InlinerInterface interface,
Region src,
Block inlineBlock,
Block::iterator  inlinePoint,
ValueRange  inlinedOperands,
ValueRange  resultsToReplace,
Optional< Location inlineLoc,
bool  shouldCloneInlinedRegion,
Operation call = nullptr 
)
static

◆ isLegalToInline()

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

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

Definition at line 113 of file InliningUtils.cpp.

References mlir::InlinerInterface::isLegalToInline(), and mlir::InlinerInterface::shouldAnalyzeRecursively().

Referenced by containsReturn(), eachHasOnlyOneOfTypes(), and remainsLegalAfterInline().

◆ 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 306 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().

Referenced by mlir::inlineCall().

◆ 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 30 of file InliningUtils.cpp.

Referenced by inlineRegionImpl().

◆ remapInlinedOperands()

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

Definition at line 45 of file InliningUtils.cpp.

References mlir::BlockAndValueMapping::lookupOrNull().

Referenced by inlineRegionImpl().