MLIR  16.0.0git
FuncBufferizableOpInterfaceImpl.h
Go to the documentation of this file.
1 //===- BufferizableOpInterfaceImpl.h - Impl. of BufferizableOpInterface ---===//
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_BUFFERIZATION_TRANSFORMS_FUNCBUFFERIZABLEOPINTERFACEIMPL_H
10 #define MLIR_BUFFERIZATION_TRANSFORMS_FUNCBUFFERIZABLEOPINTERFACEIMPL_H
11 
15 
16 namespace mlir {
17 class DialectRegistry;
18 
19 namespace func {
20 class FuncOp;
21 } // namespace func
22 
23 namespace bufferization {
24 namespace func_ext {
25 /// The state of analysis of a FuncOp.
27 
28 using func::FuncOp;
29 
30 /// Extra analysis state that is required for bufferization of function
31 /// boundaries.
34  : OneShotAnalysisState::Extension(state) {}
35 
36  // Note: Function arguments and/or function return values may disappear during
37  // bufferization. Functions and their CallOps are analyzed and bufferized
38  // separately. To ensure that a CallOp analysis/bufferization can access an
39  // already bufferized function's analysis results, we store bbArg/return value
40  // indices instead of BlockArguments/OpOperand pointers.
41 
42  /// A set of block argument indices.
44 
45  /// A mapping of indices to indices.
47 
48  /// A mapping of indices to a list of indices.
50 
51  /// A mapping of ReturnOp OpOperand indices to equivalent FuncOp BBArg
52  /// indices.
54 
55  /// A mapping of ReturnOp OpOperand indices to aliasing FuncOp BBArg indices.
57 
58  /// A mapping of FuncOp BBArg indices to aliasing ReturnOp OpOperand indices.
60 
61  /// A set of all read BlockArguments of FuncOps.
63 
64  /// A set of all written-to BlockArguments of FuncOps.
66 
67  /// Keep track of which FuncOps are fully analyzed or currently being
68  /// analyzed.
70 
71  /// This function is called right before analyzing the given FuncOp. It
72  /// initializes the data structures for the FuncOp in this state object.
73  void startFunctionAnalysis(FuncOp funcOp);
74 };
75 
77 } // namespace func_ext
78 } // namespace bufferization
79 } // namespace mlir
80 
81 #endif // MLIR_BUFFERIZATION_TRANSFORMS_FUNCBUFFERIZABLEOPINTERFACEIMPL_H
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
Base class for OneShotAnalysisState extensions that allow OneShotAnalysisState to contain user-specif...
Extension(OneShotAnalysisState &state)
Constructs an extension of the given state object.
State for analysis-enabled bufferization.
FuncOpAnalysisState
The state of analysis of a FuncOp.
void registerBufferizableOpInterfaceExternalModels(DialectRegistry &registry)
Include the generated interface declarations.
Extra analysis state that is required for bufferization of function boundaries.
DenseMap< FuncOp, IndexMapping > equivalentFuncArgs
A mapping of ReturnOp OpOperand indices to equivalent FuncOp BBArg indices.
DenseMap< FuncOp, IndexToIndexListMapping > aliasingReturnVals
A mapping of FuncOp BBArg indices to aliasing ReturnOp OpOperand indices.
DenseMap< FuncOp, BbArgIndexSet > readBbArgs
A set of all read BlockArguments of FuncOps.
DenseMap< FuncOp, IndexToIndexListMapping > aliasingFuncArgs
A mapping of ReturnOp OpOperand indices to aliasing FuncOp BBArg indices.
DenseMap< FuncOp, BbArgIndexSet > writtenBbArgs
A set of all written-to BlockArguments of FuncOps.
DenseMap< FuncOp, FuncOpAnalysisState > analyzedFuncOps
Keep track of which FuncOps are fully analyzed or currently being analyzed.
void startFunctionAnalysis(FuncOp funcOp)
This function is called right before analyzing the given FuncOp.