MLIR  19.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 FuncOp BBArg indices to aliasing ReturnOp OpOperand indices.
57 
58  /// A set of all read BlockArguments of FuncOps.
60 
61  /// A set of all written-to BlockArguments of FuncOps.
63 
64  /// Keep track of which FuncOps are fully analyzed or currently being
65  /// analyzed.
67 
68  /// This function is called right before analyzing the given FuncOp. It
69  /// initializes the data structures for the FuncOp in this state object.
70  void startFunctionAnalysis(FuncOp funcOp);
71 };
72 
74 } // namespace func_ext
75 } // namespace bufferization
76 } // namespace mlir
77 
78 #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, 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.