1 #ifndef MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_PASSES_H
2 #define MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_PASSES_H
9 class FunctionOpInterface;
12 class RewritePatternSet;
20 namespace bufferization {
21 struct OneShotBufferizationOptions;
31 #include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
119 SymbolTable &symbolTable);
140 std::function<bool(func::FuncOp *)>
filterFn = [](func::FuncOp *func) {
148 return builder.
create<memref::AllocOp>(loc, type).getResult();
155 builder.
create<memref::CopyOp>(loc, from, to);
179 std::unique_ptr<Pass>
187 #define GEN_PASS_REGISTRATION
188 #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.
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
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...
LogicalResult deallocateBuffersOwnershipBased(FunctionOpInterface op, DeallocationOptions options)
Run the ownership-based buffer deallocation.
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
std::function< LogicalResult(OpBuilder &, Location, Value, Value)> MemCpyFn
Memcpy function: Generate a memcpy between two memrefs.
std::function< FailureOr< Value >(OpBuilder &, Location, MemRefType)> 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