MLIR  21.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 llvm {
13 struct LogicalResult;
14 } // namespace llvm
15 
16 namespace mlir {
17 class ModuleOp;
18 
19 namespace bufferization {
20 struct BufferizationStatistics;
21 class OneShotAnalysisState;
22 struct OneShotBufferizationOptions;
23 class BufferizationState;
24 
25 /// Analyze `moduleOp` and its nested ops. Bufferization decisions are stored in
26 /// `state`.
27 llvm::LogicalResult
28 analyzeModuleOp(ModuleOp moduleOp, OneShotAnalysisState &state,
29  BufferizationStatistics *statistics = nullptr);
30 
31 /// Bufferize `op` and its nested ops that implement `BufferizableOpInterface`.
32 ///
33 /// Note: This function does not run One-Shot Analysis. No buffer copies are
34 /// inserted except two cases:
35 /// - `options.copyBeforeWrite` is set, in which case buffers are copied before
36 /// every write.
37 /// - `options.copyBeforeWrite` is not set and `options.noAnalysisFuncFilter`
38 /// is not empty. The FuncOps it contains were not analyzed. Buffer copies
39 /// will be inserted only to these FuncOps.
40 llvm::LogicalResult
41 bufferizeModuleOp(ModuleOp moduleOp, const OneShotBufferizationOptions &options,
42  BufferizationState &state,
43  BufferizationStatistics *statistics = nullptr);
44 
45 /// Remove bufferization attributes on every FuncOp arguments in the ModuleOp.
46 void removeBufferizationAttributesInModule(ModuleOp moduleOp);
47 
48 /// Run One-Shot Module Bufferization on the given module. Performs a simple
49 /// function call analysis to determine which function arguments are
50 /// inplaceable. Then analyzes and bufferizes FuncOps one-by-one with One-Shot
51 /// Bufferize.
52 llvm::LogicalResult runOneShotModuleBufferize(
53  ModuleOp moduleOp,
54  const bufferization::OneShotBufferizationOptions &options,
55  BufferizationState &state, BufferizationStatistics *statistics = nullptr);
56 
57 } // namespace bufferization
58 } // namespace mlir
59 
60 #endif // MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTMODULEBUFFERIZE_H
static llvm::ManagedStatic< PassManagerOptions > options
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition: CallGraph.h:229
llvm::LogicalResult analyzeModuleOp(ModuleOp moduleOp, OneShotAnalysisState &state, BufferizationStatistics *statistics=nullptr)
Analyze moduleOp and its nested ops.
llvm::LogicalResult bufferizeModuleOp(ModuleOp moduleOp, const OneShotBufferizationOptions &options, BufferizationState &state, BufferizationStatistics *statistics=nullptr)
Bufferize op and its nested ops that implement BufferizableOpInterface.
void removeBufferizationAttributesInModule(ModuleOp moduleOp)
Remove bufferization attributes on every FuncOp arguments in the ModuleOp.
llvm::LogicalResult runOneShotModuleBufferize(ModuleOp moduleOp, const bufferization::OneShotBufferizationOptions &options, BufferizationState &state, BufferizationStatistics *statistics=nullptr)
Run One-Shot Module Bufferization on the given module.
Include the generated interface declarations.