20 struct DefaultAllocationInterface
21 :
public bufferization::AllocationOpInterface::ExternalModel<
22 DefaultAllocationInterface, memref::AllocOp> {
23 static std::optional<Operation *> buildDealloc(
OpBuilder &builder,
25 return builder.
create<memref::DeallocOp>(alloc.
getLoc(), alloc)
28 static std::optional<Value> buildClone(
OpBuilder &builder,
Value alloc) {
29 return builder.
create<bufferization::CloneOp>(alloc.
getLoc(), alloc)
35 static ::std::optional<::mlir::Operation *>
38 return builder.
create<memref::AllocaOp>(
44 struct DefaultAutomaticAllocationHoistingInterface
45 :
public bufferization::AllocationOpInterface::ExternalModel<
46 DefaultAutomaticAllocationHoistingInterface, memref::AllocaOp> {
50 struct DefaultReallocationInterface
51 :
public bufferization::AllocationOpInterface::ExternalModel<
52 DefaultAllocationInterface, memref::ReallocOp> {
53 static std::optional<Operation *> buildDealloc(
OpBuilder &builder,
55 return builder.
create<memref::DeallocOp>(realloc.
getLoc(), realloc)
64 memref::AllocOp::attachInterface<DefaultAllocationInterface>(*ctx);
65 memref::AllocaOp::attachInterface<
66 DefaultAutomaticAllocationHoistingInterface>(*ctx);
67 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.
This class helps build Operations.
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
Operation is the basic unit of execution within MLIR.
Location getLoc()
The source location the operation was defined or derived from.
ArrayRef< NamedAttribute > getAttrs()
Return all of the attributes on this operation.
result_type_range getResultTypes()
operand_range getOperands()
Returns an iterator on the underlying Value's.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
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.