MLIR  22.0.0git
BufferizationPipelines.cpp
Go to the documentation of this file.
1 //===- BufferizationPipelines.cpp - Pipelines for bufferization -----------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 
13 #include "mlir/Pass/PassManager.h"
14 #include "mlir/Transforms/Passes.h"
15 
16 //===----------------------------------------------------------------------===//
17 // Pipeline implementation.
18 //===----------------------------------------------------------------------===//
19 
22  memref::ExpandReallocPassOptions expandAllocPassOptions{
23  /*emitDeallocs=*/false};
24  pm.addPass(memref::createExpandReallocPass(expandAllocPassOptions));
26 
27  OwnershipBasedBufferDeallocationPassOptions deallocationOptions{
28  options.privateFunctionDynamicOwnership};
29  pm.addPass(createOwnershipBasedBufferDeallocationPass(deallocationOptions));
31  pm.addPass(createBufferDeallocationSimplificationPass());
32  pm.addPass(createLowerDeallocationsPass());
33  pm.addPass(createCSEPass());
35 }
36 
37 //===----------------------------------------------------------------------===//
38 // Pipeline registration.
39 //===----------------------------------------------------------------------===//
40 
43  "buffer-deallocation-pipeline",
44  "The default pipeline for automatically inserting deallocation "
45  "operations after one-shot bufferization. Deallocation operations "
46  "(except `memref.realloc`) may not be present already.",
48 }
static llvm::ManagedStatic< PassManagerOptions > options
This class represents a pass manager that runs passes on either a specific operation type,...
Definition: PassManager.h:46
void addPass(std::unique_ptr< Pass > pass)
Add the given pass to this pass manager.
Definition: Pass.cpp:367
void registerBufferizationPipelines()
Registers all pipelines for the bufferization dialect.
void buildBufferDeallocationPipeline(OpPassManager &pm, const BufferDeallocationPipelineOptions &options)
Adds the buffer deallocation pipeline to the OpPassManager.
std::unique_ptr< Pass > createCSEPass()
Creates a pass to perform common sub expression elimination.
Definition: CSE.cpp:412
std::unique_ptr< Pass > createCanonicalizerPass()
Creates an instance of the Canonicalizer pass, configured with default settings (which can be overrid...
PassPipelineRegistration provides a global initializer that registers a Pass pipeline builder routine...
Definition: PassRegistry.h:177
Options for the buffer deallocation pipeline.
Definition: Passes.h:24