MLIR  19.0.0git
OneShotModuleBufferize.h
Go to the documentation of this file.
1 //===- OneShotModuleBufferize.h - Bufferization across Func. Boundaries ---===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTMODULEBUFFERIZE_H
10 #define MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTMODULEBUFFERIZE_H
11 
12 namespace mlir {
13 
14 struct LogicalResult;
15 class ModuleOp;
16 
17 namespace bufferization {
18 struct BufferizationStatistics;
19 class OneShotAnalysisState;
20 struct OneShotBufferizationOptions;
21 
22 /// Analyze `moduleOp` and its nested ops. Bufferization decisions are stored in
23 /// `state`.
24 LogicalResult analyzeModuleOp(ModuleOp moduleOp, OneShotAnalysisState &state,
25  BufferizationStatistics *statistics = nullptr);
26 
27 /// Bufferize `op` and its nested ops that implement `BufferizableOpInterface`.
28 ///
29 /// Note: This function does not run One-Shot Analysis. No buffer copies are
30 /// inserted except two cases:
31 /// - `options.copyBeforeWrite` is set, in which case buffers are copied before
32 /// every write.
33 /// - `options.copyBeforeWrite` is not set and `options.noAnalysisFuncFilter`
34 /// is not empty. The FuncOps it contains were not analyzed. Buffer copies
35 /// will be inserted only to these FuncOps.
36 LogicalResult bufferizeModuleOp(ModuleOp moduleOp,
37  const OneShotBufferizationOptions &options,
38  BufferizationStatistics *statistics = nullptr);
39 
40 /// Remove bufferization attributes on every FuncOp arguments in the ModuleOp.
41 void removeBufferizationAttributesInModule(ModuleOp moduleOp);
42 
43 /// Run One-Shot Module Bufferization on the given module. Performs a simple
44 /// function call analysis to determine which function arguments are
45 /// inplaceable. Then analyzes and bufferizes FuncOps one-by-one with One-Shot
46 /// Bufferize.
47 LogicalResult runOneShotModuleBufferize(
48  ModuleOp moduleOp,
49  const bufferization::OneShotBufferizationOptions &options,
50  BufferizationStatistics *statistics = nullptr);
51 
52 } // namespace bufferization
53 } // namespace mlir
54 
55 #endif // MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTMODULEBUFFERIZE_H
static llvm::ManagedStatic< PassManagerOptions > options
LogicalResult runOneShotModuleBufferize(ModuleOp moduleOp, const bufferization::OneShotBufferizationOptions &options, BufferizationStatistics *statistics=nullptr)
Run One-Shot Module Bufferization on the given module.
LogicalResult analyzeModuleOp(ModuleOp moduleOp, OneShotAnalysisState &state, BufferizationStatistics *statistics=nullptr)
Analyze moduleOp and its nested ops.
void removeBufferizationAttributesInModule(ModuleOp moduleOp)
Remove bufferization attributes on every FuncOp arguments in the ModuleOp.
LogicalResult bufferizeModuleOp(ModuleOp moduleOp, const OneShotBufferizationOptions &options, BufferizationStatistics *statistics=nullptr)
Bufferize op and its nested ops that implement BufferizableOpInterface.
Include the generated interface declarations.