
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
49 lines
2.1 KiB
C++
49 lines
2.1 KiB
C++
//===- BufferizationPipelines.cpp - Pipelines for bufferization -----------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/Dialect/Bufferization/Pipelines/Passes.h"
|
|
|
|
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
|
|
#include "mlir/Dialect/MemRef/Transforms/Passes.h"
|
|
#include "mlir/Pass/PassManager.h"
|
|
#include "mlir/Transforms/Passes.h"
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Pipeline implementation.
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
void mlir::bufferization::buildBufferDeallocationPipeline(
|
|
OpPassManager &pm, const BufferDeallocationPipelineOptions &options) {
|
|
memref::ExpandReallocPassOptions expandAllocPassOptions{
|
|
/*emitDeallocs=*/false};
|
|
pm.addPass(memref::createExpandReallocPass(expandAllocPassOptions));
|
|
pm.addPass(createCanonicalizerPass());
|
|
|
|
OwnershipBasedBufferDeallocationPassOptions deallocationOptions{
|
|
options.privateFunctionDynamicOwnership};
|
|
pm.addPass(createOwnershipBasedBufferDeallocationPass(deallocationOptions));
|
|
pm.addPass(createCanonicalizerPass());
|
|
pm.addPass(createBufferDeallocationSimplificationPass());
|
|
pm.addPass(createLowerDeallocationsPass());
|
|
pm.addPass(createCSEPass());
|
|
pm.addPass(createCanonicalizerPass());
|
|
}
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Pipeline registration.
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
void mlir::bufferization::registerBufferizationPipelines() {
|
|
PassPipelineRegistration<BufferDeallocationPipelineOptions>(
|
|
"buffer-deallocation-pipeline",
|
|
"The default pipeline for automatically inserting deallocation "
|
|
"operations after one-shot bufferization. Deallocation operations "
|
|
"(except `memref.realloc`) may not be present already.",
|
|
buildBufferDeallocationPipeline);
|
|
}
|