20struct DefaultAllocationInterface
21 :
public bufferization::AllocationOpInterface::ExternalModel<
22 DefaultAllocationInterface, memref::AllocOp> {
23 static std::optional<Operation *> buildDealloc(OpBuilder &builder,
25 return memref::DeallocOp::create(builder, alloc.
getLoc(), alloc)
28 static std::optional<Value> buildClone(OpBuilder &builder, Value alloc) {
29 return bufferization::CloneOp::create(builder, alloc.
getLoc(), alloc)
32 static ::mlir::HoistingKind getHoistingKind() {
33 return HoistingKind::Loop | HoistingKind::Block;
35 static ::std::optional<::mlir::Operation *>
36 buildPromotedAlloc(OpBuilder &builder, Value alloc) {
38 return memref::AllocaOp::create(
39 builder, definingOp->
getLoc(),
45struct DefaultAutomaticAllocationHoistingInterface
46 :
public bufferization::AllocationOpInterface::ExternalModel<
47 DefaultAutomaticAllocationHoistingInterface, memref::AllocaOp> {
48 static ::mlir::HoistingKind getHoistingKind() {
return HoistingKind::Loop; }
51struct DefaultReallocationInterface
52 :
public bufferization::AllocationOpInterface::ExternalModel<
53 DefaultAllocationInterface, memref::ReallocOp> {
54 static std::optional<Operation *> buildDealloc(OpBuilder &builder,
56 return memref::DeallocOp::create(builder, realloc.
getLoc(), realloc)
65 memref::AllocOp::attachInterface<DefaultAllocationInterface>(*ctx);
66 memref::AllocaOp::attachInterface<
67 DefaultAutomaticAllocationHoistingInterface>(*ctx);
68 memref::ReallocOp::attachInterface<DefaultReallocationInterface>(*ctx);
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
bool addExtension(TypeID extensionID, std::unique_ptr< DialectExtensionBase > extension)
Add the given extension to the registry.
MLIRContext is the top-level object for a collection of MLIR operations.
ArrayRef< NamedAttribute > getAttrs()
Return all of the attributes on this operation.
Location getLoc()
The source location the operation was defined or derived from.
result_type_range getResultTypes()
operand_range getOperands()
Returns an iterator on the underlying Value's.
Location getLoc() const
Return the location of this value.
Operation * getDefiningOp() const
If this value is the result of an operation, return the operation that defines it.
void registerAllocationOpInterfaceExternalModels(DialectRegistry ®istry)
Include the generated interface declarations.