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 class OneShotAnalysisState; 19 struct OneShotBufferizationOptions; 20 21 /// Analyze `moduleOp` and its nested ops. Bufferization decisions are stored in 22 /// `state`. 23 LogicalResult analyzeModuleOp(ModuleOp moduleOp, OneShotAnalysisState &state); 24 25 /// Bufferize `op` and its nested ops that implement `BufferizableOpInterface`. 26 /// Whether buffer copies are needed or not is queried from the given state. 27 LogicalResult bufferizeModuleOp(ModuleOp moduleOp, 28 const OneShotAnalysisState &analysisState); 29 30 /// Run One-Shot Module Bufferization on the given module. Performs a simple 31 /// function call analysis to determine which function arguments are 32 /// inplaceable. Then analyzes and bufferizes FuncOps one-by-one with One-Shot 33 /// Bufferize. 34 LogicalResult runOneShotModuleBufferize( 35 ModuleOp moduleOp, 36 const bufferization::OneShotBufferizationOptions &options); 37 38 } // namespace bufferization 39 } // namespace mlir 40 41 #endif // MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTMODULEBUFFERIZE_H 42