#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
#include "mlir/Dialect/Bufferization/Transforms/OneShotModuleBufferize.h"
#include "mlir/Dialect/Bufferization/Transforms/Transforms.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Operation.h"
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Transforms/Passes.h"
#include <optional>
namespace mlir {
namespace bufferization {
#define GEN_PASS_DEF_FINALIZINGBUFFERIZE
#define GEN_PASS_DEF_BUFFERIZATIONBUFFERIZE
#define GEN_PASS_DEF_ONESHOTBUFFERIZE
#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
}
}
#define DEBUG_TYPE …
usingnamespacemlir;
usingnamespacemlir::bufferization;
static Value materializeToTensor(OpBuilder &builder, TensorType type,
ValueRange inputs, Location loc) { … }
BufferizeTypeConverter::BufferizeTypeConverter() { … }
void mlir::bufferization::populateBufferizeMaterializationLegality(
ConversionTarget &target) { … }
namespace {
class BufferizeToTensorOp
: public OpConversionPattern<bufferization::ToTensorOp> { … };
}
namespace {
class BufferizeToMemrefOp
: public OpConversionPattern<bufferization::ToMemrefOp> { … };
}
void mlir::bufferization::populateEliminateBufferizeMaterializationsPatterns(
const BufferizeTypeConverter &typeConverter, RewritePatternSet &patterns) { … }
namespace {
struct FinalizingBufferizePass
: public bufferization::impl::FinalizingBufferizeBase<
FinalizingBufferizePass> { … };
static LayoutMapOption parseLayoutMapOption(const std::string &s) { … }
static OneShotBufferizationOptions::AnalysisHeuristic
parseHeuristicOption(const std::string &s) { … }
struct OneShotBufferizePass
: public bufferization::impl::OneShotBufferizeBase<OneShotBufferizePass> { … };
}
std::unique_ptr<Pass> mlir::bufferization::createOneShotBufferizePass() { … }
std::unique_ptr<Pass> mlir::bufferization::createOneShotBufferizePass(
const OneShotBufferizationOptions &options) { … }
std::unique_ptr<OperationPass<func::FuncOp>>
mlir::bufferization::createFinalizingBufferizePass() { … }
namespace {
class BufferizationRewriter : public IRRewriter, public RewriterBase::Listener { … };
}
LogicalResult bufferization::bufferizeOp(Operation *op,
const BufferizationOptions &options,
BufferizationStatistics *statistics) { … }
LogicalResult
bufferization::bufferizeBlockSignature(Block *block, RewriterBase &rewriter,
const BufferizationOptions &options) { … }
BufferizationOptions bufferization::getPartialBufferizationOptions() { … }