#include "mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/IR/Value.h"
#include "llvm/ADT/SetOperations.h"
namespace mlir {
namespace bufferization {
#include "mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.cpp.inc"
}
}
usingnamespacemlir;
usingnamespacebufferization;
static Value buildBoolValue(OpBuilder &builder, Location loc, bool value) { … }
static bool isMemref(Value v) { … }
Ownership::Ownership(Value indicator)
: … { … }
Ownership Ownership::getUnknown() { … }
Ownership Ownership::getUnique(Value indicator) { … }
Ownership Ownership::getUninitialized() { … }
bool Ownership::isUninitialized() const { … }
bool Ownership::isUnique() const { … }
bool Ownership::isUnknown() const { … }
Value Ownership::getIndicator() const { … }
Ownership Ownership::getCombined(Ownership other) const { … }
void Ownership::combine(Ownership other) { … }
DeallocationState::DeallocationState(Operation *op) : … { … }
void DeallocationState::updateOwnership(Value memref, Ownership ownership,
Block *block) { … }
void DeallocationState::resetOwnerships(ValueRange memrefs, Block *block) { … }
Ownership DeallocationState::getOwnership(Value memref, Block *block) const { … }
void DeallocationState::addMemrefToDeallocate(Value memref, Block *block) { … }
void DeallocationState::dropMemrefToDeallocate(Value memref, Block *block) { … }
void DeallocationState::getLiveMemrefsIn(Block *block,
SmallVectorImpl<Value> &memrefs) { … }
std::pair<Value, Value>
DeallocationState::getMemrefWithUniqueOwnership(OpBuilder &builder,
Value memref, Block *block) { … }
void DeallocationState::getMemrefsToRetain(
Block *fromBlock, Block *toBlock, ValueRange destOperands,
SmallVectorImpl<Value> &toRetain) const { … }
LogicalResult DeallocationState::getMemrefsAndConditionsToDeallocate(
OpBuilder &builder, Location loc, Block *block,
SmallVectorImpl<Value> &memrefs, SmallVectorImpl<Value> &conditions) const { … }
bool ValueComparator::operator()(const Value &lhs, const Value &rhs) const { … }
FailureOr<Operation *> deallocation_impl::insertDeallocOpForReturnLike(
DeallocationState &state, Operation *op, ValueRange operands,
SmallVectorImpl<Value> &updatedOperandOwnerships) { … }