MLIR  22.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 Operation;
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`. This operates on any `SymbolTable` op.
27 llvm::LogicalResult
28 analyzeModuleOp(Operation *moduleOp, OneShotAnalysisState &state,
29  BufferizationStatistics *statistics = nullptr);
30 
31 /// Bufferize an `op`s nested ops that implement `BufferizableOpInterface`.
32 /// This operates on any `SymbolTable` op.
33 ///
34 /// Note: This function does not run One-Shot Analysis. No buffer copies are
35 /// inserted except two cases:
36 /// - `options.copyBeforeWrite` is set, in which case buffers are copied before
37 /// every write.
38 /// - `options.copyBeforeWrite` is not set and `options.noAnalysisFuncFilter`
39 /// is not empty. The FuncOps it contains were not analyzed. Buffer copies
40 /// will be inserted only to these FuncOps.
41 llvm::LogicalResult bufferizeModuleOp(
42  Operation *moduleOp, const OneShotBufferizationOptions &options,
43  BufferizationState &state, BufferizationStatistics *statistics = nullptr);
44 
45 /// Remove bufferization attributes on every FuncOp arguments in the SymbolTable
46 /// op.
47 void removeBufferizationAttributesInModule(Operation *moduleOp);
48 
49 /// Run One-Shot Module Bufferization on the given SymbolTable. Performs a
50 /// simple function call analysis to determine which function arguments are
51 /// inplaceable. Then analyzes and bufferizes FuncOps one-by-one with One-Shot
52 /// Bufferize.
53 llvm::LogicalResult runOneShotModuleBufferize(
54  Operation *moduleOp,
55  const bufferization::OneShotBufferizationOptions &options,
56  BufferizationState &state, BufferizationStatistics *statistics = nullptr);
57 
58 } // namespace bufferization
59 } // namespace mlir
60 
61 #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 bufferizeModuleOp(Operation *moduleOp, const OneShotBufferizationOptions &options, BufferizationState &state, BufferizationStatistics *statistics=nullptr)
Bufferize an ops nested ops that implement BufferizableOpInterface.
void removeBufferizationAttributesInModule(Operation *moduleOp)
Remove bufferization attributes on every FuncOp arguments in the SymbolTable op.
llvm::LogicalResult analyzeModuleOp(Operation *moduleOp, OneShotAnalysisState &state, BufferizationStatistics *statistics=nullptr)
Analyze moduleOp and its nested ops.
llvm::LogicalResult runOneShotModuleBufferize(Operation *moduleOp, const bufferization::OneShotBufferizationOptions &options, BufferizationState &state, BufferizationStatistics *statistics=nullptr)
Run One-Shot Module Bufferization on the given SymbolTable.
Include the generated interface declarations.