MLIR: include/mlir/Dialect/Bufferization/Transforms/BufferUtils.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #ifndef MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_BUFFERUTILS_H
15 #define MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_BUFFERUTILS_H
16
25
26 namespace mlir {
27 namespace memref {
28 class GlobalOp;
29 }
30
31 namespace bufferization {
32 class BufferizationState;
33
34
36 public:
37
38 using AllocEntry = std::tuple<Value, Operation *>;
39
40
42
43
44
47
48 public:
49
50
52
53
54 AllocEntryList::const_iterator begin() const { return allocs.begin(); }
55
56
57 AllocEntryList::const_iterator end() const { return allocs.end(); }
58
59
60 AllocEntryList::iterator begin() { return allocs.begin(); }
61
62
63 AllocEntryList::iterator end() { return allocs.end(); }
64
65
67
68 private:
69
71
72 private:
73
75 };
76
77
78
79
80
81 template
84 const DominatorT &doms) {
85
86
88
90 for (Value childValue : values) {
92
93
94 blocks.insert(user->getBlock());
95 }
96
97 blocks.insert(childValue.getParentBlock());
98 }
99 return doms.findNearestCommonDominator(blocks);
100 }
101
102
104 public:
106
107
109
110 protected:
111
113
114
116
117
118
120 };
121
122
123
124
125 FailureOrmemref::GlobalOp getGlobalFor(arith::ConstantOp constantOp,
127 uint64_t alignment,
129
131
133
134 }
135 }
136
137 #endif
Attributes are known-constant values of operations.
Block represents an ordered list of Operations.
A straight-forward alias analysis which ensures that all dependencies of all values will be determine...
SmallPtrSet< Value, 16 > ValueSetT
Represents an analysis for computing liveness information from a given top-level operation.
Operation is the basic unit of execution within MLIR.
user_range getUsers()
Returns a range of all users.
This class represents a collection of SymbolTables.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Block * getParentBlock()
Return the Block in which this Value is defined.
A simple analysis that detects allocation operations.
void registerAlloc(const AllocEntry &entry)
Registers a new allocation entry.
static Operation * getStartOperation(Value allocValue, Block *placementBlock, const Liveness &liveness)
Get the start operation to place the given alloc value within the specified placement block.
BufferPlacementAllocs(Operation *op)
Initializes the internal list by discovering all supported allocation nodes.
AllocEntryList::iterator end()
Returns the end iterator that can be used in combination with begin.
AllocEntryList::const_iterator end() const
Returns the end iterator that can be used in combination with begin.
AllocEntryList::iterator begin()
Returns the begin iterator to iterate over all allocations.
std::tuple< Value, Operation * > AllocEntry
Represents a tuple of allocValue and deallocOperation.
AllocEntryList::const_iterator begin() const
Returns the begin iterator to iterate over all allocations.
SmallVector< AllocEntry, 8 > AllocEntryList
Represents a list containing all alloc entries.
The base class for all BufferPlacement transformations.
BufferViewFlowAnalysis aliases
Alias information that can be updated during the insertion of copies.
BufferPlacementAllocs allocs
Stores all internally managed allocations.
BufferPlacementTransformationBase(Operation *op)
Constructs a new operation base using the given root operation.
Liveness liveness
The underlying liveness analysis to compute fine grained information about alloc and dealloc position...
void insertSymbol(Operation *op, BufferizationState &state)
Block * findCommonDominator(Value value, const BufferViewFlowAnalysis::ValueSetT &values, const DominatorT &doms)
Finds a common dominator for the given value while taking the positions of the values in the value se...
FailureOr< memref::GlobalOp > getGlobalFor(arith::ConstantOp constantOp, SymbolTableCollection &symbolTables, uint64_t alignment, Attribute memorySpace={})
void removeSymbol(Operation *op, BufferizationState &state)
Include the generated interface declarations.