#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>
#define DEBUG_TYPE …
usingnamespacemlir;
static void
remapInlinedLocations(iterator_range<Region::iterator> inlinedBlocks,
Location callerLoc) { … }
static void remapInlinedOperands(iterator_range<Region::iterator> inlinedBlocks,
IRMapping &mapper) { … }
bool InlinerInterface::isLegalToInline(Operation *call, Operation *callable,
bool wouldBeCloned) const { … }
bool InlinerInterface::isLegalToInline(Region *dest, Region *src,
bool wouldBeCloned,
IRMapping &valueMapping) const { … }
bool InlinerInterface::isLegalToInline(Operation *op, Region *dest,
bool wouldBeCloned,
IRMapping &valueMapping) const { … }
bool InlinerInterface::shouldAnalyzeRecursively(Operation *op) const { … }
void InlinerInterface::handleTerminator(Operation *op, Block *newDest) const { … }
void InlinerInterface::handleTerminator(Operation *op,
ValueRange valuesToRepl) const { … }
Value InlinerInterface::handleArgument(OpBuilder &builder, Operation *call,
Operation *callable, Value argument,
DictionaryAttr argumentAttrs) const { … }
Value InlinerInterface::handleResult(OpBuilder &builder, Operation *call,
Operation *callable, Value result,
DictionaryAttr resultAttrs) const { … }
void InlinerInterface::processInlinedCallBlocks(
Operation *call, iterator_range<Region::iterator> inlinedBlocks) const { … }
static bool isLegalToInline(InlinerInterface &interface, Region *src,
Region *insertRegion, bool shouldCloneInlinedRegion,
IRMapping &valueMapping) { … }
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 = { … }
LogicalResult mlir::inlineRegion(InlinerInterface &interface, Region *src,
Operation *inlinePoint, IRMapping &mapper,
ValueRange resultsToReplace,
TypeRange regionResultTypes,
std::optional<Location> inlineLoc,
bool shouldCloneInlinedRegion) { … }
LogicalResult mlir::inlineRegion(InlinerInterface &interface, Region *src,
Block *inlineBlock,
Block::iterator inlinePoint, IRMapping &mapper,
ValueRange resultsToReplace,
TypeRange regionResultTypes,
std::optional<Location> inlineLoc,
bool shouldCloneInlinedRegion) { … }
LogicalResult mlir::inlineRegion(InlinerInterface &interface, Region *src,
Operation *inlinePoint,
ValueRange inlinedOperands,
ValueRange resultsToReplace,
std::optional<Location> inlineLoc,
bool shouldCloneInlinedRegion) { … }
LogicalResult mlir::inlineRegion(InlinerInterface &interface, Region *src,
Block *inlineBlock,
Block::iterator inlinePoint,
ValueRange inlinedOperands,
ValueRange resultsToReplace,
std::optional<Location> inlineLoc,
bool shouldCloneInlinedRegion) { … }
static Value materializeConversion(const DialectInlinerInterface *interface,
SmallVectorImpl<Operation *> &castOps,
OpBuilder &castBuilder, Value arg, Type type,
Location conversionLoc) { … }
LogicalResult mlir::inlineCall(InlinerInterface &interface,
CallOpInterface call,
CallableOpInterface callable, Region *src,
bool shouldCloneInlinedRegion) { … }