#include "mlir/Dialect/MemRef/IR/MemRefMemorySlot.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/BuiltinDialect.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/Value.h"
#include "mlir/Interfaces/InferTypeOpInterface.h"
#include "mlir/Interfaces/MemorySlotInterfaces.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/ErrorHandling.h"
usingnamespacemlir;
static LogicalResult nextIndex(ArrayRef<int64_t> shape,
MutableArrayRef<int64_t> index) { … }
template <typename CallableT>
static void walkIndicesAsAttr(MLIRContext *ctx, ArrayRef<int64_t> shape,
CallableT &&walker) { … }
static bool isSupportedElementType(Type type) { … }
SmallVector<MemorySlot> memref::AllocaOp::getPromotableSlots() { … }
Value memref::AllocaOp::getDefaultValue(const MemorySlot &slot,
OpBuilder &builder) { … }
std::optional<PromotableAllocationOpInterface>
memref::AllocaOp::handlePromotionComplete(const MemorySlot &slot,
Value defaultValue,
OpBuilder &builder) { … }
void memref::AllocaOp::handleBlockArgument(const MemorySlot &slot,
BlockArgument argument,
OpBuilder &builder) { … }
SmallVector<DestructurableMemorySlot>
memref::AllocaOp::getDestructurableSlots() { … }
DenseMap<Attribute, MemorySlot> memref::AllocaOp::destructure(
const DestructurableMemorySlot &slot,
const SmallPtrSetImpl<Attribute> &usedIndices, OpBuilder &builder,
SmallVectorImpl<DestructurableAllocationOpInterface> &newAllocators) { … }
std::optional<DestructurableAllocationOpInterface>
memref::AllocaOp::handleDestructuringComplete(
const DestructurableMemorySlot &slot, OpBuilder &builder) { … }
bool memref::LoadOp::loadsFrom(const MemorySlot &slot) { … }
bool memref::LoadOp::storesTo(const MemorySlot &slot) { … }
Value memref::LoadOp::getStored(const MemorySlot &slot, OpBuilder &builder,
Value reachingDef,
const DataLayout &dataLayout) { … }
bool memref::LoadOp::canUsesBeRemoved(
const MemorySlot &slot, const SmallPtrSetImpl<OpOperand *> &blockingUses,
SmallVectorImpl<OpOperand *> &newBlockingUses,
const DataLayout &dataLayout) { … }
DeletionKind memref::LoadOp::removeBlockingUses(
const MemorySlot &slot, const SmallPtrSetImpl<OpOperand *> &blockingUses,
OpBuilder &builder, Value reachingDefinition,
const DataLayout &dataLayout) { … }
static Attribute getAttributeIndexFromIndexOperands(MLIRContext *ctx,
ValueRange indices,
MemRefType memrefType) { … }
bool memref::LoadOp::canRewire(const DestructurableMemorySlot &slot,
SmallPtrSetImpl<Attribute> &usedIndices,
SmallVectorImpl<MemorySlot> &mustBeSafelyUsed,
const DataLayout &dataLayout) { … }
DeletionKind memref::LoadOp::rewire(const DestructurableMemorySlot &slot,
DenseMap<Attribute, MemorySlot> &subslots,
OpBuilder &builder,
const DataLayout &dataLayout) { … }
bool memref::StoreOp::loadsFrom(const MemorySlot &slot) { … }
bool memref::StoreOp::storesTo(const MemorySlot &slot) { … }
Value memref::StoreOp::getStored(const MemorySlot &slot, OpBuilder &builder,
Value reachingDef,
const DataLayout &dataLayout) { … }
bool memref::StoreOp::canUsesBeRemoved(
const MemorySlot &slot, const SmallPtrSetImpl<OpOperand *> &blockingUses,
SmallVectorImpl<OpOperand *> &newBlockingUses,
const DataLayout &dataLayout) { … }
DeletionKind memref::StoreOp::removeBlockingUses(
const MemorySlot &slot, const SmallPtrSetImpl<OpOperand *> &blockingUses,
OpBuilder &builder, Value reachingDefinition,
const DataLayout &dataLayout) { … }
bool memref::StoreOp::canRewire(const DestructurableMemorySlot &slot,
SmallPtrSetImpl<Attribute> &usedIndices,
SmallVectorImpl<MemorySlot> &mustBeSafelyUsed,
const DataLayout &dataLayout) { … }
DeletionKind memref::StoreOp::rewire(const DestructurableMemorySlot &slot,
DenseMap<Attribute, MemorySlot> &subslots,
OpBuilder &builder,
const DataLayout &dataLayout) { … }
namespace {
struct MemRefDestructurableTypeExternalModel
: public DestructurableTypeInterface::ExternalModel<
MemRefDestructurableTypeExternalModel, MemRefType> { … };
}
void mlir::memref::registerMemorySlotExternalModels(DialectRegistry ®istry) { … }