1 #ifndef MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_PASSES_H
2 #define MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_PASSES_H
10 class FunctionOpInterface;
13 class RewritePatternSet;
21 namespace bufferization {
22 struct OneShotBufferizationOptions;
32 #include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
120 SymbolTable &symbolTable);
126 SymbolTableCollection &symbolTables);
143 std::function<bool(func::FuncOp *)>
filterFn = [](func::FuncOp *func) {
151 return memref::AllocOp::create(builder, loc, type, dynamicSizes)
159 memref::CopyOp::create(builder, loc, from, to);
187 std::unique_ptr<Pass>
195 #define GEN_PASS_REGISTRATION
196 #include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
static llvm::ManagedStatic< PassManagerOptions > options
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
This class helps build Operations.
This class provides an abstraction over the different types of ranges over Values.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
LogicalResult deallocateBuffersOwnershipBased(FunctionOpInterface op, DeallocationOptions options, SymbolTableCollection &symbolTables)
Run the ownership-based buffer deallocation.
std::unique_ptr< Pass > createPromoteBuffersToStackPass(std::function< bool(Value)> isSmallAlloc)
Creates a pass that promotes heap-based allocations to stack-based ones.
LogicalResult promoteBufferResultsToOutParams(ModuleOp module, const BufferResultsToOutParamsOpts &options)
Replace buffers that are returned from a function with an out parameter.
llvm::DenseMap< Operation *, func::FuncOp > DeallocHelperMap
Maps from symbol table to its corresponding dealloc helper function.
void populateBufferizationDeallocLoweringPattern(RewritePatternSet &patterns, const DeallocHelperMap &deallocHelperFuncMap)
Adds the conversion pattern of the bufferization.dealloc operation to the given pattern set for use i...
func::FuncOp buildDeallocationLibraryFunction(OpBuilder &builder, Location loc, SymbolTable &symbolTable)
Construct the library function needed for the fully generic bufferization.dealloc lowering implemente...
LogicalResult dropEquivalentBufferResults(ModuleOp module)
Drop all memref function results that are equivalent to a function argument.
Include the generated interface declarations.
const FrozenRewritePatternSet & patterns
bool hoistDynamicAllocs
If true, the pass eliminates the memref.alloc and memcpy if the returned memref is allocated in the c...
std::function< LogicalResult(OpBuilder &, Location, Value, Value)> MemCpyFn
Memcpy function: Generate a memcpy between two memrefs.
std::function< FailureOr< Value >(OpBuilder &, Location, MemRefType, ValueRange)> AllocationFn
Allocator function: Generate a memref allocation with the given type.
MemCpyFn memCpyFn
Memcpy function; used to create a copy between two memrefs.
bool hoistStaticAllocs
If true, the pass eliminates the memref.alloc and memcpy if the returned memref is allocated in the c...
AllocationFn allocationFn
Allocation function; used to allocate a memref.
bool addResultAttribute
If true, the pass adds a "bufferize.result" attribute to each output parameter.
std::function< bool(func::FuncOp *)> filterFn