//===- BufferUtils.cpp - buffer transformation utilities ------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements utilities for buffer optimization passes. // //===----------------------------------------------------------------------===// #include "mlir/Dialect/Bufferization/Transforms/BufferUtils.h" #include "mlir/Dialect/Bufferization/Transforms/Bufferize.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" #include "mlir/Dialect/MemRef/Utils/MemRefUtils.h" #include "mlir/IR/Operation.h" #include "mlir/Interfaces/ControlFlowInterfaces.h" #include "mlir/Interfaces/LoopLikeInterface.h" #include "mlir/Pass/Pass.h" #include "llvm/ADT/SetOperations.h" #include "llvm/ADT/SmallString.h" #include <optional> usingnamespacemlir; usingnamespacemlir::bufferization; //===----------------------------------------------------------------------===// // BufferPlacementAllocs //===----------------------------------------------------------------------===// /// Get the start operation to place the given alloc value withing the // specified placement block. Operation *BufferPlacementAllocs::getStartOperation(Value allocValue, Block *placementBlock, const Liveness &liveness) { … } /// Initializes the internal list by discovering all supported allocation /// nodes. BufferPlacementAllocs::BufferPlacementAllocs(Operation *op) { … } /// Searches for and registers all supported allocation entries. void BufferPlacementAllocs::build(Operation *op) { … } //===----------------------------------------------------------------------===// // BufferPlacementTransformationBase //===----------------------------------------------------------------------===// /// Constructs a new transformation base using the given root operation. BufferPlacementTransformationBase::BufferPlacementTransformationBase( Operation *op) : … { … } //===----------------------------------------------------------------------===// // BufferPlacementTransformationBase //===----------------------------------------------------------------------===// FailureOr<memref::GlobalOp> bufferization::getGlobalFor(arith::ConstantOp constantOp, uint64_t alignment, Attribute memorySpace) { … }