33 bool wouldBeCloned)
const final {
34 auto callOp = dyn_cast<func::CallOp>(call);
35 auto funcOp = dyn_cast<func::FuncOp>(callable);
36 return !(callOp && callOp.getNoInline()) &&
37 !(funcOp && funcOp.getNoInline());
41 bool isLegalToInline(Operation *, Region *,
bool, IRMapping &)
const final {
46 bool isLegalToInline(Region *, Region *,
bool, IRMapping &)
const final {
56 void handleTerminator(Operation *op,
Block *newDest)
const final {
58 auto returnOp = dyn_cast<ReturnOp>(op);
63 OpBuilder builder(op);
64 cf::BranchOp::create(builder, op->getLoc(), newDest,
65 returnOp.getOperands());
71 void handleTerminator(Operation *op,
ValueRange valuesToRepl)
const final {
73 auto returnOp = cast<ReturnOp>(op);
76 assert(returnOp.getNumOperands() == valuesToRepl.size());
77 for (
const auto &it : llvm::enumerate(returnOp.getOperands()))
78 valuesToRepl[it.index()].replaceAllUsesWith(it.value());
89 dialect->addInterfaces<FuncInlinerInterface>();
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.
This is the interface that must be implemented by the dialects of operations to be inlined.
DialectInlinerInterface(Dialect *dialect)
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
bool addExtension(TypeID extensionID, std::unique_ptr< DialectExtensionBase > extension)
Add the given extension to the registry.
MLIRContext is the top-level object for a collection of MLIR operations.
T * getOrLoadDialect()
Get (or create) a dialect for the given derived dialect type.
void registerInlinerExtension(DialectRegistry ®istry)
Register the extension used to support inlining the func dialect.
Include the generated interface declarations.