MLIR: lib/Dialect/MemRef/IR/MemRefDialect.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
20 #include
21
22 using namespace mlir;
24
25 #include "mlir/Dialect/MemRef/IR/MemRefOpsDialect.cpp.inc"
26
27
28
29
30
31 namespace {
35 IRMapping &valueMapping) const final {
36 return true;
37 }
40 return true;
41 }
42 };
43 }
44
45 void mlir::memref::MemRefDialect::initialize() {
46 addOperations<
47 #define GET_OP_LIST
48 #include "mlir/Dialect/MemRef/IR/MemRefOps.cpp.inc"
49 >();
50 addInterfaces();
51 declarePromisedInterface<ConvertToEmitCPatternInterface, MemRefDialect>();
52 declarePromisedInterface<ConvertToLLVMPatternInterface, MemRefDialect>();
53 declarePromisedInterfaces<bufferization::AllocationOpInterface, AllocOp,
54 AllocaOp, ReallocOp>();
55 declarePromisedInterfaces<RuntimeVerifiableOpInterface, CastOp, ExpandShapeOp,
56 LoadOp, ReinterpretCastOp, StoreOp, SubViewOp>();
57 declarePromisedInterfaces<ValueBoundsOpInterface, AllocOp, AllocaOp, CastOp,
58 DimOp, GetGlobalOp, RankOp, SubViewOp>();
59 declarePromisedInterface<DestructurableTypeInterface, MemRefType>();
60 }
61
62
66 if (!hasEffectMemoryEffects::Free(user, allocValue))
67 continue;
68
69 if (isamemref::ReallocOp(user))
70 return std::nullopt;
71
72 if (dealloc)
73 return std::nullopt;
74 dealloc = user;
75 }
76 return dealloc;
77 }
static bool isLegalToInline(InlinerInterface &interface, Region *src, Region *insertRegion, bool shouldCloneInlinedRegion, IRMapping &valueMapping)
Utility to check that all of the operations within 'src' can be inlined.
This is the interface that must be implemented by the dialects of operations to be inlined.
DialectInlinerInterface(Dialect *dialect)
This is a utility class for mapping one set of IR entities to another.
Operation is the basic unit of execution within MLIR.
This class contains a list of basic blocks and a link to the parent operation it is attached to.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
user_range getUsers() const
std::optional< Operation * > findDealloc(Value allocValue)
Finds a single dealloc operation for the given allocated value.
Include the generated interface declarations.