CIRCT  19.0.0git
IbisPassPipelines.cpp
Go to the documentation of this file.
1 //===- IbisPassPipelines.cpp - Ibis pass pipelines ------------------------===//
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 
12 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
13 #include "mlir/Transforms/Passes.h"
14 
15 using namespace mlir;
16 using namespace circt;
17 using namespace ibis;
18 
19 /// Create a simple canonicalizer pass.
20 static std::unique_ptr<Pass> createSimpleCanonicalizerPass() {
21  mlir::GreedyRewriteConfig config;
22  config.useTopDownTraversal = true;
23  config.enableRegionSimplification = false;
24  return mlir::createCanonicalizerPass(config);
25 }
26 
27 void circt::ibis::loadIbisLowLevelPassPipeline(mlir::PassManager &pm) {
28  pm.addPass(createContainerizePass());
29 
30  // Pre-tunneling CSE pass. This ensures that duplicate get_port calls are
31  // removed before we start tunneling - no reason to tunnel the same thing
32  // twice.
33  pm.addPass(mlir::createCSEPass());
34  pm.addPass(createTunnelingPass(IbisTunnelingOptions{"", ""}));
35  pm.addPass(createPortrefLoweringPass());
36  pm.addPass(createSimpleCanonicalizerPass());
37  pm.addPass(createCleanSelfdriversPass());
38  pm.addPass(createContainersToHWPass());
39 }
40 
41 void circt::ibis::loadIbisHighLevelPassPipeline(mlir::PassManager &pm) {
42  pm.nest<ibis::ClassOp>().nest<ibis::MethodOp>().addPass(
44  pm.addPass(mlir::createMem2Reg());
45 
46  // TODO @mortbopet: Add a verification pass to ensure that there are no more
47  // memref.alloca's - we want all memories to be mem2reg'able, unless they are
48  // member variable accesses.
49  // - just add it as an illegal op.
50 
51  // Now, perform SSA maximizations.
52  pm.addPass(circt::createMaximizeSSAPass());
53 
54  // SSA maximal form achieved. Reconstruct the Ibis sblocks.
55  pm.nest<ibis::ClassOp>().nest<ibis::MethodOp>().addPass(
57  pm.addPass(ibis::createArgifyBlocksPass());
58  pm.addPass(createSimpleCanonicalizerPass());
59 }
static std::unique_ptr< Pass > createSimpleCanonicalizerPass()
Create a simple canonicalizer pass.
std::unique_ptr< mlir::Pass > createReblockPass()
std::unique_ptr< mlir::Pass > createInlineSBlocksPass()
std::unique_ptr< mlir::Pass > createTunnelingPass(const IbisTunnelingOptions &={})
void loadIbisHighLevelPassPipeline(mlir::PassManager &pm)
void loadIbisLowLevelPassPipeline(mlir::PassManager &pm)
std::unique_ptr< mlir::Pass > createCleanSelfdriversPass()
std::unique_ptr< mlir::Pass > createContainerizePass()
std::unique_ptr< mlir::Pass > createArgifyBlocksPass()
std::unique_ptr< mlir::Pass > createContainersToHWPass()
std::unique_ptr< mlir::Pass > createPortrefLoweringPass()
This file defines an intermediate representation for circuits acting as an abstraction for constraint...
Definition: DebugAnalysis.h:21
std::unique_ptr< mlir::Pass > createMaximizeSSAPass()