MLIR
17.0.0git
|
#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 LogicalResult | inlineRegionImpl (InlinerInterface &interface, Region *src, Block *inlineBlock, Block::iterator inlinePoint, IRMapping &mapper, ValueRange resultsToReplace, TypeRange regionResultTypes, std::optional< Location > inlineLoc, bool shouldCloneInlinedRegion, Operation *call=nullptr) |
static LogicalResult | inlineRegionImpl (InlinerInterface &interface, Region *src, Block *inlineBlock, Block::iterator inlinePoint, ValueRange inlinedOperands, ValueRange resultsToReplace, std::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... | |
#define DEBUG_TYPE "inlining" |
Definition at line 24 of file InliningUtils.cpp.
|
static |
Handle the terminators for each of the new blocks.
Definition at line 145 of file InliningUtils.cpp.
References mlir::Block::addArgument(), mlir::Block::begin(), mlir::Region::begin(), mlir::Region::cloneInto(), mlir::Region::empty(), mlir::Block::end(), mlir::Region::end(), mlir::detail::enumerate(), mlir::Block::erase(), mlir::failure(), mlir::Region::front(), mlir::Region::getBlocks(), mlir::Block::getOperations(), mlir::Block::getParent(), mlir::Block::getTerminator(), mlir::InlinerInterface::handleTerminator(), isLegalToInline(), mlir::InlinerInterface::isLegalToInline(), mlir::InlinerInterface::processInlinedBlocks(), mlir::InlinerInterface::processInlinedCallBlocks(), remapInlinedLocations(), remapInlinedOperands(), mlir::Block::splitBlock(), and mlir::success().
Referenced by mlir::inlineCall(), mlir::inlineRegion(), and inlineRegionImpl().
|
static |
Definition at line 234 of file InliningUtils.cpp.
References mlir::Region::empty(), mlir::failure(), mlir::Region::front(), mlir::Value::getType(), mlir::ValueRange::getTypes(), inlineRegionImpl(), and mlir::IRMapping::map().
|
static |
Utility to check that all of the operations within 'src' can be inlined.
Definition at line 114 of file InliningUtils.cpp.
References mlir::InlinerInterface::isLegalToInline(), and mlir::InlinerInterface::shouldAnalyzeRecursively().
Referenced by inlineRegionImpl().
|
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 309 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().
|
static |
Remap locations from the inlined blocks with CallSiteLoc locations with the provided caller location.
Definition at line 31 of file InliningUtils.cpp.
Referenced by inlineRegionImpl().
|
static |
Definition at line 46 of file InliningUtils.cpp.
References mlir::IRMapping::lookupOrNull().
Referenced by inlineRegionImpl().