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 
13 
14 namespace mlir {
15 class DialectRegistry;
16 
17 namespace func {
18 class FuncOp;
19 } // namespace func
20 
21 namespace bufferization {
22 namespace func_ext {
23 /// The state of analysis of a FuncOp.
25 
26 using func::FuncOp;
27 
28 /// Extra analysis state that is required for bufferization of function
29 /// boundaries.
31  // Note: Function arguments and/or function return values may disappear during
32  // bufferization. Functions and their CallOps are analyzed and bufferized
33  // separately. To ensure that a CallOp analysis/bufferization can access an
34  // already bufferized function's analysis results, we store bbArg/return value
35  // indices instead of BlockArguments/OpOperand pointers.
36 
37  /// A set of block argument indices.
39 
40  /// A mapping of indices to indices.
42 
43  /// A mapping of indices to a list of indices.
45 
46  /// A mapping of ReturnOp OpOperand indices to equivalent FuncOp BBArg
47  /// indices.
49 
50  /// A mapping of ReturnOp OpOperand indices to aliasing FuncOp BBArg indices.
52 
53  /// A mapping of FuncOp BBArg indices to aliasing ReturnOp OpOperand indices.
55 
56  /// A set of all read BlockArguments of FuncOps.
58 
59  /// A set of all written-to BlockArguments of FuncOps.
61 
62  /// Keep track of which FuncOps are fully analyzed or currently being
63  /// analyzed.
65 
66  /// This function is called right before analyzing the given FuncOp. It
67  /// initializes the data structures for the FuncOp in this state object.
68  void startFunctionAnalysis(FuncOp funcOp);
69 };
70 
72 } // namespace func_ext
73 } // namespace bufferization
74 } // namespace mlir
75 
76 #endif // MLIR_BUFFERIZATION_TRANSFORMS_FUNCBUFFERIZABLEOPINTERFACEIMPL_H
Include the generated interface declarations.
DenseMap< FuncOp, IndexToIndexListMapping > aliasingFuncArgs
A mapping of ReturnOp OpOperand indices to aliasing FuncOp BBArg indices.
DenseMap< FuncOp, FuncOpAnalysisState > analyzedFuncOps
Keep track of which FuncOps are fully analyzed or currently being analyzed.
void registerBufferizableOpInterfaceExternalModels(DialectRegistry &registry)
Extra analysis state that is required for bufferization of function boundaries.
DenseMap< FuncOp, BbArgIndexSet > writtenBbArgs
A set of all written-to BlockArguments of FuncOps.
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
DenseMap< FuncOp, IndexMapping > equivalentFuncArgs
A mapping of ReturnOp OpOperand indices to equivalent FuncOp BBArg indices.
DenseMap< FuncOp, BbArgIndexSet > readBbArgs
A set of all read BlockArguments of FuncOps.
FuncOpAnalysisState
The state of analysis of a FuncOp.
DenseMap< FuncOp, IndexToIndexListMapping > aliasingReturnVals
A mapping of FuncOp BBArg indices to aliasing ReturnOp OpOperand indices.