MLIR 22.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#include "llvm/ADT/SmallVector.h"
16
17namespace mlir {
18class DialectRegistry;
19
20namespace func {
21class FuncOp;
22} // namespace func
23
24namespace bufferization {
25/// Helper function that returns all func.return ops in the given function.
26SmallVector<func::ReturnOp> getReturnOps(func::FuncOp funcOp);
27
28namespace func_ext {
29/// The state of analysis of a FuncOp.
31
32using func::FuncOp;
33
34/// Extra analysis state that is required for bufferization of function
35/// boundaries.
39
40 // Note: Function arguments and/or function return values may disappear during
41 // bufferization. Functions and their CallOps are analyzed and bufferized
42 // separately. To ensure that a CallOp analysis/bufferization can access an
43 // already bufferized function's analysis results, we store bbArg/return value
44 // indices instead of BlockArguments/OpOperand pointers.
45
46 /// A set of block argument indices.
48
49 /// A mapping of indices to indices.
51
52 /// A mapping of indices to a list of indices.
54
55 /// A mapping of ReturnOp OpOperand indices to equivalent FuncOp BBArg
56 /// indices.
58
59 /// A mapping of FuncOp BBArg indices to aliasing ReturnOp OpOperand indices.
61
62 /// A set of all read BlockArguments of FuncOps.
64
65 /// A set of all written-to BlockArguments of FuncOps.
67
68 /// Keep track of which FuncOps are fully analyzed or currently being
69 /// analyzed.
71
72 /// A collection of cached SymbolTables used for faster function lookup.
74
75 /// This function is called right before analyzing the given FuncOp. It
76 /// initializes the data structures for the FuncOp in this state object.
77 void startFunctionAnalysis(FuncOp funcOp);
78};
79
81} // namespace func_ext
82} // namespace bufferization
83} // namespace mlir
84
85#endif // MLIR_BUFFERIZATION_TRANSFORMS_FUNCBUFFERIZABLEOPINTERFACEIMPL_H
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
This class represents a collection of SymbolTables.
Base class for OneShotAnalysisState extensions that allow OneShotAnalysisState to contain user-specif...
Extension(OneShotAnalysisState &state)
Constructs an extension of the given state object.
FuncOpAnalysisState
The state of analysis of a FuncOp.
void registerBufferizableOpInterfaceExternalModels(DialectRegistry &registry)
SmallVector< func::ReturnOp > getReturnOps(func::FuncOp funcOp)
Helper function that returns all func.return ops in the given function.
Include the generated interface declarations.
llvm::DenseSet< ValueT, ValueInfoT > DenseSet
Definition LLVM.h:128
llvm::DenseMap< KeyT, ValueT, KeyInfoT, BucketT > DenseMap
Definition LLVM.h:126
DenseMap< FuncOp, IndexMapping > equivalentFuncArgs
A mapping of ReturnOp OpOperand indices to equivalent FuncOp BBArg indices.
DenseMap< int64_t, SmallVector< int64_t > > IndexToIndexListMapping
A mapping of indices to a list of indices.
DenseMap< FuncOp, IndexToIndexListMapping > aliasingReturnVals
A mapping of FuncOp BBArg indices to aliasing ReturnOp OpOperand indices.
SymbolTableCollection symbolTables
A collection of cached SymbolTables used for faster function lookup.
DenseMap< FuncOp, BbArgIndexSet > readBbArgs
A set of all read BlockArguments of FuncOps.
DenseSet< int64_t > BbArgIndexSet
A set of block argument 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.
DenseMap< int64_t, int64_t > IndexMapping
A mapping of indices to indices.